I am doing logistic regression in R. Can somebody clarify what is the differences of running these two lines?
1. glm(Response ~ Temperature, data=temp,
family = binomial(link="logit"))
2. glm(cbind(Response, n - Response) ~ Temperature,
data=temp, family =binomial, Ntrials=n)
The data looks like this: (Note : Response is binary. 0=Die 1=Not die)
Response Temperature
0 24.61
1 39.61
1 39.50
0 22.71
0 21.61
1 39.70
1 36.73
1 33.32
0 21.73
1 49.61
Logistic regression analysis belongs to the class of generalized linear models. In R generalized linear models are handled by the glm() function. The function is written as glm(response ~ predictor, family = binomial(link = "logit"), data) .
A fitted value is a statistical model's prediction of the mean response value when you input the values of the predictors, factor levels, or components into the model. Suppose you have the following regression equation: y = 3X + 5. If you enter a value of 5 for the predictor, the fitted value is 20.
Similar to linear regression, logistic regression is also used to estimate the relationship between a dependent variable and one or more independent variables, but it is used to make a prediction about a categorical variable versus a continuous one.
When doing the binomial or quasibinomial glm
, you either supply a probability of success, a two-column matrix with the columns giving the numbers of successes and failures or a factor where the first level denotes failure and the others success on the left hand side of the equation. See details in ?glm
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With