[R] Improper coding for an offset in vglm()?

Christopher R. Dolanc crdolanc at ucdavis.edu
Tue Jun 5 20:08:04 CEST 2012


Hello R-help.

I believe I may be coding the offset incorrectly in my formula. I am 
testing significance between different group pairings using the VGAM 
package. My data are zero-truncated and poisson-distributed and 
overdispersed, so I'm using the posnegbinomial function in vglm (code 
below). I've spent a very long time working out this model and am pretty 
sure it's the best for my data, but I have several examples of groups 
with very similar means that come out significant. I'm looking at 
differences in density between 2 data sources (see attached file), but 
the plot size varies between the 2, so I am using plot "Area" as an 
offset and running tests on "Stems". I've attached a sample where the 
means for density are 26.4 vs. 25.2 with clearly overlapping error bars, 
yet the test comes out significant. (A Wilcoxan test on density also 
comes out significant.) Just to check, I did a t-test on density, which 
was non-significant, and a t-test on Stems, which WAS significant. This 
leads me to believe that my vglm model is not accounting for the area 
offset (and thus density) and is just running the model straight on 
"Stems". Here's the code:

vglm(Stems~Data + offset(log(Area)), family=posnegbinomial, data=...)

I've tried changing the family to "pospoisson" and it makes no 
difference. I've also tried taking out the log part of the offset, just 
to see what would happen, but couldn't get the model to run. I'm 
currently working with R 2.14.1.

I'd love any ideas you may have on possible solutions.

Chris

-- 
Christopher R. Dolanc
Post-doctoral Researcher
University of Montana and UC-Davis


