Closed gregorgorjanc closed 6 months ago
The "fixed" model is a special model that takes a model matrix as input. When a formula specification is provided instead of a matrix, it automatically calls MatrixModels::model.Matrix(formula, data = .data.)
to construct the corresponding model matrix. If you want a different model matrix construction, replace formula = ~ x1 + x2
by some other R code that generates the needed matrix.
This can surely be more extensively documented somewhere; I'm not sure where the main documentation for this feature actually appears, so I'd be happy about suggestions/actual text.
@finnlindgren i think that if you add this explanation into https://inlabru-org.github.io/inlabru/articles/component.html it would be beneficial to the users (assuming they read it!).
We are following https://inlabru-org.github.io/inlabru/articles/component.html to define various model components. Each component should be something like:
The second one needs to have
~
in themain
argument, which can be confusing compared to other model components that don't need~
- it took me a while to debug this yesterday and I suspect it might trip others too. I assume this is required so that themain
is a formula for theMatrixModels::model.Matrix(main, .data.)
call. Could this be changed toas.formula(main)
instead? Aha, this won't work because we could not domain = x1 + x2
, right?Anyway, I wanted to share this struggle we encountered as beginner users.