Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • bayesmh: allowing hyperparamter to be dependent on variables

    Hi all,

    I am using bayesmh to fit a hierarchical model, and want to allow the hyperparameter to be linearly dependent on some covariates. Using the pig.dta from the bayes manual as example:
    use http://www.stata-press.com/data/r15/pig, clear
    tab id
    *create an arbitrary covariate called female to illustrate my intention
    gen female=1 if id<=24
    replace female=0 if female==.
    Then I want to estimate the following random effect model, but want to allow beta_0 to be different between female and male pigs:
    pigs.png
    I have the following codes to do this, but returns error messages:
    fvset base none id
    bayesmh weight week i.id, likelihood(normal({var_0})) noconstant prior({weight:i.id}, normal({beta0}+{beta0female}*female,{var_id})) prior({beta0}, normal(0, 100)) prior({beta0female}, normal(0, 100)) prior({weight:week}, normal(0, 100)) prior({var_0}, igamma(0.001, 0.001)) prior({var_id}, igamma(0.001, 0.001)) mcmcsize(5000) dots

    Error message:
    Burn-in 2500 normal: 48 found where 432 rows expected
    r(503);
    There are 48 ids and total of 432 observations in the dataset, if the information is helpful. Could anyone please help debug this problem, or point out a way to do this with bayesmh? Many thanks!

    Kind regards,
    Sherry
Working...
X