Select the lcModel with the lowest metric value
# S3 method for lcModels
min(x, name, ...)
The lcModels
object
The name of the internal metric.
Additional arguments.
The lcModel with the lowest 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
,
max.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)
min(models, "WMAE")
#> Longitudinal cluster model using lmkm
#> lcMethodLMKM specifying "lm-kmeans"
#> time: "Time"
#> id: "Id"
#> nClusters: 3
#> 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=3):
#> A B C
#> 50 (25%) 72 (36%) 78 (39%)
#>
#> Number of obs: 2000, strata (Id): 200
#>
#> Scaled residuals:
#> Min. 1st Qu. Median Mean 3rd Qu. Max.
#> -3.55483 -0.55670 -0.04454 0.00000 0.59256 5.41874
#>