-------------- next part --------------
Data	Plot	Stems	Area	Density
FIA	8.87E+12	1	665.0103	15.03736
FIA	2.51E+13	2	672.45	29.74199
FIA	8.94E+12	3	619.9869	48.38812
FIA	2.38E+13	1	601.4576	16.62628
FIA	1.31E+13	2	634.6976	31.51107
FIA	2.30E+13	1	659.3915	15.1655
FIA	2.99E+13	2	634.6976	31.51107
FIA	2.40E+13	1	659.3915	15.1655
FIA	8.87E+12	1	665.0103	15.03736
FIA	2.40E+13	1	665.0103	15.03736
FIA	2.51E+13	1	666.8388	14.99613
FIA	2.30E+13	1	601.4576	16.62628
FIA	2.36E+13	1	599.0423	16.69331
FIA	8.94E+12	1	624.3542	16.01655
FIA	2.51E+13	2	672.45	29.74199
FIA	2.94E+13	1	659.3915	15.1655
FIA	2.51E+13	1	666.8388	14.99613
FIA	2.29E+13	1	661.8141	15.10998
FIA	2.51E+13	1	672.45	14.87099
FIA	2.38E+13	1	669.743	14.9311
FIA	2.99E+13	2	672.45	29.74199
FIA	2.42E+13	1	652.3723	15.32867
FIA	2.29E+13	1	634.6976	15.75554
FIA	2.30E+13	1	628.5952	15.90849
FIA	1.31E+13	3	671.2428	44.69321
FIA	2.36E+13	1	671.611	14.88957
FIA	8.94E+12	2	619.9869	32.25875
FIA	1.31E+13	1	634.6976	15.75554
FIA	2.37E+13	1	659.3915	15.1655
FIA	2.38E+13	1	601.4576	16.62628
FIA	2.38E+13	2	670.3084	29.83701
FIA	2.30E+13	1	669.1128	14.94516
FIA	2.37E+13	2	168.1125	118.96795
FIA	1.32E+13	3	644.0903	46.57732
FIA	2.99E+13	1	645.8406	15.4837
FIA	2.37E+13	1	649.2028	15.40351
FIA	2.94E+13	2	659.3915	30.331
FIA	2.30E+13	3	659.3915	45.49649
FIA	8.87E+12	1	669.1128	14.94516
FIA	2.42E+13	1	525.0952	19.04416
FIA	1.31E+13	3	589.2114	50.91551
FIA	8.94E+12	3	624.3542	48.04965
FIA	2.29E+13	1	613.2216	16.30732
FIA	2.43E+13	2	498.7577	40.09963
FIA	1.32E+13	2	659.3915	30.331
FIA	2.43E+13	1	550.8925	18.15236
FIA	1.31E+13	1	613.2216	16.30732
FIA	2.29E+13	1	634.6976	15.75554
FIA	2.37E+13	4	613.2216	65.22927
FIA	2.30E+13	3	661.8141	45.32995
FIA	2.43E+13	2	525.0952	38.08833
FIA	1.31E+13	1	512.3661	19.51729
FIA	8.89E+12	1	463.7586	21.56294
FIA	2.29E+13	1	634.6976	15.75554
FIA	2.50E+13	1	550.8925	18.15236
FIA	8.92E+12	1	672.45	14.87099
FIA	2.38E+13	1	669.1128	14.94516
FIA	1.31E+13	1	634.6976	15.75554
FIA	2.30E+13	4	659.3915	60.66199
FIA	2.40E+13	1	659.3915	15.1655
FIA	2.29E+13	1	667.66	14.97768
FIA	1.32E+13	4	576.6211	69.36964
FIA	2.38E+13	1	576.6211	17.34241
FIA	2.37E+13	1	487.5259	20.51173
FIA	2.43E+13	1	608.5832	16.43161
FIA	2.42E+13	1	525.0952	19.04416
FIA	2.29E+13	1	601.4576	16.62628
FIA	8.94E+12	1	634.6976	15.75554
FIA	1.31E+13	1	589.2114	16.97184
FIA	2.36E+13	1	634.6976	15.75554
FIA	8.94E+12	1	632.6997	15.80529
FIA	2.38E+13	2	589.2114	33.94368
FIA	8.94E+12	1	624.3542	16.01655
VTM	56F54	3	785.2601	38.2039
VTM	56D51	1	793.7091	12.59907
VTM	55E414	4	793.7091	50.3963
VTM	39F41	1	763.985	13.08926
VTM	56F54	1	785.2601	12.73463
VTM	69C119	1	785.2601	12.73463
VTM	69C18	1	785.2601	12.73463
VTM	69C216	2	785.2601	25.46927
VTM	69D29	3	800.4724	37.47787
VTM	68C514	1	709.2333	14.09973
VTM	68C68	1	800.4724	12.49262
VTM	3.90E+26	1	800.4724	12.49262
VTM	5.60E+53	1	694.0784	14.40759
VTM	39C12	1	738.1344	13.54767
VTM	3.90E+33	1	793.7091	12.59907
VTM	39D33	2	763.985	26.17852
VTM	40B44	3	808.4177	37.10953
VTM	40B513	1	806.1692	12.40434
VTM	68C616	2	723.9741	27.6253
VTM	68C65	1	808.4177	12.36984
VTM	69B17	2	785.2601	25.46927
VTM	40B511	1	808.4177	12.36984
VTM	40B56	1	775.291	12.89838
VTM	50A64	1	793.7091	12.59907
VTM	68C514	1	709.2333	14.09973
VTM	78C44	1	763.985	13.08926
VTM	39C24	2	723.9741	27.6253
VTM	40B52	2	808.4177	24.73969
VTM	51B15	1	785.2601	12.73463
VTM	51B16	1	785.2601	12.73463
VTM	51F43	1	723.9741	13.81265
VTM	56B43	2	694.0784	28.81519
VTM	56C414	2	808.4177	24.73969
VTM	56D46	1	751.5347	13.30611
VTM	3.90E+24	1	785.2601	12.73463
VTM	68A66	1	763.985	13.08926
VTM	39D37	1	751.5347	13.30611
VTM	69C122	2	723.9741	27.6253
VTM	40A69	1	763.985	13.08926
VTM	68A63	2	775.291	25.79676
VTM	3.90E+23	2	808.4177	24.73969
VTM	3.90E+27	2	800.4724	24.98525
VTM	40C64	5	783.3059	63.83202
VTM	39D11	3	775.291	38.69515
VTM	40B58	5	809.0636	61.79984
VTM	50B31	2	809.4276	24.70882
VTM	56E512	1	793.7091	12.59907
VTM	56F412	1	808.4177	12.36984
VTM	56F42	1	763.985	13.08926
VTM	68C54	1	738.1344	13.54767
VTM	68C616	1	723.9741	13.81265
VTM	69C11	3	751.5347	39.91832
VTM	78D510	1	775.291	12.89838
VTM	40A412	3	809.2658	37.07064
VTM	40B67	2	809.4276	24.70882
VTM	89A37	1	803.6619	12.44304
VTM	40C52	2	783.3059	25.53281
VTM	56D49	1	809.4276	12.35441
VTM	39D12	18	783.3059	229.79529
VTM	3.90E+35	5	751.5347	66.53053
VTM	6.90E+212	4	709.2333	56.39893
VTM	38F115	1	738.1344	13.54767
VTM	39F12	5	775.291	64.49191
VTM	39F32	3	808.4177	37.10953
VTM	50A32	2	808.4177	24.73969
VTM	50B44	2	808.4177	24.73969
VTM	50D54	3	805.4106	37.24808
VTM	50D61	1	808.4177	12.36984
VTM	50D62	2	793.7091	25.19815
VTM	50F69	1	763.985	13.08926
VTM	56A11	3	808.4177	37.10953
VTM	56A21	1	775.291	12.89838
VTM	56A32	2	738.1344	27.09534
VTM	56B11	1	763.985	13.08926
VTM	56B22	1	793.7091	12.59907
VTM	56C410	1	751.5347	13.30611
VTM	56E414	2	805.4106	24.83206
VTM	56F54	1	785.2601	12.73463
VTM	68B614	1	808.4177	12.36984
VTM	68B616	3	809.4276	37.06323
VTM	69B112	1	793.7091	12.59907
VTM	69C12	3	763.985	39.26779
VTM	69C216	2	785.2601	25.46927
VTM	69E310	1	751.5347	13.30611
VTM	69F17	3	763.985	39.26779
VTM	69F214	2	808.4177	24.73969
VTM	69F24	3	694.0784	43.22278
VTM	77F113	1	775.291	12.89838
VTM	89A14	1	785.2601	12.73463
VTM	51F19	1	785.2601	12.73463
VTM	69B17	1	785.2601	12.73463
VTM	6.90E+29	2	723.9741	27.6253
VTM	6.80E+68	3	775.291	38.69515
VTM	5.60E+70	1	793.7091	12.59907
VTM	40A411	3	775.291	38.69515
VTM	40B511	2	808.4177	24.73969
VTM	40B56	1	775.291	12.89838
VTM	50A52	2	775.291	25.79676
VTM	50A62	3	775.291	38.69515
VTM	50A64	4	793.7091	50.3963
VTM	50F67	1	805.4106	12.41603
VTM	51C12	2	805.4106	24.83206
VTM	51F12	1	793.7091	12.59907
VTM	56C413	2	793.7091	25.19815
VTM	56F58	2	775.291	25.79676
VTM	68D64	1	738.1344	13.54767
VTM	69B16	1	785.2601	12.73463
VTM	69E317	2	785.2601	25.46927
VTM	78C44	2	763.985	26.17852
VTM	78C614	1	763.985	13.08926
VTM	89A36	2	808.4177	24.73969
VTM	89A35	1	800.4724	12.49262
VTM	68B53	2	709.2333	28.19946
VTM	68B64	1	793.7091	12.59907
VTM	56D56	3	751.5347	39.91832
VTM	6.90E+19	1	775.291	12.89838
VTM	3.90E+26	2	800.4724	24.98525
VTM	3.90E+32	6	805.4106	74.49617
VTM	7.70E+118	1	785.2601	12.73463
VTM	39C11	1	751.5347	13.30611
VTM	39D21	3	775.291	38.69515
VTM	40D62	1	775.291	12.89838
VTM	40D67	4	808.4177	49.47937
VTM	50B45	3	805.4106	37.24808
VTM	50F68	2	805.4106	24.83206
VTM	51B15	3	785.2601	38.2039
VTM	51B16	1	785.2601	12.73463
VTM	51F43	2	723.9741	27.6253
VTM	56A33	1	709.2333	14.09973
VTM	56A37	1	775.291	12.89838
VTM	56B16	1	775.291	12.89838
VTM	56B26	1	793.7091	12.59907
VTM	56B43	3	694.0784	43.22278
VTM	56C414	2	808.4177	24.73969
VTM	56D32	1	785.2601	12.73463
VTM	56D34	2	723.9741	27.6253
VTM	56D46	6	751.5347	79.83664
VTM	56E415	1	805.4106	12.41603
VTM	68C510	1	723.9741	13.81265
VTM	68C67	2	738.1344	27.09534
VTM	69C17	3	763.985	39.26779
VTM	69D28	2	738.1344	27.09534
VTM	69F26	3	800.4724	37.47787
VTM	69F29	3	800.4724	37.47787
VTM	78B410	5	751.5347	66.53053
VTM	78C62	1	763.985	13.08926
VTM	39D24	7	783.3059	89.36483
VTM	5.10E+17	1	808.4177	12.36984
VTM	3.90E+24	8	785.2601	101.87707
VTM	3.90E+33	4	793.7091	50.3963
VTM	38F23	2	793.7091	25.19815
VTM	39C14	6	800.4724	74.95574
VTM	39F31	2	723.9741	27.6253
VTM	39F42	5	738.1344	67.73834
VTM	39F64	7	805.4106	86.91219
VTM	51B12	4	751.5347	53.22442
VTM	51B37	1	723.9741	13.81265
VTM	51C11	1	785.2601	12.73463
VTM	51D210	1	808.4177	12.36984
VTM	56C52	3	808.4177	37.10953
VTM	56C58	1	793.7091	12.59907
VTM	56D47	3	738.1344	40.643
VTM	56D53	5	785.2601	63.67317
VTM	69C115	1	800.4724	12.49262
VTM	69F313	3	808.4177	37.10953
VTM	89A34	1	806.8498	12.39388
VTM	3.90E+22	2	793.7091	25.19815
VTM	39D37	2	751.5347	26.61221
VTM	39F56	3	808.4177	37.10953
VTM	40A57	1	775.291	12.89838
VTM	40B45	10	809.2658	123.5688
VTM	40B63	1	800.4724	12.49262
VTM	50B62	6	805.4106	74.49617
VTM	51A111	1	793.7091	12.59907
VTM	55C114	7	751.5347	93.14274
VTM	56B24	1	763.985	13.08926
VTM	56C49	4	805.4106	49.66411
VTM	56D43	1	785.2601	12.73463
VTM	56F410	3	785.2601	38.2039
VTM	68C64	2	723.9741	27.6253
VTM	78C418	2	706.2305	28.31937
VTM	56B23	1	785.2601	12.73463
VTM	39F65	1	647.5421	15.44301
VTM	68C619	1	751.5347	13.30611
VTM	69C122	2	723.9741	27.6253
VTM	68C627	2	800.4724	24.98525
VTM	5.60E+55	3	785.2601	38.2039
VTM	38F24	2	793.7091	25.19815
VTM	39D33	11	763.985	143.98188
VTM	39D34	3	805.4106	37.24808
VTM	40A612	1	809.0636	12.35997
VTM	40A69	1	763.985	13.08926
VTM	40B44	1	808.4177	12.36984
VTM	40B513	4	806.1692	49.61738
VTM	40D64	2	808.4177	24.73969
VTM	56B27	2	793.7091	25.19815
VTM	56C51	1	775.291	12.89838
VTM	56D510	1	805.4106	12.41603
VTM	56F46	1	800.4724	12.49262
VTM	68C512	1	751.5347	13.30611
VTM	69C118	2	785.2601	25.46927
VTM	77F115	1	785.2601	12.73463
VTM	78C613	1	779.4497	12.82956
VTM	5.10E+22	3	779.4497	38.48869
VTM	3.90E+34	6	800.4724	74.95574
VTM	6.90E+38	2	775.291	25.79676
VTM	39D32	1	793.7091	12.59907
VTM	50B41	4	793.7091	50.3963
VTM	56B35	1	805.4106	12.41603
VTM	56C41	1	785.2601	12.73463
VTM	56D410	2	775.291	25.79676
VTM	77D117	1	763.985	13.08926
VTM	78A21	3	800.4724	37.47787
VTM	40B57	3	809.2658	37.07064
VTM	69B115	1	793.7091	12.59907
VTM	5.10E+25	1	808.4177	12.36984
VTM	40A410	1	809.2658	12.35688
VTM	40B53	1	803.6619	12.44304
VTM	56C45	2	785.2601	25.46927
VTM	68C610	1	751.5347	13.30611
VTM	78A28	2	729.7176	27.40786
VTM	7.70E+16	1	785.2601	12.73463
VTM	68F67	1	751.5347	13.30611
VTM	69F214	2	808.4177	24.73969
VTM	69F24	2	694.0784	28.81519
VTM	5.60E+22	1	808.4177	12.36984
VTM	69F16	1	775.291	12.89838
VTM	68D65	1	793.7091	12.59907
VTM	3.90E+15	1	775.291	12.89838
VTM	56E413	1	808.4177	12.36984
VTM	78B519	1	793.7091	12.59907
VTM	78D65	1	694.0784	14.40759
VTM	6.90E+40	1	775.291	12.89838
VTM	69F216	2	808.4177	24.73969
VTM	78B215	1	805.4106	12.41603
VTM	56B21	1	808.4177	12.36984
VTM	78B49	1	793.7091	12.59907
VTM	50D52	1	805.4106	12.41603
VTM	69C117	1	805.4106	12.41603
VTM	78B314	2	709.2333	28.19946
VTM	6.90E+111	1	809.4276	12.35441
VTM	69F215	1	809.4276	12.35441
VTM	5.10E+111	1	723.9741	13.81265
VTM	56D31	1	694.0784	14.40759
VTM	40A59	2	785.2601	25.46927
VTM	50A32	1	808.4177	12.36984
VTM	50B44	2	808.4177	24.73969
VTM	56F54	1	785.2601	12.73463
VTM	56F57	4	763.985	52.35705
VTM	68A48	1	763.985	13.08926
VTM	50B52	1	793.7091	12.59907
VTM	78B416	1	775.291	12.89838
VTM	68B613	1	738.1344	13.54767
VTM	68C628	2	694.0784	28.81519
VTM	39C11	1	751.5347	13.30611
VTM	39C24	3	723.9741	41.43795
VTM	40B52	1	808.4177	12.36984
VTM	40D62	1	775.291	12.89838
VTM	50B45	1	805.4106	12.41603
VTM	56B43	2	694.0784	28.81519
VTM	56D51	1	793.7091	12.59907
VTM	51F51	1	572.3517	17.47177
VTM	39F56	1	808.4177	12.36984
VTM	40A57	1	775.291	12.89838
VTM	56B210	1	763.985	13.08926
VTM	40A53	1	763.985	13.08926
VTM	5.60E+36	1	751.5347	13.30611
VTM	40A511	2	809.2658	24.71376
VTM	56F43	4	793.7091	50.3963
VTM	40B53	3	803.6619	37.32913
VTM	56C45	3	785.2601	38.2039


More information about the R-help mailing list