LoslegenKostenlos loslegen

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.

Diese Übung ist Teil des Kurses

Generalized Linear Models in R

Kurs anzeigen

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Fit a wide form logistic regression
lr_2 <- ___

# Print the output of lr_2
___
Code bearbeiten und ausführen