Select the lcModel with the highest metric value
# S3 method for class 'lcModels'
max(x, name, ...)
The lcModel with the highest metric value
Print an argument summary for each of the models.
Convert to a data.frame
of method arguments.
Subset the list.
Compute an internal metric or external metric.
Obtain the best model according to minimizing or maximizing a metric.
Obtain the summed estimation time.
Plot a metric across a variable.
Other lcModels functions:
as.lcModels()
,
lcModels
,
lcModels-class
,
min.lcModels()
,
plotMetric()
,
print.lcModels()
,
subset.lcModels()
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
#>