depratio {drm}R Documentation

Empirical estimates of the dependence ratios

Description

Calculates the observed values of the adjacent dependence ratios from the data.

Usage

depratio(formula, data, subset, ord = 2, boot.ci = FALSE, n.boot = NULL,
         ci.width=0.95) 

Arguments

formula the syntax is of form y~cluster(id)+Time(time), where id denotes the cluster indicator, and Time denotes the order along which the adjacent dependence ratios will be calculated.
data optional data frame containing the variables in the formula
subset an optional vector specifying a subset of observations from the data
ord order of the dependence ratios to be calculated. The default is 2
boot.ci logical argument specifying whether bootstrap confidence intervals will be calculated for the empirical dependence ratio estimates
n.boot number of bootstrap replicates
ci.width width of the confidence interval. Default is 0.95

Value

An object of class depratio. Generic functions print and plot are also available.
An object of class depratio is a list containing at least the following two components:

tau matrix of the observed dependence ratios
freq matrix of the frequencies of events for the numerator of the observed dependence ratios

See Also

drm, cluster, Time

Examples

## calculate and plot the observed 2nd order dependence ratios
## for the marijuana data:
data(marijuana)
dr.male <- depratio(y~cluster(id)+Time(age), data=marijuana,
                    subset=sex=="male")
dr.male
plot(dr.male)

## confirm that the 1st order Markov assumption is adequate
## for the madras data:
data(madras)

dr2 <- depratio(symptom~cluster(id)+Time(month), data=madras)
dr3 <- depratio(symptom~cluster(id)+Time(month), ord=3, data=madras)
dr <- rbind(dr2$tau[-length(dr2$tau)]*dr2$tau[-1], dr3$tau)

matplot(1:ncol(dr), t(dr))


[Package drm version 0.5-8 Index]