如何在 R 中实现 scale() 函数所需的建议

Advice needed in how to implement the scale() function in R

上下文

作为我生态学研究的一部分,我试图坚持在 Karlsson 等人中执行的分位数回归方法。 al (2022)(来源:https://arxiv.org/pdf/2202.02206.pdf). As I am facing some unexpected challenges (more insights here if interested: https://stats.stackexchange.com/questions/572277/theory-understanding-behind-quantile-regression),我正在尝试尽可能多地重现他们的方法,以便找到一些解决我的问题的方法。

这是我假设他们的数据集已经建立的方式(+一些我不会考虑的协变量列):

individual year julian_day
1 y(1) j(1)
... ... ...
n y(n) j(n)

基本上,1 行 = 1 只鸟,记录的年份和记录的日期(儒略日格式)。

我正在尝试重现我最初忽略的一个句子,因为我认为它不重要:

For all fitted models, year was centered around 2001.

这只是他们在论文中提供的有关居中年份列的信息。

问题

The scale() function, by default, subtracts the mean from each individual observation and then divides by the standard deviation. By specifying scale=FALSE, we tell R not to divide by the standard deviation.

我的问题很简单:由于没有具体说明,scale() 函数的“常用”是什么?关于引用的句子,您认为比例参数应该是:FALSE 或 TRUE;为什么?

非常感谢您的帮助。

我想你想在你的模型中使用 I(year - 2001)。这将使年份以 2001 年为中心。scale() 将以平均值为中心,根据数据,平均值可能是也可能不是 2001 年。如果 scale=FALSE 只完成居中。如果 scale=TRUE,则结果居中的变量除以其标准差。