![How To Calculate Standard Error How To Calculate Standard Error](/uploads/1/2/3/5/123591376/327245640.jpg)
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. Now that we understand how to manually calculate delta method standard errors, we are ready to use the deltamethod function in the msm package. The deltamethod function expects at least 3 arguments. The first argument is a formula representing the function, in which all variables must be labeled as x1, x2, etc.
Is there any command to find the standard error of the mean in R?
jogo10.2k9 gold badges23 silver badges36 bronze badges
alexalex
7 Answers
There's the plotrix package with has a built-in function for this: std.error
Matt BallMatt Ball288k77 gold badges567 silver badges640 bronze badges
The standard error is just the standard deviation divided by the square root of the sample size. So you can easily make your own function:
Ian FellowsIan Fellows14.8k10 gold badges41 silver badges61 bronze badges
It is probably more efficient to use var... since you actually sqrt twice in your code, once to get the sd (code for sd is in r and revealed by just typing 'sd')...
JohnJohn19.5k3 gold badges42 silver badges77 bronze badges
A version of John's answer above that removes the pesky NA's:
Megatron6,3866 gold badges51 silver badges68 bronze badges
arandomlypickednamearandomlypickedname8341 gold badge9 silver badges11 bronze badges
The package sciplot has the built-in function se(x)
user2045554user2045554
more generally, for standard errors on any other parameter, you can use the boot package for bootstrap simulations (or write them on your own)
owenowen
sd(y)
for standard deviation var(y)
for variance.Both derivations use
Sébastienn-1
in the denominator so they are based on sample data.8,63211 gold badges40 silver badges60 bronze badges
user2945838user2945838
![How To Calculate Standard Error How To Calculate Standard Error](/uploads/1/2/3/5/123591376/720444889.png)