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

Error with objects of class stanreg #70

Closed
davidkane9 opened this issue Mar 2, 2020 · 2 comments
Closed

Error with objects of class stanreg #70

davidkane9 opened this issue Mar 2, 2020 · 2 comments

Comments

@davidkane9
Copy link

Describe the bug
report() produces an error when run on an object of class "stanreg" "glm" "lm"

To Reproduce

library(rstanarm)
#> Loading required package: Rcpp
#> rstanarm (Version 2.19.2, packaged: 2019-10-01 20:20:33 UTC)
#> - Do not expect the default priors to remain the same in future rstanarm versions.
#> Thus, R scripts should specify priors explicitly, even if they are just the defaults.
#> - For execution on a local, multicore CPU with excess RAM we recommend calling
#> options(mc.cores = parallel::detectCores())
#> - bayesplot theme set to bayesplot::theme_default()
#>    * Does _not_ affect other ggplot2 plots
#>    * See ?bayesplot_theme_set for details on theme setting
library(report)

z <- stan_glm(mpg ~ cyl, data = mtcars, refresh = 0)

report(z)
#> Error: $ operator is invalid for atomic vectors

Created on 2020-03-02 by the reprex package (v0.3.0)

Expected behaviour
Should get a report object.

Specifiations (please complete the following information):

  • report_0.1.0
  • rstanarm_2.19.2
@strengejacke
Copy link
Member

Should work now after updating parameters and performance from CRAN. Due to the "dependency chain", it might be you need to install insight from GitHub first, before installing parameters and performance (sorry for the inconvenience...).

@strengejacke
Copy link
Member

strengejacke commented Mar 4, 2020

library(report)
library(rstanarm)
z <- stan_glm(mpg ~ cyl, data = mtcars, refresh = 0)
report(z)

We fitted a Bayesian linear model (estimated using MCMC sampling with 4 chains of 2000 iterations and a warmup of 1000) to predict mpg with cyl (formula = mpg ~ cyl). Priors over parameters were set as normal (mean = 0.00, SD = 8.44) distributions. The Region of Practical Equivalence (ROPE) percentage was defined as the proportion of the posterior distribution within the [-0.60, 0.60] range. The 89% Credible Intervals (CIs) were based on Highest Density Intervals (HDI). Parameters were scaled by the mean and the SD of the response variable. Effect sizes were labelled following Funder's (2019) recommendations.The model's explanatory power is substantial (R2's median = 0.71, 89% CI [0.60, 0.82], adj. R2 = 0.68). The model's intercept, corresponding to mpg = 0 and cyl = 0, is at 37.81 (89% CI [34.51, 41.47], 0% in ROPE). Within this model:

  • The effect of cyl has a probability of 100% of being negative and can be considered as large and significant (median = -2.87, 89% CI [-3.41, -2.33], 0% in ROPE, std. median = -0.85). The algorithm successfuly converged (Rhat = 1.000) and the estimates can be considered as stable (ESS = 3478).

Created on 2020-03-04 by the reprex package (v0.3.0)

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