Learn R Programming

dexter (version 0.8.5)

plausible_values: Draw plausible values

Description

Draws plausible values based on test scores

Usage

plausible_values(dataSrc, parms = NULL, predicate = NULL,
  covariates = NULL, nPV = 1, use_draw = NULL)

Arguments

dataSrc

Data source: a dexter project db handle or a data.frame with columns: person_id, item_id, item_score

parms

An object returned by function fit_enorm and containing parameter estimates. If parms is given the function provides plausible values conditional on the item parameters; i.e., these are considered known and might be based on a different data set. If parms = NULL, the user is given plausible values marginalized over the posterior distribution of the item parameters. In plain words, this means that the uncertainty of the item parameters is taken into account.

predicate

an expression to filter data. If missing, the function will use all data in dataSrc

covariates

name or a vector of names of the variables to group the populations used to improve the prior. A covariate must be a discrete person covariate (e.g. not a float) that indicates nominal categories, e.g. gender or school If dataSrc is a data.frame, it must contain the covariate.

nPV

Number of plausible values to draw per person.

use_draw

When the ENORM was fitted with a Gibbs sampler (this is recognised automatically), the number of the random draw (iteration) to use in generating the PV. If NULL, all draws will be averaged; that is, the posterior means are used for the item parameters. If outside range, the last iteration will be used.

Value

A data.frame with columns booklet_id, person_id, sumScore and nPV plausible values named PV1...PVn.

References

Marsman, M., Maris, G., Bechger, T. M., and Glas, C.A.C. (2016) What can we learn from plausible values? Psychometrika. 2016; 81: 274-289. See also the vignette.

Examples

Run this code
# NOT RUN {
db = start_new_project(verbAggrRules, ":memory:", 
   covariates=list(gender="<unknown>"))
add_booklet(db, verbAggrData, "agg")
add_item_properties(db, verbAggrProperties)

f=fit_enorm(db)
pv_M=plausible_values(db,f,(mode=="Do")&(gender=="Male"))
pv_F=plausible_values(db,f,(mode=="Do")&(gender=="Female"))

par(mfrow=c(1,2))

plot(ecdf(pv_M$PV1), 
   main="Do: males versus females", xlab="Ability", col="red")
lines(ecdf(pv_F$PV1), col="green")
legend(-2.2,0.9, c("female", "male") , 
   lty=1, col=c('green', 'red'), bty='n', cex=.75)

pv_M=plausible_values(db,f,(mode=="Want")&(gender=="Male"))
pv_F=plausible_values(db,f,(mode=="Want")&(gender=="Female"))

plot(ecdf(pv_M$PV1), 
   main="Want: males versus females", xlab=" Ability", col="red")
lines(ecdf(pv_F$PV1),col="green")
legend(-2.2,0.9, c("female", "male") , 
   lty=1, col=c('green', 'red'), bty='n', cex=.75)
   
close_project(db)    

# }

Run the code above in your browser using DataLab