Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Type of term: NestedTerm #268

Open
PharmCat opened this issue Nov 6, 2022 · 1 comment
Open

New Type of term: NestedTerm #268

PharmCat opened this issue Nov 6, 2022 · 1 comment

Comments

@PharmCat
Copy link

PharmCat commented Nov 6, 2022

Like it is done in popular software, I think it is important to have the ability to declare nested factors. The main difference with InteractionTerm is that not all combinations will be represented in the model, but only existed. Then it will be possible to get the real number of levels in each group. Also it will be possible to calculate the correct lsmeans.

For example, if you have models y~sequence + subject and y~sequence + subject(sequence) your lsmeans will not be correct in the first case if the factor subject and sequence is really nested.

https://www.ibm.com/docs/en/spss-statistics/29.0.0?topic=effects-build-nested-terms

https://stats.oarc.ucla.edu/sas/examples/da4/design-and-analysis-fourth-edition-by-keppel-and-wickenschapter-25-nested-factors/

https://support.minitab.com/en-us/minitab/20/help-and-how-to/statistical-modeling/anova/supporting-topics/anova-models/what-are-crossed-and-nested-factors/

@kleinschmidt
Copy link
Member

This isn't really possible without a pretty substantial overhaul of how the schema is extracted. Right now, one schema is extracted for each leaf Term; in order for this to be workable, you need more information than that can give you (i.e., the combination of levels that are present in the data).

Related to #154, we'd also need some way of distinguishing from a "normal" interaction term; if that way is additional special syntax, then we'd need to be able to convert the FunctionTerm created by whatever syntax that is into this NestedTerm before the schema is extracted (because how else would we know that we need to extract the unique combinations of the individual terms rather than the unique levels of each individual term), but currently the mechanism that converts special syntax into custom terms happens after a schema is extracted.

@PharmCat PharmCat mentioned this issue Jan 26, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants