Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

By default you will not get the same results from 'rxGlm' as you do from 'glm'.

You actually need to set the arguments 'dropFirst' to TRUE and 'dropMain' to FALSE as well to reproduce the results from glm, because 
RevoScaleR will use SAS contrasts by default rather than R's default contrasts.

 

Here is some sample data and code I used in testing this issue that illustrates how to get the two functions to produce matching results:

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)

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Was this information helpful?

What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×