Documentation for ‘sibreg’ module¶
Documentation for the sibreg model class.
-
class
sibreg.
model
(y, X, labels)[source]¶ Define a linear model with within-class correlations.
Parameters: - y :
array
1D array of phenotype observations
- X :
array
Design matrix for the fixed mean effects.
- labels :
array
1D array of sample labels
Returns: - model :
sibreg.model
Methods
alpha_mle
(self, tau[, sigma2, compute_cov])Compute the MLE of alpha given variance parameters likelihood_and_gradient
(self, sigma2, tau)Compute the loss function, which is -2 times the likelihood along with its gradient optimize_model
(self, init_params)Find the parameters that minimise the loss function for a given regularisation parameter predict
(self, X)Predict new observations based on model regression coefficients set_alpha -
alpha_mle
(self, tau, sigma2=nan, compute_cov=False)[source]¶ Compute the MLE of alpha given variance parameters
Parameters: Returns: - alpha :
array
MLE of alpha
- alpha :
-
likelihood_and_gradient
(self, sigma2, tau)[source]¶ Compute the loss function, which is -2 times the likelihood along with its gradient
Parameters: Returns: - L, grad :
float
loss function and gradient, divided by sample size
- L, grad :
-
optimize_model
(self, init_params)[source]¶ Find the parameters that minimise the loss function for a given regularisation parameter
Parameters: - init_param :
array
initial values for residual variance (sigma^2_epsilon) followed by ratio of residual variance to within-class variance (tau)
Returns: - optim :
dict
dictionary with keys: ‘success’, whether optimisation was successful (bool); ‘warnflag’, output of L-BFGS-B algorithm giving warnings; ‘sigma2’, MLE of residual variance; ‘tau’, MLE of ratio of residual variance to within-class variance; ‘likelihood’, maximum of likelihood.
- init_param :
- y :