[R] calculating std err (SEM)?
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Fri Mar 1 20:01:43 CET 2002
"JRG" <loesljrg at accucom.net> writes:
> On 1 Mar 02, at 16:44, Peter Dalgaard BSA wrote:
>
> > "Kirk R. Wythers" <kwythers at umn.edu> writes:
> >
> > > Is there a "canned" function in R for finding the standard error of the
> > > mean? I have tried
> > >
> > > > sem <- function(x) c(mean =mean(x),
> > > + SEM = stdev(x)/sqrt(length(x)))
> > > > sem(pnet.lai)
> > > Error in sem(pnet.lai) : couldn't find function "stdev"
> > >
> > >
> > > It looks like there is no stdev function in R
> >
> > It's sd() (as help.search("deviation") might have told you). Also,
> > beware of missing values: sd(x,na.rm=TRUE)/sum(!is.na(x)) is the sure
> > kill.
> >
>
> Would that perhaps be sd(x,na.rm=TRUE)/sqrt(sum(!is.na(x))) ?
Um. Yes.
On the other hand, I didn't say *what* it killed, did I? ;-)
-p
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list