BRM model compiling but returning model object

吃可爱长大的小学妹 提交于 2020-08-25 04:24:30

问题


I am building a hierarchical model using the BRMS package in R, and having trouble fitting a model successfully. When running the code it outputs "Compiling Stan program...", runs for about five minutes, and then stops. There are no other messages or errors, but there is no model object.

Some reproducible code from an example online, though I imagine this is not code related since the same issue occurs in my model and this one downloaded from a tutorial. When running the following code the only console output is:

Compiling Stan program...
> 
> summary(interceptonlymodeltest)
Error in summary(interceptonlymodeltest) : 
  object 'interceptonlymodeltest' not found


# Reproducible code
library(brms) # for the analysis
        library(haven) # to load the SPSS .sav file
        library(tidyverse) # needed for data manipulation.
        library(RColorBrewer) # needed for some extra colours in one of the graphs
        library(ggmcmc)
        library(ggthemes)
        library(ggridges)
        
        popular2data <- read_sav(file = "https://github.com/MultiLevelAnalysis/Datasets-third-edition-Multilevel-book/blob/master/chapter%202/popularity/SPSS/popular2.sav?raw=true")
        
        interceptonlymodeltest <- brm(popular ~ 1 + (1 | class), 
                                      data   = popular2data, 
                                      warmup = 100, 
                                      iter   = 200, 
                                      chains = 2, 
                                      inits  = "random",
                                      cores  = 2)  #the cores function tells STAN to make use of 2 CPU cores simultaneously instead of just 1.
        
        summary(interceptonlymodeltest)

I uninstalled and reinstalled r and rtools, as well as brms and all of its dependencies. Running find_rtools() from the devtools package returns TRUE, so as far as I can tell everything with the installation of the packages is squared away.

Any and all help is appreciated!


回答1:


After more digging, it turns out this is a bug introduced in the latest release of rstan (v 2.21.1), reverting back to the last version (2.19.3) has solved the issue for me.



来源:https://stackoverflow.com/questions/63025052/brm-model-compiling-but-returning-model-object

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!