| PLNfit_fixedcov {PLNmodels} | R Documentation |
An R6 Class to represent a PLNfit in a standard, general framework, with fixed (inverse) residual covariance
Description
An R6 Class to represent a PLNfit in a standard, general framework, with fixed (inverse) residual covariance
An R6 Class to represent a PLNfit in a standard, general framework, with fixed (inverse) residual covariance
Super class
PLNmodels::PLNfit -> PLNfit_fixedcov
Active bindings
nb_paramnumber of parameters in the current PLN model
vcov_modelcharacter: the model used for the residual covariance
vcov_coefmatrix of sandwich estimator of the variance-covariance of B (needs known covariance at the moment)
Methods
Public methods
Inherited methods
Method new()
Initialize a PLNfit model
Usage
PLNfit_fixedcov$new(responses, covariates, offsets, weights, formula, control)
Arguments
responsesthe matrix of responses (called Y in the model). Will usually be extracted from the corresponding field in PLNfamily-class
covariatesdesign matrix (called X in the model). Will usually be extracted from the corresponding field in PLNfamily-class
offsetsoffset matrix (called O in the model). Will usually be extracted from the corresponding field in PLNfamily-class
weightsan optional vector of observation weights to be used in the fitting process.
formulamodel formula used for fitting, extracted from the formula in the upper-level call
controla list for controlling the optimization. See details.
Method optimize()
Call to the NLopt or TORCH optimizer and update of the relevant fields
Usage
PLNfit_fixedcov$optimize(responses, covariates, offsets, weights, config)
Arguments
responsesthe matrix of responses (called Y in the model). Will usually be extracted from the corresponding field in PLNfamily-class
covariatesdesign matrix (called X in the model). Will usually be extracted from the corresponding field in PLNfamily-class
offsetsoffset matrix (called O in the model). Will usually be extracted from the corresponding field in PLNfamily-class
weightsan optional vector of observation weights to be used in the fitting process.
configpart of the
controlargument which configures the optimizer
Method postTreatment()
Update R2, fisher and std_err fields after optimization
Usage
PLNfit_fixedcov$postTreatment( responses, covariates, offsets, weights = rep(1, nrow(responses)), config_post, config_optim, nullModel = NULL )
Arguments
responsesthe matrix of responses (called Y in the model). Will usually be extracted from the corresponding field in PLNfamily-class
covariatesdesign matrix (called X in the model). Will usually be extracted from the corresponding field in PLNfamily-class
offsetsoffset matrix (called O in the model). Will usually be extracted from the corresponding field in PLNfamily-class
weightsan optional vector of observation weights to be used in the fitting process.
config_posta list for controlling the post-treatments (optional bootstrap, jackknife, R2, etc.). See details
config_optima list for controlling the optimization parameter. See details
nullModelnull model used for approximate R2 computations. Defaults to a GLM model with same design matrix but not latent variable.
Details
The list of parameters config controls the post-treatment processing, with the following entries:
trace integer for verbosity. should be > 1 to see output in post-treatments
jackknife boolean indicating whether jackknife should be performed to evaluate bias and variance of the model parameters. Default is FALSE.
bootstrap integer indicating the number of bootstrap resamples generated to evaluate the variance of the model parameters. Default is 0 (inactivated).
variational_var boolean indicating whether variational Fisher information matrix should be computed to estimate the variance of the model parameters (highly underestimated). Default is FALSE.
rsquared boolean indicating whether approximation of R2 based on deviance should be computed. Default is TRUE
Method clone()
The objects of this class are cloneable with this method.
Usage
PLNfit_fixedcov$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Examples
## Not run:
data(trichoptera)
trichoptera <- prepare_data(trichoptera$Abundance, trichoptera$Covariate)
myPLN <- PLN(Abundance ~ 1, data = trichoptera)
class(myPLN)
print(myPLN)
## End(Not run)