An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130503/3b599c15/attachment.pl>
Very basic statistics in R
10 messages · S Ellison, Jeff Newmiller, Xavier Prudent +6 more
- the mean <x> -> mean(x) - the uncertainty on <x> -> std.error(x) ? Or sd(x)? - the standard deviation of x -> ? - the uncertainty on the standard deviation -> ? Anyone has an idea?
1. Use R's help system to look up 'standard deviation' and 'mean'
e.g.:
??'standard deviation'
??'mean'
For the other two questions, consult your basic stats textbook; the answers can be calculated from the two above together with the number of observations.
*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}
I recommend you read the Introduction to R document that comes with R. Look for making vectors with the c() function, and using the mean() and sd() functions. Note that this is not a homework help forum (read the Posting Guide mentioned at the bottom of every message). If this is not homework, you are going to need to do quite a bit of self study before you can ask questions clearly enough to get useful responses on this list. See http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity.
Xavier Prudent <prudentxavier at gmail.com> wrote:
Dear all, Very simple question, but apparently uneasy to solve in R: I have a sampling of a variable x: (3, 4. 5, 2, ...) I want to know: - the mean <x> -> mean(x) - the uncertainty on <x> -> std.error(x) ? Or sd(x)? - the standard deviation of x -> ? - the uncertainty on the standard deviation -> ? Anyone has an idea? Thanks in advance, regards, Xavier
2 days later
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130506/199c5bd1/attachment.pl>
Dear Xavier, Jeffs answer was to point out two things to you: 1: How to find these functions on your own. 2: These functions are definitely available in R Good luck, Marius
On Mon, 6 May 2013, Xavier Prudent wrote:
Dear Jeff, Thanks for your fast answer, I could for sure implement the 2-lines code to calculate the uncertainties, but I am astonished that a widespread statistics package like R does not include these very basic quantities. Regards, Xavier 2013/5/3 S Ellison <S.Ellison at lgcgroup.com>
- the mean <x> -> mean(x) - the uncertainty on <x> -> std.error(x) ? Or sd(x)? - the standard deviation of x -> ? - the uncertainty on the standard deviation -> ? Anyone has an idea?
1. Use R's help system to look up 'standard deviation' and 'mean' e.g.: ??'standard deviation' ??'mean' For the other two questions, consult your basic stats textbook; the answers can be calculated from the two above together with the number of observations. ******************************************************************* This email and any attachments are confidential. Any use, copying or disclosure other than by the intended recipient is unauthorised. If you have received this message in error, please notify the sender immediately via +44(0)20 8943 7000 or notify postmaster at lgcgroup.com and delete this message and any copies from your computer and network. LGC Limited. Registered in England 2991879. Registered office: Queens Road, Teddington, Middlesex, TW11 0LY, UK
-- *--------------------------------------- Xavier Prudent * * Computational biology and evolutionary genomics * * * *Guest scientist at the Max-Planck-Institut f?r Physik komplexer Systeme* *(MPI-PKS)* *Noethnitzer Str. 38* *01187 Dresden * * * *Max Planck-Institute for Molecular Cell Biology and Genetics* * (MPI-CBG) * * Pfotenhauerstra?e 108 * * 01307 Dresden * * * * Phone: +49 351 210-2621 * *Mail: prudent [ at ] mpi-cbg.de **---------------------------------------* [[alternative HTML version deleted]]
Hi, ?set.seed(15) ?vec1<- sample(1:15,10,replace=TRUE) ?mean(vec1) #[1] 10 ?sd(vec1) #[1] 4.346135 ?stErr<- sd(vec1)/sqrt(length(vec1)) ?stErr #[1] 1.374369 library(plotrix) ?std.error(vec1) #[1] 1.374369 A.K. ----- Original Message ----- From: Xavier Prudent <prudentxavier at gmail.com> To: S Ellison <S.Ellison at lgcgroup.com> Cc: "r-help at r-project.org" <r-help at r-project.org> Sent: Monday, May 6, 2013 3:05 AM Subject: Re: [R] Very basic statistics in R Dear Jeff, Thanks for your fast answer, I could for sure implement the 2-lines code to calculate the uncertainties, but I am astonished that a widespread statistics package like R does not include these very basic quantities. Regards, Xavier 2013/5/3 S Ellison <S.Ellison at lgcgroup.com>
? - the mean <x>? ? ? ? ? ? ? ? ? -> mean(x) ? - the uncertainty on <x>? ? ? -> std.error(x) ? Or sd(x)? ? - the standard deviation of x? -> ? ? - the uncertainty on the standard deviation -> ? Anyone has an idea?
1. Use R's help system to look up 'standard deviation' and 'mean' e.g.: ??'standard deviation' ??'mean' For the other two questions, consult your basic stats textbook; the answers can be calculated from the two above together with the number of observations. ******************************************************************* This email and any attachments are confidential. Any use, copying or disclosure other than by the intended recipient is unauthorised. If you have received this message in error, please notify the sender immediately via +44(0)20 8943 7000 or notify postmaster at lgcgroup.com and delete this message and any copies from your computer and network. LGC Limited. Registered in England 2991879. Registered office: Queens Road, Teddington, Middlesex, TW11 0LY, UK
*--------------------------------------- Xavier Prudent * * Computational biology and evolutionary genomics * * * *Guest scientist at the Max-Planck-Institut f?r Physik komplexer Systeme* *(MPI-PKS)* *Noethnitzer Str. 38* *01187 Dresden * * * *Max Planck-Institute for Molecular Cell Biology and Genetics* * (MPI-CBG) * * Pfotenhauerstra?e 108 * * 01307 Dresden * * * * Phone: +49 351 210-2621 * *Mail: prudent [ at ] mpi-cbg.de **---------------------------------------* ??? [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
2 days later
On 5/6/2013 7:02 AM, arun wrote:
stErr<- sd(vec1)/sqrt(length(vec1)) Or possibly, stErr<- sd(vec1)/sqrt(!is.na(vec1))
Robert W. Baer, Ph.D. Professor of Physiology Kirksille College of Osteopathic Medicine A. T. Still University of Health Sciences Kirksville, MO 63501 USA
On May 8, 2013, at 20:38 , Robert Baer wrote:
On 5/6/2013 7:02 AM, arun wrote: stErr<- sd(vec1)/sqrt(length(vec1)) Or possibly, stErr<- sd(vec1)/sqrt(!is.na(vec1))
You probably intended sqrt(sum(!is.na(...))).
Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
Hello, Or, to make it complete, use the na.rm argument. sd(vec1, na.rm = TRUE)/sqrt(sum(!is.na(vec1))) Rui Barradas Em 08-05-2013 20:55, peter dalgaard escreveu:
On May 8, 2013, at 20:38 , Robert Baer wrote:
On 5/6/2013 7:02 AM, arun wrote: stErr<- sd(vec1)/sqrt(length(vec1)) Or possibly, stErr<- sd(vec1)/sqrt(!is.na(vec1))
You probably intended sqrt(sum(!is.na(...))).
On May 8, 2013, at 12:55 PM, peter dalgaard wrote:
On May 8, 2013, at 20:38 , Robert Baer wrote:
On 5/6/2013 7:02 AM, arun wrote: stErr<- sd(vec1)/sqrt(length(vec1)) Or possibly, stErr<- sd(vec1)/sqrt(!is.na(vec1))
You probably intended sqrt(sum(!is.na(...))).
And if 'vec1' has NA's in it, he would also need: sd(vec1, na.rm=TRUE)
David Winsemius Alameda, CA, USA