R/LONRBGLSS.R

Defines functions LONRBGLSS

LONRBGLSS <- function(y,e,X,g,w,z,k,quant,max.steps,sparse, structure, iterations, burn.in=NULL){
  n = nrow(g)
  m = ncol(g)
  p = ncol(w)
  E = cbind(e,X)
  o = ncol(X)
  q = ncol(E)
  c = ncol(z)
  n1 = n/k
  hatTau=1
  hatV = rep(1,n)
  hatSg1 = rep(1,m)
  hatSg21= rep(1,p)
  hatSg22 = rep(1,m)
  xi1=(1-2*quant)/(quant*(1-quant))
  xi2 = sqrt(2/(quant*(1-quant)))
  hatEtaSq1=1
  hatEtaSq2=1
  r1=1
  r2=1
  a=1
  b=1
  hatAta=matrix(c(rep(1,n1*c)),nrow=c)
  hatBeta = rep(1,m)
  hatEta1 = rep(1,p)
  hatEta2 = matrix(c(rep(1,p)),nrow=q-o)
  hatAlpha = rep(1,q)
  invSigAlpha0 = diag(rep(10^-3,q))
  alpha1=0
  gamma1=0
  hatPhi1Sq=hatPhi2Sq=1
  progress=0
  hatPi1=1/2
  hatPi2=1/2
  sh1=1
  sh0=1
  debugging=FALSE

  progress = ifelse(debugging, 10^(floor(log10(max.steps))-1), 0)

  if (sparse) {

    if (structure == "bi-level") {

      fit <- RBGLSS(
        y, E, g, w, max.steps, q, o, k,
        hatBeta, hatEta2, hatAlpha, hatAta, z,
        hatTau, hatV, hatSg1, hatSg22, invSigAlpha0,
        hatPi1, hatPi2, hatEtaSq1, hatEtaSq2,
        xi1, xi2, r1, r2, hatPhi1Sq, hatPhi2Sq,
        a, b, alpha1, gamma1, sh1, sh0, progress
      )

    } else if (structure == "individual") {

      fit <- RBLSS(
        y, E, g, w, max.steps, q, k,
        hatBeta, hatEta1, hatAlpha, hatAta, z,
        hatTau, hatV, hatSg1, hatSg21, invSigAlpha0,
        hatPi1, hatPi2, hatEtaSq1, hatEtaSq2,
        xi1, xi2, r1, r2, hatPhi1Sq, hatPhi2Sq,
        a, b, alpha1, gamma1, sh1, sh0, progress
      )

    }

  } else {

    if (structure == "bi-level") {

      fit <- RBGL(
        y, E, g, w, max.steps, q, o, k,
        hatBeta, hatEta2, hatAlpha, hatAta, z,
        hatTau, hatV, hatSg1, hatSg22, invSigAlpha0,
        hatEtaSq1, hatEtaSq2,
        xi1, xi2, r1, r2, hatPhi1Sq, hatPhi2Sq,
        a, b, alpha1, gamma1, progress
      )

    } else if (structure == "individual") {

      fit <- RBL(
        y, E, g, w, max.steps, q, k,
        hatBeta, hatEta1, hatAlpha, hatAta, z,
        hatTau, hatV, hatSg1, hatSg21, invSigAlpha0,
        hatEtaSq1, hatEtaSq2,
        xi1, xi2, r1, r2, hatPhi1Sq, hatPhi2Sq,
        a, b, alpha1, gamma1, progress
      )

    }
  }


  fit

}

Try the mixedBayes package in your browser

Any scripts or data that you put into this service are public.

mixedBayes documentation built on March 17, 2026, 1:07 a.m.