Description Usage Format Source Examples
aps dataset.
1 |
A data.frame with 508 rows and 11 variables:
Identification Code (1 - 508)
Placement (1: Outpatient, 2: Day Treatment, 3: Intermediate Residential, 4: Residential)
Placement Combined (1: Outpatient or Day Treatment, 2: Intermediate Residential, 3: Residential )
Age at Admission (Years)
Race (1: White, 2: Non-white)
Gender (1: Female, 2: Male)
Neuropsychiatric Disturbance (1: None, 2: Mild, 3: Moderate, 4: Severe)
Emotional Disturbance (1: Not Severe, 2: Severe)
Danger to Others (1: Unlikely, 2: Possible, 3: Probable, 4: Likely)
Elopement Risk (1: No Risk, 2: At Risk)
Length of Hospitalization (Days)
Behavioral Symptoms Score (0 - 9)
State Custody (1: No, 2: Yes)
History of Violence (1: No, 2: Yes)
Hosmer, D.W., Lemeshow, S. and Sturdivant, R.X. (2013) Applied Logistic Regression, 3rd ed., New York: Wiley
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | head(aps, n = 10)
summary(aps)
## Table 8.2 p. 274
library(nnet)
modt8.2 <- multinom(place3 ~ viol, data = aps)
summary(modt8.2)
exp(coef(modt8.2)[, "violYes"])
t(exp(confint(modt8.2)["violYes", ,]))
## To test differences between b_2 and b_1 we need the estimated variance
## covariance matrix for the fitted model (Table 8.3 p. 274).
vcov(modt8.2) # 'raw'
## To have exactly the same output as the text we need to rearrange just a
## minimum
VarCovM <- vcov(modt8.2)[c(2, 1, 4, 3), c(2, 1, 4, 3)]
VarCovM[upper.tri(VarCovM)] <- NA
VarCovM
## Testing against null model.
modt8.2Null <- multinom(place3 ~ 1, data = aps)
anova(modt8.2, modt8.2Null, test = "Chisq")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.