lmer.c File Reference

#include "lmer.h"
#include <Rmath.h>
#include <R_ext/Lapack.h>
#include <R_ext/stats_package.h>
#include "Matrix.h"
#include "Syms.h"

Include dependency graph for lmer.c:

Go to the source code of this file.

Defines

#define _(String)   (String)
 Allow for translation of error messages.
#define A_SLOT(x)   AS_CHM_SP(GET_SLOT(x, lme4_ASym))
 Allocate (alloca) a cholmod_sparse struct, populate it with values from the A slot and return the pointer.
#define Alloca(n, t)   (t *) alloca( (size_t) ( (n) * sizeof(t) ) )
 alloca n elements of type t
#define AZERO(x, n)   {int _I_, _SZ_ = (n); for(_I_ = 0; _I_ < _SZ_; _I_++) (x)[_I_] = 0;}
 zero an array
#define BUF_SIZE   127
 size of buffer for an error message
#define CM_MAXITER   300
 Maximum number of iterations in update_u.
#define Cm_SLOT(x)   AS_CHM_SP(GET_SLOT(x, lme4_CmSym))
 Allocate (alloca) a cholmod_sparse struct, populate it with values from the Cm slot and return the pointer.
#define CM_SMIN   1e-5
 Minimum step factor in update_u.
#define CM_TOL   1e-10
 Tolerance level for convergence criterion in update_u.
#define Cx_SLOT(x)   SLOT_REAL_NULL(x, lme4_CxSym)
 Return the double pointer to the Cx slot or (double*) NULL if Cx has length 0).
#define DEV_SLOT(x)   SLOT_REAL_NULL(x, lme4_devianceSym)
 Return the double pointer to the deviance slot.
#define DIMS_SLOT(x)   INTEGER(GET_SLOT(x, lme4_dimsSym))
 Return the integer pointer to the dims slot.
#define ETA_SLOT(x)   SLOT_REAL_NULL(x, lme4_etaSym)
 Return the double pointer to the eta slot.
#define FIXEF_SLOT(x)   SLOT_REAL_NULL(x, lme4_fixefSym)
 Return the double pointer to the fixef slot.
#define Gp_SLOT(x)   INTEGER(GET_SLOT(x, lme4_GpSym))
 Return the integer pointer to the Gp slot.
#define L_SLOT(x)   AS_CHM_FR(GET_SLOT(x, lme4_LSym))
 Allocate (alloca) a cholmod_factor struct, populate it with values from the L slot and return the pointer.
#define LTHRESH   30.
#define MLTHRESH   -30.
#define MU_SLOT(x)   SLOT_REAL_NULL(x, lme4_muSym)
 Return the double pointer to the mu slot.
#define MUETA_SLOT(x)   SLOT_REAL_NULL(x, lme4_muEtaSym)
 Return the double pointer to the muEta slot or (double*) NULL if muEta has length 0).
#define OFFSET_SLOT(x)   SLOT_REAL_NULL(x, lme4_offsetSym)
 Return the double pointer to the offset slot or (double*) NULL if offset has length 0).
#define PERM_VEC(x)   INTEGER(GET_SLOT(GET_SLOT(x, lme4_LSym), lme4_permSym))
 Return the integer pointer to the permutation vector in the L slot.
#define PWT_SLOT(x)   SLOT_REAL_NULL(x, lme4_pWtSym)
 Return the double pointer to the pWt slot or (double*) NULL if pWt has length 0).
#define RANEF_SLOT(x)   SLOT_REAL_NULL(x, lme4_ranefSym)
 Return the double pointer to the ranef slot or (double*) NULL if ranef has length 0).
#define RDF(dims)   (dims[n_POS] - (dims[isREML_POS] ? dims[p_POS] : 0))
 Residual degrees of freedom.
#define RESID_SLOT(x)   SLOT_REAL_NULL(x, lme4_residSym)
 Return the double pointer to the resid slot.
#define RX_SLOT(x)   SLOT_REAL_NULL(x, lme4_RXSym)
 Return the double pointer to the RX slot.
#define RZX_SLOT(x)   SLOT_REAL_NULL(x, lme4_RZXSym)
 Return the double pointer to the RZX slot.
#define SRWT_SLOT(x)   SLOT_REAL_NULL(x, lme4_sqrtrWtSym)
 Return the double pointer to the sqrtrWt slot or (double*) NULL if sqrtrWt has length 0).
#define SXWT_SLOT(x)   SLOT_REAL_NULL(x, lme4_sqrtXWtSym)
 Return the double pointer to the sqrtXWt slot or (double*) NULL if sqrtXWt has length 0).
#define U_SLOT(x)   SLOT_REAL_NULL(x, lme4_uSym)
 Return the double pointer to the u slot.
#define V_SLOT(x)   SLOT_REAL_NULL(x, lme4_VSym)
 Return the double pointer to the V slot or (double*) NULL if V has length 0).
#define VAR_SLOT(x)   SLOT_REAL_NULL(x, lme4_varSym)
 Return the double pointer to the var slot or (double*) NULL if var has length 0).
#define X_SLOT(x)   SLOT_REAL_NULL(x, lme4_XSym)
 Return the double pointer to the X slot.
#define Y_SLOT(x)   SLOT_REAL_NULL(x, lme4_ySym)
 Return the double pointer to the y slot.
#define Zt_SLOT(x)   AS_CHM_SP(GET_SLOT(x, lme4_ZtSym))
 Allocate (alloca) a cholmod_sparse struct, populate it with values from the Zt slot and return the pointer.

Enumerations

enum  devP {
  ML_POS = 0, REML_POS, ldL2_POS, ldRX2_POS, sigmaML_POS, sigmaREML_POS, pwrss_POS, disc_POS,
  usqr_POS, wrss_POS
}
 positions in the deviance vector More...
enum  dimP {
  nf_POS = 0, n_POS, p_POS, q_POS, s_POS, np_POS, isREML_POS, fTyp_POS,
  lTyp_POS, vTyp_POS, nest_POS, useSc_POS, nAGQ_POS, cvg_POS
}
 positions in the dims vector More...

Functions

static R_INLINE double * apply_perm (double *dest, const double *src, const int *perm, int n)
 Permute the vector src according to perm into dest.
static int chkDims (char *buf, int nb, SEXP x, SEXP sym, int nr, int nc)
 Check that slot sym of object x is a numeric matrix of dimension nr by nc.
static int chkLen (char *buf, int nb, SEXP x, SEXP sym, int len, int zerok)
 Check that the length of the sym slot in x is len or, possibly, zero.
static R_INLINE int Gp_grp (int ind, int nf, const int *Gp)
 Return the index of the term associated with parameter index ind.
