saudiwin / ordbetareg_pack

Repository for R package ordbetareg, used to fit continuous data with lower and upper bounds.
Other
17 stars 3 forks source link

Failure to fit with only intercept model #21

Open bgerber123 opened 4 months ago

bgerber123 commented 4 months ago

I noticed that intercept only type models with no slope/offset parameters are not currently possible. Using the example code/data- this model -

ord_fit_mean <- ordbetareg(formula=therm ~ 1 + (1|region), data=model_data, cores=2,chains=2)

returns this error -

Error: The following priors do not correspond to any model parameter: b ~ normal(0,5) Function 'default_prior' might be helpful to you.

Seems like a possible backend code fix for not pre-specifying b priors without checking the design matrix.

I would be interested in this being fixed to be able to fit a model using ordbetreg.

Thanks! cheers, Brian

saudiwin commented 4 months ago

This will require a new option to allow for formulas with only intercepts. In the meantime, it's relatively easy to get around this restriction, just add a covariate to the formula equal to 0, as in the following code:

model_data$zero_cov <- 0
ord_fit_mean <- ordbetareg(formula=therm ~ zero_cov + (1|region),
data=model_data,
cores=2,chains=2)