compute_PLN_starting_point: Helper function for PLN initialization.

View source: R/utils.R

compute_PLN_starting_pointR Documentation

Helper function for PLN initialization.

Description

Barebone function to compute starting points for B, M and S when fitting a PLN. Mostly intended for internal use.

Usage

compute_PLN_starting_point(Y, X, O, w, s = 0.1)

Arguments

Y

Response count matrix

X

Covariate matrix

O

Offset matrix (in log-scale)

w

Weight vector (defaults to 1)

s

Scale parameter for S (defaults to 0.1)

Details

The default strategy to estimate B and M is to fit a linear model with covariates X to the response count matrix (after adding a pseudocount of 1, scaling by the offset and taking the log). The regression matrix is used to initialize B and the residuals to initialize M. S is initialized as a constant conformable matrix with value s.

Value

a named list of starting values for model parameter B and variational parameters M and S used in the iterative optimization algorithm of PLN()

Examples

## Not run: 
data(barents)
Y <- barents$Abundance
X <- model.matrix(Abundance ~ Latitude + Longitude + Depth + Temperature, data = barents)
O <- log(barents$Offset)
w <-- rep(1, nrow(Y))
compute_PLN_starting_point(Y, X, O, w)

## End(Not run)


PLN-team/PLNmodels documentation built on Oct. 13, 2024, 4:01 a.m.