static double lme4_devResid (const double *mu, const double *pWt, const double *y, int n, int vTyp)
 Evaluate the sum of the deviance residuals for a GLM family.
static void lme4_muEta (double *mu, double *muEta, const double *eta, int n, int lTyp)
 Evaluate the derivative d mu/d eta for the GLM link function of type lTyp.
static void lme4_varFunc (double *var, const double *mu, int n, int vTyp)
 Evaluate the GLM variance function of type vTyp given mu.
static double lmm_update_fixef_u (SEXP x)
 Determine the conditional estimates of the fixed effects and the conditional mode of u for a linear mixed model.
static void lmm_update_projection (SEXP x, double *pb, double *pbeta)
 Update the projections of the response vector onto the column spaces of the random effects and the fixed effects.
static void MCMC_beta_u (SEXP x, double sigma, double *fvals, double *rvals)
 Update the fixed effects and the orthogonal random effects in an MCMC sample from an mer object.
static void MCMC_S (SEXP x, double sigma)
 Update the theta_S parameters from the ST arrays in place.
static void MCMC_T (SEXP x, double sigma)
 Update the theta_T parameters from the ST arrays in place.
SEXP mer_create_L (SEXP CmP)
 Create and initialize L.
SEXP mer_MCMCsamp (SEXP x, SEXP fm)
 Generate a Markov-chain Monte Carlo sample from an mer object.
SEXP mer_optimize (SEXP x, SEXP verbp)
 Optimize the profiled deviance of an lmer object or the Laplace approximation to the deviance of a nlmer or glmer object.
SEXP mer_postVar (SEXP x)
 Extract the conditional variances of the random effects in an mer object.
SEXP mer_ST_chol (SEXP x)
 Return a list of (upper) Cholesky factors from the ST list.
SEXP mer_ST_getPars (SEXP x)
 Extract the parameters from the ST slot of an mer object.
SEXP mer_ST_initialize (SEXP ST, SEXP Gpp, SEXP Zt)
 Evaluate starting estimates for the elements of ST.
SEXP mer_ST_setPars (SEXP x, SEXP pars)
 Update the ST slot of an mer object from a REAL vector of parameters and update the sparse model matrix A.
SEXP mer_update_dev (SEXP x)
 Evaluate the discrepancy and log of the penalized discrepancy.
SEXP mer_update_L (SEXP x)
 Externally callable update_L.
SEXP mer_update_mu (SEXP x)
 Externally callable update_mu.
SEXP mer_update_projection (SEXP x)
 Externally callable lmm_update_projection.
SEXP mer_update_ranef (SEXP x)
 Externally callable update_ranef.
SEXP mer_update_RX (SEXP x)
 Externally callable update_RX.
SEXP mer_update_u (SEXP x, SEXP verbP)
 Externally callable update_u.
SEXP mer_validate (SEXP x)
 Check validity of an mer object.
SEXP merMCMC_validate (SEXP x)
 Check validity of an merMCMC object.
SEXP merMCMC_VarCorr (SEXP x, SEXP typP)
static void P_sdmult (double *dest, const int *perm, const CHM_SP A, const double *X, int nc)
 Create PAX in dest.
static R_INLINE double * SLOT_REAL_NULL (SEXP obj, SEXP nm)
 Extract the slot named nm from the object obj and return a null pointer if the slot has length 0 or a pointer to the REAL contents.
SEXP spR_optimize (SEXP x, SEXP verbP)
 Optimize the log-likelihood for the sparse representation of a Rasch model.
SEXP spR_update_mu (SEXP x)
 Update the eta, mu, resid and var slots in a sparseRasch object from the current values of the model parameters in the beta slot.
static R_INLINE double sqr_length (const double *x, int n)
 Return the sum of squares of the first n elements of x.
static double * ST_getPars (SEXP x, double *pars)
 Extract the parameters from ST list.
static int ST_nc_nlev (const SEXP ST, const int *Gp, double **st, int *nc, int *nlev)
 Populate the st, nc and nlev arrays.
static void ST_setPars (SEXP x, const double *pars)
 Update the ST and A slots of an mer object.
static R_INLINE int theta_S_ind (int i, int nf, int *Gp, int *nlev, int *spt)
 Determine the index in theta_S corresponding to index i in the u vector.
static void Tt_Zt (CHM_SP A, int *Gp, int *nc, int *nlev, double **st, int nf)
 Multiply A on the left by T'.
static void update_A (SEXP x)
 Evaluate the sparse model matrix A from the Zt and ST slots.
static double update_L (SEXP x)
 Update the L, sqrtrWt and resid slots.
static double update_mu (SEXP x)
 Update the eta, v, mu, resid and var slots according to the current values of the parameters and u.
static void update_ranef (SEXP x)
 Update the contents of the ranef slot in an mer object using the current contents of the u and ST slots.
static double update_RX (SEXP x)
 Update the RZX and RX slots in an mer object.
static int update_u (SEXP x, int verb)
 Iterate to determine the conditional modes of the random effects.
static R_INLINE double y_log_y (double y, double mu)
 Evaluate y * log(y/mu) with the correct limiting value at y = 0.

Variables

cholmod_common c
 cholmod_common struct initialized in R_init_lme4
static const double INVEPS = 1/DOUBLE_EPS
static double MPTHRESH = 0
static double PTHRESH = 0


Define Documentation

#define _ ( String   )     (String)

Allow for translation of error messages.

Definition at line 16 of file lmer.c.

Referenced by chkDims(), chkLen(), Gp_grp(), lme4_devResid(), lme4_muEta(), lme4_varFunc(), lmm_update_fixef_u(), lmm_update_projection(), MCMC_beta_u(), MCMC_S(), mer_create_L(), mer_ST_setPars(), mer_validate(), merMCMC_validate(), merMCMC_VarCorr(), spR_optimize(), spR_update_mu(), update_A(), update_L(), update_mu(), and update_u().

#define A_SLOT (  )     AS_CHM_SP(GET_SLOT(x, lme4_ASym))

Allocate (alloca) a cholmod_sparse struct, populate it with values from the A slot and return the pointer.

Definition at line 88 of file lmer.c.

Referenced by lmm_update_projection(), MCMC_S(), mer_validate(), update_A(), update_L(), update_mu(), update_RX(), and update_u().

#define Alloca ( n,
 )     (t *) alloca( (size_t) ( (n) * sizeof(t) ) )

alloca n elements of type t

Definition at line 33 of file lmer.c.

Referenced by MCMC_beta_u(), MCMC_S(), MCMC_T(), mer_optimize(), mer_postVar(), mer_ST_chol(), mer_ST_initialize(), mer_validate(), merMCMC_validate(), merMCMC_VarCorr(), P_sdmult(), ST_setPars(), update_A(), update_ranef(), and update_u().

