Standard Error and confidence interval
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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?
0 commentaires
Réponses (1)
Star Strider
le 20 Juil 2020
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)
.
0 commentaires
Voir également
Catégories
En savoir plus sur Hypothesis Tests dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!