GLMprob: Sampling probabilities estimated with logistic regression.

View source: R/wpl9.R View source: R/wpl8.R

GLMprobR Documentation

Sampling probabilities estimated with logistic regression.

Description

Estimates sampling probabilities with logistic regression. The weights included in the Cox-regressions (wpl) and which could be used for other procedures are inverse sampling probabilities i.e. the inverse of these probabilities. The probabilties are estimated for all subjects in the cohort.

survtime, left.time and continuous matching variables are included in the logistic regression as continuous variables while categorical matching variables are taken as factors.

Usage

GLMprob(survtime, samplestat, left.time = 0, match.var = 0, match.int = 0)

Arguments

survtime

Follow-up time for all cohort subjects

samplestat

A vector containing sampling and status information: 0 represents non-sampled subjects in the cohort, 1: sampled controls, 2,3,... indicate different events. Cohort dimension.

left.time

Entry time if the survival times are left-truncated. Cohort dimension.

match.var

If the controls are matched to the cases (on other variables than time), match.var is the vector of matching variables. Cohort dimension.

match.int

A vector of length 2*number of matching variables. For caliper matching (matched on value pluss/minus epsilon) match.int should consist of c(-epsilon,epsilon). For exact matching match.int should consist of c(0,0).

Value

A vector of cohort dimension of sampling probabilities.

Author(s)

Nathalie C. Stoer

References

Stoer NC and Samuelsen SO (2013): Inverse probability weighting in nested case-control studies with additional matching - a simulation study. Statistics in Medicine, 32(30), 5328-5339.

See Also

wpl, coxph, Chenprob, GAMprob, KMprob

Examples

data(CVD_Accidents)
attach(CVD_Accidents)
GLMprob(agestop,samplestat,agestart)
GLMprob(agestop,samplestat,agestart,match.var=cbind(sex,bmi),match.int=c(0,0,-2,2))

## The function is currently defined as
function (survtime, samplestat, left.time = 0, match.var = 0, 
    match.int = 0) 
{
    n.cohort = length(survtime)
    status = rep(0, n.cohort)
    status[samplestat > 1] = 1
    samplestat[samplestat > 1] = 1
    pglm = pGLM(status, survtime, samplestat, n.cohort, left.time, 
        match.var, match.int)
    p = rep(1, n.cohort)
    p[status == 0] = pglm
    p
  }

multipleNCC documentation built on July 9, 2023, 5:20 p.m.