## ----include = FALSE---------------------------------------------------------- knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) ## ----setup-------------------------------------------------------------------- library(nparLD) ## ----eval=FALSE--------------------------------------------------------------- # # nparLD(response ~ factor1 * factor2, # data = dat, # subject = "subject") # ## ----eval = FALSE------------------------------------------------------------- # hypothesis = "H0p" ## ----eval = FALSE------------------------------------------------------------- # hypothesis = "H0F" ## ----dental-example----------------------------------------------------------- data(dental) fit_dental <- nparLD( resp ~ time, data = dental, subject = "subject", hypothesis = "H0p", covariance = TRUE ) fit_dental ## ----shoulder-example, fig.width = 7, fig.height = 5-------------------------- data(shoulder) fit_shoulder <- nparLD( resp ~ group1 * group2 * time, data = shoulder, subject = "subject", hypothesis = "H0p", contrast = list("group1:time") ) fit_shoulder plot(fit_shoulder) plot(fit_shoulder$MCTP) ## ----missing-example---------------------------------------------------------- set.seed(123) dat_miss <- dental dat_miss$resp[c(2, 7, 12)] <- NA fit_miss <- nparLD( resp ~ time, data = dat_miss, subject = "subject", hypothesis = "H0p" ) fit_miss ## ----eval = FALSE------------------------------------------------------------- # nparLD(response ~ group * time, # data = dat, # subject = "subject", # replicate = "replicate") ## ----eval = FALSE------------------------------------------------------------- # cell.weights = "subjects" ## ----eval = FALSE------------------------------------------------------------- # cell.weights = "observations" ## ----replicate-example-------------------------------------------------------- data(brdu) fit_brdu_subjects <- nparLD( resp ~ dose, data = brdu, subject = "culture", replicate = "replicate", hypothesis = "H0p", cell.weights = "subjects" ) fit_brdu_observations <- nparLD( resp ~ dose, data = brdu, subject = "culture", replicate = "replicate", hypothesis = "H0p", cell.weights = "observations" ) fit_brdu_subjects fit_brdu_observations ## ----plot-cell-effects, fig.width=7, fig.height=4----------------------------- plot(fit_shoulder) ## ----plot-term effects, fig.width=7, fig.height=4----------------------------- fit_shoulder_info <- nparLD( resp ~ group1 * group2 * time, data = shoulder, subject = "subject", hypothesis = "H0p", Factor.Information = TRUE ) plot(fit_shoulder_info, term = "group1:time") ## ----plot-cell-effectsseveral, fig.width=7, fig.height=4---------------------- plot(fit_shoulder_info, term = c("time", "group1:time")) ## ----eval = FALSE------------------------------------------------------------- # contrast = list("time", "Dunnett") ## ----eval = FALSE------------------------------------------------------------- # contrast = list("group:time") ## ----eval = FALSE------------------------------------------------------------- # plot(fit$MCTP) ## ----shoulder-data------------------------------------------------------------ data(shoulder) str(shoulder) ## ----shoulder-h0f------------------------------------------------------------- fit_shoulder_F <- nparLD( resp ~ group1 * group2 * time, data = shoulder, subject = "subject", hypothesis = "H0F" ) fit_shoulder_F ## ----shoulder-h0p------------------------------------------------------------- fit_shoulder_p <- nparLD( resp ~ group1 * group2 * time, data = shoulder, subject = "subject", hypothesis = "H0p" ) fit_shoulder_p ## ----shoulder-plot, fig.width = 7, fig.height = 5----------------------------- plot(fit_shoulder_p) ## ----shoulder-mctp------------------------------------------------------------ fit_shoulder_contrast <- nparLD( resp ~ group1 * group2 * time, data = shoulder, subject = "subject", hypothesis = "H0p", contrast = list("group1:time") ) fit_shoulder_contrast$MCTP ## ----shoulder-mctp-plot, fig.width = 7, fig.height = 5------------------------ plot(fit_shoulder_contrast$MCTP) ## ----effects-component-------------------------------------------------------- head(fit_shoulder_p$effects) ## ----test-components---------------------------------------------------------- fit_shoulder_p$WTS fit_shoulder_p$ATS ## ----mctp-component----------------------------------------------------------- fit_shoulder_contrast$MCTP ## ----output-plots, eval = FALSE----------------------------------------------- # plot(fit_shoulder_p) # plot(fit_shoulder_contrast$MCTP)