Open p-gw opened 1 year ago
For the construction of the item predictor matrix Q
we need to pass the matrix to the appropriate models.
On the user side it might be more convenient to allow constructions from Tables.jl compatible sources as well. This could easily be done via StatsModels.jl
using DataFrames
using StatsModels
df = DataFrame(item = 1:5, a=[1,1,1,0,0], b=[0,0,1,1,1])
f = @formula(0 ~ a + b)
f = apply_schema(f, schema(f, df))
Q = modelmatrix(f, df)
5×2 Matrix{Int64}:
1 0
1 0
1 1
0 1
0 1
I thought of something like this:
using DataStructures: OrderedDict
Q_input = OrderedDict(
"a" => [1, 2, 3],
"b" => [3, 4, 5]
)
handle_q = function(Q_input::OrderedDict, I::Int)
C = length(Q_input)
Q_matrix = zeros(Int, I, C)
Q_values = values(Q_input)
for (i, v) in enumerate(Q_values)
Q_matrix[v, i] .+= 1
end
return Q_matrix
end
handle_q(Q_input, 5)
5×2 Matrix{Int64}:
1 0
1 0
1 1
0 1
0 1
Maybe we can allow for numerous ways for convenient Q-matrix inputs.
This issue splits #5.
Separately implement linear variants of simple Rasch models:
TODO