#define AZERO ( x,
 )     {int _I_, _SZ_ = (n); for(_I_ = 0; _I_ < _SZ_; _I_++) (x)[_I_] = 0;}

zero an array

Definition at line 36 of file lmer.c.

Referenced by lmm_update_projection(), MCMC_S(), mer_ST_initialize(), P_sdmult(), update_A(), update_L(), update_RX(), and update_u().

#define BUF_SIZE   127

size of buffer for an error message

Definition at line 184 of file lmer.c.

Referenced by chkDims(), chkLen(), mer_validate(), and merMCMC_validate().

#define CM_MAXITER   300

Maximum number of iterations in update_u.

Definition at line 188 of file lmer.c.

Referenced by spR_optimize(), and update_u().

#define Cm_SLOT (  )     AS_CHM_SP(GET_SLOT(x, lme4_CmSym))

Allocate (alloca) a cholmod_sparse struct, populate it with values from the Cm slot and return the pointer.

Definition at line 92 of file lmer.c.

Referenced by update_L(), update_RX(), and update_u().

#define CM_SMIN   1e-5

Minimum step factor in update_u.

Definition at line 192 of file lmer.c.

Referenced by spR_optimize(), and update_u().

#define CM_TOL   1e-10

Tolerance level for convergence criterion in update_u.

Definition at line 190 of file lmer.c.

Referenced by spR_optimize(), and update_u().

#define Cx_SLOT (  )     SLOT_REAL_NULL(x, lme4_CxSym)

Return the double pointer to the Cx slot or (double*) NULL if Cx has length 0).

Definition at line 96 of file lmer.c.

Referenced by update_L(), update_RX(), and update_u().

#define DEV_SLOT (  )     SLOT_REAL_NULL(x, lme4_devianceSym)

Return the double pointer to the deviance slot.

Definition at line 99 of file lmer.c.

Referenced by lmm_update_fixef_u(), lmm_update_projection(), mer_MCMCsamp(), mer_optimize(), mer_postVar(), mer_update_dev(), spR_optimize(), spR_update_mu(), update_L(), update_mu(), and update_RX().

#define DIMS_SLOT (  )     INTEGER(GET_SLOT(x, lme4_dimsSym))

Return the integer pointer to the dims slot.

Definition at line 102 of file lmer.c.

Referenced by lmm_update_fixef_u(), lmm_update_projection(), MCMC_beta_u(), MCMC_S(), MCMC_T(), mer_MCMCsamp(), mer_optimize(), mer_postVar(), mer_ST_chol(), mer_ST_getPars(), mer_ST_setPars(), mer_update_dev(), mer_update_projection(), spR_update_mu(), ST_setPars(), update_A(), update_L(), update_mu(), update_ranef(), update_RX(), and update_u().

#define ETA_SLOT (  )     SLOT_REAL_NULL(x, lme4_etaSym)

Return the double pointer to the eta slot.

Definition at line 105 of file lmer.c.

Referenced by MCMC_S(), and update_mu().

#define FIXEF_SLOT (  )     SLOT_REAL_NULL(x, lme4_fixefSym)

Return the double pointer to the fixef slot.

Definition at line 108 of file lmer.c.

Referenced by lmm_update_fixef_u(), MCMC_beta_u(), MCMC_S(), mer_MCMCsamp(), mer_optimize(), spR_optimize(), and update_mu().

#define Gp_SLOT (  )     INTEGER(GET_SLOT(x, lme4_GpSym))

Return the integer pointer to the Gp slot.

Definition at line 111 of file lmer.c.

Referenced by MCMC_S(), MCMC_T(), mer_postVar(), mer_ST_chol(), merMCMC_VarCorr(), ST_setPars(), update_A(), and update_ranef().

#define L_SLOT (  )     AS_CHM_FR(GET_SLOT(x, lme4_LSym))

Allocate (alloca) a cholmod_factor struct, populate it with values from the L slot and return the pointer.

Definition at line 115 of file lmer.c.

Referenced by lmm_update_fixef_u(), lmm_update_projection(), MCMC_beta_u(), mer_postVar(), mer_validate(), spR_optimize(), update_L(), update_mu(), update_RX(), and update_u().

#define LTHRESH   30.

Definition at line 194 of file lmer.c.

Referenced by lme4_muEta().

#define MLTHRESH   -30.

Definition at line 195 of file lmer.c.

Referenced by lme4_muEta().

#define MU_SLOT (  )     SLOT_REAL_NULL(x, lme4_muSym)

Return the double pointer to the mu slot.

Definition at line 118 of file lmer.c.

Referenced by mer_update_dev(), spR_optimize(), spR_update_mu(), update_L(), and update_mu().

#define MUETA_SLOT (  )     SLOT_REAL_NULL(x, lme4_muEtaSym)

Return the double pointer to the muEta slot or (double*) NULL if muEta has length 0).

Definition at line 122 of file lmer.c.

Referenced by lmm_update_fixef_u(), MCMC_beta_u(), mer_optimize(), mer_update_dev(), spR_optimize(), spR_update_mu(), update_L(), and update_mu().

#define OFFSET_SLOT (  )     SLOT_REAL_NULL(x, lme4_offsetSym)

Return the double pointer to the offset slot or (double*) NULL if offset has length 0).

Definition at line 126 of file lmer.c.

Referenced by MCMC_S(), spR_update_mu(), and update_mu().

#define PERM_VEC (  )     INTEGER(GET_SLOT(GET_SLOT(x, lme4_LSym), lme4_permSym))

Return the integer pointer to the permutation vector in the L slot.

Definition at line 129 of file lmer.c.

Referenced by MCMC_S(), and update_ranef().

#define PWT_SLOT (  )     SLOT_REAL_NULL(x, lme4_pWtSym)

Return the double pointer to the pWt slot or (double*) NULL if pWt has length 0).

Definition at line 133 of file lmer.c.

Referenced by mer_update_dev(), spR_optimize(), and update_L().

#define RANEF_SLOT (  )     SLOT_REAL_NULL(x, lme4_ranefSym)

Return the double pointer to the ranef slot or (double*) NULL if ranef has length 0).

Definition at line 137 of file lmer.c.

Referenced by MCMC_beta_u(), MCMC_S(), mer_MCMCsamp(), and update_ranef().

#define RDF ( dims   )     (dims[n_POS] - (dims[isREML_POS] ? dims[p_POS] : 0))

Residual degrees of freedom.

Definition at line 140 of file lmer.c.

#define RESID_SLOT (  )     SLOT_REAL_NULL(x, lme4_residSym)

Return the double pointer to the resid slot.

Definition at line 143 of file lmer.c.

Referenced by spR_optimize(), spR_update_mu(), update_L(), update_mu(), and update_u().

