Learn R Programming

MRIaggr (version 1.1.5)

fMMalgo: finite Mixture Model with spatial regularization

Description

Estimate a finite mixture model with glm-response model, possible concomittant model, two-level spatial regularization and Growing Region step.

Usage

fMMalgo(M, G, data, Id=NULL, Wweight_SR=NULL, Wdist_LR=NULL, posterior_proba=NULL,
         formula_reg, offset_reg=NULL, family=gaussian(link="identity"), prior_theta="kmeans", prior_sigma=NULL,
         formula_group=NULL, prior_prevalence=FALSE, prior_proba=NULL,
         test.GR=FALSE, sigma_GR="auto", proba_GR=NULL, proba_GRseed=NULL, seed=NULL, n.order=3,
         test.ICM=FALSE, rho_ICM="init", G_ICM=1:G, prior_prevalenceICM=TRUE, rho_max=10, update_rho=FALSE,                            
         test.ICMregional=FALSE, coords=NULL, nbGroup_min=100, threshold_potential=0.1, distance_ref=NULL,
         multiV=FALSE, digit.pmin=7, epsilon=10^(-3), epsilon_corrSpat=epsilon*10, iter_max=100,
         trace=TRUE, trace_iter=FALSE, trace_radius=FALSE, export.predicteur=FALSE)

Arguments

M
The number of responses variable. integer.
G
The number of groups to be considered for the mixture. integer.
data
A dataframe containing the data. data.frame[n,p].
Id
The identifier of the images to segment. character vector[n]. Default is NULL indicating a unique identifier for all voxels.
Wweight_SR
The local neighborhood matrix. dgCMatrix[n,n]. Should be normalized by row (i.e. rowSums(Wweight_SR)=1). Only used if test.GR or test.ICM is true.
Wdist_LR
The regional neighborhood matrix. dgCMatrix[n,n]. Should contain the distances between the observations (0 indicating infinite distance). Only used if both test.ICM and test.ICMregional are true
formula_reg
A list of formula corresponding to the reponse model of each group for each response variable. list[[M]][[G]].
offset_reg
A list of offset corresponding to each reponse model. list[[M]][n,G]. Default is NULL indicating no offset.
family
A list of families corresponding to the response model of each group for each response variable. list[[M]][[G]].
prior_theta
Initialisation of the means of each group means by random sampling (NULL), kmeans ("kmeans") or user defined values (list[[M]][G]).
prior_sigma
Initialisation of the standard deviation of each group by dividing the total variance by G (NULL), by the standard deviation of the kmeans groups ("kmeans") or by user defined values (list[[M]][G]).
posterior_proba
Initialisation of the posterior membership probabilities to user defined values (matrix[n,g]). Ignored if NULL.
formula_group
A formula for the concomitant model (formula). Else (NULL) indicates no concomittant model.
prior_prevalence
Should a prior based on the prevalence of each group be used ? logical.
prior_proba
Initialisation of the prior membership probabilities to user defined values (matrix[n,g]) or to uninformative values (NULL).
test.GR
Should Growing Region algorithm be performed ? logical.
sigma_GR
Maximum variance of the Growing Region. Can be set to a user defined value (numeric) or estimated by the variance of group G ("auto").
proba_GRseed
Seeds with group probability membership below proba_GRseed are excluded from the initialisation step of the GR algorithm. numeric. Ignored if NULL.
proba_GR
Minimum probability membership to group G required for an observation to be a candidate for the GR. numeric. Ignored if NULL.
seed
(T/F) or (1/0) indicating the seeds to be used in the GR algorithm. logical vector[n]]. Can alternatively contains the name of a column in data (character).
n.order
The penalization for the voxels outside the lesion group defined by the growing region algorithm (bandwith of the gaussian kernel). numeric. Default is 3.
test.ICM
Should local/regional regularization be performed ? logical.
rho_ICM
Value of the spatial regularisation parameters : can be fixed a priori (numeric if test.ICMregional=F and numeric vector[2] if test.ICMregional=T) or estimated ("init").
G_ICM
Potential group merging for the regularization step (interger[G]) where each element must be inferior or equal to G.
prior_prevalenceICM
Should a prior based on the prevalence of each group be used for estimation of the regularization paramters ? logical. Default is FALSE.
rho_max
Maximum possible rho value (numeric), minimum is 0. Only used if rho_ICM="init".
update_rho
Should rho be re-estimated using the posterior probabilites at each step ? logical.
test.ICMregional
Should regional regularization be performed ? logical. test.ICM must be also T to be active.
coords
Coordinates (matrix[n,.]) or the name of columns in data (character vector[.]) giving the observation coordinates.
nbGroup_min
The minimum group size of the spatial groups required for performing regional regularization. integer. Default is 100.
threshold_potential
The minimum value of the posterior probability for group G for being considered as lesioned when forming the spatial groups. numeric.
distance_ref
The distance defining the several neighborhood orders relatively to Wdist_LR. numeric vector[.].
multiV
Should the regional potential range be specific to each spatial group ? logical. Default is FALSE.
digit.pmin
Below 10^{-digit.pmin} the posterior probability is set to 0. integer
epsilon
Convergence occurs when the relative variation of the log-likelihood or of the parameter values between two iterations is below epsilon. numeric
epsilon_corrSpat
Spatial regularization begins when the relative variation of the log-likelihood or of the parameter values between two iterations is below epsilon_corrSpat. numeric.
iter_max
Maximum number of EM iterations. integer. Default is 100.
trace
Should initialisation and final EM estimations be displayed ? logical. Default is TRUE.
trace_iter
Should estimations be displayed at each EM iteration ? logical. Default is FALSE.
trace_radius
Should the radius of the spatial groups be displayed at each EM iteration ? logical. Default is FALSE.
export.predicteur
Should the fitted glm models be exported or only their summary ? logical. Default is FALSE.

