# Brms/projpred problem

**URL:** <https://discourse.mc-stan.org/t/brms-projpred-problem/19042>\
**Category:** brms\
**Created:** [November 3, 2020, 3:42am UTC](https://discourse.mc-stan.org/t/brms-projpred-problem/19042 "2020-11-03T03:42:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nlpacestan](https://avatars.discourse-cdn.com/v4/letter/n/71e660/32.png) [@nlpacestan](https://discourse.mc-stan.org/u/nlpacestan)\
**Post date:** [November 3, 2020, 3:42am UTC](https://discourse.mc-stan.org/t/brms-projpred-problem/19042/1 "2020-11-03T03:42:59Z")

</div>

I have previously run a brm\_multiple model and used projpred successfully on this object class( ‘brmsfit\_mutiple’ ‘brmsfit’). The model is bernoulli family with mu = logit.

The projpred call was:

tmp.imp.t.stan\_glm.cvs \<- cv\_varsel(  
tmp.imp.t.stan\_glm,  
method = ‘forward’,  
data = tmp.df.imp,  
cv\_method = ‘LOO’,  
verbose = FALSE  
)

This returned the expected vsel object.

I have installed the latest brms and projpred and rerun the same model.

Making exactly the same projpred call returns:

Error in get(extend\_family\_specific, mode = “function”) :  
object ‘extend\_family\_bernoulli’ of mode ‘function’ was not found

I attempted to get a reference model structure and returned the same error.

tmpfit \<- get\_refmodel(tmp.imp.t.stan\_glm)  
Error in get(extend\_family\_specific, mode = “function”) :  
object ‘extend\_family\_bernoulli’ of mode ‘function’ was not found

- Operating System: CentOS Linux 7
- brms Version: 2.14.0
- projpred Version: 2.0.2
- R: 3.6.3

```````````

On a Mac platform I was attempting the CRAN projpred Gaussian vignette.

I used the data and code as shown in the vignette modified to set n = 1000, chains = 4 and adapt_delta = 0.95.

The attempt to get a reference model as specified in the Quick Start vignette failed:

refmodel <- get_refmodel(fit)
Error in init_refmodel(object, data, y, formula, family, ref_predfun, : 
  argument "y" is missing, with no default

An attempt to directly submit the model object to cv_varsel also failed: 

> vs <- cv_varsel(fit, method = "forward")
Error in init_refmodel(object, data, y, formula, family, ref_predfun, : 
  argument "y" is missing, with no default

* Operating System: macOS 10.15.7
* brms Version: 2.14.0
* projpred Version: 2.0.2
* R : 4.0.2

``````````

Using the vignettes and the projpred package documentation, I am not able to debug either problem.

Nathan
```````````

---

<div class="post-metadata">

**Author:** ![paul.buerkner](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/paul.buerkner/32/3303_2.png) [@paul.buerkner](https://discourse.mc-stan.org/u/paul.buerkner)\
**Post date:** [November 3, 2020, 5:18am UTC](https://discourse.mc-stan.org/t/brms-projpred-problem/19042/2 "2020-11-03T05:18:00Z")

</div>

Try the latest brms version from github (on CRAN soon)

---

<div class="post-metadata">

**Author:** ![nlpacestan](https://avatars.discourse-cdn.com/v4/letter/n/71e660/32.png) [@nlpacestan](https://discourse.mc-stan.org/u/nlpacestan)\
**Post date:** [November 3, 2020, 6:25am UTC](https://discourse.mc-stan.org/t/brms-projpred-problem/19042/3 "2020-11-03T06:25:21Z")

</div>

Thanks for the pointer.

On my macOS, I have installed XCode 12.1 and R 4.0.3.

Using the suggested devtools call, I get multiple error messages about the need for a C++11 compiler when attempting to install projpred from github.

Suggestions?

Nathan

---

<div class="post-metadata">

**Author:** ![nlpacestan](https://avatars.discourse-cdn.com/v4/letter/n/71e660/32.png) [@nlpacestan](https://discourse.mc-stan.org/u/nlpacestan)\
**Post date:** [January 27, 2021, 7:10pm UTC](https://discourse.mc-stan.org/t/brms-projpred-problem/19042/4 "2021-01-27T19:10:39Z")

</div>

I am still attempting to submit a brm\_multiple model [class(brmsfit\_multiple, brmsfit)] to projpred.

Still running on the same CentOS Linux7 platform using R 3.6.3.

Projpred is still 2.0.2, but now running latest brms 2.14.4.

The call to projpred is:

tmp.imp.t.stan\_glm.cvs ← cv\_varsel(  
tmp.imp.t.stan\_glm,  
method = ‘forward’,  
data = tmp.df.imp,  
cv\_method = ‘LOO’,  
verbose = FALSE  
)

The error message is:

Error in .fun(object = .x1, data = .x2, formula = .x3, family = .x4, folds = .x5, :  
formal argument “data” matched by multiple actual arguments

I can’t find guidance in the projpred documentation for understanding this error message.

My data object is a 5 fold multiple imputation. I am assuming that .x1 to .x5 refers to the models of the different imputations.

Is there an argument to restrict projpred to only one imputed model?

Nathan
