profiles.drm {drm} | R Documentation |
Creates a support matrix for the calculation of all possible
profile probabilities using the ML estimates obtained from
drm
.
profiles.drm(n.categories, n.repetitions, structure = "exchangeable")
n.categories |
Number of respose variable categories |
n.repetitions |
Number of response repetitions within a cluster |
structure |
Association structure indicator of the model to be fitted: "exchangeable" if the structure is exchangeable, otherwise either "M" or "M2" |
Creation of this support object is useful if the cluster size
is large and if several models are fitted to the same dataset. Avoids
creating the same matrix over and over again for each model fit.
See examples for drm
.
If structure
="exchangeable", returns a
matrix with row and column size equal to n.categories to the power of
n.repetitions. For temporal structures "M" and "M2", the result is an
array.
## use marijuana-data data(marijuana) ## create matrix for profiles: W.mari <- profiles.drm(3, 5, "M") ## fit the model using W.mari: fit <- drm(y~age+cluster(id)+Time(age), data=marijuana, subset=sex=="male",pmatrix="W.mari", save.profiles=FALSE, dep=list("M",tau12~function(a=1,b=0) a+b*c(0:3), tau21~function(a=1,b=0) a+b*c(0:3)),print=0) ## a speedy way of saving the profile probabilities to the object: fit <- drm(y~age+cluster(id)+Time(age), data=marijuana, subset=sex=="male",pmatrix="W.mari", save.profiles=TRUE, dep=list("M",tau12~function(a=1,b=0) a+b*c(0:3), tau21~function(a=1,b=0) a+b*c(0:3)),print=0, start=coef(fit))