[R] logistic regression
Melrose2012
melissa.patrician at stonybrook.edu
Wed Apr 4 07:10:15 CEST 2012
Thank you for your reply.
I do understand that I am working in log space with the default link
function of the binomial being "logit." My problem is, I thought that they
way I had written the code, when I did the "lines" command, it should plot
the best-fit line (found by 'glm') on top of my graph. As you can see,
however, this clearly did not work and I am off by several factors of
magnitude. I am not sure if the problem lies in the way I have done the
'glm' or in the plotting.
If I understand the function correctly, when I do 'glm' of family=binomial,
I am working in log space (hence the link function default being "logit.")
If this is correct, then doesn't either my data have to be converted to log
space also or the results of my 'glm.fit' be converted to linear space (i.e.
using 'inv.logit' from the boot library)? This was my thought process
behind plotting the data as log (I tried several other obviously useless
iterations of various scalings.) It appears that you can not do an
inv.logit on the result from the 'glm' command.
If I try to do this: inv.logit(glm.fit)
I get an error saying: Error in plogis(q, location, scale, lower.tail,
log.p) : Non-numeric argument to mathematical function
I'm pretty sure this is a limitation in my understanding of exactly what R
is doing in this logistic regression and I am having a hard time finding
help online or in the R help files that helps me to decipher this problem.
Can anyone tell me if I have set up the 'glm' wrong or if the error is in
how I am trying to plot the best-fit line on the data?
I am new to these sorts of statistics and data manipulation, so I
acknowledge my ignorance and appreciate whatever help anyone can give me.
Thank you again!
Cheers,
Melissa
--
View this message in context: http://r.789695.n4.nabble.com/logistic-regression-tp4530651p4530959.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list