logistic regression using "glm",which "y" is set to be "1"
Dear all:
By comparing glmresult$y and model.response(model.frame(glmresult)), I
have found out which one is
set to be "TRUE" and which "FALSE".But it seems that to fit a logistic
regression , logit (or logistic) transformation has to be done before
regression.
Does anybody know how to obtain the transformation result ? It is hard
to settle down before knowing the actual process R works . I have read some
books and the "?glm" help file , but what they told me was not sufficient.
Best wishes ,
Bin Yue
Weiwei Shi wrote:
Dear Bin:
you type
?glm
in R console and you will find the Detail section of help file for glm
i pasted it for you too
Details
A typical predictor has the form response ~ terms where response is the
(numeric) response vector and terms is a series of terms which specifies a
linear predictor for response. For binomialand quasibinomial families the
response can also be specified as a
factor<file:///Library/Frameworks/R.framework/Versions/2.6/Resources/library/base/html/factor.html>
(when
the first level denotes failure and all others success) or as a two-column
matrix with the columns giving the numbers of successes and failures. A
terms specification of the form first + second indicates all the terms in
first together with all the terms in second with duplicates removed. The
terms in the formula will be re-ordered so that main effects come first,
followed by the interactions, all second-order, all third-order and so on:
to avoid this pass a terms object as the formula.
A specification of the form first:second indicates the the set of terms
obtained by taking the interactions of all terms in first with all terms
in
second. The specification first*second indicates the *cross* of first and
second. This is the same as first + second + first:second.
glm.fit is the workhorse function.
If more than one of etastart, start and mustart is specified, the first in
the list will be used. It is often advisable to supply starting values for
a
quasi<file:///Library/Frameworks/R.framework/Versions/2.6/Resources/library/stats/html/family.html>
family,
and also for families with unusual links such as gaussian("log").
All of weights, subset, offset, etastart and mustart are evaluated in the
same way as variables in formula, that is first in data and then in the
environment of formula.
On Dec 5, 2007 10:41 PM, Bin Yue <leffgh at 163.com> wrote:
Dear Marc Schwartz: When I ask R2.6.0 for windows, the information it gives does not contain much about family=binomial . You said that there is a detail section of "?glm". I want to read it thoroughly. Could you tell me where and how I can find the detail section of "?glm". Thank you very much . Best regards, Bin Yue Marc Schwartz wrote:
On Wed, 2007-12-05 at 18:06 -0800, Bin Yue wrote:
Dear friends :
using the "glm" function and setting family=binomial, I got a list
of
coefficients. The coefficients reflect the effects of predicted variables on the probability of the response to be "1". My response variable consists of "A" and "D" . I don't know which
level
of the response was set to be 1. is the first element of the response set to be 1? Thank all in advance. Regards, ----- Best regards, Bin Yue
As per the Details section of ?glm: For binomial and quasibinomial families the response can also be specified as a factor (when the first level denotes failure and all others success) ... So use: levels(response.variable) and that will give you the factor levels, where the first level is 0
and
the second level is 1. If you work in a typical English based locale with default alpha based level ordering, it will likely be A (Alive?) is 0 and D (Dead?) is 1. HTH, Marc Schwartz
______________________________________________ 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.
----- Best regards, Bin Yue ************* student for a Master program in South Botanical Garden , CAS -- View this message in context: http://www.nabble.com/logistic-regression-using-%22glm%22%2Cwhich-%22y%22-is-set-to-be-%221%22-tf4953617.html#a14185819 Sent from the R help mailing list archive at Nabble.com.
______________________________________________ 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.
-- Weiwei Shi, Ph.D Research Scientist GeneGO, Inc. "Did you always know?" "No, I did not. But I believed..." ---Matrix III [[alternative HTML version deleted]]
______________________________________________ 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.
----- Best regards, Bin Yue ************* student for a Master program in South Botanical Garden , CAS
View this message in context: http://www.nabble.com/logistic-regression-using-%22glm%22%2Cwhich-%22y%22-is-set-to-be-%221%22-tf4953617.html#a14187112 Sent from the R help mailing list archive at Nabble.com.