Get startedGet started for free

Wide-form input logistic regression

The second and third approaches for fitting logistic regressions require "wide" format data:

      x fail success Total successProportion
    1 a   12       2    14         0.1428571
    2 b    3      11    14         0.7857143

For the second approach, model a 2 column matrix of successes and failures (e.g. number of no's and yes's per group).

In this format, use the formula cbind(success, fail) ~ predictor.

For the third approach, model the probability of success (e.g. group 1 had 75% yes and group 2 had 65% no) and the weight or number of observations per group (e.g. there were 40 individuals in group 1 and 100 individuals in group 2). In this example, successProportion = success / Total.

In this format, the formula proportion of successes ~ response variable is used with weights = number in treatment.

This exercise is part of the course

Generalized Linear Models in R

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Fit a wide form logistic regression
lr_2 <- ___

# Print the output of lr_2
___
Edit and Run Code