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 782, Fri Jun 24 23:06:33 2005 UTC revision 784, Sun Jun 26 03:42:21 2005 UTC
# Line 852  Line 852 
852      doLMEopt <- quote(LMEopt(x = mer, value = cv))      doLMEopt <- quote(LMEopt(x = mer, value = cv))
853    
854      GSpt <- .Call("glmer_init", environment())      GSpt <- .Call("glmer_init", environment())
     ans <- list(fixed = matrix(0, nr = length(obj@fixed), nc = nsamp),  
                 varc = matrix(0, nr = length(obj@fixed), nc = nsamp))  
855      nf <- length(obj@flist)      nf <- length(obj@flist)
856      fixed <- obj@fixed      fixed <- obj@fixed
857      varc <- .Call("lmer_coef", mer, 2, PACKAGE = "Matrix")      varc <- .Call("lmer_coef", mer, 2, PACKAGE = "Matrix")
858      b <- ranef(obj)      b <- .Call("lmer_ranef", mer, PACKAGE = "Matrix")
859        ans <- list(fixed = matrix(0, nr = length(fixed), nc = nsamp),
860                    varc = matrix(0, nr = length(varc), nc = nsamp))
861      for (i in 1:nsamp) {      for (i in 1:nsamp) {
862          ## conditional means and variances of fixed effects          ## conditional means and variances of fixed effects
863          print(fixed <- .Call("glmer_fixed_update", GSpt, b, fixed, PACKAGE = "Matrix"))          fixed <- .Call("glmer_fixed_update", GSpt, b, fixed, PACKAGE = "Matrix")
864            ans$fixed[,i] <- fixed
865          ## sample from the conditional distribution of beta given b and y          ## sample from the conditional distribution of beta given b and y
866          ## conditional means and variances of random_effects          ## conditional means and variances of random_effects
867          .Call("glmer_bhat", GSpt, fixed, varc, PACKAGE = "Matrix")          .Call("glmer_bhat", GSpt, fixed, varc, PACKAGE = "Matrix")
868          print(bhat <- ranef(mer))          print(bhat <- .Call("lmer_ranef", mer, PACKAGE = "Matrix"))
869          ## sample from the conditional distribution of b given beta and y          ## sample from the conditional distribution of b given beta and y
870          ## sample from the conditional distribution of varc given b          ## sample from the conditional distribution of varc given b
871            ans$varc[,i] <- varc
872      }      }
873      fixed      ans
874  }  }
875    

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

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