Value

  • A list containing :
  • Ya data.frame containing the response variables.
  • Ida data.frame containing, if any the coordinates of the observations.
  • thetaa list containing the estimated regressors of the response models.
  • sigmaa list containing the estimated dispersion coefficient of the response models.
  • rega list containing the adjusted response ($Y) and concomittant ($groupe) models.
  • betaa vector containing the estimated regressors of the concomittant models.
  • rho_ICMif any, a vector containing the regularization parameters.
  • posterior_probaa matrix containing the posterior probabilities of the observations.
  • prior_probaa matrix containing the prior probabilities of the observations.
  • proba_priorRegif any, a matrix containing the spatial prior probabilities of the observations.
  • radiusif any, a vector indicating the radius of the spatial groups of group G.
  • groupa list indicating for each group the most probable index of observations that belong to the group.
  • familya list containing the family used in the response models.
  • critere_cva list containing the convergence criteria.
  • cva logical indicating whether convergence occured.
  • tpsa list indicating the time at which the algorithm started and stopped.

Details

If a formula formula_group must not contains any response variable (i.e. must be of the form ~ X1 + X2). If formula_group is NULL, prior_prevalence is useless. If posterior_proba is specified, other initialisation variables (prior_theta, prior_sigma, prior_proba) are useless. Growing region algorithm is performed considering only group G. Pixels that are not included in the result of the growing region algorithm have their probability of belonging to group G lowered using a gaussian kernel. G_ICM indicates the groups used in the regularization step. Default is 1:G which indicates no group merging. For G=4, G_ICM = c(1,2,2,3) indicates to merge groups 2 and 3 (i.e. to sum the associated probabilites) in the regularization step. This function require the following packages : Matrix, nnet and Rcpp, RcppArmadillo in case of spatial regularization.

See Also

launcher_fMM a more user frendly interface to fMMalgo, plotCv_fMM to plot the convergence criteria, plotProba_fMM to display the prior or the posterior distirbution, plotY_fMM to display the fitted mixture distribution, calcW_fMM to compute the neighborhood matrix, rhoMF to estimate the regularization parameters on external data.

Examples

Run this code
# see launcher_fMM

Run the code above in your browser using DataLab