[R] liner regression for multiple keys
Ben Bolker
bolker at ufl.edu
Wed Apr 14 23:10:43 CEST 2010
newbie_2010 <girishbogu <at> gmail.com> writes:
> a1 is the first key in input. second column is x-axis and 3rd is y-axis and
> 4th is its corresponding key.
> Now for every key in 1st column I would like to calculate LR that gives p
> value. I tried to manage with a single key. But my problem is that How could
> I manage multiple keys in input.
> Thanx in advance
>
something like:
library(nlme)
fm <- lmList(y~x|key,data=...)
get.pval <- function(z) {
x <- summary(z)
pf(x$fstatistic[1L],
x$fstatistic[2L], x$fstatistic[3L], lower.tail = FALSE)
}
sapply(fm,get.pval)
More information about the R-help
mailing list