cholesterol             package:multcomp             R Documentation

_C_h_o_l_e_s_t_e_r_o_l _R_e_d_u_c_t_i_o_n _D_a_t_a _S_e_t

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

     Cholesterol reduction for five treatments; data set taken from 
     Westfall et al. (1999, p. 153). All pairwise comparisons according
      to Tukey in a balanced one-way layout.

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

     data(cholesterol)

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

     This data frame contains the following variables

     _t_r_t Treatment at 5 levels, see below.

     _r_e_s_p_o_n_s_e Response variable.

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

     See Westfall et al. (1999, p. 153). The treatment formulations 
     are defined as: 20mg one a day ('1time'), 10mg twice a day
     ('2times') and 5mg four times a day ('4times'). In addition, two
     competing drugs were used as control ('drugD') and ('drugE').

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

     P. H. Westfall, R. D. Tobias, D. Rom, R. D. Wolfinger, Y. Hochberg
     (1999). _Multiple Comparisons and Multiple Tests Using the SAS
     System_. Cary, NC: SAS Institute Inc.

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

     data(cholesterol)

     # adjusted p-values for all-pairwise comparisons in a one-way layout 
     # tests for restricted combinations
     simtest(response ~ trt, data=cholesterol, type="Tukey",
             ttype="logical")

     # adjusted p-values all-pairwise comparisons in a one-way layout 
     # (tests for free combinations -> p-values will be larger)
     simtest(response ~ trt, data=cholesterol, type="Tukey",
             ttype="free")

     # the following lines illustrate the basic principles of
     # parameter estimation used in all functions in this package
     # and how the low-level functions can be used with raw parameter
     # estimates.

     # the full design matrix (with reduced rank!)
     x <- cbind(1, 
                matrix(c(rep(c(rep(1,10), rep(0,50)), 4), 
                         rep(1, 10)), nrow = 50))
     y <- cholesterol$response

     xpxi   <- mginv(t(x) %*% x)
     rankx  <- sum(diag((xpxi %*% (t(x) %*% x))))
     n      <- nrow(x)
     p      <- ncol(x)
     df     <- round(n-rankx)

     # parameter estimates and their correlation
     parm   <- xpxi %*% t(x) %*% y
     mse    <- t(y-x %*% parm) %*% (y-x %*% parm)/df
     covm   <- mse[1,1]*xpxi

     # the contrast matrix
     contrast <- contrMat(table(cholesterol$trt), type="Tukey")

     # use the work-horse directly (and add zero column for the intercept)

     csimint(estpar=parm, df=df, covm=covm, cmatrix=cbind(0, contrast))    
     csimtest(estpar=parm, df=df, covm=covm, cmatrix=cbind(0, contrast),
              ttype="logical")      

     # only a subset of all pairwise hypotheses:
     #
     # * drug D versus all other formulations and
     # * all pairwise comparisions for "1time", "2times" and "4times"
     #
     csubset = contrast[c(1,3,5,6,8,10),]
     csubset
     simint(response ~ trt, data=cholesterol, cmatrix = csubset)

