Description Usage Arguments Value Author(s) Examples
Function for grouping regression curves, given a number k, based on the k-means or k-medians algorithm.
1 | kregcurves(y, x, z, k, kbin = 50, h = -1, algorithm = "kmeans", seed = NULL)
|
y |
Response variable. |
x |
Dependent variable. |
z |
Categorical variable indicating the population to which the observations belongs. |
k |
An integer specifying the number of groups of curves to be performed. |
kbin |
Size of the grid over which the survival functions are to be estimated. |
h |
The kernel bandwidth smoothing parameter. |
algorithm |
A character string specifying which clustering algorithm is used,
i.e., k-means( |
seed |
Seed to be used in the procedure. |
A list containing the following items:
measure |
Value of the test statistic. |
levels |
Original levels of the variable |
cluster |
A vector of integers (from 1:k) indicating the cluster to which each curve is allocated. |
centers |
An object containing the fitted centroids (mean of the curves pertaining to the same group). |
curves |
An object containing the fitted regression curves for each population. |
Nora M. Villanueva and Marta Sestelo.
1 2 3 4 5 6 7 | library(clustcurv)
# Regression: 2 groups k-means
r2 <- kregcurves(y = barnacle5$DW, x = barnacle5$RC,
z = barnacle5$F, k = 2, algorithm = "kmeans")
data.frame(level = r2$level, cluster = r2$cluster)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.