testBParamCompoundConstraint: Test inequality-constrained hypothesis for two or more...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/utilityFunctions.R

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.

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)".

Usage

1

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)".

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.

Author(s)

Michael Hallquist

See Also

testBParamConstraint

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
#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)")


## End(Not run)

MplusAutomation documentation built on May 2, 2019, 5:55 p.m.