SCM

SCM Repository

[matrix] Diff of /pkg/R/lmer.R
ViewVC logotype

Diff of /pkg/R/lmer.R

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 781, Fri Jun 24 15:38:43 2005 UTC revision 782, Fri Jun 24 23:06:33 2005 UTC
# Line 465  Line 465 
465                val <- -deviance(object, REML = REML)/2                val <- -deviance(object, REML = REML)/2
466                nc <- object@nc[-seq(a = object@Omega)]                nc <- object@nc[-seq(a = object@Omega)]
467                attr(val, "nall") <- attr(val, "nobs") <- nc[2]                attr(val, "nall") <- attr(val, "nobs") <- nc[2]
468                attr(val, "df") <- nc[1] +                attr(val, "df") <- abs(nc[1]) +
469                    length(.Call("lmer_coef", object, 0, PACKAGE = "Matrix"))                    length(.Call("lmer_coef", object, 0, PACKAGE = "Matrix"))
470                attr(val, "REML") <- REML                attr(val, "REML") <- REML
471                class(val) <- "logLik"                class(val) <- "logLik"
# Line 806  Line 806 
806            print(reMat, quote = FALSE)            print(reMat, quote = FALSE)
807        })        })
808    
809  glmmMCMC <- function(obj, method = c("full"), nsamp = 1000)  glmmMCMC <- function(obj, method = c("full"), nsamp = 1)
810  {  {
811      if (!inherits(obj, "lmer")) stop("obj must be of class `lmer'")      if (!inherits(obj, "lmer")) stop("obj must be of class `lmer'")
812      if (obj@family$family == "gaussian" && obj@family$link == "identity")      if (obj@family$family == "gaussian" && obj@family$link == "identity")
# Line 859  Line 859 
859      varc <- .Call("lmer_coef", mer, 2, PACKAGE = "Matrix")      varc <- .Call("lmer_coef", mer, 2, PACKAGE = "Matrix")
860      b <- ranef(obj)      b <- ranef(obj)
861      for (i in 1:nsamp) {      for (i in 1:nsamp) {
862          ## update fixed          ## conditional means and variances of fixed effects
863          .Call("glmer_fixed_update", GSpt, PACKAGE = "Matrix")          print(fixed <- .Call("glmer_fixed_update", GSpt, b, fixed, PACKAGE = "Matrix"))
864            ## sample from the conditional distribution of beta given b and y
865            ## conditional means and variances of random_effects
866            .Call("glmer_bhat", GSpt, fixed, varc, PACKAGE = "Matrix")
867            print(bhat <- ranef(mer))
868            ## sample from the conditional distribution of b given beta and y
869            ## sample from the conditional distribution of varc given b
870      }      }
871        fixed
872  }  }
873    

Legend:
Removed from v.781  
changed lines
  Added in v.782

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge