What is Standard Error?
In statistics, the standard error is the standard deviation of the sampling statistical measure, and it's most commonly used for the sample mean. The standard error measures how accurately the sample represents the actual population from which the sample was drawn.
Since there could be different samples drawn from the population, there exists a distribution of sampled means. The standard error measures the standard deviation of all sample means drawn from the population.
The formula for calculating the standard error of the mean is the sample standard deviation divided by the square root of the sample size.
The Command for Standard Error in MATLAB
To calculate the standard error of the mean in a sample, the user needs to run a one-line command in MATLAB:
stderror= std( data ) / sqrt( length( data ))where:data=an array with sample valuesstd=the MATLAB function that computes standard deviation of the samplesqrt=the MATLAB function that computes the square root of a non-negative numberlength=the MATLAB function that computes the total number of observations in the sample
Example of Calculating Standard Error in MATLAB
Consider a sample of annual household incomes drawn from the general population of the United States. The sample contains five observations and consists of values $10,000, $100,000, $50,000, $45,000 and $35,000.
First, the user needs to create an array called "data" containing these observations in MATLAB. Next, the user can calculate the standard error of the mean with the command "stderror = std( data ) / sqrt( length )". The result of this command says that the mean of this sample, which is $48,000, has a standard error of $13,161.