费尔姆的论点在R中被打破了?

费尔姆的论点在R中被打破了?,r,regression,R,Regression,在R中,FELM中的权重参数表示即使在数据集中也找不到权重变量 # Reproducible example for felm weights problem df <- NULL df$y <- rnorm(1000) df$x0 <- rnorm(1000) df$x1 <- sample(1:10, 1000, replace=T) df$weightvar <- sample(1:10, 1000, replace=T) df1 <- data.fr

在R中,FELM中的权重参数表示即使在数据集中也找不到权重变量

# Reproducible example for felm weights problem
df <- NULL
df$y <- rnorm(1000)
df$x0 <- rnorm(1000)
df$x1 <- sample(1:10, 1000, replace=T)
df$weightvar <- sample(1:10, 1000, replace=T)

df1 <- data.frame(df)
reg <- felm(y ~ x0 | factor(x1) | 0 | 0
           , data = df1, weights = weightvar)
felm重量问题的可再现示例
df
weights=df1$weightvar
有效吗?我认为R知道如何从
data
参数中查找公式中的变量,但是对于其他参数,您可能必须手动指定。您是正确的,这就解决了问题!