Select the lcModel with the highest metric value

# S3 method for class 'lcModels'
max(x, name, ...)

Arguments

x

The lcModels object.

name

The name of the internal metric.

...

Additional arguments.

Value

The lcModel with the highest metric value

Functionality

Examples

data(latrendData)
method <- lcMethodLMKM(Y ~ Time, id = "Id", time = "Time")

model1 <- latrend(method, latrendData, nClusters = 1)
model2 <- latrend(method, latrendData, nClusters = 2)
model3 <- latrend(method, latrendData, nClusters = 3)

models <- lcModels(model1, model2, model3)

if (require("clusterCrit")) {
  max(models, "Dunn")
}
#> Loading required package: clusterCrit
#> Longitudinal cluster model using lmkm
#> lcMethodLMKM specifying "lm-kmeans"
#>  time:           "Time"
#>  id:             "Id"
#>  nClusters:      2
#>  center:         function (x) {    mean(x, na.rm = TRUE)}
#>  standardize:    `scale`
#>  method:         "qr"
#>  model:          TRUE
#>  y:              FALSE
#>  qr:             TRUE
#>  singular.ok:    TRUE
#>  contrasts:      NULL
#>  iter.max:       10
#>  nstart:         1
#>  algorithm:      `c("Hartigan-Wong", "Lloyd", "Forgy", "M
#>  formula:        Y ~ Time
#> 
#> Cluster sizes (K=2):
#>         A         B 
#>  80 (40%) 120 (60%) 
#> 
#> Number of obs: 2000, strata (Id): 200
#> 
#> Scaled residuals:
#>     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
#> -3.57615 -0.62971  0.05638  0.00000  0.65400  3.20251 
#>