Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Logistic regression - cbind command in glm

Tags:

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
like image 896
Eddie Avatar asked Feb 02 '12 11:02

Eddie


People also ask

Is GLM used for logistic regression?

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) .

What are fitted values in logistic regression?

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.

What is logistic regression used for?

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.


1 Answers

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.

like image 128
James Avatar answered Dec 13 '22 11:12

James