Message-ID: <CAJvXuh5pV17wjvb2ZAOMc2myxP1ZAv_3T5h6tU0HU9itGa=txg@mail.gmail.com>
Date: 2016-08-18T11:48:36Z
From: fatimah soleimany
Subject: loop function
Hi Dear users,
for an interactive use, i am trying to write a loop that looks for all
variables in the conditions which i introduced, this is what I'm trying:
library(MASS)> i=1> for (i in 58:1){+ for(j in 58:i){+ + str.temp <-
paste("y1 ~ x", i, "* x", j, sep = "")+
univar<-glm.nb(as.formula(str.temp), data=df)+
b=summary(univar)$coeffients[4,4]+ b<-c(i,j)+ if(b < 0.6){ +
print(b)+ }+ }+ }
i have no error but i didn't get true response too, my result is this:
b[1] 1 1
but i want all the variables that their p-value are less than 0.6, i
think i couldn't write a true loop,can you help me?
thank you in advance for any help
[[alternative HTML version deleted]]