加拿大天气数据(来自fda软件包)->平滑->聚类
我在funFEM群集中找到错误消息。
res = funFEM(fdobj,K=4)
此代码有误。
# smoothing-dailyAv_temperature
smoothbs0 <- smooth.basis(daytime, CanadianWeather$dailyAv[,,"Temperature.C"], fbfdPar0)
smoothbs1 <- smooth.basis(daytime, CanadianWeather$dailyAv[,,"Temperature.C"], fbfdPar1)
smoothbs2 <- smooth.basis(daytime, CanadianWeather$dailyAv[,,"Temperature.C"], fbfdPar2)
smoothbs3 <- smooth.basis(daytime, CanadianWeather$dailyAv[,,"Temperature.C"], fbfdPar3)
smoothbs4 <- smooth.basis(daytime, CanadianWeather$dailyAv[,,"Temperature.C"], fbfdPar4)
smoothbs5 <- smooth.basis(daytime, CanadianWeather$dailyAv[,,"Temperature.C"], fbfdPar5)
smoothbs6 <- smooth.basis(daytime, CanadianWeather$dailyAv[,,"Temperature.C"], fbfdPar6)
smoothbs7 <- smooth.basis(daytime, CanadianWeather$dailyAv[,,"Temperature.C"], fbfdPar7)
smoothbs8 <- smooth.basis(daytime, CanadianWeather$dailyAv[,,"Temperature.C"], fbfdPar8)
# Choosing Smoothing Parameter Lamda-dailyAv
bsgcv_list <- list(smoothbs0$gcv,smoothbs1$gcv, smoothbs2$gcv, smoothbs3$gcv,smoothbs4$gcv, smoothbs5$gcv, smoothbs6$gcv, smoothbs7$gcv, smoothbs8$gcv)
bsgcv_sum <- sapply(bsgcv_list, sum)
plot(x = 0:8, y = bsgcv_sum, type = "b", xlab = "log lambda", ylab = "sum of gcv") # choose lambda = 10^6
# Clustering the well-known "Canadian temperature" data (Ramsay & Silverman)
basis <- create.fourier.basis(c(0, 365), nbasis=7)
fdobj <- smooth.basis(day.5, CanadianWeather$dailyAv[,,"Temperature.C"],basis,fdnames=list("Day", "Station", "Deg C"))$fd
res = funFEM(fdobj,K=4)
“ ward”方法已重命名为“ ward.D”;注意新的“ ward.D2”
答案 0 :(得分:1)
假设您使用的是funFEM
包,我相信作者还没有将参数parameter(请参见此行)修改为功能hclust
。您应该注意,这是一条消息/警告,而不是错误。
> hclust(dist(USArrests), method = "ward")
The "ward" method has been renamed to "ward.D"; note new "ward.D2"
Call:
hclust(d = dist(USArrests), method = "ward")
Cluster method : ward.D
Distance : euclidean
Number of objects: 50
> hclust(dist(USArrests), method = "ward.D")
Call:
hclust(d = dist(USArrests), method = "ward.D")
Cluster method : ward.D
Distance : euclidean
Number of objects: 50
> hclust(dist(USArrests), method = "ward.D2")
Call:
hclust(d = dist(USArrests), method = "ward.D2")
Cluster method : ward.D2
Distance : euclidean
Number of objects: 50
如果查看hclust
的源代码,您会注意到"ward"
已映射到"ward.D"
。
if (method == "ward") {
message("The \"ward\" method has been renamed to \"ward.D\"; note new \"ward.D2\"")
method <- "ward.D"
}