Binary and count outcomes
This example fits generalized linear models from R formulas. phplyr's glm() passes the formula and the phibble DataFrame to Phit\fit_glm(), which builds R's model matrix and fits the model. The coefficient names, deviances, and AIC follow R's glm().
The logistic and probit models use 80 simulated students, where passed is 1 when a student passed and 0 otherwise. Those outcomes were drawn from a logistic model, so the probit fit shows how the coefficients change with the link. The Poisson model uses 120 simulated clinic records, where calls is a count that rises with visitors and falls with staff. Both data sets come from the phit documentation and are read from CSV files. Checking the interaction box replaces + with *, which adds the product of the two predictors.