#define RX_SLOT (  )     SLOT_REAL_NULL(x, lme4_RXSym)

Return the double pointer to the RX slot.

Definition at line 146 of file lmer.c.

Referenced by lmm_update_fixef_u(), lmm_update_projection(), MCMC_beta_u(), and update_RX().

#define RZX_SLOT (  )     SLOT_REAL_NULL(x, lme4_RZXSym)

Return the double pointer to the RZX slot.

Definition at line 149 of file lmer.c.

Referenced by lmm_update_fixef_u(), lmm_update_projection(), MCMC_beta_u(), and update_RX().

#define SRWT_SLOT (  )     SLOT_REAL_NULL(x, lme4_sqrtrWtSym)

Return the double pointer to the sqrtrWt slot or (double*) NULL if sqrtrWt has length 0).

Definition at line 153 of file lmer.c.

Referenced by lmm_update_fixef_u(), spR_optimize(), spR_update_mu(), update_L(), and update_mu().

#define SXWT_SLOT (  )     SLOT_REAL_NULL(x, lme4_sqrtXWtSym)

Return the double pointer to the sqrtXWt slot or (double*) NULL if sqrtXWt has length 0).

Definition at line 157 of file lmer.c.

Referenced by lmm_update_projection(), update_L(), update_RX(), and update_u().

#define U_SLOT (  )     SLOT_REAL_NULL(x, lme4_uSym)

Return the double pointer to the u slot.

Definition at line 160 of file lmer.c.

Referenced by lmm_update_fixef_u(), MCMC_beta_u(), MCMC_S(), update_ranef(), and update_u().

#define V_SLOT (  )     SLOT_REAL_NULL(x, lme4_VSym)

Return the double pointer to the V slot or (double*) NULL if V has length 0).

Definition at line 164 of file lmer.c.

Referenced by lmm_update_fixef_u(), MCMC_beta_u(), mer_optimize(), update_L(), and update_mu().

#define VAR_SLOT (  )     SLOT_REAL_NULL(x, lme4_varSym)

Return the double pointer to the var slot or (double*) NULL if var has length 0).

Definition at line 168 of file lmer.c.

Referenced by spR_optimize(), spR_update_mu(), update_L(), and update_mu().

#define X_SLOT (  )     SLOT_REAL_NULL(x, lme4_XSym)

Return the double pointer to the X slot.

Definition at line 171 of file lmer.c.

Referenced by lmm_update_projection(), MCMC_S(), update_mu(), and update_RX().

#define Y_SLOT (  )     SLOT_REAL_NULL(x, lme4_ySym)

Return the double pointer to the y slot.

Definition at line 174 of file lmer.c.

Referenced by lmm_update_projection(), MCMC_S(), mer_update_dev(), spR_optimize(), spR_update_mu(), update_L(), and update_mu().

#define Zt_SLOT (  )     AS_CHM_SP(GET_SLOT(x, lme4_ZtSym))

Allocate (alloca) a cholmod_sparse struct, populate it with values from the Zt slot and return the pointer.

Definition at line 178 of file lmer.c.

Referenced by MCMC_S(), mer_validate(), spR_optimize(), spR_update_mu(), and update_A().


Enumeration Type Documentation

enum devP

positions in the deviance vector

Enumerator:
ML_POS  Maximum likelihood deviance.
REML_POS  REML deviance.
ldL2_POS  2*log-determinant of L
ldRX2_POS  2*log-determinant of RX
sigmaML_POS  current ML estimate of sigma
sigmaREML_POS  current REML estimate of sigma
pwrss_POS  penalized weighted residual sum of squares
disc_POS  discrepancy
usqr_POS  squared length of u
wrss_POS  weighted residual sum of squares

Definition at line 39 of file lmer.c.

enum dimP

positions in the dims vector

Enumerator:
nf_POS  number of terms in random effects
n_POS  number of observations
p_POS  number of fixed-effects parameters
q_POS  number of random effects
s_POS  number of variables in h (1 unless nonlinear)
np_POS  total number of parameters for T and S
isREML_POS  indicator of REML estimation
fTyp_POS  family type for generalized model
lTyp_POS  link type for generalized model
vTyp_POS  variance type for generalized model
nest_POS  indicator of nested grouping factors
useSc_POS  does the family use a separate scale parameter
nAGQ_POS  use adaptive Gauss-Hermite quadrature?
cvg_POS  convergence indictor from port optimization

Definition at line 52 of file lmer.c.


Function Documentation

static R_INLINE double* apply_perm ( double *  dest,
const double *  src,
const int *  perm,
int  n 
) [static]

Permute the vector src according to perm into dest.

Parameters:
dest destination
src source
perm NULL or 0-based permutation of length n
n length of src, dest and perm
Returns:
dest
Note:
If perm is NULL the first n elements of src are copied to dest.

Definition at line 217 of file lmer.c.

Referenced by P_sdmult(), spR_optimize(), and update_u().

Here is the caller graph for this function:

static int chkDims ( char *  buf,
int  nb,
SEXP  x,
SEXP  sym,
int  nr,
int  nc 
) [static]

Check that slot sym of object x is a numeric matrix of dimension nr by nc.

Parameters:
buf character buffer of length nb + 1
nb number of writable positions in the buffer
x pointer to an mer object
sym name (symbol, actually) of the slot to check
nr expected number of rows
nc expected number of columns
Returns:
0 for success, number of characters written to buf on failure

Definition at line 283 of file lmer.c.

References _, and BUF_SIZE.

Referenced by mer_validate(), and merMCMC_validate().

Here is the caller graph for this function:

static int chkLen ( char *  buf,
int  nb,
SEXP  x,
SEXP  sym,
int  len,
int  zerok 
) [static]

Check that the length of the sym slot in x is len or, possibly, zero.

Parameters:
buf character buffer of length nb + 1
nb number of writable positions in the buffer
x pointer to an mer object
sym name (symbol, actually) of the slot to check
len expected length
zerok is a length of zero allowed?
Returns:
0 for success, number of characters written to buf on failure

Definition at line 306 of file lmer.c.

References _, and BUF_SIZE.

Referenced by mer_validate(), and merMCMC_validate().

Here is the caller graph for this function:

static R_INLINE int Gp_grp ( int  ind,
int  nf,
const int *  Gp 
) [static]

Return the index of the term associated with parameter index ind.

Parameters:
ind an index in [0, Gp[nf] - 1]
nf total number of terms
Gp group pointers, a vector of length nf+1 with Gp[0] = 0
Returns:
sum of squares

Definition at line 232 of file lmer.c.

References _.

Referenced by theta_S_ind(), Tt_Zt(), and update_A().

Here is the caller graph for this function:

