- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
假设我有一个数据矩阵 d
pc = prcomp(d)
# pc1 and pc2 are the principal components
pc1 = pc$rotation[,1]
pc2 = pc$rotation[,2]
r = lm(y ~ pc1+pc2)
Errormodel.frame.default(formula = y ~ pc1+pc2, drop.unused.levels = TRUE) :
unequal dimensions('pc1')
最佳答案
答:您不想要 pc$rotation,它是旋转矩阵,而不是旋转值(分数)的矩阵。
整理一些数据:
x1 = runif(100)
x2 = runif(100)
y = rnorm(2+3*x1+4*x2)
d = cbind(x1,x2)
pc = prcomp(d)
dim(pc$rotation)
## [1] 2 2
x: if ‘retx’ is true the value of the rotated data (the centred (and scaled if requested) data multiplied by the ‘rotation' matrix) is returned.
dim(pc$x)
## [1] 100 2
lm(y~pc$x[,1]+pc$x[,2])
##
## Call:
## lm(formula = y ~ pc$x[, 1] + pc$x[, 2])
## Coefficients:
## (Intercept) pc$x[, 1] pc$x[, 2]
## 0.04942 0.14272 -0.13557
关于r - 如何在R中拟合具有两个主成分的线性回归模型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1805149/
我有一些带有反应组件抽象的外部 UI,我想从试剂中重用它们,有没有什么方法可以通过从 clojurescript 传递数据来直接渲染预定义的 react 组件。我是 clojurescript 初学者
我刚刚构建了一个库(Material Components库)from source并将本地Maven存储库添加到了我的项目中。现在,我可以通过将Log调用添加到库的本地源中来成功地进行一些外行调试。
我正在尝试测试呈现 grommet 的组件菜单 组件。索环 Menu 组件将绝对定位的菜单呈现到文档的顶层,作为子级插入到 body 中。因此它呈现在包装器的范围之外。我可以使用 document.b
如何创建一个凹形的 SKPhysicsBody? 我的猜测是创建一个由多个凸体组成的复合节点。我可以用任何其他方式“粘贴”它们,从而在它们之间创建 SKPhysicsJointFixed 吗? 最佳答
我正在开发一个食谱应用程序来帮助我妻子培养她的蛋糕爱好。这个想法是创建一个食谱数据库来保存她所有的蛋糕食谱。 每个食谱都有多种成分。每种成分都会有测量值(克、毫升、茶匙等),然后是数量。 我了解如何创
我正在使用 sklearn's PCA用于对大量图像进行降维。安装 PCA 后,我想看看组件的外观。 可以通过查看 components_ 属性来做到这一点。没有意识到这是可用的,我做了其他事情: e
我是一名优秀的程序员,十分优秀!