void update() { y_hat.value = X*b.value; rsq.value = as_scalar(1 - var(y - y_hat.value) / var(y)); b.dnorm(0.0, 0.0001); tau_y.dgamma(0.1, 0.1); likelihood.dnorm(y_hat.value,tau_y.value); }
/** Sets parameter alpha. Also known as the shape parameter. */ void GammaRng::setAlpha(double alpha) { if (fabs(alpha) < DBL_MIN) { cerr << "ERROR: Shape parameter alpha must be non-zero." << endl; return; } Gamma * grng = static_cast< Gamma * >(rng_); if ( grng ) { alpha_ = grng->getAlpha(); } else { alpha_ = alpha; isAlphaSet_ = true; if ( isThetaSet_ ){ rng_ = new Gamma(alpha_, theta_); } } }
static RCP<const Basic> diff(const Gamma &self, const RCP<const Symbol> &x) { RCP<const Basic> gamma_arg = self.get_args()[0]; return mul(mul(self.rcp_from_this(), polygamma(zero, gamma_arg)), gamma_arg->diff(x)); }
void bvisit(const Gamma &x) { apply(result_, *(x.get_args()[0])); mpfr_gamma(result_, result_, rnd_); };