static double lme4_devResid ( const double *  mu,
const double *  pWt,
const double *  y,
int  n,
int  vTyp 
) [static]

Evaluate the sum of the deviance residuals for a GLM family.

Parameters:
mu pointer to the mu vector
pWt pointer to the vector of prior weights (NULL for constant weights)
y pointer to the response vector
n length of mu and y
vTyp type of variance function: the 1-based index into c("constant", "mu(1-mu)", "mu", "mu^2", "mu^3")
Returns:
the sum of the deviance residuals

Definition at line 330 of file lmer.c.

References _, and y_log_y().

Referenced by mer_update_dev().

Here is the call graph for this function:

Here is the caller graph for this function:

static void lme4_muEta ( double *  mu,
double *  muEta,
const double *  eta,
int  n,
int  lTyp 
) [static]

Evaluate the derivative d mu/d eta for the GLM link function of type lTyp.

Parameters:
mu pointer to the mu vector
muEta pointer to the muEta vector
eta pointer to the eta vector
n length of mu, muEta and eta
lTyp type of link: the 1-based index into c("logit", "probit", "cauchit", "cloglog", "identity", "log", "sqrt", "1/mu^2", "inverse")

Definition at line 374 of file lmer.c.

References _, INVEPS, LTHRESH, MLTHRESH, MPTHRESH, and PTHRESH.

Referenced by spR_update_mu(), and update_mu().

Here is the caller graph for this function:

static void lme4_varFunc ( double *  var,
const double *  mu,
int  n,
int  vTyp 
) [static]

Evaluate the GLM variance function of type vTyp given mu.

Parameters:
var pointer to the variance vector
mu pointer to the mu vector
n length of var and mu
vTyp type of variance function: the 1-based index into c("constant", "mu(1-mu)", "mu", "mu^2", "mu^3")

Definition at line 432 of file lmer.c.

References _.

Referenced by spR_update_mu(), and update_mu().

Here is the caller graph for this function:

static double lmm_update_fixef_u ( SEXP  x  )  [static]

Determine the conditional estimates of the fixed effects and the conditional mode of u for a linear mixed model.

Parameters:
x an mer object

Definition at line 977 of file lmer.c.

References _, c, DEV_SLOT, DIMS_SLOT, disc_POS, FIXEF_SLOT, isREML_POS, L_SLOT, ldL2_POS, ldRX2_POS, lmm_update_projection(), ML_POS, MUETA_SLOT, n_POS, p_POS, pwrss_POS, q_POS, REML_POS, RX_SLOT, RZX_SLOT, sigmaML_POS, sigmaREML_POS, sqr_length(), SRWT_SLOT, U_SLOT, usqr_POS, V_SLOT, and wrss_POS.

Referenced by MCMC_beta_u(), mer_MCMCsamp(), and mer_optimize().

Here is the call graph for this function:

Here is the caller graph for this function:

static void lmm_update_projection ( SEXP  x,
double *  pb,
double *  pbeta 
) [static]

Update the projections of the response vector onto the column spaces of the random effects and the fixed effects.

This function is needed separately for the one-argument form of the anova function.

Parameters:
x an mer object
pb position to store the random-effects projection
pbeta position to store the fixed-effects projection

Definition at line 613 of file lmer.c.

References _, A_SLOT, AZERO, c, DEV_SLOT, DIMS_SLOT, L_SLOT, n_POS, p_POS, P_sdmult(), pwrss_POS, q_POS, RX_SLOT, RZX_SLOT, sqr_length(), SXWT_SLOT, X_SLOT, and Y_SLOT.

Referenced by lmm_update_fixef_u(), and mer_update_projection().

Here is the call graph for this function:

Here is the caller graph for this function:

static void MCMC_beta_u ( SEXP  x,
double  sigma,
double *  fvals,
double *  rvals 
) [static]

Update the fixed effects and the orthogonal random effects in an MCMC sample from an mer object.

Parameters:
x an mer object
sigma current standard deviation of the per-observation noise terms.
fvals pointer to memory in which to store the updated beta
rvals pointer to memory in which to store the updated b (may be (double*)NULL)

Definition at line 1139 of file lmer.c.

References _, Alloca, c, DIMS_SLOT, FIXEF_SLOT, L_SLOT, lmm_update_fixef_u(), MUETA_SLOT, p_POS, q_POS, RANEF_SLOT, RX_SLOT, RZX_SLOT, U_SLOT, update_L(), update_mu(), update_ranef(), update_RX(), and V_SLOT.

Referenced by mer_MCMCsamp().

Here is the call graph for this function:

Here is the caller graph for this function:

static void MCMC_S ( SEXP  x,
double  sigma 
) [static]

Update the theta_S parameters from the ST arrays in place.

Parameters:
x an mer object
sigma current standard deviation of the per-observation noise terms.

Definition at line 1202 of file lmer.c.

References _, A_SLOT, Alloca, AZERO, DIMS_SLOT, ETA_SLOT, FIXEF_SLOT, Gp_SLOT, lme4_STSym, n_POS, nf_POS, OFFSET_SLOT, p_POS, PERM_VEC, q_POS, RANEF_SLOT, ST_nc_nlev(), theta_S_ind(), Tt_Zt(), U_SLOT, update_A(), X_SLOT, Y_SLOT, and Zt_SLOT.

Referenced by mer_MCMCsamp().

Here is the call graph for this function:

Here is the caller graph for this function:

static void MCMC_T ( SEXP  x,
double  sigma 
) [static]

Update the theta_T parameters from the ST arrays in place.

Parameters:
x an mer object
sigma current standard deviation of the per-observation noise terms.

Definition at line 1184 of file lmer.c.

References Alloca, DIMS_SLOT, Gp_SLOT, lme4_STSym, nf_POS, and ST_nc_nlev().

Referenced by mer_MCMCsamp().

Here is the call graph for this function:

Here is the caller graph for this function:

SEXP mer_create_L ( SEXP  CmP  ) 

Create and initialize L.

Parameters:
CmP pointer to the model matrix for the orthogonal random effects (transposed)
Returns:
L

Definition at line 1293 of file lmer.c.

References _, and c.

SEXP mer_MCMCsamp ( SEXP  x,
SEXP  fm 
)

Generate a Markov-chain Monte Carlo sample from an mer object.

Parameters:
x pointer to an merMCMC object
fm pointer to an mer object
Returns:
x with samples filled in

Definition at line 1316 of file lmer.c.

References DEV_SLOT, DIMS_SLOT, FIXEF_SLOT, lme4_devianceSym, lme4_sigmaSym, lme4_STSym, lmm_update_fixef_u(), MCMC_beta_u(), MCMC_S(), MCMC_T(), ML_POS, n_POS, np_POS, p_POS, pwrss_POS, q_POS, RANEF_SLOT, SLOT_REAL_NULL(), ST_getPars(), ST_setPars(), update_L(), update_ranef(), update_RX(), and update_u().

