[R] gamma glm - using of weights gives error

Andreas Wittmann andreas_wittmann at gmx.de
Sun Oct 24 11:17:45 CEST 2010


Dear R-users,

i try to use the following code to do a gamma regression

glm(x1 / x2 ~ x3 + x4 + x5 + x6 + x7 + x8, family=Gamma(link="log"), 
weights=x2)

but here i get the error

Error: NA/NaN/Inf in foreign function call (arg 1)
In addition: Warning message:
step size truncated due to divergence

x2 has integer values ranging from 1 to 6.

If i do instead

glm(x1 / x2 ~ x3 + x4 + x5 + x6 + x7 + x8, family=Gamma(link="log"))

without using the weights-argument i get no error.

So far i don't really understand what this argument realy does, what is 
the difference in the results? What can i do to locate the root of the 
error and how can i avoid this error? Can i to the regression without 
the weights argument?

Thanks and best regards

Andreas



More information about the R-help mailing list