The first command counts missing values in every column: there are missing ages and missing cabin entries, with none in the other variables. The next command deletes Cabin. The final command replaces every missing age by the mean of the observed ages, using na.rm = TRUE so missing entries do not contaminate that mean.
The code fits a Bernoulli logistic-regression model. Conditionally on the covariates, the responses are independent with
where the design includes the displayed numerical predictors and indicator columns for factor levels. It maximizes
Akaike information criterion is
where is the number of fitted parameters. Backward stepwise selection starts from the full model, tentatively removes each eligible term, chooses the removal producing the lowest AIC, and repeats while AIC decreases. It balances fit against model size rather than testing every coefficient at a fixed significance threshold.
The residual deviance per residual degree of freedom is
reasonably close to one. The first and third quartiles of the deviance residuals, and , are also fairly close to the standard-normal quartiles . There is mild evidence of underdispersion, but nothing in this summary makes the binomial value one plainly unreasonable.
A standard moment estimator is the Pearson dispersion estimator
For Bernoulli data, . The deviance divided by its residual degrees of freedom is a common alternative.

Articles by others on the same topic (0)

There are currently no matching articles.