File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 1+ function predict (model:: SemLoss , params:: AbstractVector ,
2+ scores:: AbstractMatrix ;
3+ score_vars:: Union{AbstractVector, Nothing} = latent_var_indices (model),
4+ predict_vars:: Union{AbstractVector, Nothing} = observed_var_indices (model))
5+ ram = imply (model). ram_matrices
6+ A = materialize (ram. A, params)
7+ I_A⁻¹ = inv (I - A)
8+ sv_I_A⁻¹ = ! isnothing (score_vars) ? I_A⁻¹[:, score_vars] : I_A⁻¹
9+ res = scores * sv_I_A⁻¹'
10+ if MeanStructure (imply (model)) === HasMeanStructure
11+ M = materialize (ram. M, params)
12+ M[score_vars] .= 0 # intercepts already included in the scores
13+ res .+ = (I_A⁻¹ * M)'
14+ end
15+ if ! isnothing (predict_vars)
16+ res = res[:, predict_vars]
17+ end
18+ return res
19+ end
20+
121abstract type SemScoresPredictMethod end
222
323struct SemRegressionScores <: SemScoresPredictMethod end
You can’t perform that action at this time.
0 commit comments