interaction_cox: Runs single referent group cox models using interaction...

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

View source: R/interaction_cox.R

Description

The interaction_cox() function runs single referent group interaction cox models. The main interaction variable is coded using the interaction(var1, var2) function.

Usage

1
interaction_cox(dat,start,stop,outcome,expoVar,strataVar,age,covariates=NULL)

Arguments

dat

data frame used in the analysis

start

Character vector naming your start of followup time, can be numeric or date format. Typically this is one of our DTINT variables. For time dependent or late-entry models, this will be the name of your start time variable.

stop

Character vector naming your end of followup time, can be numeric or date format. Typically this is one of our DATEFT or DATEDD variables. For time dependent or late-entry models, this will be the name of your stop time variable.

outcome

Character vector for the censor variable used in the analysis, must be coded as 0=control, 1=case

expoVar

Character vector for our main exposure variable, may be categorical or numeric

strataVar

Character vector for our stratification variable, must be categorical

age

Character vector for our age variable used for stratifying on single year of age

covariates

Character vector of covariates. Default is NULL (age-adjusted analysis only)

Details

The interaction_cox() function will run simple interaction models, format the results into a table, and return all model output in a list format that is suitable for program review. The function will run standard, time-dependent, or late-entry models, depending on how the data are structured prior to running the function

Interaction models are coded using the following formula:

y <- formula(Surv(start,stop,outcome)~ interaction(expoVar,strataVar) + covariates + strata(age))

To calculate a p-interaction, a reduced model is also calculated:

y <- formula(Surv(start,stop,outcome) strataVar + expoVar + covariates + strata(age))

The p-interaction is then calculated:

anova(interaction.model, reduced.model)

Value

The function outputs a 3-level list including all the output from the analysis.

final

A data frame containing the organized output of the function. Includes exposure name, categories, case numbers, stratified estimates and p-values, and a p-value for interaction.

int.model

All model output for the interaction model

base.model

All model output from the base model

Author(s)

Brian Carter

References

G:/Intramural Research/Epidemiology Research/Analysts EPI/Memos, presentations, resources and code/Interaction/Memo, Interaction Methods.doc

See Also

coxph, cox_models, stratified_cox

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
df <- example_data

foo <- interaction_cox(dat=df,
                      start="dtint92",
                      stop="dateft",
                      outcome="dead",
                      expoVar="smoke92",
                      strataVar="bmicat92",
                      age="age92m",
                      covariates=NULL)

buddha2490/BERG documentation built on Feb. 7, 2020, 6:01 p.m.