fitPLGlmm: GLMM parameter estimation using pseudo-likelihood

View source: R/RcppExports.R

fitPLGlmmR Documentation

GLMM parameter estimation using pseudo-likelihood

Description

Iteratively estimate GLMM fixed and random effect parameters, and variance component parameters using Fisher scoring based on the Pseudo-likelihood approximation to a Normal loglihood.

Usage

fitPLGlmm(
  Z,
  X,
  muvec,
  offsets,
  curr_beta,
  curr_theta,
  curr_u,
  curr_sigma,
  curr_G,
  y,
  u_indices,
  theta_conv,
  rlevels,
  curr_disp,
  REML,
  maxit,
  solver,
  vardist
)

Arguments

Z

mat - sparse matrix that maps random effect variable levels to observations

X

mat - sparse matrix that maps fixed effect variables to observations

muvec

vec vector of estimated phenotype means

offsets

vec vector of model offsets

curr_beta

vec vector of initial beta estimates

curr_theta

vec vector of initial parameter estimates

curr_u

vec of initial u estimates

curr_sigma

vec of initial sigma estimates

curr_G

mat c X c matrix of variance components

y

vec of observed counts

u_indices

List a List, each element contains the indices of Z relevant to each RE and all its levels

theta_conv

double Convergence tolerance for paramter estimates

rlevels

List containing mapping of RE variables to individual levels

curr_disp

double Dispersion parameter estimate

REML

bool - use REML for variance component estimation

maxit

int maximum number of iterations if theta_conv is FALSE

solver

string which solver to use - either HE (Haseman-Elston regression) or Fisher scoring

vardist

string which variance form to use NB = negative binomial, P=Poisson [not yet implemented.]

Details

Fit a NB-GLMM to the counts provided in y. The model uses an iterative approach that switches between the joint fixed and random effect parameter inference, and the variance component estimation. A pseudo-likelihood approach is adopted to minimise the log-likelihood of the model given the parameter estimates. The fixed and random effect parameters are estimated using Hendersons mixed model equations, and the variance component parameters are then estimated with the specified solver, i.e. Fisher scoring, Haseman-Elston or constrained Haseman-Elston regression. As the domain of the variance components is [0, +Inf], any negative variance component estimates will trigger the switch to the HE-NNLS solver until the model converges.

Value

A list containing the following elements (note: return types are dictated by Rcpp, so the R types are described here):

FE:

numeric vector of fixed effect parameter estimates.

RE:

list of the same length as the number of random effect variables. Each slot contains the best linear unbiased predictors (BLUPs) for the levels of the corresponding RE variable.

Sigma:

numeric vector of variance component estimates, 1 per random effect variable.

converged:

logical scalar of whether the model has reached the convergence tolerance or not.

Iters:

numeric scalar with the number of iterations that the model ran for. Is strictly <= max.iter.

Dispersion:

numeric scalar of the dispersion estimate computed off-line

Hessian:

matrix of 2nd derivative elements from the fixed and random effect parameter inference.

SE:

matrix of standard error estimates, derived from the hessian, i.e. the square roots of the diagonal elements.

t:

numeric vector containing the compute t-score for each fixed effect variable.

COEFF:

matrix containing the coefficient matrix from the mixed model equations.

P:

matrix containing the elements of the REML projection matrix.

Vpartial:

list containing the partial derivatives of the (pseudo)variance matrix with respect to each variance component.

Ginv:

matrix of the inverse variance components broadcast to the full Z matrix.

Vsinv:

matrix of the inverse pseudovariance.

Winv:

matrix of the inverse elements of W = D^-1 V D^-1

VCOV:

matrix of the variance-covariance for all model fixed and random effect variable parameter estimates. This is required to compute the degrees of freedom for the fixed effect parameter inference.

CONVLIST:

list of list containing the parameter estimates and differences between current and previous iteration estimates at each model iteration. These are included for each fixed effect, random effect and variance component parameter. The list elements for each iteration are: ThetaDiff, SigmaDiff, beta, u, sigma.

Author(s)

Mike Morgan

Examples

NULL


MarioniLab/miloR documentation built on Oct. 18, 2024, 6:04 p.m.