应用对象
Revolution Analytics

默认情况下您不会获得相同的结果从 rxGlm 从 'glm 一样。您实际需要为 FALSE,也重现 glm 的结果设置为 TRUE 的参数 'dropFirst' 和 'dropMain',因为RevoScaleR 将使用默认的 SAS 对比度,而不是 R 的默认对比度。 下面是一些示例数据,我在测试此问题,说明了如何获取两个函数来生成匹配结果中使用的代码︰

basictestdata <- data.frame(  Factor1 = as.factor(c(1,1,1,1,2,2,2,2)),  Factor2 = as.factor(c(1,1,2,2,1,1,2,2)),  Discount = c(1,2,1,2,1,2,1,2),  Exposure = c(24000, 40000, 7000, 14000, 7500, 15000, 2000, 5600),  PurePrem = c(46,32,73,58,48,25,220,30))GLM.1 <- glm(PurePrem ~ Factor1 * Factor2 - 1,  family = tweedie(var.power = 1.5, link.power = 0),  data = basictestdata, weights = Exposure  , offset = log(Discount))rxGlm.1 <- rxGlm(PurePrem ~ Factor1 * Factor2 - 1 + offset(log(Discount)),  family = rxTweedie(var.power = 1.5, link.power = 0),  data = basictestdata, fweights = "Exposure", dropFirst = TRUE, dropMain = FALSE)coef(GLM.1) coef(rxGlm.1)

需要更多帮助?

需要更多选项?

了解订阅权益、浏览培训课程、了解如何保护设备等。