On Aug 19, 2011, at 8:43 PM, Andra Isan wrote:
Hello All,
I have a question about glm in R. I would like to fit a model with
glm function, I have a vector y (size n) which is my response
variable and I have matrix X which is by size (n*f) where f is the
number of features or columns. I have about 80 features, and when I
fit a model using the following formula,
glmfit = glm(y ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 +
x11 + x12 + x13 + x14 + x15 + x16 + x17 + x18 + x19 + x20 + x21 +
x22 + x23 + x24 + x25 + x26 + x27 + x28 + x29 + x30 + x31 + x32 +
x33 + x34 + x35 + x36 + x37 + x38 + x39 + x40 + x41 + x42 + x43 +
x44 + x45 + x46 + x47 + x48 + x49 + x50 + x51 + x52 + x53 + x54 +
x55 + x56 + x57 + x58 + x59 + x60 + x61 + x62 + x63 + x64 + x65 +
x66 + x67 + x68 + x69 + x70 + x71 + x72 + x73 + x74 + x75 + x76 +
x77 + x78 + x79 + x80)
If X is a matrix, then you cannot attach it and none of its column
names would be accessible by functions. what does ls() return? I'm
guessing you constructed a dataframe (forgot to include x3) and
attach()-ed it and are calling it (incorrectly ) a "matrix".
it gives me an error "Error in eval(expr, envir, enclos) : object
'x3' not found" which I dont know why I am given those errors. The
other thing is that when I use the "glm.fit", I can get coefficients
without any errors.
Really? What was the R code that produced results?
So, I am not sure what is going on
Yes. Neither are we.
and if glm.fit is the same as glm, can I use glm.fit instead of glm?
I do not see a formula method for glm.fit in the help page. Nor do I
see a mechanism for handling formulas in the code of glm.fit.
Perhaps the question is, "Do you care about errors?"
--
David Winsemius, MD
West Hartford, CT
______________________________________________
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.