Learn R Programming

BaPreStoPro (version 0.1)

mixedRegression-class: S4 class of model informations for the hierarchical (mixed) regression model

Description

Informations of model $y_{ij} = f(\phi_j, t_{ij}) + \epsilon_{ij}, \phi_j\sim N(\mu, \Omega), \epsilon_{ij}\sim N(0,\gamma^2\widetilde{s}(t_{ij}))$.

Arguments

Slots

phi
parameter $\phi$
mu
parameter $\mu$
Omega
parameter $\Omega$
gamma2
parameter $\gamma^2$
fun
function $f(\phi, t)$
sT.fun
function $\widetilde{s}(t)$
prior
list of prior parameters
start
list of starting values for the Metropolis within Gibbs sampler

Examples

Run this code
mu <- c(2, 1); Omega <- c(1, 0.04)
phi <- sapply(1:2, function(i) rnorm(21, mu[i], sqrt(Omega[i])))
parameter <- list(phi = phi, mu = mu, Omega = Omega, gamma2 = 0.01)
fun <- function(phi, t) phi[1] + phi[2]*t
sT.fun <- function(t) t
prior <- list(m.mu = parameter$mu, v.mu = parameter$mu^2,
   alpha.omega = rep(3, length(parameter$mu)), beta.omega = parameter$Omega*2,
   alpha.gamma = 3, beta.gamma = parameter$gamma2*2)
start <- parameter
model <- set.to.class("mixedRegression", parameter, prior, start, fun = fun, sT.fun = sT.fun)

Run the code above in your browser using DataLab