Here is my dataframe with 1000 rows: employee_id weigth p-value 100 150 101 200 102 300 103 180 ..... My question: how can I calculate the p-value in R for each employee? the distribution of the weigth will be established from the above 1000 samples. -- View this message in context: http://r.789695.n4.nabble.com/p-VALUE-calculation-tp2299497p2299497.html Sent from the R help mailing list archive at Nabble.com.
What is your null hypothesis? What is your alternate hypothesis? What is the test statistic? Why do you want a p-value? Hadley On Thu, Jul 22, 2010 at 5:40 PM, jd6688 <jdsignature at gmail.com> wrote:> > Here is my dataframe with 1000 rows: > > employee_id ? ? ? ? weigth ? ? ? p-value > > 100 ? ? ? ? ? ? ? ? ? ? 150 > 101 ? ? ? ? ? ? ? ? ? ? 200 > 102 ? ? ? ? ? ? ? ? ? ? 300 > 103 ? ? ? ? ? ? ? ? ? ? 180 > ..... > > My question: > > ? ? how can I calculate the p-value in R for each employee? the > distribution of the weigth will be established from the above 1000 samples. > -- > View this message in context: http://r.789695.n4.nabble.com/p-VALUE-calculation-tp2299497p2299497.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. >-- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/
Is this the kind of thing you mean?> wData <- within(wData, {+ z <- (weigth - mean(weigth))/sd(weigth) + "p-value" <- 2*pnorm(-abs(z)) ## 2-sided + rm(z) })> wDataemployee_id weigth p-value 1 100 150 0.3763641 2 101 200 0.9081403 3 102 300 0.1547139 4 103 180 0.6722391 (You might want to think about the spelling of 'weigth' a bit more.) -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of jd6688 Sent: Friday, 23 July 2010 8:41 AM To: r-help at r-project.org Subject: [R] p-VALUE calculation Here is my dataframe with 1000 rows: employee_id weigth p-value 100 150 101 200 102 300 103 180 ..... My question: how can I calculate the p-value in R for each employee? the distribution of the weigth will be established from the above 1000 samples. -- View this message in context: http://r.789695.n4.nabble.com/p-VALUE-calculation-tp2299497p2299497.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.