Logistic regression with RCommander

Logistic regression with RCommander - Logistic regression...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Logistic regression with RCommander Simple logistic regression with the rat tumors dataset Load the RatTumors dataset. You should have three columns: Rat (a unique identifier for each individual), Dose (the dose applied) and Tumor (zero means no tumor, one means a tumor appeared). Make a scatterplot (Graphs -> Scatterplot), with Dose as the x-variable and Tumor as the y-variable. Select “Jitter x-variable” and “Jitter y-variable”. You should get something like this: 0 100 200 300 400 500 0.0 0.2 0.4 0.6 0.8 1.0 Dose Tumor
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Note that the vertical displacement of the points is for display only; the linear regression line is fitted to the actual data. Also note that the OLS linear regression line is NOT what we want! Convert the Tumor variable to a factor (Data -> Manage variables… -> Convert numeric…): Use Statistics -> Fit models -> Generalized Linear Model to do a logistic regression. Make sure that “Family” is set to “binomial” and “Link function” is set to “logit”:
Background image of page 2
The output should look like this: Call: glm(formula = Tumor ~ Dose, family = binomial(logit), data = tumor) Deviance Residuals: Min 1Q Median 3Q Max -2.0463 -0.3491 -0.1658 -0.1607 2.9518 Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) -4.343571 0.378074 -11.49 <2e-16 *** Dose 0.012611 0.001193 10.57 <2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 (Dispersion parameter for binomial family taken to be 1) Null deviance: 428.44 on 431 degrees of freedom Residual deviance: 193.56 on 430 degrees of freedom AIC: 197.56 Number of Fisher Scoring iterations: 6 To see the fitted curve, we need to create a new dataset with the doses that we want to use
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 8

Logistic regression with RCommander - Logistic regression...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online