LatentStage: Discrete heterogeneity model with multiple stages

Description Usage Arguments Value Examples

Description

The discrete heterogeneity model is primarily applicable to the scenario in which each subject is assigned a latent class, and fixed parameters are applied across those subjects in the same class. This particular function allows for more than one response, thus appropriate for constructing a model with multiple stages. Although each response is typically nested within one another, this property is not required, in order to fit the model.

Usage

1
LatentStage(nclass, ...)

Arguments

nclass

Number of classes for all subjects, determining how many groups of different parameters will be obtained

...
  • X1, X2, X3... - Matrix of covariates for 1st, 2nd, 3rd stage, respectively.

  • y1, y2, y3... - Vector of responses for 1st, 2nd, 3rd stage, respectively.

  • id1, id2, id3... - Vector of subject IDs for 1st, 2nd, 3rd stage, respectively. The dimensions of these arguments must be the same, i.e. row(X1) = length(y1) = length(id1), as they determine the number of stages in the model.

Value

A list object containing both arguments and results:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
data(threestage)
attach(threestage)
mod <- LatentStage(5, X1=stage1[, 4:7],
       y1=stage1$Y1, id1=stage1$Person,
       X2=stage2[, 4:7],
       y2=stage2$Y2, id2=stage2$Person,
       X3=stage3[, 4:7],
       y3=stage3$Y3, id3=stage3$Person)

data(dating)
attach(dating)
nonmiss <- !is.na(wrote)
mod <- LatentStage(3, y1 = browsed, y2 = wrote[nonmiss],
                   id1 = respid, id2 = respid[nonmiss],
                   X1 = agedif, X2 = agedif[nonmiss])

hollicam/DiscreteChoiceModels documentation built on May 3, 2019, 8:59 p.m.