# Sampling probabilities estimated with generalized additive models.

### Description

Estimates sampling probabilities with generalized additive models. 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 will be
smoothed on while categorical matching variables are taken as factors.

### Usage

1 | ```
GAMprob(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`

, `GLMprob`

,
`KMprob`

, `gam`

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ```
data(CVD_Accidents)
attach(CVD_Accidents)
GAMprob(agestop,samplestat,agestart)
GAMprob(agestop,samplestat,agestop,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
pgam = pGAM(status, survtime, samplestat, n.cohort, left.time)
p = rep(1, n.cohort)
p[status == 0] = pgam
p
}
``` |