getass.drm: Support function for drm: specification of the association...

Description Details References See Also Examples

Description

A support function called by drm that parses from the argument dep the covariates and functional forms for the association model. This function should not be used directly by the user.

Details

In the argument dep, the user needs to specify the covariates and functional forms on the association parameters. The following list describes the notation and concise interpretation of the association parameters. For more details, see the reference below.

References

Jokinen J. Fast estimation algorithm for likelihood-based analysis of repeated categorical responses. Computational Statistics and Data Analysis 2006; 51:1509-1522.

See Also

drm

Examples

 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
### Example of functional forms:
## non-stationary second order Markov structure
## initial values of the dependence ratios are set to 1.
## Not run: 
data(wheeze)
assoc <- list("M2",
              tau12 ~ function(a78=1, a89=1, a910=1)c(a78, a89, a910),
              tau123 ~ function(a789=1, a8910=1)c(a789, a8910),
              tau13 ~ function(a79=1, a810=1)c(a79, a810))

fit1 <- drm(wheeze~I(age>9)+smoking+cluster(id)+Time(age),
            data=wheeze, dep=assoc, print=0)
### Example of other parameter restrictions:
## fixing parameters to a known value: ~tau12==1, ~tau21==1
## setting parameters to equal: ~tau11==tau22
data(marijuana)
assoc <- list("M", ~tau12==1, ~tau21==1, ~tau11==tau22)

fit2 <- drm(y~age+cluster(id)+Time(age), data=marijuana,
            subset=sex=="female", dep=assoc, print=0)

## setting all parameters to equal:

assoc <- list("M", ~tau11==tau12, ~tau11==tau21, ~tau11==tau22)

fit3 <- drm(y~age+cluster(id)+Time(age), data=marijuana,
            subset=sex=="female", dep=assoc, print=0)

## End(Not run)
### Example of covariates for the association parameters:
## allow the probabilities within the latent class
## vary by sex. Note: covariate needs to be a factor.
data(obese)
assoc <- list("L", kappa ~ kappa:factor(sex))

fit4 <- drm(obese~age+cluster(id)+Time(age), data=obese,
            dep=assoc, print=0)

### Example how to derive conditional probabilities from marginals
## Fit a model with three latent classes:
data(wheeze)
latent3 <- drm(wheeze~I(age>9)+smoking+cluster(id),data=wheeze,
               dep="L",Lclass=3, print=0)

## calculate conditional probabilities:
## pr(Y=1|L=2) = pr(Y=1)/(nu2+kappa1*nu1+kappa0*(1-nu1-nu2))
## pr(Y=1|L=1) = kappa1*pr(Y=1|L=2)
## pr(Y=1|L=0) = kappa0*pr(Y=1|L=2)

est <- coef(latent3)
psi2 <- latent3$fitted.marginals/
        (est["nu2"]+est["kappa1"]*est["nu1"]+
         est["kappa0"]*(1-est["nu1"]-est["nu2"]))
psi1 <- psi2*est["kappa1"]
psi0 <- psi2*est["kappa0"]

## check the model validity, i.e. require that 0 < psi_i <1:
range(cbind(psi0,psi1,psi2))

drm documentation built on May 29, 2017, 7:24 p.m.

Related to getass.drm in drm...