tukeytrendfit: Fit multiple marginal models by updating a given fitted model...

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/tukeytrendfit.R

Description

Wrapper function to re-fit a given model after different rescalings of a single dose variable. The refitted models are combined into a list that is suitable as input to the multiple marginal model function of package multcomp, mmm.

Usage

1
2
3
tukeytrendfit(fit, dose, 
scaling = c("ari", "ord", "log", "arilog", "highvslow", "treat"),
ctype = NULL, ddf = c("residual", "KR", "PB"), d0shift = 1)

Arguments

fit

A fitted model object, currently, the classes lm, glm, lmer, and nlme are supported. The left hand side of the models formula must contain a single (numeric) variable that is treated as a dose variable in Tukeys trend test. It may contain further variables that are not changed when refitting the model.

dose

A single character string, naming a numeric variable in the models formula. This variable is rescaled acc. to the options in scaling and the model in fit is then refitted with the rescaled dose variable.

scaling

A vector of character strings, naming the options for rescaling the variable specified in dose: "ari": no rescaling, "ord": ranks of dose levels, "log": log-transformed dose levels, "arilog": log-transformnd dose levels, with interpolated dose score for 0, "high.vs.low": dose coerced to a factor, and only highest and lowest dose level retained, all others set NA, "treat": dose coerced to a factor, all levels retained with the option to apply multiple contrast tests to the treatment levels

ctype

optional character string naming a contrast type for multiple comparisons between dose levels, when scaling="treat". Options are "Dunnett", "William" etc., see ?contrMat in package multcomp. Argument ctype is ignored if scaling does not involve option "treat".

ddf

single character string, defining the option for the degree of freedom in inference after model fitting. By default, "residual" degrees of freedom will be used for all models. "KR": For models of class "lmerMod" (fitted by "lmer" from package "lme4"), Kenward-Roger degrees of freedom can be computed (based on methods from package "pbkrtest"); "PB": For models of class "lme" (fitted by "lme" from package "nlme"), containment degrees of freedom as defined by Pinheiro and Bates can be extracted.

d0shift

an optional factor, that is multiplied with the interpolated dose score for dose = 0 in option scaling="arilog"; ignored in all other options for rescaling

Value

A list with elements

mmm

a list of fitted models, after rescaling the dose variable

mlf

a list of matrices defining a linear functions of model parameters for each model in mmm, defining the parameter of interest for inference in function mlf and glht

df

a vector of degrees of freedom, one for each model in mmm

and information of the model typ and call of the initial model

Author(s)

Frank Schaarschmidt and Christian Ritz (providing internal functions to interface objects of class "lmerMod" and "lme")

References

Tukey JW, Ciminera JL, Heyse JF (1985). Testing the statistical certainty of a response to increasing doses of a drug. Biometrics 41(1), 295-301.

Pipper CB, Ritz C, Bisgaard H (2012). A versatile methode for confirmatory evaluation of the effects of a covariate in multiple models. JRSSC - Applied Statistics 61, 315-326.

See Also

Functions glht and mmm in package multcomp; tukeytrendformula for starting with a model formula and data.frame; combtt for concatenating several objects resulting from this function, e.g. for multiple endpoints or with different covariates; asglht for direct conversion to a glht-object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
data(litter, package="multcomp")

# variable of interest is 'dose', but
# we may want to include 'number' as a covariate

dl <- litter
dl$dosen <- as.numeric(as.character(dl$dose))

fit <- lm(weight ~ dosen + number, data=dl)

# as it is unclear on which scale of dosage, 
# dose-response-shape is met best, we may try different
# re-scalings of the dose variable, including Dunnett- type multiple contrast test

ttlitter <- tukeytrendfit(fit, dose="dosen", 
 scaling=c("ari", "ord", "log", "treat"), ctype="Dunnett")

summary(asglht(ttlitter))

tukeytrend documentation built on March 13, 2020, 5:06 p.m.