我正在尝试并行运行 R 来运行回归。我正在尝试使用降雪库(但对任何方法都持开放态度)。目前,我正在运行以下回归,这需要很长时间才能运行。有人可以告诉我如何做到这一点吗?
sales_day_region_ctgry_lm <- lm(log(sales_out+1)~factor(region_out)
+ date_vector_out + factor(date_vector_out) +
factor(category_out) + mean_temp_out)
我已经开始了以下路径:
library(snowfall)
sfInit(parallel = TRUE, cpus=4, type="SOCK")
wrapper <- function() {
return(lm(log(sales_out+1)~factor(region_out) + date_vector_out +
factor(date_vector_out) + factor(category_out) + mean_temp_out))
}
output_lm <- sfLapply(*no idea what to do here*,wrapper)
sfStop()
summary(output_lm)
但是这种方法充满了错误。
谢谢!