Here is the call graph for this function:

SEXP mer_optimize ( SEXP  x,
SEXP  verbp 
)

Optimize the profiled deviance of an lmer object or the Laplace approximation to the deviance of a nlmer or glmer object.

Parameters:
x pointer to an mer object
verbp pointer to indicator of verbose output
Returns:
R_NilValue

Definition at line 1366 of file lmer.c.

References Alloca, cvg_POS, DEV_SLOT, DIMS_SLOT, FIXEF_SLOT, lme4_STSym, lmm_update_fixef_u(), mer_update_dev(), ML_POS, MUETA_SLOT, nf_POS, np_POS, p_POS, ST_getPars(), ST_setPars(), update_L(), update_RX(), update_u(), and V_SLOT.

Here is the call graph for this function:

SEXP mer_postVar ( SEXP  x  ) 

Extract the conditional variances of the random effects in an mer object.

Some people called these posterior variances, hence the name.

Parameters:
x pointer to an mer object
Returns:
pointer to a list of arrays

Definition at line 1434 of file lmer.c.

References Alloca, c, DEV_SLOT, DIMS_SLOT, Gp_SLOT, isREML_POS, L_SLOT, lme4_STSym, nf_POS, q_POS, sigmaML_POS, sigmaREML_POS, ST_nc_nlev(), and useSc_POS.

Here is the call graph for this function:

SEXP mer_ST_chol ( SEXP  x  ) 

Return a list of (upper) Cholesky factors from the ST list.

Parameters:
x an mer object
Returns:
a list of upper Cholesky factors

Definition at line 1495 of file lmer.c.

References Alloca, DIMS_SLOT, Gp_SLOT, lme4_STSym, nf_POS, and ST_nc_nlev().

Here is the call graph for this function:

SEXP mer_ST_getPars ( SEXP  x  ) 

Extract the parameters from the ST slot of an mer object.

Parameters:
x an mer object
Returns:
pointer to a REAL vector

Definition at line 1530 of file lmer.c.

References DIMS_SLOT, np_POS, and ST_getPars().

Here is the call graph for this function:

SEXP mer_ST_initialize ( SEXP  ST,
SEXP  Gpp,
SEXP  Zt 
)

Evaluate starting estimates for the elements of ST.

Parameters:
ST pointers to the nf ST factorizations of the diagonal elements of Sigma
Gpp length nf+1 vector of group pointers for the rows of Zt
Zt transpose of Z matrix

Definition at line 1548 of file lmer.c.

References Alloca, AZERO, lme4_DimSym, lme4_iSym, lme4_pSym, lme4_xSym, and ST_nc_nlev().

Here is the call graph for this function:

SEXP mer_ST_setPars ( SEXP  x,
SEXP  pars 
)

Update the ST slot of an mer object from a REAL vector of parameters and update the sparse model matrix A.

Parameters:
x an mer object
pars a REAL vector of the appropriate length
Returns:
R_NilValue

Definition at line 1584 of file lmer.c.

References _, DIMS_SLOT, np_POS, and ST_setPars().

Here is the call graph for this function:

SEXP mer_update_dev ( SEXP  x  ) 

Evaluate the discrepancy and log of the penalized discrepancy.

update_mu must be called first.

Parameters:
x pointer to an mer object

Definition at line 1601 of file lmer.c.

References DEV_SLOT, DIMS_SLOT, disc_POS, ldL2_POS, lme4_devResid(), ML_POS, MU_SLOT, MUETA_SLOT, n_POS, nAGQ_POS, PWT_SLOT, usqr_POS, vTyp_POS, wrss_POS, and Y_SLOT.

Referenced by mer_optimize().

Here is the call graph for this function:

Here is the caller graph for this function:

SEXP mer_update_L ( SEXP  x  ) 

Externally callable update_L.

Update the A, L, sqrtrWt and resid slots. It is assumed that update_mu has already been called at the current values of u and the model parameters.

Parameters:
x an mer object
Returns:
penalized weighted residual sum of squares

Definition at line 1637 of file lmer.c.

References update_L().

Here is the call graph for this function:

SEXP mer_update_mu ( SEXP  x  ) 

Externally callable update_mu.

Update the eta, v, mu, resid and var slots according to the current values of the parameters and u. Also evaluate d[wrss_POS] using the current contents of sqrtrWt. The sqrtrWt slot is updated in update_L.

Parameters:
x pointer to an mer object
Returns:
penalized, weighted residual sum of squares

Definition at line 1652 of file lmer.c.

References update_mu().

Here is the call graph for this function:

SEXP mer_update_projection ( SEXP  x  ) 

Externally callable lmm_update_projection.

Create the projections onto the column spaces of the random effects and the fixed effects.

Parameters:
x an mer object
Returns:
a list with two elements, both REAL vectors

Definition at line 1682 of file lmer.c.

References DIMS_SLOT, lmm_update_projection(), p_POS, and q_POS.

Here is the call graph for this function:

SEXP mer_update_ranef ( SEXP  x  ) 

Externally callable update_ranef.

Update the contents of the ranef slot in an mer object. For a linear mixed model the conditional estimates of the fixed effects and the conditional mode of u are evaluated first.

Parameters:
x an mer object
Returns:
R_NilValue

Definition at line 1706 of file lmer.c.

References update_ranef().

Here is the call graph for this function:

SEXP mer_update_RX ( SEXP  x  ) 

Externally callable update_RX.

Parameters:
x pointer to an mer object
Returns:
profiled deviance or REML deviance

Definition at line 1720 of file lmer.c.

References update_RX().

Here is the call graph for this function:

SEXP mer_update_u ( SEXP  x,
SEXP  verbP 
)

Externally callable update_u.

Iterate to determine the conditional modes of the random effects.

Parameters:
x pointer to an mer object
verbP scalar integer indicator of verbose output (negative values produce a lot of output)
Returns:
number of iterations to convergence (0 for non-convergence)

Definition at line 1668 of file lmer.c.

References update_u().

Here is the call graph for this function:

SEXP mer_validate ( SEXP  x  ) 

Check validity of an mer object.

Parameters:
x Pointer to an mer object
Returns:
TRUE if the object is a valid mer object, otherwise a string that describes the violation.

Definition at line 1771 of file lmer.c.

