Standard Error and confidence interval

조회 수: 2 (최근 30일)
Paola
Paola 2020년 7월 20일
답변: Star Strider 2020년 7월 20일
Hello,
I have a 16x31 matrix, DeltaAnglesAdj, and I calculated the Standard error, columnwise:
std_err_mean = std(DeltaAnglesAdj,[],1)/sqrt(size(DeltaAnglesAdj,1)); (1x31 vector)
Then I calculated the P95:
P95 = tinv(0.975, size(DeltaAnglesAdj,1)-1);
How can I calculate the Confidence interval?
when I applied the method found on previous questions on Mathworks, it gives me error:
mean_data = mean(DeltaAnglesAdj,1); (1x31 vector)
CI95 = mean_data + std_err_mean*[-1 1]*P95;
Error using *
Incorrect dimensions for matrix multiplication. Check that the number of
columns in the first matrix matches the number of rows in the second matrix.
To perform elementwise multiplication, use '.*'.
The error persists also after following the instruction:
CI95 = mean_data + std_err_mean*.[-1 1]*.P95;
Error: Invalid use of operator.
How can I solve this?

답변 (1개)

Star Strider
Star Strider 2020년 7월 20일
The actual problem is that the vectors you are working with are row vectors. To create ‘CI95’ as a (2x31) matrix, you need to code it a bit differently.
Try this:
CI95 = mean_data + std_err_mean.*[-1; 1]*P95;
Then, to plot the mean and confidence intervals:
figure
plot((1:31), mean_data, (1:31), CI95)
.

카테고리

Help CenterFile Exchange에서 Hypothesis Tests에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by