Note
Click here to download the full example code
Model codingΒΆ
Illustrates how to inspect coding of regression models.
look at data
ds.head()
Out:
A B
-------
a1 b1
a1 b1
a1 b0
a1 b0
a0 b1
a0 b1
a0 b0
a0 b0
create a fixed effects model
Out:
A + B + A % B
show the model coding
print(m)
Out:
intercept A B A x B
-------------------------
1 0 0 0
1 0 0 0
1 0 1 0
1 0 1 0
1 1 0 0
1 1 0 0
1 1 1 1
1 1 1 1
create random effects model
Out:
A + B + A % B + subject + A % subject + B % subject + A % B % subject
show the model coding
print(m)
Out:
intercept A B A x B subject A x subject B x subject A x B x subject
---------------------------------------------------------------------------------
1 0 0 0 1 0 0 0
1 0 0 0 0 0 0 0
1 0 1 0 1 0 1 0
1 0 1 0 0 0 0 0
1 1 0 0 1 1 0 0
1 1 0 0 0 0 0 0
1 1 1 1 1 1 1 1
1 1 1 1 0 0 0 0