examples/BAS archive/BAS_old/R/glm-fit.R

bayesglm.fit <-
function (x, y, weights = rep(1, nobs), start = NULL, etastart = NULL, 
            mustart = NULL, offset = rep(0, nobs), family = binomial(),
            coefprior = bic.prior(nobs),
            control = glm.control(),intercept=TRUE) 
{

  x <- as.matrix(x)
  ynames <- if (is.matrix(y))     rownames(y)
            else names(y)
  conv <- FALSE
  nobs <- NROW(y)
  nvars <- ncol(x)
  EMPTY <- nvars == 0
  if (is.null(weights))   weights <- rep.int(1, nobs)
  if (is.null(offset))    offset <- rep.int(0, nobs)
  eval(family$initialize)
  if (coefprior$family == "BIC") coefprior$hyper = nobs
  newfit = .Call("glm_fit",
    RX=x, RY = y,
    family=family, Roffset = offset,
    Rweights = weights,
    Rpriorcoef = coefprior, Rcontrol=control, PACKAGE="BAS")
  
  return(newfit)
}
aliaksah/EMJMCMC2016 documentation built on July 27, 2023, 5:48 a.m.