I am trying to understand the code written in the following discussion (see link):
library(boot) library(reshape) dataset <- data.frame(Person = c(rep("A", 20), rep("B", 10)), Success = c(rbinom(20, 1, 0.25), rbinom(10, 1, 0.75))) Aggregated <- cast(Person ~ ., data = dataset, value = "Success", fun = list(mean, length)) m0 <- glm(Success ~ 1, data = dataset, family = binomial) m1 <- glm(mean ~ 1, data = Aggregated, family = binomial, weights = length) inv.logit(coef(m0)) inv.logit(coef(m1))
I am confused as to what the
1 in the formula
Success ~ 1 means.
In the documentation for the formula,
there is a description of the special symbol
. in a formula
but there is not description of
y ~ x - 1 means a line through the origin.