svyloglin               package:survey               R Documentation

_L_o_g_l_i_n_e_a_r _m_o_d_e_l_s

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

     Fit and compare hierarchical loglinear models for complex survey
     data.

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

     svyloglin(formula, design, ...)
     ## S3 method for class 'svyloglin':
     update(object,formula,...)
     ## S3 method for class 'svyloglin':
     anova(object,object1,...,integrate=FALSE)
     ## S3 method for class 'anova.svyloglin':
     print(x,pval=c("F","saddlepoint","lincom","chisq"),...)
     ## S3 method for class 'svyloglin':
     coef(object,...,intercept=FALSE)

_A_r_g_u_m_e_n_t_s:

 formula: Model formula

  design: survey design object

object,object1: loglinear model from 'svyloglin'

    pval: p-value approximation: see Details

integrate: Compute the exact asymptotic p-value (slow)?

     ...: not used 

intercept: Report the intercept?

       x: anova object

_D_e_t_a_i_l_s:

     The loglinear model is fitted to a multiway table with
     probabilities estimated by 'svymean' and with the sample size
     equal to the observed sample size, treating the resulting table as
     if it came from iid multinomial sampling, as described by Rao and
     Scott. The variance-covariance matrix does not include the
     intercept term, and so by default neither does the 'coef' method. 
     A Newton-Raphson algorithm is used, rather than iterative
     proportional fitting, so starting values are not needed.

     The 'anova' method computes the quantities that would be the score
     (Pearson) and likelihood ratio chi-squared statistics if the data
     were an iid sample. It computes four p-values for each of these,
     based on the exact asymptotic distribution (see 'pchisqsum'), a
     saddlepoint approximateion to this distribution, a scaled
     chi-squared distribution, and a scaled F-distribution.  When
     testing the two-way interaction model against the main-effects
     model in a two-way table the score statistic and p-values match
     the Rao-Scott tests computed by 'svychisq'.

     The 'anova' method can only compare two models if they are for
     exactly the same multiway table (same variables and same order).
     The 'update' method will help with this. It is also much faster to
     use 'update' than 'svyloglin' for a large data set: its time
     complexity depends only on the size of the model, not on the size
     of the data set.

     It is not possible to fit a model using a variable created inline,
     eg 'I(x<10)', since the multiway table is based on all variables
     used in the formula.

_V_a_l_u_e:

     Object of class '"svyloglin"'

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

     Rao, JNK, Scott, AJ (1984) "On Chi-squared Tests For Multiway
     Contingency Tables with Proportions Estimated From Survey Data"
     Annals of Statistics 12:46-60.

_S_e_e _A_l_s_o:

     'svychisq', 'svyglm','pchisqsum'

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

      data(api)
      dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc)
      a<-svyloglin(~stype+comp.imp,dclus1)
      b<-update(a,~.^2)
      an<-anova(a,b)
      an
      print(an, pval="saddlepoint")

      ## Wald test
      regTermTest(b, ~stype:comp.imp)

      ## linear-by-linear association
      d<-update(a,~.+as.numeric(stype):as.numeric(comp.imp))
      an1<-anova(a,d)
      an1

