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 input a1 1 2.5 x a1 2 3.5 x a1 3 4.5 x a1 1 2.6 x a1 2 3.8 x b1 1 4.6 y b1 2 5 y b1 3 6 y b1 6 7 y desiredoutput a1 pvalue(LR) x b1 pvalue(LR) y -- View this message in context: http://n4.nabble.com/liner-regression-for-multiple-keys-tp1839105p1839105.html Sent from the R help mailing list archive at Nabble.com.
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)
Hi Ben it's working good except no values of 4th column in output. And also if the file is large I'm getting the following error. Error in pf(q, df1, df2, lower.tail, log.p) : Non-numeric argument to mathematical function I rechecked if I have any non numeric arguments the defined columns. Inputfile is good. Any suggestions on this. Thanx -- View this message in context: http://r.789695.n4.nabble.com/liner-regression-for-multiple-keys-tp1839105p2066051.html Sent from the R help mailing list archive at Nabble.com.