l****c 发帖数: 7 | 1 Suppose X is a n*p matrix, Y is 1*n vector. I want to fit a multiple
regression in R as:
glm(y~ x[,1] +x[,2] + ...+x[,p]) ( this is not work in R, since "..." is
not work)
Here p is pretty large, suppose 20, do I have to type all 20 variables. Is
there a simple way to write that in R?
I tried to use glm.fit in R as:
glm.fit(X, y)
But the coeffiecients is different from the glm(why).
Thanks! | D******n 发帖数: 2836 | 2 glm(y~.)
is
Is
【在 l****c 的大作中提到】 : Suppose X is a n*p matrix, Y is 1*n vector. I want to fit a multiple : regression in R as: : glm(y~ x[,1] +x[,2] + ...+x[,p]) ( this is not work in R, since "..." is : not work) : Here p is pretty large, suppose 20, do I have to type all 20 variables. Is : there a simple way to write that in R? : I tried to use glm.fit in R as: : glm.fit(X, y) : But the coeffiecients is different from the glm(why). : Thanks!
| l*********s 发帖数: 5409 | 3 An associated question: is there some short hand notation for specification
of ,say, all 2nd order interaction terms?
【在 D******n 的大作中提到】 : glm(y~.) : : is : Is
| l****c 发帖数: 7 | 4 I didn't get it.
R won't recognize y~. in regression model.
【在 D******n 的大作中提到】 : glm(y~.) : : is : Is
| o****o 发帖数: 8077 | 5 难道不是
glm(y~x[,1:p])
么?
is
Is
【在 l****c 的大作中提到】 : I didn't get it. : R won't recognize y~. in regression model.
| l****c 发帖数: 7 | 6 Yeap!!!Thanks!
【在 o****o 的大作中提到】 : 难道不是 : glm(y~x[,1:p]) : 么? : : is : Is
|
|