In statistics, the standard error is the standard deviation of the sampling statistical measure, usually the sample mean. The standard error measures how accurately the sample represents the actual population from which the sample was drawn. 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" represents an array with sample values, "std" is the MATLAB function that computes standard deviation of the sample, "sqrt" is the MATLAB function that computes the square root of a non-negative number and "length" is the MATLAB function that computes the total number of observations in the sample.
The standard error is most commonly computed for the sample mean. 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 equation for the standard error of the mean is the sample standard deviation divided by the square root of the sample size.
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.