使用 PostgreSQL 计算相关系数?
我已经弄清楚了如何计算两个字段之间的相关系数(如果两个字段都在同一个表中):
SELECT corr(column1, column2) FROM table WHERE <my filters>;
...但是当列来自不同的表时我无法弄清楚如何执行此操作(我需要应用相同的过滤器)到两个表)。
有什么提示吗?
I have worked out how to calculate the correlation coefficient between two fields if both are in the same table:
SELECT corr(column1, column2) FROM table WHERE <my filters>;
...but I can't work out how to do it when the columns are from different tables (I need to apply the same filters to both tables).
Any hints, please?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果这些表彼此相关以便您可以将它们连接起来,那就相当简单了。只需加入它们并进行关联即可:
如果它们不是,那么您应该如何找出要在其上运行
corr
的每个表中的哪些字段组合?If the tables are related to one another such that you can join them, it's fairly simple. Just join them and do the correlation:
If they're not, then how are you supposed to find out which combination of fields from each table you want to run
corr
on?试试这个
try this