References _, A_SLOT, Alloca, BUF_SIZE, chkDims(), chkLen(), cvg_POS, L_SLOT, lme4_devianceSym, lme4_dimsSym, lme4_etaSym, lme4_fixefSym, lme4_flistSym, lme4_GpSym, lme4_muEtaSym, lme4_muSym, lme4_offsetSym, lme4_pWtSym, lme4_ranefSym, lme4_residSym, lme4_RXSym, lme4_RZXSym, lme4_sqrtrWtSym, lme4_STSym, lme4_uSym, lme4_varSym, lme4_VSym, lme4_XSym, lme4_ySym, n_POS, nf_POS, p_POS, q_POS, s_POS, wrss_POS, and Zt_SLOT.

Here is the call graph for this function:

SEXP merMCMC_validate ( SEXP  x  ) 

Check validity of an merMCMC object.

Parameters:
x Pointer to an merMCMC object
Returns:
TRUE if the object is a valid merMCMC object, otherwise a string that describes the violation.

Definition at line 1862 of file lmer.c.

References _, Alloca, BUF_SIZE, chkDims(), chkLen(), cvg_POS, lme4_devianceSym, lme4_dimsSym, lme4_fixefSym, lme4_GpSym, lme4_ncSym, lme4_ranefSym, lme4_sigmaSym, lme4_STSym, nf_POS, np_POS, p_POS, q_POS, and useSc_POS.

Here is the call graph for this function:

SEXP merMCMC_VarCorr ( SEXP  x,
SEXP  typP 
)

Definition at line 1725 of file lmer.c.

References _, Alloca, Gp_SLOT, lme4_sigmaSym, lme4_STSym, and SLOT_REAL_NULL().

Here is the call graph for this function:

static void P_sdmult ( double *  dest,
const int *  perm,
const CHM_SP  A,
const double *  X,
int  nc 
) [static]

Create PAX in dest.

Parameters:
dest values to be calculated
perm NULL or a 0-based permutation vector defining P
A sparse matrix
X dense matrix
nc number of columns in X

Definition at line 478 of file lmer.c.

References Alloca, apply_perm(), and AZERO.

Referenced by lmm_update_projection().

Here is the call graph for this function:

Here is the caller graph for this function:

static R_INLINE double* SLOT_REAL_NULL ( SEXP  obj,
SEXP  nm 
) [static]

Extract the slot named nm from the object obj and return a null pointer if the slot has length 0 or a pointer to the REAL contents.

Parameters:
obj pointer to an S4 object
nm pointer to a symbol naming the slot to extract
Returns:
pointer to the REAL contents, if nonzero length, otherwise a NULL pointer

Definition at line 80 of file lmer.c.

Referenced by mer_MCMCsamp(), and merMCMC_VarCorr().

Here is the caller graph for this function:

SEXP spR_optimize ( SEXP  x,
SEXP  verbP 
)

Optimize the log-likelihood for the sparse representation of a Rasch model.

Parameters:
x pointer to a sparseRasch object
verbP pointer to indicator of verbose output
Returns:
R_NilValue

Definition at line 1944 of file lmer.c.

References _, apply_perm(), c, CM_MAXITER, CM_SMIN, CM_TOL, DEV_SLOT, FIXEF_SLOT, L_SLOT, MU_SLOT, MUETA_SLOT, PWT_SLOT, RESID_SLOT, spR_update_mu(), sqr_length(), SRWT_SLOT, VAR_SLOT, wrss_POS, Y_SLOT, and Zt_SLOT.

Here is the call graph for this function:

SEXP spR_update_mu ( SEXP  x  ) 

Update the eta, mu, resid and var slots in a sparseRasch object from the current values of the model parameters in the beta slot.

Parameters:
x pointer to an sparseRasch object
Returns:
R_NilValue

Definition at line 1905 of file lmer.c.

References _, c, DEV_SLOT, DIMS_SLOT, lme4_fixefSym, lme4_muEta(), lme4_varFunc(), lTyp_POS, MU_SLOT, MUETA_SLOT, n_POS, OFFSET_SLOT, RESID_SLOT, SRWT_SLOT, VAR_SLOT, vTyp_POS, wrss_POS, Y_SLOT, and Zt_SLOT.

Referenced by spR_optimize().

Here is the call graph for this function:

Here is the caller graph for this function:

static R_INLINE double sqr_length ( const double *  x,
int  n 
) [static]

Return the sum of squares of the first n elements of x.

Parameters:
n 
x 
Returns:
sum of squares

Definition at line 247 of file lmer.c.

Referenced by lmm_update_fixef_u(), lmm_update_projection(), spR_optimize(), update_L(), update_mu(), and update_u().

Here is the caller graph for this function:

static double* ST_getPars ( SEXP  x,
double *  pars 
) [static]

Extract the parameters from ST list.

Parameters:
x an mer object
pars vector of the appropriate length
Returns:
pointer to the parameter vector

Definition at line 503 of file lmer.c.

References lme4_STSym.

Referenced by mer_MCMCsamp(), mer_optimize(), and mer_ST_getPars().

Here is the caller graph for this function:

static int ST_nc_nlev ( const SEXP  ST,
const int *  Gp,
double **  st,
int *  nc,
int *  nlev 
) [static]

Populate the st, nc and nlev arrays.

Return the maximum element of nc.

Parameters:
ST pointer to a list (length nf) of matrices
Gp group pointers (length nf + 1)
st length nf array of (double*) pointers to be filled with pointers to the contents of the matrices in ST. Not used if NULL.
nc length nf array to be filled with the number of columns
nlev length nf array to be filled with the number of levels of the grouping factor for each term
Returns:
maximum element of nc

Definition at line 536 of file lmer.c.

Referenced by MCMC_S(), MCMC_T(), mer_postVar(), mer_ST_chol(), mer_ST_initialize(), ST_setPars(), update_A(), and update_ranef().

Here is the caller graph for this function:

static void ST_setPars ( SEXP  x,
const double *  pars 
) [static]

Update the ST and A slots of an mer object.

Parameters:
x an mer object
pars double vector of the appropriate length

Definition at line 1024 of file lmer.c.

References Alloca, DIMS_SLOT, Gp_SLOT, lme4_STSym, nf_POS, ST_nc_nlev(), and update_A().

Referenced by mer_MCMCsamp(), mer_optimize(), and mer_ST_setPars().

Here is the call graph for this function:

Here is the caller graph for this function:

static R_INLINE int theta_S_ind ( int  i,
int  nf,
int *  Gp,
int *  nlev,
int *  spt 
) [static]

Determine the index in theta_S corresponding to index i in the u vector.

Parameters:
i index in u vector (0 <= i < q)
nf number of random effects terms in the model
Gp vector of group pointers into u (length nf + 1, Gp[0] == 0)
nlev vector of length nf giving the number of levels per term
spt vector of group pointers into theta_S (length nf + 1, spt[0] == 0)

Definition at line 564 of file lmer.c.

References Gp_grp().

