Learn R Programming

MplusAutomation (version 1.1.1)

testBParamCompoundConstraint: Test inequality-constrained hypothesis for two or more parameters based on iterations of MCMC chains

Description

Tests an inequality-constrained hypothesis (van de Schoot, Hoijtink, Hallquist, & Boelen, in press) based on draws from the posterior distribution of the model parameters, which provides information about the proportion of the distribution that is in agreement with a given hypothesis. This function is used for more complex hypotheses about three or more parameters, whereas testBParamConstraint tests a simple two-parameter hypothesis.

Usage

testBParamCompoundConstraint(bparams, test)

Value

No value is returned by this function. Instead, two summary tables are printed to the screen containing the number and proportion of draws consistent with the hypothesis.

Arguments

bparams

An object containing draws from the posterior distribution (class mplus.model or mplus.bparameters). Obtained by SAVEDATA:BPARAMETERS in Mplus and getSavedata_Bparams or readModels in MplusAutomation.

test

The R code defining the parameter test of three or more parameters. Example: "(STAITOT.ON.CG > STAITOT.ON.UCG) & (BDIM.ON.CG > BDIM.ON.UCG)".

Author

Michael Hallquist

Details

This function accepts a bparameters object containing iterations of the MCMC chains (rows) for each model parameter (columns) and prints out the number and proportion of draws that are consistent with the requested hypothesis test.

The test argument is evaluated directly as R code, with the bparams object attached so that variable names are available directly in the environment. Because the goal is to evaluate the test for each draw from the posterior distribution, remember to use vector-based logic operators, not boolean operators. That is, stick to & or | for joining tests of parameters, rather than && or || since the latter will return a single TRUE/FALSE, which is irrelevant.

An example test in R logic would be "(STAITOT.ON.CG > STAITOT.ON.UCG) & (BDIM.ON.CG > BDIM.ON.UCG)".

See Also

testBParamConstraint

Examples

Run this code
if (FALSE) {
  #using bparameters directly
  btest <- getSavedata_Bparams("model vb1_simpel_b.out")
  testBParametersCompoundConstraint(btest,
  "(STDYX_STAITOT.ON.CG > STDYX_STAITOT.ON.UCG) & (STDYX_BDIM.ON.CG > STDYX_BDIM.ON.UCG)")

  #or using readModels
  btest <- readModels("model vb1_simpel_b.out")
  testBParametersCompoundConstraint(btest,
  "(STDYX_STAITOT.ON.CG > STDYX_STAITOT.ON.UCG) & (STDYX_BDIM.ON.CG > STDYX_BDIM.ON.UCG)")
}

Run the code above in your browser using DataLab