【问题标题】:Can I calculate z-score with R? [duplicate]我可以用 R 计算 z 分数吗? [复制]
【发布时间】:2011-09-09 22:35:48
【问题描述】:

可能重复:
R, correlation: is there a func that converts a vector of nums to a vector of standard units

通过阅读 stackoverflow 的 cmets,我发现 z-score 可能是用 Python 或 perl 计算的,但我还没有遇到任何 R 的。我错过了吗?可以用R来完成吗?

作为 (http://en.wikipedia.org/wiki/Standard_score.)

z-score = (x-μ)/σ

x is a raw score to be standardized; 
μ is the mean of the population; 
σ is the standard deviation of the population. 

我相信有为此设计的 R 包?我们在哪里可以找到它们?或者类似的标准化包?

【问题讨论】:

标签: r normalization


【解决方案1】:

如果x 是一个带有原始分数的向量,那么scale(x) 是一个带有标准化分数的向量。

或手动:(x-mean(x))/sd(x)

【讨论】:

  • 如何标准化每个图的数据,因为我有来自许多图的多元时间序列数据,并且我想在每个图的基础上进行标准化?即,我有情节、年份和测量变量(如丰度),我想在每个情节的基础上进行标准化!谢谢!
  • 注意:scale 内部是na.rm,所以它更等同于(x-mean(x, na.rm=TRUE))/sd(x, na.rm=TRUE)
猜你喜欢
  • 1970-01-01
  • 2016-04-14
  • 2022-08-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-01-10
  • 1970-01-01
  • 2020-07-23
相关资源
最近更新 更多