How can I get the standard error of each row of a matrix?

72 views (last 30 days)
I have a 8x30 matrix 'data' and need the mean and standard error of each row. I've figured out the mean
but I have no idea about the standard error. I have tried to get the std of the mean, but no matter what I do I just jet the std of the whole matrix, not each row. I've tried for example:
I'm probably really stupid, but I've just started Matlab two weks ago and fail at the easiest would be appreciated!

Answers (1)

Star Strider
Star Strider on 1 Jun 2018
The standard error of the mean (link) is defined as the standard deviation divided by the square root of the number of samples:
std_err_mean = std(data,[],2)/sqrt(size(data,2)); % Standard Error Of The Mean (Row-Wise)
To calculate the 95% confidence intervals, continue with:
mean_data = mean(data,2); % Mean (Row-Wise)
P95 = tinv(0.975, size(data,2)-1); % Compute 95% Confidence Standard Deviation
CI95 = mean(data,2) + std_err_mean*[-1 1]*P95; % 95% Confidence Intervals (Row-Wise)
  1 Comment
hxen on 29 Feb 2024
You're a very helpful person Star and very much appreciated. Many of you great people on this community have been super helpful.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!