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

Handle covariance matrix with vector input #58

Open
StaffanBetner opened this issue Sep 12, 2023 · 2 comments
Open

Handle covariance matrix with vector input #58

StaffanBetner opened this issue Sep 12, 2023 · 2 comments

Comments

@StaffanBetner
Copy link

Functionality like this would be useful to have available:

lm(formula = mpg ~ cyl + wt, data = mtcars) |> coef() -> coefficients
lm(formula = mpg ~ cyl + wt, data = mtcars) |> vcov() -> covar_mat

set_errors(coefficients, value = covar_mat) -> coefficients_covar

It is a bit cumbersome to set the covariances one by one.

@Enchufa2
Copy link
Member

What do you mean "one by one"?

@Enchufa2
Copy link
Member

Enchufa2 commented Sep 12, 2023

Maybe something like

covar(x) <- vcov(fit)
set_covar(x, value=vcov(fit))

could be handled as special cases when the provided argument is detected as a valid covariance matrix?

The thing is that the output of this should be a list, which may be confusing for set_covar, but it's not acceptable for covar<- I think, because it's effectively changing the object. See this discussion about wrapping linear models.

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