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

stan_lm doesn't work #583

Open
acastroaraujo opened this issue Jan 16, 2023 · 2 comments
Open

stan_lm doesn't work #583

acastroaraujo opened this issue Jan 16, 2023 · 2 comments

Comments

@acastroaraujo
Copy link

Summary:

The stan_lm() function doesn't work for me.

library(rstanarm)
options(mc.cores = parallel::detectCores())

stan_lm(mpg ~ wt, data = mtcars)
# Error in stopifnot(is.numeric(location)) : 'location' must be specified

More info:

  • R version 4.2.1 (2022-06-23)
  • rstan (Version 2.21.7)
packageVersion("rstanarm")
# [1] ‘2.21.3’
@jttoivon
Copy link

Hi,

The help page of stan_lm() says the following:

prior | Must be a call to R2 with its location argument specified or NULL, which would indicate a standard uniform prior for the R^2.

The following two examples seem to work:

stan_lm(mpg ~ wt, data = mtcars, prior=NULL)
stan_lm(mpg ~ wt, data = mtcars, prior=R2(0.75, what = "median"))

Jarkko

@acastroaraujo
Copy link
Author

Thanks!

I do think that this is a bad default, though. I think the only people out there using stan_lm() are early students (outside statistics departments) trying to transition from lm(). Having to specify a prior on R^2 seems too confusing at that level.

Best,
Andrés

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