You received this message because you are subscribed to the Google Groups "pystatsmodels" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pystatsmodel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pystatsmodels/4b4c285f-63a0-4e96-913d-7d817b589c9fn%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "pystatsmodels" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pystatsmodel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pystatsmodels/CAMMTP%2BD86GO19TSaDmdYzYwM7U11c%2BMh1MsN5T7VEAU%3DkOjbtA%40mail.gmail.com.
When I run the following, it works.y,x = patsy.dmatrices(formula, df, return_type = 'matrix')
weight_factor = np.array(df[df['x1'].isna() == False]['weight'])
offset_factor = np.array(df[df['x1'].isna() == False]['offset'])
offset_factor_l = np.log(offset_factor)
model = sm.GLM(y, x, family = sm.families.Poisson(), freq_weights=weight_factor).fit(scale="x2")When I add the offset as follows, I get the NaN/Inf in my weight error.y,x = patsy.dmatrices(formula, df, return_type = 'matrix')
weight_factor = np.array(df[df['x1'].isna() == False]['weight'])
offset_factor = np.array(df[df['x1'].isna() == False]['offset'])
offset_factor_l = np.log(offset_factor)
model = sm.GLM(y, x, family = sm.families.Poisson(), freq_weights=weight_factor,offset = offset_factor).fit(scale="x2")When I run it with the log of the offset, it runs without error, but doesn't give a difference answer then running without the offset.y,x = patsy.dmatrices(formula, df, return_type = 'matrix')
weight_factor = np.array(df[df['x1'].isna() == False]['weight'])
offset_factor = np.array(df[df['x1'].isna() == False]['offset'])
offset_factor_l = np.log(offset_factor)
model = sm.GLM(y, x, family = sm.families.Poisson(), freq_weights=weight_factor,offset = offset_factor_l).fit(scale="x2")The overall goal is to set all variables coefficients but one (x). x is then replaced with a value from a different data source to see what type of lift that value (x1) brings compared to the original (x).Does that example make more sense?
To view this discussion on the web visit https://groups.google.com/d/msgid/pystatsmodels/CAJhRQOCxz_EZvSqRBtUB1YX0q0qd-0EqzMSHMu%2Bi__AhTRz8-A%40mail.gmail.com.
On Nov 1, 2021, at 2:39 PM, josef...@gmail.com wrote:
To view this discussion on the web visit https://groups.google.com/d/msgid/pystatsmodels/CAMMTP%2BAnAV%3DteVjvpS%2Biezc3HEbjn276F-H4x8PJwsYmmKycag%40mail.gmail.com.
It is the same dataset throughout. The Paramus in the offset are exp(xnot*coefficient). The total offset factor is the conglomerate of the previous model.Offset = (x1*coefficient)*(x2*coefficient)*(xN*coefficient)
To view this discussion on the web visit https://groups.google.com/d/msgid/pystatsmodels/436E51CB-4E36-45F8-928A-E6769904DA66%40gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pystatsmodels/CAMMTP%2BB6Z%3D_gnRx10UFW9jVCg%2B9js%3D3zf_-sk1bUVzqaW%3D7FnA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pystatsmodels/CAJhRQODxiMht2P3gx6w0zL-utfAbU1L_XzETofuOwm4fNhGMJA%40mail.gmail.com.
You received this message because you are subscribed to a topic in the Google Groups "pystatsmodels" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pystatsmodels/bxWRGYs4lxA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pystatsmodel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pystatsmodels/CAMMTP%2BCo6DYtZav_ReqvKryuHqTTTbtvvBA2A2cBvA5%2BNty2Nw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pystatsmodels/CAJhRQOBu%3D_qgRmuE3EEt8Ue%2BGEorqTpgxoyQU3TewdsQQxkJ3w%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pystatsmodels/CAMMTP%2BCBMjWWyNBcXvr-_qTJP2xW1iNmODkFmA5X%3D0sG5sRPTg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pystatsmodels/CAJhRQOCLgCQk6RJL-ZRTEbHepOTELeXMvipN2dkmt8P5bw6T%2Bg%40mail.gmail.com.