Hello, I am working with a dataset with three variables and one binomial parameter. The glm function provides coefficients for these three variables, e.g. -1.5 | 27.2 | -2.9 If I'm not mistaken, $fitted.values gives me an estimate of how likely my parameter is to be true/1 . I would like to apply these coefficients on other variables to predict the binomial parameter but I'm not sure how to make use of them. To clarify a bit more I'm looking for a formula to calculate the chance that the parameter is true/1, based on the three variables/coefficients, something like -1.5*V1+27.2*V2-2.9*V2 I hope someone understands my awkwardly worded question and is able to help me out - thanks! -- View this message in context: http://r.789695.n4.nabble.com/Applying-glm-coefficients-Beginner-Question-tp4643737.html Sent from the R help mailing list archive at Nabble.com.
Applying glm coefficients (Beginner Question)
6 messages · SirRon, Robert Kinley, David Winsemius +1 more
Windows XP (SP3) , R 2.15.1 32bit Hi ... I have a script which fails and closes my R session. Unfortunately, it bombs out at a different point each time I run it. I'm guessing that it may be something to do with memory management, or perhaps it's to do with the various .C dll's the script calls. Has anyone come across similar problems and if so, how did you track down the cause ? Pathetically grateful for any pointers ... Cheers Bob Kinley
On Sep 20, 2012, at 6:55 AM, SirRon wrote:
Hello, I am working with a dataset with three variables and one binomial parameter. The glm function provides coefficients for these three variables, e.g. -1.5 | 27.2 | -2.9 If I'm not mistaken, $fitted.values gives me an estimate of how likely my parameter is to be true/1 .
Not at all how I would have expressed it.
I would like to apply these coefficients on other variables to predict the binomial parameter but I'm not sure how to make use of them.
On other instances of similarly measured variables? Then use the new data argument to predict().
To clarify a bit more I'm looking for a formula to calculate the chance that the parameter is true/1, based on the three variables/coefficients, something like -1.5*V1+27.2*V2-2.9*V2
I am guessing you will be using the type="response" argument to predict(), but again is is not the case that this will be answer the question as you have expressed it and I have interpreted it. It is not going to return the probability that the "parameter is true", at least if the word "parameter" is what most people are calling "coefficient". ?predict.glm
I hope someone understands my awkwardly worded question and is able to help me out - thanks!
Awkwardly worded questions will get much better answers if they are accompanied by some test data.
David Winsemius, MD Alameda, CA, USA
On Thu, Sep 20, 2012 at 4:34 PM, Robert Douglas Kinley
<kinley_robert at lilly.com> wrote:
Windows XP (SP3) , R 2.15.1 32bit Hi ... I have a script which fails and closes my R session. Unfortunately, it bombs out at a different point each time I run it. I'm guessing that it may be something to do with memory management, or perhaps it's to do with the various .C dll's the script calls.
Much more likely this one.
Has anyone come across similar problems and if so, how did you track down the cause ?
Valgrind perhaps? Or stepping through it interactively? See the Writing-R-Extensions manual for some tips, but it's a hard process. You'll likely be rewarded in spending at least a little time trying to identify which C call it is (first heuristic: if a crash is at line n, you can immediately eliminate all the C calls after n) Good luck, Michael
Pathetically grateful for any pointers ...
Cheers Bob Kinley
______________________________________________ R-help at 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.
Thanks for the reply! Using predict() on new data works just fine. What I'm interested in is, if I can use the coefficients or other data, to develop my own formula which does the same as predict(). -- View this message in context: http://r.789695.n4.nabble.com/Applying-glm-coefficients-Beginner-Question-tp4643737p4643769.html Sent from the R help mailing list archive at Nabble.com.
On Sep 20, 2012, at 10:58 AM, SirRon wrote:
Thanks for the reply! Using predict() on new data works just fine. What I'm interested in is, if I can use the coefficients or other data, to develop my own formula which does the same as predict().
Of course you can. Extract the coefficients, apply them to the new data, and build predictions. The code is all there to see how it's done by the Masters. Perhaps you need to do a bit of reading. Or do some searching. There must be many worked examples of constructing logistic regression estimates from first principles on various faculty websites aroune th world. The Posting Guide requests that you not consider this list an elementary statistics tutoring service.
David Winsemius, MD Alameda, CA, USA