Getting started
After successful installation you are ready to estimate person parameters. In this simple example we will estimate person parameters for a simulated data set assuming a Rasch model.
Simulating data
First, we need to aquire item parameters. In a Rasch model there is only a single item parameter, the item difficulty (b). Assuming a test with 10 items we therefore need 10 item difficulty parameters. For this example we draw these from a standard normal distribution.
difficulties = randn(10)10-element Vector{Float64}:
-1.0404288511750712
0.2146514070141379
-0.3562695662666039
-1.4314998994618426
-0.499040165316529
-0.07974473485930385
0.40123961808781694
0.793190395589391
1.1926174603489277
1.0964576513238238Next, responses need to be simulated. Assuming 20 test-takers we simply randomly generate a response matrix where each test-taker responds to each item.
responses = rand(20, 10) .> 0.520×10 BitMatrix:
1 0 0 0 1 1 1 1 0 0
1 0 1 0 0 0 0 0 1 1
1 0 0 0 1 0 0 1 0 0
0 1 0 0 0 1 0 1 1 0
1 0 0 1 1 1 0 0 0 1
1 0 1 0 1 0 0 0 1 1
0 0 0 0 1 1 1 1 1 0
1 0 1 0 0 1 1 1 1 0
1 1 0 1 0 0 0 1 0 1
1 1 0 1 0 1 1 1 1 0
1 0 1 0 1 1 0 0 1 0
1 0 0 1 0 1 0 1 1 0
0 1 0 0 1 1 1 1 0 0
0 1 1 1 0 0 1 1 0 0
1 0 0 1 0 1 1 0 1 1
1 0 0 1 1 0 0 0 0 1
1 1 1 1 1 0 1 0 1 0
1 1 1 0 0 0 0 1 0 0
1 1 1 0 1 0 0 0 1 1
1 0 1 0 0 0 1 1 1 0Estimation of person parameters
Given the item parameters difficulties and response matrix responses, we are ready to estimate person parameters. To do this only a single call to person_parameters is required. person_parameters accepts 4 arguments: the model type M, some responses, item parameters betas and an estimation algorithm alg. For this example we chose simple maximum likelihood estimation using the MLE algorithm[1].
using PersonParameters
pp = person_parameters(OnePL, responses, difficulties, MLE())20-element PersonParameterResult{OneParameterLogisticModel, PersonParameter{Float64}, MLE{Roots.Secant}}:
PersonParameter{Float64}(0.037961098910380374, 0.6828137955581843)
PersonParameter{Float64}(-0.4347765337022231, 0.6964062194255234)
PersonParameter{Float64}(-0.9459744421932545, 0.7393266417630334)
PersonParameter{Float64}(-0.43477653370222313, 0.6964062194255234)
PersonParameter{Float64}(0.037961098910380436, 0.6828137955581843)
PersonParameter{Float64}(0.0379610989103803, 0.6828137955581843)
PersonParameter{Float64}(0.037961098910380256, 0.6828137955581843)
PersonParameter{Float64}(0.5086219559336693, 0.6934083716370472)
PersonParameter{Float64}(0.03796109891038032, 0.6828137955581843)
PersonParameter{Float64}(1.0135193279697836, 0.7335819408873576)
PersonParameter{Float64}(0.037961098910380305, 0.6828137955581843)
PersonParameter{Float64}(0.03796109891038044, 0.6828137955581843)
PersonParameter{Float64}(0.037961098910380464, 0.6828137955581843)
PersonParameter{Float64}(0.03796109891038037, 0.6828137955581843)
PersonParameter{Float64}(0.5086219559336694, 0.6934083716370472)
PersonParameter{Float64}(-0.43477653370222324, 0.6964062194255234)
PersonParameter{Float64}(1.0135193279697836, 0.7335819408873576)
PersonParameter{Float64}(-0.43477653370222313, 0.6964062194255234)
PersonParameter{Float64}(0.5086219559336693, 0.6934083716370472)
PersonParameter{Float64}(0.03796109891038041, 0.6828137955581843)The resulting PersonParameterResult object contains the estimated person parameters for all 20 test-takers. The estimate of a single person can be obtained by indexing the pp object.
pp17 = pp[17]PersonParameter{Float64}(1.0135193279697836, 0.7335819408873576)The PersonParameter object consists of the estimate and standard error of estimation for a single test-taker. To access the values you can use value and se respectivelty.
value(pp17)1.0135193279697836se(pp17)0.7335819408873576How to continue from here?
For specific use cases see one of our guides:
Or you can dive straight into the API Reference.
For a full list of implemented algorithms see the API Reference. ↩︎