Draw plausible values (PVs) from an mml fit
Usage
drawPVs(x, npv, pvVariableNameSuffix = "_dire", ...)
# S3 method for summary.mmlMeans
drawPVs(x, npv = 5L, pvVariableNameSuffix = "_dire", ...)
# S3 method for mmlMeans
drawPVs(
x,
npv = 5L,
pvVariableNameSuffix = "_dire",
stochasticBeta = FALSE,
normalApprox = TRUE,
newStuDat = NULL,
newStuItems = NULL,
returnPosterior = FALSE,
construct = NULL,
...
)
# S3 method for mmlCompositeMeans
drawPVs(
x,
npv = 5L,
pvVariableNameSuffix = "_dire",
stochasticBeta = FALSE,
normalApprox = TRUE,
newStuDat = NULL,
newStuItems = NULL,
verbose = TRUE,
...
)
Arguments
- x
a fit from a call to
mml
- npv
integer indicating the number of plausible values to draw
- pvVariableNameSuffix
suffix added to new PV variables after construct name and before the plausible value ID. For example, if there is a construct
math
and the suffix is the default_dire
, then the fourth plausible value would have a column name,math_dire4
.- ...
additional parameters
- stochasticBeta
logical when
TRUE
the regression coefficients will be drawn from their posterior distribution. Can also be a data frame of values (see Details).- normalApprox
logical must be
TRUE
to use the normal approximation to the posterior distribution rather than drawing from the actual posterior distribution.- newStuDat
new
stuDat
object, (seemml
) for which plausible values will be drawn- newStuItems
new
stuItems
object, (seemml
); unlike inmml
students with no items can be passed to this function- returnPosterior
logical set to
TRUE
to change output to include two additional data frames (see Value).- construct
character, changes the name of the columns in the final data frame
- verbose
logical set to
TRUE
to see the status of the processing
Value
when returnPosterior
is FALSE returns a object of class DirePV
which is a list of two elements.
first, a data frame with a row for every row of newStuDat (or the original stuDat object)
id
the value ofidVar
in the model run[construct][pvVariableNameSuffix][L]
every other column is a plausible value of this format. The[construct]
is the name of the construct, the[pvVariableNameSuffix]
is the value of thepvVariableNameSuffix
argument, and the[L]
part is the plausible value index, from 1 tonpv
.
The second argument is named newpvvars
and is a list with an element for each set of construct that lists all of the variables in that construct.
When returnPosterior
is TRUE returns list
with three elements. One is named posterior
and has one
row per idvar
level in the newStuDat
argument and three columns:
id
the value ofidVar
in the model runmu
the posterior meansd
the posterior standard deviation
the second list element is named X
that is the design matrix for newStuDat
(see Value for mml
). The third list element is
the rr1
element returned from mml
with one column for each individual in newStuDat
(see Value in mml
).