Error in code example: “Bayesian Hierarchical Weighting Adjustment and Survey Inference.”

@jonah wondering if you can help me with the example code in Si et al. 2020.

The fit statement in the example you provide on p. 206 gives me the following error:
Error: ‘mrp_structured’ is not an exported object from ‘namespace:rstanarm’

Do you have any insights into this error? My modified code is as follows:

  formula = 
    Y ~ 1 + (1 | HHsize) + (1 | Income) + 
    (1 | HHsize:Income) , 
  data = dat_rstanarm, iter = 1000, chains = 4, cores = 4, 
  prior_covariance = 
    rstanarm::mrp_structured(
      cell_size = dat_rstanarm$n, 
      cell_sd = dat_rstanarm$sd_cell, 
      group_level_scale = 1, 
      group_level_df = 1),
  seed = 123, 
  prior_aux = cauchy(0, 5), 
  prior_intercept = normal(0, 100, autoscale = FALSE), 
  adapt_delta = 0.99)

Thanks so much for your help!

1 Like

Just found this related thread from the forum. There seems quite a bit of interest in getting this issue resolved as the application looks very useful.
Thanks so much for all your help.

Has anybody had a chance to look into why the mrp_structured error occurs? Thanks so much for your help.

Hi @toschwo, the reason the error occurs is because the machinery to perform this analysis is not in the main version of rstanarm but rather is on an old branch. The related thread you linked above contains everything that I think is currently known about how to (attempt to) install and run that branch. Depending on your setup, it appears that successfully running the code might be difficult.

Thanks @jsocolar. Is the development team considering bringing this capability into the main version of rstanarm? There seems to be considerable interest among survey researchers.

To my knowledge there are no plans to do so. Perhaps @jonah knows otherwise.

I’m also pinging @Yajuan_Si herself as the example involves her code, and @bgoodri, who’ll know what’s up with plans for rstanarm.

1 Like

Thanks for the interest in my paper, and thank Bob for letting me know. This was implemented in an old brunch of Rstanarm and not included in the released versions. I will work on the release plan with Ben and Jonah.

Excellent and much appreciated @Yajuan_Si.
Could someone please let me and others on the forum know once you have a plan for implementation? Thank you so very much.