Referenced by MCMC_S().

Here is the call graph for this function:

Here is the caller graph for this function:

static void Tt_Zt ( CHM_SP  A,
int *  Gp,
int *  nc,
int *  nlev,
double **  st,
int  nf 
) [static]

Multiply A on the left by T'.

Parameters:
A sparse model matrix
Gp group pointers
nc number of columns per term
nlev number of levels per term
st ST arrays for each term
nf number of terms

Definition at line 581 of file lmer.c.

References Gp_grp().

Referenced by MCMC_S(), and update_A().

Here is the call graph for this function:

Here is the caller graph for this function:

static void update_A ( SEXP  x  )  [static]

Evaluate the sparse model matrix A from the Zt and ST slots.

Parameters:
x an mer object

Definition at line 664 of file lmer.c.

References _, A_SLOT, Alloca, AZERO, DIMS_SLOT, Gp_grp(), Gp_SLOT, lme4_STSym, nf_POS, ST_nc_nlev(), Tt_Zt(), and Zt_SLOT.

Referenced by MCMC_S(), and ST_setPars().

Here is the call graph for this function:

Here is the caller graph for this function:

static double update_L ( SEXP  x  )  [static]

Update the L, sqrtrWt and resid slots.

It is assumed that update_mu has already been called at the current values of u and the model parameters and that A has been updated.

Parameters:
x pointer to an mer object
Returns:
penalized weighted residual sum of squares

Definition at line 711 of file lmer.c.

References _, A_SLOT, AZERO, c, Cm_SLOT, Cx_SLOT, DEV_SLOT, DIMS_SLOT, L_SLOT, ldL2_POS, MU_SLOT, MUETA_SLOT, n_POS, p_POS, pwrss_POS, PWT_SLOT, RESID_SLOT, s_POS, sigmaML_POS, sigmaREML_POS, sqr_length(), SRWT_SLOT, SXWT_SLOT, usqr_POS, V_SLOT, VAR_SLOT, wrss_POS, and Y_SLOT.

Referenced by MCMC_beta_u(), mer_MCMCsamp(), mer_optimize(), mer_update_L(), and update_u().

Here is the call graph for this function:

Here is the caller graph for this function:

static double update_mu ( SEXP  x  )  [static]

Update the eta, v, mu, resid and var slots according to the current values of the parameters and u.

Also evaluate d[wrss_POS] using the current sqrtrWt slot. The sqrtrWt slot is changed in update_L.

Parameters:
x pointer to an mer object
Returns:
penalized, weighted residual sum of squares

Definition at line 791 of file lmer.c.

References _, A_SLOT, c, DEV_SLOT, DIMS_SLOT, ETA_SLOT, FIXEF_SLOT, L_SLOT, lme4_envSym, lme4_gradientSym, lme4_muEta(), lme4_nlmodelSym, lme4_uSym, lme4_varFunc(), lme4_VSym, lTyp_POS, MU_SLOT, MUETA_SLOT, n_POS, OFFSET_SLOT, p_POS, pwrss_POS, q_POS, RESID_SLOT, s_POS, sigmaML_POS, sigmaREML_POS, sqr_length(), SRWT_SLOT, usqr_POS, V_SLOT, VAR_SLOT, vTyp_POS, wrss_POS, X_SLOT, and Y_SLOT.

Referenced by MCMC_beta_u(), mer_update_mu(), and update_u().

Here is the call graph for this function:

Here is the caller graph for this function:

static void update_ranef ( SEXP  x  )  [static]

Update the contents of the ranef slot in an mer object using the current contents of the u and ST slots.

b = T *% S *% t(P) *% u

Parameters:
x an mer object

Definition at line 887 of file lmer.c.

References Alloca, DIMS_SLOT, Gp_SLOT, lme4_STSym, nf_POS, PERM_VEC, q_POS, RANEF_SLOT, ST_nc_nlev(), and U_SLOT.

Referenced by MCMC_beta_u(), mer_MCMCsamp(), and mer_update_ranef().

Here is the call graph for this function:

Here is the caller graph for this function:

static double update_RX ( SEXP  x  )  [static]

Update the RZX and RX slots in an mer object.

update_L should be called before update_RX

Parameters:
x pointer to an mer object
Returns:
profiled deviance or REML deviance

Definition at line 920 of file lmer.c.

References A_SLOT, AZERO, Cm_SLOT, Cx_SLOT, DEV_SLOT, DIMS_SLOT, L_SLOT, n_POS, p_POS, q_POS, RX_SLOT, RZX_SLOT, s_POS, SXWT_SLOT, and X_SLOT.

Referenced by MCMC_beta_u(), mer_MCMCsamp(), mer_optimize(), and mer_update_RX().

Here is the caller graph for this function:

static int update_u ( SEXP  x,
int  verb 
) [static]

Iterate to determine the conditional modes of the random effects.

Parameters:
x pointer to an mer object
verb indicator of verbose iterations (negative values produce a lot of output)
Returns:
number of iterations to convergence (0 for non-convergence)

Definition at line 1055 of file lmer.c.

References _, A_SLOT, Alloca, apply_perm(), AZERO, c, CM_MAXITER, Cm_SLOT, CM_SMIN, CM_TOL, Cx_SLOT, DIMS_SLOT, L_SLOT, n_POS, q_POS, RESID_SLOT, sqr_length(), SXWT_SLOT, U_SLOT, update_L(), and update_mu().

Referenced by mer_MCMCsamp(), mer_optimize(), and mer_update_u().

Here is the call graph for this function:

Here is the caller graph for this function:

static R_INLINE double y_log_y ( double  y,
double  mu 
) [static]

Evaluate y * log(y/mu) with the correct limiting value at y = 0.

Parameters:
y 
mu 
Returns:
y * log(y/mu) for y > 0, 0 for y == 0.

Definition at line 263 of file lmer.c.

Referenced by lme4_devResid().

Here is the caller graph for this function:


Variable Documentation

cholmod_common c

cholmod_common struct initialized in R_init_lme4

Definition at line 37 of file init.c.

Referenced by lmm_update_fixef_u(), lmm_update_projection(), MCMC_beta_u(), mer_create_L(), mer_postVar(), spR_optimize(), spR_update_mu(), update_L(), update_mu(), and update_u().

const double INVEPS = 1/DOUBLE_EPS [static]

Definition at line 199 of file lmer.c.

Referenced by lme4_muEta().

double MPTHRESH = 0 [static]

Definition at line 197 of file lmer.c.

Referenced by lme4_muEta().

double PTHRESH = 0 [static]

Definition at line 198 of file lmer.c.

Referenced by lme4_muEta().


Generated on Wed Jul 9 15:07:55 2008 for lme4 by  doxygen 1.4.7