Description Usage Arguments Value Author(s) References See Also Examples
This function draws npv
plausible values for each person from their posterior density.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | PV(estobj, ...)
## S3 method for class 'fourpl'
PV(estobj, npv = 10, approx = TRUE, thinning = 6, burnin = 10, mult = 2, ...)
## S3 method for class 'gpcm'
PV(estobj, npv = 10, approx = TRUE, thinning = 6, burnin = 10, mult = 2, ...)
## S3 method for class 'gpcm4pl'
PV(estobj, npv = 10, approx = TRUE, thinning = 6, burnin = 10, mult = 2, ...)
## S3 method for class 'pv'
print(x, ...)
## S3 method for class 'pv'
summary(object, nrowmax = 15, ...)
|
estobj |
An object which originates from using |
... |
More arguments |
npv |
The number of (effectively returned) plausible values - default is 10. |
approx |
Whether a normal approximation |
thinning |
A numeric vector of length = 1. If approx = FALSE, a Metropolitan-Hastings-Algorithm draws the plausible values. To avoid autocorrelation, thinning takes every kth value as effective plausible value. The default is 6 (every 6th value is taken), which works appropriately in almost all cases here (with default settings). |
burnin |
How many draws should be discarded at the chains beginning? Default is 10 - and this seems reasonable high (probably 5 will be enough as well), because starting point is the EAP. |
mult |
Multiplication constant (default = 2). Use this parameter to vary the width of the proposal distribution - which is |
x |
An object of class |
object |
An object of class |
nrowmax |
When printing the matrix of estimates - how many rows should be shown? Default = 15. |
The function returns a list which main element is pvdraws
. This is a matrix of size number_of_persons x npv - so if 10 plausible values are requested for 100 persons, a 100x10 matrix is returned.
Manuel Reif
Mislevy, R. J. (1991). Randomization-based inference about latent variables from complex samples. Psychometrika, 56(2), 177-196.
Von Davier, M., Gonzalez, E., & Mislevy, R. (2009). What are plausible values and why are they useful. IERI monograph series, 2, 9-36.
Kruschke, J. (2010). Doing Bayesian data analysis: A tutorial introduction with R. Academic Press.
PP_gpcm, PP_4pl, JKpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | ################# Plausible values #############################################################
### 4 PL model ######
### data creation ##########
set.seed(1522)
# intercepts
diffpar <- seq(-3,3,length=12)
# slope parameters
sl <- round(runif(12,0.5,1.5),2)
la <- round(runif(12,0,0.25),2)
ua <- round(runif(12,0.8,1),2)
# response matrix
awm <- matrix(sample(0:1,10*12,replace=TRUE),ncol=12)
# EAP estimation - 2pl model
res2pleap <- PP_4pl(respm = awm,thres = diffpar, slopes = sl,type = "eap")
# draw 10 plausible values
res_pv <- PV(res2pleap)
summary(res_pv)
# draw 10 plausible values - use a metropolitan hastings algorithm
res_pv2 <- PV(res2pleap,approx = FALSE)
summary(res_pv2)
# ------ check the PVs
# -- autocorrelation?
autocor <- function(acv)
{
cor(acv[-1],acv[-length(acv)])
}
res_pvac <- PV(res2pleap,approx = FALSE,npv = 200)
# independent draws - so there cannot be any systematic autocorrelation when
# approx = TRUE. So this acts as a kind of benchmark for the MH-Alg.
res_pvac2 <- PV(res2pleap,approx = TRUE,npv = 200)
apply(res_pvac$pvdraws,1,autocor)
apply(res_pvac2$pvdraws,1,autocor)
# -- autocorrelation distr?
apply(res_pvac$pvdraws,1,quantile)
apply(res_pvac2$pvdraws,1, quantile)
### GPCM model ######
# some threshold parameters
THRES <- matrix(c(-2,-1.23,1.11,3.48,1
,2,-1,-0.2,0.5,1.3,-0.8,1.5),nrow=2)
# slopes
sl <- c(0.5,1,1.5,1.1,1,0.98)
awmatrix <- matrix(c(1,0,2,0,1,1,1,0,0,1
,2,0,0,0,0,0,0,0,0,1,1,2,2,1,1,1,1,0,0,1),byrow=TRUE,nrow=5)
# EAP estimation
resgpcmeap <- PP_gpcm(respm = awmatrix,thres = THRES, slopes = sl,type = "eap")
res_gpcmpv <- PV(resgpcmeap,approx = FALSE,npv = 20)
### GPCM and 4PL model ######
# some threshold parameters
THRES <- matrix(c(-2,-1.23,1.11,3.48,1
,2,-1,-0.2,0.5,1.3,-0.8,1.5),nrow=2)
# slopes
sl <- c(0.5,1,1.5,1.1,1,0.98)
THRESx <- THRES
THRESx[2,1:3] <- NA
# for the 4PL item the estimated parameters are submitted,
# for the GPCM items the lower asymptote = 0
# and the upper asymptote = 1.
la <- c(0.02,0.1,0,0,0,0)
ua <- c(0.97,0.91,1,1,1,1)
awmatrix <- matrix(c(1,0,1,0,1,1,1,0,0,1
,2,0,0,0,0,0,0,0,0,1
,1,2,2,1,1,1,1,0,0,1),byrow=TRUE,nrow=5)
model2est <- findmodel(THRESx)
# EAP estimation
respcmeap1 <- PPall(respm = awmatrix,thres = THRESx,
slopes = sl,lowerA = la, upperA=ua, type = "eap",
model2est=model2est)
res_mixedpv_1 <- PV(respcmeap1,approx = FALSE,npv = 200)
# rowMeans of plausible values should approximate the EAPs
rowMeans(res_mixedpv_1$pvdraws)
# EAPs
respcmeap1
# show the quantiles of the empirical distribution
apply(res_mixedpv_1$pvdraws,1,quantile)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.