Open PharmCat opened 1 year ago
Base: 88.75% // Head: 89.38% // Increases project coverage by +0.63%
:tada:
Coverage data is based on head (
ff47219
) compared to base (b728917
). Patch coverage: 97.53% of modified lines in pull request are covered.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
add test for coverage, reference dataset 1 from Schütz, Helmut & Labes, Detlew & Fuglsang, Anders. (2014). Reference Datasets for 2-Treatment, 2-Sequence, 2-Period Bioequivalence Studies. The AAPS journal. 16. 1292-1297. 10.1208/s12248-014-9661-0.
Maybe lcontrast
function can be simplified with using StatsModels.hypothesis_matrix
, but anyway it is not working with InteractionTerm
.
Hi! Maybe if this PR not appropriate to GLM - make it as additional package?
I have not followed the whole discussion, but I think we should not create a separate package. Rather it would be better to think of the best package to place it into.
This is draft PR.
This test can be used by users who want ANOVA and can't use F-test for some data (as in my case with crossover designs).
Tests of Between-Subjects Effects included in this PR as it described in SPSS:
F =β' L' (L V L')⁻¹ β L / rank(L)
where V - variance-covariance matrix of β
L-matrix description from SPSS docs (SPSS and SAS docs avialible in public access):
For the inverse of (L V L) used
pinv
because some ofV
matrices are ill-conditioned.Because
V
is Symmetric - I try to calculate it in place and more efficiently.After calculation F for each effect p values are calculated too.
where df - is rank(L)
For
Intercept
factor I think the general mean should be used, but because I can't get the number of efficient levels for InteractionTerm from StatsModel - it is not realized.Also for
InteractionTerm
it may be some issues for zero-intercept models because I don't know how to get completed contrast matrix for this.PrettyTables is used for printing because this is draft PR, it can be removed by custom output.
model used for check:
result:
SPSS result:
data used for check:
PS nested factors are not implemented because they are not implemented in StatsModels. I think SS and MS can be calculated too. The main problem - is a stable method to get real numbers of levels for
InteractionTerm
.