Offset variable seemingly not factored into GEE

#1
In SPSS I am using a repeated measures, negative binomial generalized estimating equation (GEE) to analyze my study where I counted animals on repeatedly sampled forest transects that sample 2 habitats. The habitats were not evenly sampled (it wasn't possible) so I have an offset variable of area sampled. Area sampled could vary both between transects and between replicates of individual transects when bad weather caused a sample to be truncated, so I created a separate area sampled variable to use as my offset:
GENLIN NumbIndividuals BY Habitat (ORDER=ASCENDING)

/MODEL Habitat INTERCEPT=YES OFFSET=lnAreasampled

DISTRIBUTION=NEGBIN(1) LINK=LOG
/CRITERIA METHOD=FISHER(1) SCALE=1 MAXITERATIONS=100 MAXSTEPHALVING=5 PCONVERGE=1E-006(ABSOLUTE) SINGULAR=1E-012 ANALYSISTYPE=3(WALD) CILEVEL=95 LIKELIHOOD=FULL
/EMMEANS TABLES=Habitat SCALE=ORIGINAL COMPARE=Habitat CONTRAST=PAIRWISE PADJUST=LSD
/REPEATED SUBJECT=TransectName WITHINSUBJECT=Replicates SORT=YES CORRTYPE=AR(1) ADJUSTCORR=YES COVB=ROBUST MAXITERATIONS=100 PCONVERGE=1e-006(ABSOLUTE) UPDATECORR=1
/MISSING CLASSMISSING=EXCLUDE
/PRINT CPS DESCRIPTIVES MODELINFO FIT SUMMARY SOLUTION.

The parameter Habitat is significant in the model effects and the EMMs output then gives me a significant difference with:
Habitat A: 0.54 (SE 0.071)
Habitat B: 0.16 (SE 0.067)

Means are reported for the response, so this should be the average number of individuals per transect replicate in each habitat. The problem is that A and B were not evenly sampled, so when I divide the average number of individuals per habitat above by the average area sampled per habitat to get individuals/square kilometer I end up with:

Habitat A: 6.30 individuals/km2
Habitat B: 11.01 individuals/km2

In effect the relationship between the variables has been flipped (also, the "# individuals/km2" estimates show the same relationship as the raw data whereas the "# of individuals" estimates are reversed). The direction of the regression coefficients also line up with the relationship between the "number of individuals" and not with the relationship between the "number of individuals/km2" like I think they should.

This makes me think that the EMMs test is not properly accounting for the offset.

Any ideas on how I incorporate area into this model? I was under the impression that using the natural log of an exposure variable in SPSS should allow for analyses that factor in area sampled and provide a density.

Thanks for your help.
 
#2
While I didn't get any responses to this post, I did figure out the problem so I thought I would post the answer for anyone who might run into a similar issue in the future.


My original data are in Excel, where I did my log transformations. I used "lg()" to transform the data, mistakenly thinking that this returned the natural log (which is "ln()") when the "lg()" code actually returns the log 10 in Excel. For the offset to work it must be the natural log of the independent variable used as the offset (in this case area sampled to give me # individuals/square kilometer). A rather simple error, but one that was hard to track down.

I hope that this solves someone's problem in the future.