[英]R PCA plot using Hotelling's T2 for a confidence interval
For my test data, I calculated the first two principal components using the prcomp
function. 对于我的测试数据,我使用
prcomp
函数计算了前两个主要成分。 I then plotted the first 2 components using the plot function. 然后,我使用plot函数绘制了前两个分量。
df <- data.frame(x1 = runif(10), x2 = runif(10), x3 = runif(10), x4 = runif(10))
rownames(df) <- letters[1:10]
res <- prcomp(df, center = TRUE, scale = TRUE, na.action = na.omit)
plot(res$x, xlim = c(-5, 5), ylim = c(-5, 5))
I now would like to place an ellipse around the data that represens a 95% confidence interval using Hotelling's T2 statistic. 我现在想在数据周围放置一个椭圆,使用Hotelling的T2统计数据来表示95%的置信区间。
The SensoMineR
package in particular the panellipse
function seems to be what I am looking for. 我想寻找的是
SensoMineR
软件包,尤其是panellipse
函数。 However, my R knowledge is still quite limited and I was therefore wondering if you could point me in the right direction on to construct such a confidence interval. 但是,我的R知识仍然很有限,因此我想知道您是否可以指出正确的方向来构建这样的置信区间。
Many thanks! 非常感谢! Jacky
杰基
SensoMineR is good. SensoMineR很好。
There is another package called Package 'Hotelling' which is easy to place an ellipse around the data. 还有一个名为Package'Hotelling'的软件包 ,可以很容易地在数据周围放置一个椭圆。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.