linERRscore: Compute the Firth-corrected score function

Description Usage Arguments Value Examples

View source: R/linERRscore.R

Description

Compute the Firth-corrected score for a matched case-control dataset

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
linERRscore(
  params,
  data,
  doses,
  set,
  status,
  loc,
  ccmethod,
  corrvars = NULL,
  repar = FALSE
)

Arguments

params

vector of parameters (β/ξ, α_2, ... , α_L, γ_1, ... , γ_p) for which to compute the modified score. Parameters α only need to be supplied when ccmethod="CL" or ccmethod="CCAL". Note that when repar=TRUE, ξ needs to be supplied

data

data frame containing matched case-control data, with a number of columns for doses to different locations, a column containing matched set numbers, a column containing the case's tumor location (value between 1 and the number of locations, with location x corresponding to the x-th column index in doses) and a column serving as a case-control indicator. Other covariates can also be included, in this case a parameter for each covariate column will be estimated. Hence factor variables need to be converted to dummy variables using model.matrix. If using ccmethod='meandose', a column for tumor location is still required but in this case the column can be a vector of ones.

doses

vector containing the indices of columns containing dose information.

set

column index containing matched set numbers.

status

column index containing case status.

loc

column index containing the location of the matched set's case's second tumor.

ccmethod

choice of method of analysis: one of meandose, CCML, CCAL or CL. Defaults to CCAL

corrvars

vector containing the indices of columns containing variables to be corrected for.

repar

reparametrize to β=exp(γ)? Note that this only affects the Firth modified score, not the original score. Defaults to FALSE.

Value

List object with components:

U

the original score

A

the modification to the score

The Firth corrected score is equal to U+A.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
data(linearERRdata1)

# score in the truth
score1 <- linERRscore(params=c(.3,rep(-1.386294,4),log(2)),
data=linearERRdata1,set=1, doses=2:6, status=8, loc=7, corrvars=9,ccmethod="CCAL")

# score in the truth, reparametrized
score1_repar <- linERRscore(params=c(log(.3),rep(-1.386294,4),log(2)),
data=linearERRdata1,set=1, doses=2:6, status=8, loc=7, corrvars=9,ccmethod="CCAL", repar=TRUE)

score1$U # Original score
score1$U+score1$A # Firth score

score1_repar$U+score1_repar$A # Firth score under reparametrization

# score in 0
score2 <- linERRscore(params=c(0,rep(0,4),0),
data=linearERRdata1,set=1, doses=2:6, status=8, loc=7, corrvars=9, ccmethod="CCAL")

score2$U # Original score
score2$U+score2$A # Firth score

sanderroberti/linearERRfit documentation built on Nov. 8, 2021, 12:23 a.m.