Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
203 views
in Technique[技术] by (71.8m points)

r - Specify initial values in brms

I am trying to fit a brms model in R. Right now it does not converge well, whereas it worked well with JAGS. The only difference being the initial values, I would like to specify myself the initial values in the brm() function.

My model :

    ### Priors
    
    prior_brms <- c(brms::prior(normal(0, 1), class = "Intercept"),
                    brms::prior(normal(0, 1), class = "b"),
                    brms::prior(inv_gamma(10^-3, 10^-3), class = "sd"))
    
    ### Fit
    
    brms_mod <- brms::brm(formula = Y ~  species + X1 * species + (1|tree), 
                          data = Data_stan,
                          prior= prior_brms,
                          iter = 10000 , warmup = 5000, thin = 5,
                          chains = 2, cores=2)

I read the brm() function doc, which tells me to look at rstan's doc, and I really do not understand how to specify the initial values. It says it should be a list of lists using the same parameter names as Stan.

Does someone have an idea how to do this ?

Thanks in advance !

EDIT : turns out the convergence problem has nothing to do with initial values, but with the fact that my data is so well explained by the model (without pretention, the data is simulated ;) ) that there is almost no residual variance, which stan seems to dislike (previous post about this problem).

question from:https://stackoverflow.com/questions/66050575/specify-initial-values-in-brms

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...