TreeBUGS: Extended Modeling Possibilities

Daniel W. Heck, Nina R. Arnold, & Denis Arnold

2021-01-08

Extended Modeling Possibilities

A) Including Continuous Covariates

It is possible to sample and estimate correlations of continuous covariates (e.g., age) with the individual MPT parameters. Note that this does not influence the model estimates - the estimated MPT parameters are only used repeatedly to compute a correlation. In contrast, in the latent-trait MPT model, variables can also be included as predictors to account for interindividual variance in MPT parameters, which influences the parameter estimates: \[\theta_{is} = \Phi(\mu_s + \delta_i + \gamma_i X_i)\]

The following arguments are used to specify the desired covariance structure:

Overall, the code could look like this:

fitMPT <- traitMPT(
    eqnfile = "2htm.txt", 
    data = "data_ind.csv",   
    restrictions = list("Dn=Do", "g=.5"),  
    covData = "data_covariates.csv", 
    corProbit = TRUE,
    predStructure = list("Do ; IQ"), # IQ as predictor for Do=Dn
    ...)

After fitting the model, the results are summarized by summary(fitMPT).

B) Including Discrete Factors in a Latent-Trait MPT Model

In the latent-trait model, it is possible to include discrete factors as predictor variables, similar as in the general linear model formulation of an ANOVA. Compared to continuous covariates only the following changes:

Note that the same parameter covariance structure is assumed in each group. Given that this assumtion holds, it might result in more reliable parameter estimates than specifying a separate MPT tree for each condition (and thus assuming a separate parameter covariance matrix in each group). An example might be:

fitMPT <- traitMPT(eqnfile = "2htm.txt", 
    data = "data_ind.csv",   
    covData = "data_covariates.csv", 
    predStructure = list("Do ; factor1", 
                         "Dn ; factor2"), # discrete factors
    predType = c("c", "c", "f", "r")
    ...)

Estimated group estimates for each parameter can be obtained by

getGroupMeans(fitMPT)

Multiple factors can in principle be included, but currently it is not possible to include interactions. For an introduction to Bayesian ANOVA, see Rouder et al. (2012).

C) Sampling Transformed Parameters

The argument transformedParameters allows to sample parameters that result as some determinstic function of the estimated MPT parameters. This is helpful to test differences between two core MPT parameters or obtain reparameterized versions of the parameters (e.g., for testing order constraints). For instance, the difference between two MPT parameters can be computed using

transformedParameters = list("deltaG = G_1-G_2",     # difference of parameters
                             "G1_larger = G_1>G_2")  # Bayesian p-value / testing order constraints

If the parameters are different, the 95% posterior interval of the parameter deltaG should exclude zero.

Transformed parameters are also helpful if the model contains reparameterizations of order constraints. For instance, if \(a<b\) is replaced by \(a = s_a * b\) (the standard procedure in multiTree), the EQN file includes the parameters b and s_a, but the interest is in a, which can be obtained by transformedParameters = list("a = s_a * b") . However, note that the priors need to be adjusted in case of such reparameterizations (Heck & Wagenmakers, 2016).

Note the following about the correct specification of transformed parameters:

D) Generate Simulated Data Sets

Simulated data sets are in general useful to check the robustness of the estimators and the sample size requirements. TreeBUGS includes functions to generate data sets of individual frequencies for both the Beta-MPT and the latent-trait MPT model.

# beta-MPT
genBeta <- genBetaMPT(
              N = 100,                            # number of participants     
              numItems = c(Target=250, Lure=250), # number of responses per tree
              eqnfile = "2htm.eqn",               # path to MPT file
              mean = c(Do=.7, Dn=.7, g=.5),       # true group-level parameters
              sd =   c(Do=.1, Dn=.1, g=.05))      # SD of individual parameters

# latent-trait MPT
genTrait <- genTraitMPT(
              N = 100,                             # number of participants     
              numItems = c(Target=250, Lure=250),  # number of responses per tree
              eqnfile = "2htm.eqn",                # path to MPT file
              mean = c(Do=.7, Dn=.7, g=.5),        # true group-level parameters
              sigma =   c(Do=.25, Dn=.25, g=.05),  # SD of latent (!) individual parameters
              rho = diag(3))                       # correlation matrix. here: no correlation

The resulting data sets contain both the generated frequencies (genTrait$data) and the data-generating group and individual parameters (genTrait$parameters)