不同自由度t分布图、聚类分析举例

不同自由的的t分布图

par(mfrow=c(2,2))
#opar=par(no.readonly = TRUE)
y=seq(-4,4,length.out=100)
par(fig=c(0,1,0,1))
plot(y,dt(y,1),type = "l",ylim = c(0,0.5))
plot(y,dt(y,3),type = "l",ylim=c(0,0.5))
plot(y,dt(y,5),type = "l",ylim=c(0,0.5))
plot(y,dt(y,10),type = "l",ylim=c(0,0.5))
plot(y,dt(y,30),type = "l",ylim=c(0,0.5))

Cluster聚类分析

means <- sample(c(-3,0,3),replace = T)
x <- rnorm(99,mean = means)
d <- dist(x)
hc <- hclust(d)
plot(hc,hang=-1)
clust <- cutree(hc,k=3)
plot(x~factor(clust),main = "分类均值")