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

Extend model to allow arbitrary number of covariates #30

Open
sempwn opened this issue Oct 3, 2023 · 0 comments
Open

Extend model to allow arbitrary number of covariates #30

sempwn opened this issue Oct 3, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@sempwn
Copy link
Owner

sempwn commented Oct 3, 2023

problem statement

This will require a change in how model is currently structured. Currently when running the model,

est_naloxone(d)

the function expects that d contains the column region which provides a unique key for each factor in the model (either region or site type, or a combination of the two). Instead we want d to contain an arbitrary number of columns each representing its own covariate.

design approach

Obvious choice would be to follow in the vain of brms and other packages and use the formula approach to specify the model covariates e.g.

est_naloxone(~region + site_type, data = d)

This allows us to use the R formula machinery and in particular the model.matrix function to generate a design matrix and also allows for incorporating interaction via,

X <- model.matrix(~region + site_type + region:site_type, data = d)

The default formula can be set to ~region to ensure backwards compatibility.

@sempwn sempwn self-assigned this Jan 16, 2024
@sempwn sempwn added the enhancement New feature or request label Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant