[R] GLM question
Andra Isan
andra_isan at yahoo.com
Tue Aug 23 06:43:23 CEST 2011
Hi All,
I am trying to fit my data with glm model, my data is a matrix of size n*100. So, I have n rows and 100 columns and my vector y is of size n which contains the labels (0 or 1)
My question is:
instead of manually typing the model as
glm.fit = glm(y~ x[,1]+x[,2]+...+x[,100], family=binomial())
I have a for loop as follows that concatenates the x variables as follows:
final_str=NULL
for (m in 1:100){
str = paste(x[,m],+,sep="")
final_str= paste(final_str,str,sep="")
}
glm.fit = flm(y~final_str,family=binomial())
but final_str is treated as a string and it does not work. Could you please help me with fixing that?
Thanks a lot,
Andra
More information about the R-help
mailing list