R: An R6 Class to represent a collection of PLNmixturefit

PLNmixturefamily {PLNmodels} | R Documentation

## An R6 Class to represent a collection of PLNmixturefit

### Description

The function `PLNmixture()` produces an instance of this class.

This class comes with a set of methods, some of them being useful for the user: See the documentation for `getBestModel()`, `getModel()` and `plot()`.

### Super class

`PLNmodels::PLNfamily` -> `PLNmixturefamily`

### Active bindings

`clusters`

  vector indicating the number of clusters considered is the successively fitted models

### Methods

#### Public methods

- `PLNmixturefamily$new()`

- `PLNmixturefamily$optimize()`

- `PLNmixturefamily$smooth()`

- `PLNmixturefamily$plot()`

- `PLNmixturefamily$plot_objective()`

- `PLNmixturefamily$getBestModel()`

- `PLNmixturefamily$show()`

- `PLNmixturefamily$print()`

- `PLNmixturefamily$clone()`

Inherited methods

- `PLNmodels::PLNfamily$getModel()`

- `PLNmodels::PLNfamily$postTreatment()`

#### Method `new()`

Initialize all models in the collection.

##### Usage

    PLNmixturefamily$new(
      clusters,
      responses,
      covariates,
      offsets,
      formula,
      xlevels,
      control
    )

##### Arguments

`clusters`

  the dimensions of the successively fitted models

`responses`

  the matrix of responses common to every models

`covariates`

  the matrix of covariates common to every models

`offsets`

  the matrix of offsets common to every models

`formula`

  model formula used for fitting, extracted from the formula in the upper-level call

`xlevels`

  named listed of factor levels included in the models, extracted from the formula in the upper-level call #'

`control`

  a list for controlling the optimization. See details.

`control`

  a list for controlling the optimization. See details.

#### Method `optimize()`

Call to the optimizer on all models of the collection

##### Usage

    PLNmixturefamily$optimize(control)

##### Arguments

`control`

  a list for controlling the optimization. See details.

`control`

  a list for controlling the optimization. See details.

#### Method `smooth()`

function to restart clustering to avoid local minima by smoothing the loglikelihood values as a function of the number of clusters

##### Usage

    PLNmixturefamily$smooth(control)

##### Arguments

`control`

  a list to control the smoothing process

#### Method `plot()`

Lineplot of selected criteria for all models in the collection

##### Usage

    PLNmixturefamily$plot(criteria = c("loglik", "BIC", "ICL"), reverse = FALSE)

##### Arguments

`criteria`

  A valid model selection criteria for the collection of models. Any of "loglik", "BIC" or "ICL" (all).

`reverse`

  A logical indicating whether to plot the value of the criteria in the "natural" direction (loglik - 0.5 penalty) or in the "reverse" direction (-2 loglik + penalty). Default to FALSE, i.e use the natural direction, on the same scale as the log-likelihood..

##### Returns

A `ggplot2` object

#### Method `plot_objective()`

Plot objective value of the optimization problem along the penalty path

##### Usage

    PLNmixturefamily$plot_objective()

##### Returns

a `ggplot` graph

#### Method `getBestModel()`

Extract best model in the collection

##### Usage

    PLNmixturefamily$getBestModel(crit = c("BIC", "ICL", "loglik"))

##### Arguments

`crit`

  a character for the criterion used to performed the selection. Either "BIC", "ICL" or "loglik". Default is `ICL`

##### Returns

a `PLNmixturefit` object

#### Method `show()`

User friendly print method

##### Usage

    PLNmixturefamily$show()

#### Method `print()`

User friendly print method

##### Usage

    PLNmixturefamily$print()

#### Method `clone()`

The objects of this class are cloneable with this method.

##### Usage

    PLNmixturefamily$clone(deep = FALSE)

##### Arguments

`deep`

  Whether to make a deep clone.

### See Also

The function `PLNmixture`, the class `PLNmixturefit`

[Package PLNmodels version 0.11.6 Index]