Error in set_prior function: "argument 5 is empty"

Hi everyone,

I have a problem in the priors specification of my multivariate model:

H_shannon_mod <- bf(H_shannon ~ severity)
FRic_cailliez_v2_mod <- bf(FRic_cailliez_v2 ~ severity+H_shannon)
FEve_cailliez_v2_mod <- bf(FEve_cailliez_v2 ~ severity+H_shannon)
Shannon_Bac_100_mod <- bf(Shannon_Bac_100 ~ severity+H_shannon+FRic_cailliez_v2+FEve_cailliez_v2)
Shannon_Fung_mod <- bf(Shannon_Fung ~ severity+H_shannon+FRic_cailliez_v2)
EMF_v6_mod <- bf(EMF_v6 ~ severity+H_shannon+Shannon_Bac_100+Shannon_Fung, family = Beta(link = "logit"))

k_fit_brms <- brm(EMF_v6_mod + 
                    Shannon_Fung_mod + 
                    Shannon_Bac_100_mod +
                    FEve_cailliez_v2_mod +
                    FRic_cailliez_v2_mod +
                    H_shannon_mod +
                    set_rescor(FALSE),
                  prior = c(set_prior("normal(0, 1)", class = "b", resp = c("EMF_v6_mod", "FEve_cailliez_v2_mod", "FRic_cailliez_v2_mod", "H_shannon_mod")),
                            set_prior("normal(2, 4)", class = "b", resp = c("Shannon_Fung_mod", "Shannon_Bac_100_mod")),
                            set_prior("normal(0.5, 1)", class = "Intercept", resp = c("EMF_v6_mod", "FEve_cailliez_v2_mod", "FRic_cailliez_v2_mod", "H_shannon_mod")),
                            set_prior("normal(3, 3)", class = "Intercept", resp = c("Shannon_Fung_mod", "Shannon_Bac_100_mod")),
                  ),
                  sample_prior = "only",
                  chains=6, iter = 4000, data=datos)

I get the following error:

Error in c(set_prior("normal(0, 1)", class = "b", resp = c("EMF_v6_mod",  : 
  argument 5 is empty

Thanks for your help.

Regards,

Edited by @jsocolar for R syntax highlighting.

Where A through D represent your set_prior() calls, you are passing prior = c(A, B, C, D, ). You need to delete the trailing comma inside the c() call. You are being warned that the 5th argument to c() is empty.

1 Like