LONRBGLSS_1 <- function(y,e,X,g,z,k,quant,max.steps,sparse, structure,iterations, burn.in=NULL){
  n = nrow(g)
  m = ncol(g)
  w = c()

  for (i in 1:m)
  {

    w = cbind(w,g[,i]*e)

  }
  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
  hatPhiSq=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 == "bilevel") {

      fit <- RBGLSS_1(
        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, hatPhiSq,
        a, b, alpha1, gamma1, sh1, sh0, progress
      )

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

      fit <- RBLSS_1(
        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, hatPhiSq,
        a, b, alpha1, gamma1, sh1, sh0, progress
      )

    }

  } else {

    if (structure == "bilevel") {

      fit <- RBGL_1(
        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, hatPhiSq,
        a, b, alpha1, gamma1, progress
      )

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

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

    }
  }


  fit

}
