f_fit_linERR_wf: fit Excess Relative Risk Model

Description Usage Arguments Value Examples

Description

function that calls the optimization (mle from stats4 package, so use optim) from an event format data set, and return a rERR object with the estimation and summary

Usage

1
2
f_fit_linERR_wf(formula, data, id_name, doses, times, covars, lag,
  exclusion_done = F)

Arguments

formula

Surv(entry_time,exit_time,outcome)~loglin(loglin_var1,..,loglin_varn)+
lin(lin_var1,..,lin_varm)+strata(strat_var1,...strat_varp)

data

data set returned from f_to_model_data

id_name

name of variable containing the names of subjects

doses

sub data set of grouped doses

times

sub data set of times relatives to doses

covars

sub data set of the covars that will be involved in the model (adjustments and stratification)

lag

latency period

exclusion_done

a logical indicating wheather the exclusion is already done or not

Value

rERR object with the estimation

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# set the formulas for the models
formula1 <- Surv(AgeAtEntry,age_at_event,outcome) ~ lin(dose_cum) + strata(sex)
formula2 <- Surv(AgeAtEntry,age_at_event,outcome) ~ loglin(factor(country)) + lin(dose_cum) + 
                                                    strata(sex)

  
# fit the models
fit1 <- f_fit_linERR_wf(formula1,data=cohort_wf,id_name="id",doses=cohort_wf[,45:79],
                        times=cohort_wf[,10:44],covars=cohort_wf[,c("sex","country")],
                        lag=2,exclusion_done = FALSE)

fit2 <- f_fit_linERR_wf(formula2,data=cohort_wf,id_name="id",doses=cohort_wf[,45:79],
                        times=cohort_wf[,10:44],covars=cohort_wf[,c("sex","country")],
                        lag=2,exclusion_done = FALSE)

# display a summary
summary(fit1)
summary(fit2)

# confidence intervals
confint(fit1)
confint(fit2) 

# likelihood ratio test between nested and nesting models#' 
f_lrt(fit1,fit2)

fbr600/rERR documentation built on May 7, 2019, 9:36 a.m.