Dear R users

I am new R user, execuse me I bother you, but I worked hard to find a
solution:

# data
ID <- c(1:100)
set.seed(21)
y <- rnorm(100, 10,2)
x1 <- rnorm(100, 10,2)
x2 <- rnorm(100, 10,2)
x3 <- rnorm(100, 10,2)
x4 <- rnorm(100, 10,2)
x5 <- rnorm(100, 10,2)
x6 <- rnorm(100, 10,2)
mydf <- data.frame(ID,y, x1,x2, x3, x4, x5, x6)
# just seperate analyis
require(nlme)
mod1<- lme(fixed= y ~ x1 + x2, random = ~ 1 | ID) # i want to put subject /
ID as random is it correct??
m1 <- anova(mod1)
m1 [1,4] # I am not getting exact value below <.0001???, how to get one?
m1 [2,4]
m1 [3,4]
# putting in a loop
for(i in length(mydf)){
  mylme <- NULL
  print(m1[i+1,]<- lme(fixed= mydf$y ~ mydf$x[,i] + mydf$x[,i+1], random = ~
1 | ID))}

could not help myself to work ! However I have the following output in my
mind
# The output in my mind a data fram with the following
model   p-intercept      variable1   p-value1   variable2      p-value2
1            <.0001           x1            0.9452     x2             0.5455
2           <.0001            x3            0.3301      x 4           0.9905
3          <.0001              x5            0.9971     x6            0.0487

I need a solution as I have tons of variables to work on. I am sowing these
six just for an example.

Thank you in advance;

ram sharma

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to