hello everyone, I'm new to bayesian linear hierarchical analysis. But every time I enter the stata command, I get the following error code as a screenshot
I've tried several code snippets to specify the evaluators but to no avail
HTML Code:
bayesmh pauvretelecture = b0 + b1*x1 + b2*x2 + b3*x3 + b4*x4 + b5*x5 + b6*x6 + ///
u_school + u_class, ///
likelihood(normal(_mean, sigma2)) ///
prior({b0 b1 b2 b3 b4 b5 b6}, normal(0, 100)) ///
prior({sigma2}, igamma(0.01, 0.01)) ///
prior({u_school}, normal(0, tau_school)) ///
prior({u_class}, normal(0, tau_class)) ///
prior({tau_school tau_class}, igamma(0.01, 0.01)) ///
block({b0 b1 b2 b3 b4 b5 b6 sigma2}) ///
block({u_school tau_school}) ///
block({u_class tau_class})
HTML Code:
program my_llevaluator
version 17.0
args lnf b0_elect b1_elect b2_elect b0_math b1_math b2_math sigma2_elect sigma2_math
// Utiliser les variables locales pour représenter les données et les prédicteurs
tempvar xb_elect xb_math resid_elect resid_math
// Calculer la combinaison linéaire pour chaque équation
quietly {
generate double `xb_elect' = `b0_elect' + `b1_elect' * x1 + `b2_elect' * x2
generate double `xb_math' = `b0_math' + `b1_math' * x1 + `b2_math' * x2
// Calculer les résidus
generate double `resid_elect' = pauvretelect - `xb_elect'
generate double `resid_math' = pauvretemath - `xb_math'
// Calculer la log-vraisemblance
generate double `lnf' = ln(normalden(`resid_elect', 0, sqrt(`sigma2_elect'))) + ///
ln(normalden(`resid_math', 0, sqrt(`sigma2_math')))
}
end

Comment