Skip to content
This repository has been archived by the owner on Jun 27, 2024. It is now read-only.

How do we extract the contrast/hypothesis matrix for a predictor from a fitted model? #19

Answered by palday
yjunechoe asked this question in Q&A
Discussion options

You must be logged in to vote

Let's take a look at a simple model. For now, I won't specify contrasts explicitly, so they should be dummy coding.

julia> fm1 = fit(MixedModel, @formula(rt_trunc ~ 1 + spkr*prec*load + (1|subj) + (1|item)), MixedModels.dataset(:kb07));

I can extract the formula associated with a fitted model via the formula function. This formula differs slightly from the formula you put into the model because it now carries detailed information about contrasts for categorical values and various other meta data related to applying the data schema to the formula.

julia> f = formula(fm1)
FormulaTerm
Response:
  rt_trunc(continuous)
Predictors:
  1
  spkr(DummyCoding:21)
  prec(DummyCoding:21)
  load(Dumm…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by yjunechoe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants