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

Automatically detect simple linear predictors #124

Open
finnlindgren opened this issue Nov 16, 2021 · 2 comments
Open

Automatically detect simple linear predictors #124

finnlindgren opened this issue Nov 16, 2021 · 2 comments
Assignees

Comments

@finnlindgren
Copy link
Collaborator

When specifying a formula explicitly (i.e. with components separately defined), the only way to tell inlabru it's a linear predictor is currently to use response ~ ., and to use include/exclude to specify which components to include or exclude, either in multilikelihood models with like() or in generate()/predict() calls, to avoid attempts to evaluate undefined components.
Would be useful to add a method that parses the formula and detects simple nameA + nameB predictors, and also other more complex linear predictors, such as nameA - nameB and nameA + nameB.latent ( with allow_latent=TRUE and/or allow_combine=TRUE). More complex expressions like nameA + Amatrix %*% nameB.latent may also be possible to detect.
The verbose output should also state the result (and ideally the reasoning) of this detection.

@finnlindgren
Copy link
Collaborator Author

In addition, a linear = TRUE/FALSE option should be added, to help in more general cases like sum(Amatrix %*% nameA.latent), and also to aid debugging.

@finnlindgren
Copy link
Collaborator Author

Potentially useful: http://adv-r.had.co.nz/Expressions.html#ast-funs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant