
i
i
“K23166” — 2015/1/28 — 9:35 — page 121 — #147
i
i
i
i
i
i
7.10. EXAMPLES 121
> library(MASS)
> ngroups = length(unique(ds$homeless))
> ldamodel = lda(homeless ~ age + cesd + mcs + pcs,
prior=rep(1/ngroups, ngroups), data=ds)
> print(ldamodel)
Call:
lda(homeless ~ age + cesd + mcs + pcs, data = ds, prior = rep(1/ngroups,
ngroups))
Prior probabilities of groups:
0 1
0.5 0.5
Group means:
age cesd mcs pcs
0 35.0 31.8 32.5 49.0
1 36.4 34.0 30.7 46.9
Coefficients of linear discriminants:
LD1
age 0.0702
cesd 0.0269
mcs -0.0195
pcs -0.0426
The results indicate that homeless subjects tend to be older, have higher CESD scores,
and lower MCS and PCS scores. Figure 7.4 displays