help for revcat

Reversible catalytic models

revcat depvar agevar [datevar]
[weight] [if] [in]
[, minage(#) change(numlist) age
smooth rr lambda(varlist)
init(matname) level(#) maximize_options ]

revcat_pred [type] predvar [if] [in] [ , parameter level(#) ]

by ... : may be used with revcat; see help
by.

fweights and pweights are allowed; see help weights.

Description

revcat fits a reversible catalytic model, i.e. a model in which people start off negative for some measured outcome, become positive at rate lambda and then become negative at rate rho.
If lambda and rho are constant, then someone born negative has probability of being positive at age a given by:

p(a) = lambda/(lambda+rho)*(1-exp(-(lambda+rho)*a))

depvar is the variable recording whether each person is positive or negative, and (if not missing) may only take values 0 or 1.
agevar is the person's age when the outcome was measured.
If specified, datevar is the date that the measurement was recorded.
There is assumed to be a single measurement per person.
For each set of parameters, the model calculates the predicted probability of being positive, and then assumes a binomial likelihood.

Options

minage(#) is the minimum age that is included in the estimation sample. The default is one.

change(numlist) is a list of one or more times at which lambda is assumed to change.
These numbers can have one of three meanings:

1. If the option age is specified then change() represents ages at which lambda changes.

2. If age is not specified and datevar is supplied then lambda changed at the times in change(), which represent calendar time.

3. If age is not specified and datevar is not supplied then the times in change() are the times since the changes in lambda.

Suppose that there are n values in change().
Then lambda takes n+1 values, lambda1, lambda2, lambda3,....
lambda1 is the value at the earliest calendar time, or at the youngest age if age is specified.

If age is specified then datevar is irrelevant.
If change() is not specified then both age and datevar are irrelevant.
agevar, datevar, change() and minage() must all be in the same units, e.g. years.

smooth specifies that the log of the ratio between successive values of lambda follows a normal distribution with mean zero and standard deviation sigma, where sigma is estimated.

rr specifies that the model be parameterised in terms of lambda1, r2, r3,...,
where ri = lambdai/lambda1, i=2,...,n+1.
The default parameterisation is in terms of lambda1, lambda2, lambda3,....

lambda(varlist) is a list of variables on which lambda1 depends.
If there is at least one value in change() and lambda() is specified, then the option rr must be specified.

init(matname) supplies a matrix of initial values.

level(#) specifies the confidence level, in percent,
for the confidence intervals of the coefficients and for predictions; see help level.

maximize_options control the maximization process; see help maximize.

Predictions

revcat_pred generates predictions with confidence limits after fitting a model using revcat.
Predictions are generated in predvar and confidence limits in l_predvar and u_predvar.
The default prediction is the probability of being positive.
If parameter is specified then that quantity is generated instead.
parameter may be lambda, rho, or one of lambda1, lambda2,... .
If predvar is lambda, then lambda1, lambda2,... are generated with names predvar1,predvar2,... and corresponding confidence intervals.
Otherwise a single quantity is generated with its confidence interval.

Examples

Simulate some data:

drop _all

set obs 1000

gen age=-log(runiform())*10

global lambda=0.1

global rho=0.03

gen byte pos=runiform()<$lambda/($lambda+$rho)*(1-exp(-($lambda+$rho)*age))

gen int year=2012

gen byte g=runiform()<0.5

Fit models:

revcat pos age

revcat pos age year, change(2008)

revcat pos age year, change(2008) rr

revcat pos age, change(16) age

revcat pos age year, change(2008) rr lambda(g)

Generate predictions:

revcat_pred p

revcat_pred lambda, lambda

The following two commands are equivalent, if year only takes the value 2012:

revcat pos age, change(4)

revcat pos age year, change(2008)

Author

Jamie Griffin

Department of Infectious Disease Epidemiology

Imperial College London

jamiegriffin19@gmail.com

Updated 24th June 2015