Comments (15)
Thanks! I’ll close the issue now, feel free to open a new one for any further question or issue!
from projpred.
from projpred.
Thanks, Alejandro.
L1
search in varsel
fails with a different error:
> vs <- varsel(reffull, method='L1')
Error in Reduce(function(current, pattern) { : subscript out of bounds
The forward
search in varsel works, but then fails at as.matrix(proj):
vs <- varsel(reffull, method='forward')
proj <- project(vs, nterms = 3
, ns = 500)
mcmc_areas(as.matrix(proj)) + coord_cartesian(xlim = c(-2, 2))
Error in dimnames(x) <- dn :
length of 'dimnames' [2] not equal to array extent
I think you're right about the model type, as when I add random terms as.matrix(proj)
works (but this model gives poor varsel
plots, but that's for another post!).
Thanks very much for your help. I've tried to upload the proj object but it's huge (~120MB). Will find out how to reduce it.
from projpred.
Here's the original model object (brms_cfull
in the below): this is the smallest part I can upload! Hope that's OK. Thank you.
projpred_model.Rdata.zip
reffull <- get_refmodel(brms_cfull)
vs <- varsel(reffull, method='forward')
proj <- project(vs, nterms = 3, ns = 500)
from projpred.
from projpred.
Hi @AlejandroCatalina. Thanks very much for the fix, and for the explanation regarding the varsel
plots. I really appreciate your help with this.
The varsel(..., method='L1'
fix works for me, but I still get the same error with as.matrix(proj)
:
packageVersion("projpred")
[1] ‘2.0.0’
> mcmc_areas(as.matrix(proj)) + coord_cartesian(xlim = c(-2, 2))
Error in dimnames(x) <- dn :
length of 'dimnames' [2] not equal to array extent
I'm still trying the varsel(…, ndraws_pred = 400)
fix for the model with the random effects - it's taking a very long time to run....!
from projpred.
from projpred.
Thanks, Alejandro.
Even with 400 draws, I'm still getting a flat varsel
plot which doesn't get near the reference when I add the random terms. The order of solution_terms
is also not what I expect from other model comparisons.
priorh <- set_prior("horseshoe(scale_global = tau0, scale_slab=1)", class="b")
cfull_formula_rand <- as.formula( y ~ v1_cts * f1 + v2_cts * f2 + f1:f2 + f3 + v3_cts + v4_cts + v5_cts + (1|r1) + (1|r2) + (1|r3) )
fit <- brm(cfull_formula_rand, data=data, family="bernoulli", iter=5000, prior = priorh, sample_prior = T, control=list(adapt_delta=0.999,max_treedepth = 15), save_all_pars = F, refresh=0)
vs <- varsel(fit, method='forward', ndraws_pred=400)
solution_terms(vs)
"(1 | r1)" "(1 | r2)" "(1 | r3)” "v1_cts" “f3” "v2_cts” "v5_cts” "f2" “v2_cts:f2” "f1” “v1_cts:f1” “f1:f2” “v4_cts”
plot(vs, stats=c('elpd', 'rmse'), baseline='ref')
When I remove the random terms, the varsel
results are as expected.
solution_terms(vs)
“f2” “f3” “v2_cts” “f1” “f1:f2” “v4_cts” “v1_cts” “f1:vt_cts” “f2:v2_cts” “v5_cts"
I'd be grateful for any suggestions as to what's going wrong here, or tips for diagnosis.
It'd be great if you can fix the as.matrix(proj)
issue, so I can look at the projected posterior.
Thanks again for your help.
from projpred.
from projpred.
OK, thanks for explaining.
I'll work off the fixed effect model for now, and will wait and hope that you can tweak projpred to constrain the projections.
I'm guessing that's a longer-term fix? Please let me know if you need more information about this example to help with that.
Thanks,
Andrew
from projpred.
from projpred.
from projpred.
Thanks for the update about the plan. So I'll anticipate it being a few months off, and will find a workaround for now.
Regarding the as.matrix(proj)
issue, I get this error for method="L1"
:
vs <- varsel(brms_cfull, method='L1', ndraws_pred=400)
Error in stop("l1 search is not supported for multilevel models", ) :
argument is missing, with no default
Using method="forward"
works OK.
I'm using the develop version:
packageVersion("projpred")
[1] ‘2.0.0’
from projpred.
from projpred.
Ah, sorry. Yes: that now works. Thanks!
from projpred.
Related Issues (20)
- Projpred “inherits(formula, “formula”) is not TRUE” HOT 2
- error in installation in Mac OS M2 HOT 3
- Inconsistency in reference model formula between GAMs and GAMMs
- Add post-selection inference to latent-projection vignette
- WISH: future_plan = NULL to support currently set future backend plan HOT 3
- Please undo any changes in future::plan() to what it was before HOT 3
- Recent CRAN failures HOT 1
- Use observation weights in `proj_predict()`
- L1 search and `I()` terms
- Model fit with custom distribution family? HOT 2
- Incompatability with R version <4.2.0 HOT 9
- Test Suite Crashes HOT 5
- variable selection for uncorrelated random variables HOT 3
- Incompatible with brms when random effects are specified with || syntax HOT 2
- Error from multivariate brms models HOT 6
- Memory issues in multilevel models HOT 2
- Predictive performance gap / jumpy behavior at full size in Gaussian multilevel model HOT 1
- For a stan_glm model cv_varsel with loo works, but kfold gives an error HOT 4
- plot.vsel shows extra xtick label HOT 1
- brmsfit cumulative model & Latent projection predictive feature selection HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from projpred.