forked from jansteinfeld/PP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathintro_pp.html
More file actions
375 lines (343 loc) · 26.7 KB
/
intro_pp.html
File metadata and controls
375 lines (343 loc) · 26.7 KB
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Getting started with PP • PP</title>
<!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script><!-- Bootstrap --><link href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.4.0/slate/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js" integrity="sha256-nuL8/2cJ5NDSSwnKD8VqreErSWHtnEP9E7AySL+1ev4=" crossorigin="anonymous"></script><!-- bootstrap-toc --><link rel="stylesheet" href="../bootstrap-toc.css">
<script src="../bootstrap-toc.js"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/all.min.css" integrity="sha256-mmgLkCYLUQbXn0B1SRqzHar6dCnv9oZFPEC1g1cwlkk=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.1/css/v4-shims.min.css" integrity="sha256-wZjR52fzng1pJHwx4aV2AO3yyTOXrcDW7jBpJtTwVxw=" crossorigin="anonymous">
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><!-- headroom.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom.min.js" integrity="sha256-AsUX4SJE1+yuDu5+mAVzJbuYNPHj/WroHuZ8Ir/CkE0=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.headroom.min.js" integrity="sha256-ZX/yNShbjqsohH1k95liqY9Gd8uOiE1S4vZc+9KQ1K4=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet">
<script src="../pkgdown.js"></script><link href="../extra.css" rel="stylesheet">
<meta property="og:title" content="Getting started with PP">
<meta property="og:description" content="PP">
<!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body data-spy="scroll" data-target="#toc">
<div class="container template-article">
<header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<span class="navbar-brand">
<a class="navbar-link" href="../index.html">PP</a>
<span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.6.3-11</span>
</span>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>
<a href="../index.html">
<span class="fas fa-home fa-lg"></span>
</a>
</li>
<li>
<a href="../reference/index.html">Reference</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
Articles
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<a href="../articles/intro_pfit.html">Getting started with Person-Fit in PP</a>
</li>
<li>
<a href="../articles/intro_pp.html">Getting started with PP</a>
</li>
<li>
<a href="../articles/ppass_par_and_fit.html">Analyzing a dataset</a>
</li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="https://github.com/jansteinfeld/PP/">
<span class="fab fa-github fa-lg"></span>
</a>
</li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
<!--/.container -->
</div>
<!--/.navbar -->
</header><script src="intro_pp_files/header-attrs-2.8/header-attrs.js"></script><div class="row">
<div class="col-md-9 contents">
<div class="page-header toc-ignore">
<h1 data-toc-skip>Getting started with PP</h1>
<h4 class="author">Manuel Reif</h4>
<small class="dont-index">Source: <a href="https://github.com/jansteinfeld/PP/blob/master/vignettes/intro_pp.Rmd"><code>vignettes/intro_pp.Rmd</code></a></small>
<div class="hidden name"><code>intro_pp.Rmd</code></div>
</div>
<!--
%\VignetteEngine{knitr::rmarkdown}
%\VignetteIndexEntry{Getting started with PP}
%\VignetteEncoding{UTF-8}
-->
<div id="getting-started-with-pp" class="section level1">
<h1 class="hasAnchor">
<a href="#getting-started-with-pp" class="anchor"></a>Getting started with PP</h1>
<p>Is the <code>PP</code> package the right package for you?</p>
<ol style="list-style-type: decimal">
<li>You have a data set with item responses from several persons</li>
<li>You have item parameter estimates (e.g. difficulty parameters) from these items (perhaps from a former application of these items)</li>
<li>and these items follow the 1/2/3/4-PL model or the generalized partial credit model</li>
<li>You are interested in estimating each persons <strong>ability</strong> with traditional approaches (mle, wle, map, eap) or</li>
<li>drawing <strong>plausible values</strong> for each person e.g. to apply secondary analysis or</li>
<li>getting <strong>robust</strong> ability estimates with Jackknife Methods or with weighted likelihood approaches</li>
</ol>
<p>If you agree to question 1-3 and at least to one of question 4-6, load the package an start estimating person parameters.</p>
<p>Now a simple example.</p>
<div id="pl-model" class="section level2">
<h2 class="hasAnchor">
<a href="#pl-model" class="anchor"></a>2-PL Model</h2>
<p>In this example, we want to gain ability estimates for each person in our sample. Each person answered questions in a test which has been scaled by the 2-PL model. Item parameters (difficulty and slope) are known and are supposed as fixed. What are the next steps?</p>
<ol style="list-style-type: decimal">
<li>Get the item responses and the item parameters inside the R workspace</li>
<li>Check your data and reshape them, so they can be processed by the PP functions</li>
<li>Decide which type of estimation you prefer (<code><a href="../reference/PP_4pl.html">?PP_4pl</a></code>)</li>
<li>Run the estimation</li>
</ol>
<div id="get" class="section level3">
<h3 class="hasAnchor">
<a href="#get" class="anchor"></a>Get</h3>
<p>Getting the data inside the R workspace is quite easy in this case, because we merely load the data set which already comes with the PP package. It contains 60 response sets (60 persons answered to a test of 12 items) - and we have additional information, which we do not take into account for now. We first inspect the data, and in a second step informations about item difficulty and the slope parameters are extracted from the dataset attributes.</p>
<div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://github.com/jansteinfeld/PP">PP</a></span><span class="op">)</span></code></pre></div>
<pre><code>## PP package calling ...
## Follow this project on github: https://github.com/jansteinfeld/PP.git</code></pre>
<div class="sourceCode" id="cb3"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="fu"><a href="https://rdrr.io/r/utils/data.html">data</a></span><span class="op">(</span><span class="va">fourpl_df</span><span class="op">)</span>
<span class="fu"><a href="https://rdrr.io/r/base/dim.html">dim</a></span><span class="op">(</span><span class="va">fourpl_df</span><span class="op">)</span></code></pre></div>
<pre><code>## [1] 60 14</code></pre>
<div class="sourceCode" id="cb5"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="fu"><a href="https://rdrr.io/r/utils/head.html">head</a></span><span class="op">(</span><span class="va">fourpl_df</span><span class="op">)</span></code></pre></div>
<pre><code>## id sex Item1 Item2 Item3 Item4 Item5 Item6 Item7 Item8 Item9 Item10
## 1 LVL0694 w 1 1 1 1 0 0 1 0 0 0
## 2 BBU1225 w 1 1 1 1 1 1 1 1 1 0
## 3 MJN2028 w 1 1 1 1 1 1 1 1 0 0
## 4 TSU0771 m 1 1 1 0 1 1 1 1 1 0
## 5 XDS0698 w 1 1 NA 1 1 1 1 0 0 0
## 6 BOS1292 w 0 0 0 0 0 0 0 0 0 0
## Item11 Item12
## 1 0 0
## 2 0 0
## 3 0 0
## 4 0 1
## 5 0 0
## 6 0 0</code></pre>
<div class="sourceCode" id="cb7"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="co"># extracting the information</span>
<span class="va">diff_par</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/r/base/attr.html">attr</a></span><span class="op">(</span><span class="va">fourpl_df</span>,<span class="st">"diffpar"</span><span class="op">)</span>
<span class="va">slope_par</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/r/base/attr.html">attr</a></span><span class="op">(</span><span class="va">fourpl_df</span>,<span class="st">"slopes"</span><span class="op">)</span></code></pre></div>
</div>
<div id="check-and-reshape" class="section level3">
<h3 class="hasAnchor">
<a href="#check-and-reshape" class="anchor"></a>Check and Reshape</h3>
<p>Now we explore the item response data regarding full or zero score, missing values etc. . Considering this information, we are able to decide which estimation method we will apply.</p>
<div class="sourceCode" id="cb8"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="co"># extract items and transform the data.frame to matrix</span>
<span class="va">itmat</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/r/base/matrix.html">as.matrix</a></span><span class="op">(</span><span class="va">fourpl_df</span><span class="op">[</span>,<span class="op">-</span><span class="op">(</span><span class="fl">1</span><span class="op">:</span><span class="fl">2</span><span class="op">)</span><span class="op">]</span><span class="op">)</span>
<span class="co"># are there any full scores?</span>
<span class="va">fullsc</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/r/base/apply.html">apply</a></span><span class="op">(</span><span class="va">itmat</span>,<span class="fl">1</span>,<span class="kw">function</span><span class="op">(</span><span class="va">x</span><span class="op">)</span> <span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/sum.html">sum</a></span><span class="op">(</span><span class="va">x</span>,na.rm<span class="op">=</span><span class="cn">TRUE</span><span class="op">)</span><span class="op">+</span><span class="fu"><a href="https://rdrr.io/r/base/sum.html">sum</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/NA.html">is.na</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span><span class="op">)</span><span class="op">)</span> <span class="op">==</span> <span class="fu"><a href="https://rdrr.io/r/base/length.html">length</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span><span class="op">)</span>
<span class="fu"><a href="https://rdrr.io/r/base/any.html">any</a></span><span class="op">(</span><span class="va">fullsc</span><span class="op">)</span></code></pre></div>
<pre><code>## [1] FALSE</code></pre>
<div class="sourceCode" id="cb10"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="co"># are there 0 scores?</span>
<span class="va">nullsc</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/r/base/apply.html">apply</a></span><span class="op">(</span><span class="va">itmat</span>,<span class="fl">1</span>,<span class="kw">function</span><span class="op">(</span><span class="va">x</span><span class="op">)</span> <span class="fu"><a href="https://rdrr.io/r/base/sum.html">sum</a></span><span class="op">(</span><span class="va">x</span>,na.rm<span class="op">=</span><span class="cn">TRUE</span><span class="op">)</span> <span class="op">==</span> <span class="fl">0</span><span class="op">)</span>
<span class="fu"><a href="https://rdrr.io/r/base/any.html">any</a></span><span class="op">(</span><span class="va">nullsc</span><span class="op">)</span></code></pre></div>
<pre><code>## [1] TRUE</code></pre>
<div class="sourceCode" id="cb12"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="co"># are there missing values? how many and where?</span>
<span class="va">nasc</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/r/base/apply.html">apply</a></span><span class="op">(</span><span class="va">itmat</span>,<span class="fl">1</span>,<span class="kw">function</span><span class="op">(</span><span class="va">x</span><span class="op">)</span> <span class="fu"><a href="https://rdrr.io/r/base/sum.html">sum</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/NA.html">is.na</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span><span class="op">)</span><span class="op">)</span>
<span class="fu"><a href="https://rdrr.io/r/base/any.html">any</a></span><span class="op">(</span><span class="va">nasc</span> <span class="op">></span> <span class="fl">0</span><span class="op">)</span></code></pre></div>
<pre><code>## [1] TRUE</code></pre>
<div class="sourceCode" id="cb14"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="co">#which(nasc)</span>
<span class="co"># is our data dichotomous as expected?</span>
<span class="fu"><a href="https://rdrr.io/r/base/apply.html">apply</a></span><span class="op">(</span><span class="va">itmat</span>,<span class="fl">2</span>,<span class="kw">function</span><span class="op">(</span><span class="va">x</span><span class="op">)</span> <span class="fu"><a href="https://rdrr.io/r/base/table.html">table</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span><span class="op">)</span></code></pre></div>
<pre><code>## Item1 Item2 Item3 Item4 Item5 Item6 Item7 Item8 Item9 Item10 Item11 Item12
## 0 9 17 13 16 21 23 24 28 44 53 53 53
## 1 51 43 46 44 38 37 35 32 16 7 7 7</code></pre>
<div class="sourceCode" id="cb16"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="co"># are there any duplicates?</span>
<span class="va">rdup</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/r/base/duplicated.html">duplicated</a></span><span class="op">(</span><span class="va">itmat</span><span class="op">)</span>
<span class="fu"><a href="https://rdrr.io/r/base/sum.html">sum</a></span><span class="op">(</span><span class="va">rdup</span><span class="op">)</span></code></pre></div>
<pre><code>## [1] 8</code></pre>
</div>
<div id="decide-and-run" class="section level3">
<h3 class="hasAnchor">
<a href="#decide-and-run" class="anchor"></a>Decide and Run</h3>
<p>We use the <code><a href="../reference/PP_4pl.html">PP_4pl()</a></code> function for our estimation. So perhaps you are thinking:“Why are we using a function to fit the 4-PL model, when we acutally have a dataset which stems from a 2-PL model scaled test?!” This is because with the <code><a href="../reference/PP_4pl.html">PP_4pl()</a></code> function you can fit the:</p>
<ol style="list-style-type: decimal">
<li>
<strong>1-PL model</strong> (Rasch model) by submitting: the data matrix, item difficulties and <strong>nothing else</strong>, since the 1-PL model is merely a 4-PL model with: any slope = 1, any lower asymptote = 0 and any upper asymptote = 1!</li>
<li>
<strong>2-PL model</strong> by submitting: the data matrix, item difficulties and slope parameters. Lower and upper asymptotes are automatically set to 0 und 1 respectively.</li>
<li>
<strong>3-PL model</strong> by submitting anything except the upper asymptote parameters</li>
<li>
<strong>4-PL model</strong> <span class="math inline">\(\rightarrow\)</span> submit all parameters …</li>
</ol>
<p>In this case, difficulty parameters and slopes are available, so we will submit them, and a 2-PL model is fitted <strong>automatically</strong>.</p>
<p>We decide to apply a common maximum likelihood estimation (<code>type = "mle"</code>), and do not remove duplicated response patterns (see argument: <code>ctrl=list()</code>) from estimation because there are only 8 duplicated patterns. If the data set would have been much larger, duplicated patterns are more likely and therefore choosing to remove these patterns would speed up the estimation process significantly. (Choosing this option or not, does not change the numerical results!)</p>
<div class="sourceCode" id="cb18"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://github.com/jansteinfeld/PP">PP</a></span><span class="op">)</span>
<span class="va">res1plmle</span> <span class="op"><-</span> <span class="fu"><a href="../reference/PP_4pl.html">PP_4pl</a></span><span class="op">(</span>respm <span class="op">=</span> <span class="va">itmat</span>, thres <span class="op">=</span> <span class="va">diff_par</span>, slopes <span class="op">=</span> <span class="va">slope_par</span>, type <span class="op">=</span> <span class="st">"mle"</span><span class="op">)</span></code></pre></div>
<pre><code>## Estimating: 2pl model ...
## type = mle
## Estimation finished!</code></pre>
<div class="sourceCode" id="cb20"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="fu"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op">(</span><span class="va">res1plmle</span><span class="op">)</span></code></pre></div>
<pre><code>## PP Version: 0.6.3.11
##
## Call: PP_4pl(respm = itmat, thres = diff_par, slopes = slope_par, type = "mle")
## - job started @ Mon May 24 13:28:11 2021
##
## Estimation type: mle
##
## Number of iterations: 5
## -------------------------------------
## estimate SE
## [1,] -0.8555 0.7270
## [2,] 1.9097 0.9416
## [3,] 1.1454 0.9211
## [4,] 1.7883 0.9410
## [5,] 0.4274 0.8792
## [6,] -Inf NA
## [7,] 2.8310 0.9618
## [8,] 1.7414 0.9406
## [9,] -2.4328 0.8520
## [10,] -0.2126 0.7750
## [11,] 1.1454 0.9211
## [12,] 4.0258 1.1822
## [13,] -1.6514 0.7451
## [14,] -3.6859 1.2125
## [15,] 1.0795 0.9168
## --------> output truncated <--------</code></pre>
<p>Some facts:</p>
<ol style="list-style-type: decimal">
<li>The function returns the <strong>point estimators</strong> and <strong>standard errors</strong> for each person. Whatever the (valid) input was, the main result is always a matrix with two columns and a number of rows which equals the number of persons (<code>res1plmle$resPP$resPP</code>).</li>
<li>The function deals with <strong>missing values</strong>. These are treated as if the person has never seen this item.</li>
<li>The order of the output estimates = order of the input. So the first estimate belongs to the first response pattern of the input data matrix.</li>
</ol>
</div>
<div id="edit" class="section level3">
<h3 class="hasAnchor">
<a href="#edit" class="anchor"></a>Edit</h3>
<p>In the last step, we add the estimates to the data.frame we extracted the item responses from in the first place.</p>
<div class="sourceCode" id="cb22"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">dafest</span> <span class="op"><-</span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op">(</span><span class="va">fourpl_df</span>, <span class="va">res1plmle</span><span class="op">$</span><span class="va">resPP</span><span class="op">$</span><span class="va">resPP</span><span class="op">)</span>
<span class="fu"><a href="https://rdrr.io/r/utils/head.html">head</a></span><span class="op">(</span><span class="va">dafest</span>,<span class="fl">10</span><span class="op">)</span></code></pre></div>
<pre><code>## id sex Item1 Item2 Item3 Item4 Item5 Item6 Item7 Item8 Item9 Item10
## 1 LVL0694 w 1 1 1 1 0 0 1 0 0 0
## 2 BBU1225 w 1 1 1 1 1 1 1 1 1 0
## 3 MJN2028 w 1 1 1 1 1 1 1 1 0 0
## 4 TSU0771 m 1 1 1 0 1 1 1 1 1 0
## 5 XDS0698 w 1 1 NA 1 1 1 1 0 0 0
## 6 BOS1292 w 0 0 0 0 0 0 0 0 0 0
## 7 KFF1422 w 1 1 1 1 1 1 1 1 1 0
## 8 DCQ0198 w 1 1 1 1 0 1 1 1 1 0
## 9 FTT1492 w 0 0 1 1 0 0 0 0 0 0
## 10 GCP0645 m 1 1 1 1 1 0 0 1 0 0
## Item11 Item12 estimate SE
## 1 0 0 -0.8554973 0.7270360
## 2 0 0 1.9096810 0.9415755
## 3 0 0 1.1453588 0.9210920
## 4 0 1 1.7882890 0.9409769
## 5 0 0 0.4274013 0.8792348
## 6 0 0 -Inf NA
## 7 0 1 2.8310343 0.9618330
## 8 1 0 1.7413789 0.9405966
## 9 0 0 -2.4327540 0.8520338
## 10 0 0 -0.2125844 0.7749617</code></pre>
<p>One shortcoming of the plain maximum likelihood estimate is the fact, that the <strong>extreme scores</strong> do not lead to valid parameter estimates (<code>-Inf</code> and <code>Inf</code> are hardly useful for practitioners). One possibility to overcome this issue, is to change the estimation method - for instance <code>type = wle</code> performs weighted likelihood estimation, which is on the one hand less biased than the mle estimate, and on the other hand provides reasonable estimates for the extreme scores.</p>
</div>
<div id="rerun" class="section level3">
<h3 class="hasAnchor">
<a href="#rerun" class="anchor"></a>Rerun</h3>
<div class="sourceCode" id="cb24"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="kw"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op">(</span><span class="va"><a href="https://github.com/jansteinfeld/PP">PP</a></span><span class="op">)</span>
<span class="va">res1plwle</span> <span class="op"><-</span> <span class="fu"><a href="../reference/PP_4pl.html">PP_4pl</a></span><span class="op">(</span>respm <span class="op">=</span> <span class="va">itmat</span>,thres <span class="op">=</span> <span class="va">diff_par</span>, slopes <span class="op">=</span> <span class="va">slope_par</span>, type <span class="op">=</span> <span class="st">"wle"</span><span class="op">)</span></code></pre></div>
<pre><code>## Estimating: 2pl model ...
## type = wle
## Estimation finished!</code></pre>
<div class="sourceCode" id="cb26"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="fu"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op">(</span><span class="va">res1plwle</span><span class="op">)</span></code></pre></div>
<pre><code>## PP Version: 0.6.3.11
##
## Call: PP_4pl(respm = itmat, thres = diff_par, slopes = slope_par, type = "wle")
## - job started @ Mon May 24 13:28:11 2021
##
## Estimation type: wle
##
## Number of iterations: 5
## -------------------------------------
## estimate SE
## [1,] -0.8788 0.7263
## [2,] 1.9065 0.9416
## [3,] 1.0816 0.9169
## [4,] 1.7814 0.9409
## [5,] 0.3270 0.8679
## [6,] -4.6556 1.7254
## [7,] 2.7746 0.9583
## [8,] 1.7322 0.9405
## [9,] -2.2872 0.8257
## [10,] -0.2907 0.7668
## [11,] 1.0816 0.9169
## [12,] 3.7316 1.0975
## [13,] -1.5967 0.7408
## [14,] -3.2952 1.0712
## [15,] 1.0089 0.9116
## --------> output truncated <--------</code></pre>
<p>So, this was what we were finally looking for.</p>
</div>
</div>
<div id="parameters-and-person-fit" class="section level2">
<h2 class="hasAnchor">
<a href="#parameters-and-person-fit" class="anchor"></a>Parameters and Person Fit</h2>
<p>For estimating person parameters and examining person fit in one step, use <code><a href="../reference/PPass.html">PPass()</a></code> (for ass stands for <em>assessment</em>). Using this function has several advantages over the using the other methods consecutively.</p>
<ol style="list-style-type: decimal">
<li>you ony need 1 Function</li>
<li>the data input format now is a <code>data.frame</code>
</li>
<li>the data output format is a new <code>data.frame</code> with person fit statistics added</li>
</ol>
<div class="sourceCode" id="cb28"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">pres</span> <span class="op"><-</span> <span class="fu"><a href="../reference/PPass.html">PPass</a></span><span class="op">(</span><span class="va">fourpl_df</span>, items <span class="op">=</span> <span class="fl">3</span><span class="op">:</span><span class="fl">14</span>, mod<span class="op">=</span><span class="st">"2PL"</span>, thres <span class="op">=</span> <span class="va">diff_par</span>, slopes <span class="op">=</span> <span class="va">slope_par</span>, type <span class="op">=</span> <span class="st">"wle"</span><span class="op">)</span></code></pre></div>
<pre><code>## Estimating: 2pl model ...
## type = wle
## Estimation finished!</code></pre>
</div>
</div>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="pkgdown-sidebar">
<nav id="toc" data-toggle="toc"><h2 data-toc-skip>Contents</h2>
</nav>
</div>
</div>
<footer><div class="copyright">
<p>Developed by Jan Steinfeld, Manuel Reif.</p>
</div>
<div class="pkgdown">
<p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.6.1.</p>
</div>
</footer>
</div>
</body>
</html>