mentalHealth               package:gnm               R Documentation

_D_a_t_a _o_n _M_e_n_t_a_l _H_e_a_l_t_h _a_n_d _S_o_c_i_o_e_c_o_n_o_m_i_c _S_t_a_t_u_s

_D_e_s_c_r_i_p_t_i_o_n:

     A 2-way contingency table from a sample of residents of Manhattan.
     Classifying variables are child's mental impairment ('MHS') and
     parents' socioeconomic status ('SES').

_U_s_a_g_e:

     data(mentalHealth)

_F_o_r_m_a_t:

     A data frame with 24 observations on the following 3 variables.

     '_c_o_u_n_t' a numeric vector

     '_S_E_S' an ordered factor with levels 'A' < 'B' < 'C' < 'D' < 'E' <
          'F'

     '_M_H_S' an ordered factor with levels 'well' < 'mild' < 'moderate' <
          'impaired'

_S_o_u_r_c_e:

     From Agresti (2002, p381); originally in Srole et al. (1978,
     p289).

_R_e_f_e_r_e_n_c_e_s:

     Agresti, A. (2002).  _Categorical Data Analysis_ (2nd edn).  New
     York: Wiley.

     Srole, L, Langner, T. S., Michael, S. T., Opler, M. K. and Rennie,
     T. A. C. (1978), _Mental Health in the Metropolis: The Midtown
     Manhattan Study_.  New York: NYU Press.

_E_x_a_m_p_l_e_s:

     set.seed(1)
     data(mentalHealth)

     ##  Goodman Row-Column association model fits well (deviance 3.57, df 8)
     mentalHealth$MHS <- C(mentalHealth$MHS, treatment)
     mentalHealth$SES <- C(mentalHealth$SES, treatment)
     RC1model <- gnm(count ~ SES + MHS +
                     Mult(-1 + SES, -1 + MHS),
                     family = poisson, data = mentalHealth)
     ## Row scores are parameters coef(RC1model)[10:15]
     ## Column scores are coef(RC1model)[16:19]
     ## -- both unnormalized in this parameterization of the model

     ## The scores can be normalized as in Agresti's eqn (9.15):
     rowProbs <- with(mentalHealth, tapply(count, SES, sum) / sum(count))
     colProbs <- with(mentalHealth, tapply(count, MHS, sum) / sum(count))
     rowScores <- coef(RC1model)[10:15]
     colScores <- coef(RC1model)[16:19]
     rowScores <- rowScores - sum(rowScores * rowProbs)
     colScores <- colScores - sum(colScores * colProbs)
     beta1 <- sqrt(sum(rowScores^2 * rowProbs))
     beta2 <- sqrt(sum(colScores^2 * colProbs))
     assoc <- list(beta = beta1 * beta2,
                   mu = rowScores / beta1,
                   nu = colScores / beta2)

