Estimates sampling probabilities with a Kaplan-Meier type formula. 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.

1 | ```
KMprob(survtime, samplestat, m, left.time = 0, match.var = 0, match.int = 0)
``` |

`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. |

`m` |
Number of sampled controls. A scalar if equal number of controls for all case. If unequal number of controls per case: A vector of length number of cases. The vector must be in the same order as the cases in the samplestat-vector. |

`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). |

A vector of cohort dimension of sampling probabilities.

Nathalie C. Stoer

Samuelsen SO. A pseudolikelihood approach to analysis of nested case-control studies.
Biometrika, 84(2):379-394, 1997.

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.

`wpl`

, `coxph`

, `Chenprob`

, `GLMprob`

,
`GAMprob`

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 26 27 28 29 30 | ```
data(CVD_Accidents)
attach(CVD_Accidents)
KMprob(agestop,samplestat,m=1,agestart)
KMprob(agestop,samplestat,m=1,agestart,match.var=cbind(bmi),match.int=c(-2,2))
## The function is currently defined as
function (survtime, samplestat, m, left.time = 0, match.var = 0, match.int = 0)
{
n.cohort = length(survtime)
status = rep(0, n.cohort)
status[samplestat > 1] = 1
o = order(survtime)
status = status[o]
survtime = survtime[o]
if (length(left.time) == n.cohort) {
left.time = left.time[o]
}
if (length(match.var) == n.cohort) {
match.var = match.var[o]
}
if (length(match.var) > n.cohort) {
match.var = match.var[o, ]
}
tilbakestill = (1:n.cohort)[o]
p = pKM(status, survtime, m, n.cohort, left.time, match.var,
match.int)
p[status > 0] = 1
p = p[order(tilbakestill)]
p
}
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.