[R] basic question about t-test with adjusted p value
John Sorkin
jsorkin at grecc.umaryland.edu
Sun Aug 8 00:37:00 CEST 2010
ANOVA will give you an adjusted t-test. For example:
fit<-lm(height~sex+age)
summary(fit)
Will give an age-adjusted t-test of the heights of men and women.
John
John Sorkin
Chief Biostatistics and Informatics
Univ. of Maryland School of Medicine
Division of Gerontology and Geriatric Medicine
JSorkin at grecc.umaryland.edu
-----Original Message-----
From: Erik Iverson <eriki at ccbr.umn.edu>
To: <Josef.Kardos at phila.gov>
Cc: <r-help at r-project.org>
Sent: 8/7/2010 4:24:35 PM
Subject: Re: [R] basic question about t-test with adjusted p value
On 08/07/2010 03:08 PM, Josef.Kardos at phila.gov wrote:
> I have read the R manual and help archives, sorry but I'm still stuck.
>
> How would I do a t-test with an adjusted p-value?
Please be more specific about what you mean by 'adjusted p-value'. See below...
>
> Suppose that I use t.test ( ) , with the function argument alternative =
> "two.sided", and data such that degrees of freedom = 20. The function
> calculates a t-statistic of 2.086, and p-value =0.05
>
> How do I then adjust the p-value? My thought is to do
> p.adjust (pt(2.086, df=20),"BH")
> but that doesn't change anything (returns 0.975)
A couple things here.
1) You can get the p-value returned from t.test by inspecting the object with
?str, and noting that it's stored in an element called p-value.
So,
p.val <- t.test(extra ~ group, data = sleep)$p.value
assigns the p-value to an object called p.val.
2) You're calling p.adjust with a single p-value, so what kind of adjustment did
you have in mind? You would normally be adjusting p-values because of a multiple
comparison issue (i.e., multiple tests performed). You'd pass p.adjust the
*vector* of p-values, and a method to adjust them by. Your vector is of length
1, so in p.adjust's opinion, there is nothing to adjust for.
So, what do *you* mean by 'adjusted p-value'? `Why are you looking to adjust?`
is another way of stating that.
______________________________________________
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.
Confidentiality Statement:
This email message, including any attachments, is for th...{{dropped:6}}
More information about the R-help
mailing list