GSS93                  package:cmm                  R Documentation

_P_o_l_i_t_i_c_a_l _O_r_i_e_n_t_a_t_i_o_n _a_n_d _R_e_l_i_g_i_o_n _i_n _t_h_e _U_n_i_t_e_d _S_t_a_t_e_s _i_n _1_9_9_3 (_G_e_n_e_r_a_l _S_o_c_i_a_l _S_u_r_v_e_y, _1_9_9_3)

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

     Self-reported Political Orientation (P), Religion (R), and Opinion
     of Teenage Birth-control (B) of a sample of 911 US citizens in
     1993. The data stem from the General Social Survey. The data are
     tabulated in Bergsma, Croon, and Hagenaars (2009, Table 2.1, Table
     2.3).

     See Section~2.1 in Bergsma, Croon, and Hagenaars (2009).

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

     data(GSS93)

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

     A data frame with 911 observations on the following three
     variables.

     '_P' Political orientation (ordered): 1 = Extremely liberal; 2 =
          Liberal; 3 = Slightly liberal; 4 = Moderate; 5 = Slightly
          conservative; 6 = Conservative; 6 = Extremely conservative.

     '_R' Religion (factor): 1 = Protestant; 2 = Catholic; 3 = Other.

     '_B' Opinion of birth control (ordered): 1 = Strongly agree; 2 =
          Agree; 3 = Disagree; 4 = Strongly disagree;


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

     General Social Survey (1993)

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

     Bergsma, W. P., Croon, M. A., & Hagenaars, J. A. P. (2009).
     _Marginal models for dependent, clustered, and longitudinal
     categorical data._ New York: Springer

     General Social Survey (1993).

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

     data(GSS93)

     ## Table 2.1 of Bergsma, Croon, & Hagenaars (2009)
     addmargins(table(GSS93[,1:2]))

     ## Table 2.2 of Bergsma, Croon, & Hagenaars (2009)
     # Specify coefficients
     coeff <- list("log",diag(21))
     SampleStatistics(GSS93[,1:2],coeff,CoefficientDimensions=c(7,3),Labels=c("P","R"), ShowParameters=TRUE, ShowCoefficients=FALSE)

     ## Table 2.3 of Bergsma, Croon, & Hagenaars (2009)
     ftable(B + R ~ P , data = GSS93)

     ########################################################
     ## Models for table PR

     #independence of P and R
     bt1 = ConstraintMatrix(c("P", "R"), list(c("P"), c("R")), c(7,3));
     #linear by nominal model
     bt2 = ConstraintMatrix(c("P", "R"), list(c("P","R")), c(7,3), SubsetCoding = list(c("P", "R"),c("Linear", "Nominal")))
     #linear by nominal model with equality of first two nominal parameters
     bt3 = ConstraintMatrix(c("P", "R"), list(c("P","R")), c(7,3), SubsetCoding = list(c("P", "R"),list("Linear", rbind(c(1,1,0),c(0,0,1)))))
     m = MarginalModelFit(GSS93[,1:2],list(bt2,"log"), ShowCoefficients=FALSE, ShowProgress=1, ShowParameters=TRUE, CoefficientDimensions=c(7,3),Labels=c("P","R"),ParameterCoding=list("Polynomial","Effect"))


     ########################################################
     ## Models for table PRB

     #various loglinear models
     bt1 = ConstraintMatrix(c("P", "R","B"), list(c("P","R"),c("B")), c(7,3,4))
     bt2 = ConstraintMatrix(c("P", "R","B"), list(c("P","R"),c("R","B")), c(7,3,4))
     bt3 = ConstraintMatrix(c("P", "R","B"), list(c("P","R"),c("P","B")), c(7,3,4))
     bt4 = ConstraintMatrix(c("P", "R","B"), list(c("P","R"),c("P","B"),c("R","B")), c(7,3,4))
     bt5 = ConstraintMatrix(c("P", "R","B"), list(c("P","R"),c("P","B"),c("R","B")), c(7,3,4), SubsetCoding = list(list(c("P", "B"),c("Linear", "Linear")),list(c("R", "B"),c("Nominal", "Linear"))))

     m = MarginalModelFit(GSS93,list(bt2,"log"), ShowCoefficients=FALSE, ShowProgress=1, ShowParameters=TRUE,
              CoefficientDimensions=c(7,3,4),Labels=c("P","R","B"), ParameterCoding=list("Polynomial","Polynomial","Effect"))

