In species distribution modeling where one uses a large sample of 
background points to capture background variation in 
presence\pseudo-absence or use\available models (0\1 response) it is 
frequently recommended that one weight the data so the sum of the absence 
weights is equal to the sum of presence weights so that the model isn?t 
swamped by an overwhelming and arbitrary number of background points.  My 
concern is I don't know that glm in the R stats package handles this 
correctly. 

When weights are set in glm they are ignored in the stepAIC and I'm 
wondering if this should be the case.  For example if I have a data set 
with 75 presence and 75 absence I fit glm.  If I repeat the 75 absences 10 
times say and then weigh the absences so total weight of absence equals 
total weight of presence fitting any individual glm to the two sets give 
almost the same answer (in coefficients, null and residual deviance but 
NOT in likelihood extracted using logLik).  Then when I use the step 
command in R to select the best from a series of models I get quite 
different answers for two reasons.  Step uses the likelihood which is not 
the same in the two models (and I'm not sure why given that they have the 
same deviance).  The second reason is that the step function in R uses AIC 
= - 2*log L + k * edf where edf is effective degrees of freedom.  It seems 
that if you're setting the weights then the the step function should 
adjust the degrees of freedom it uses accordingly.  I've tried adjusting 
the stepwise regression by multiplying the penalty term in step by 
sum(data$Weights)/length(data$Weights) where I generally set the penalty 
to 2 for AIC or  log(nrow(data)) for BIC.  Indeed when I use this approach 
I get much more similar predictions from the two models but because the 
likelihood is different I don't always get exactly the same predictions 
from the two models.  I was wondering if there is a statistical 
explanation for why the answers should be different and if not, why I 
can't get the correct answer.  I tried the same thing on STATA this 
afternoon and it was interesting to note that STATA did give the same 
likelihood for the two models and the same answer for stepwise selection. 

I'm aware that GLM in the standard stats package in R is intended to use 
weights only to specify an integer number of binomial trials under the 
assumption that the response is proportion of success but had read that 
the only consequence of using non-integer weights with a Bernoulli 
response was that starting values are difficult to choose and convergence 
to the maximum likelihood isn't guaranteed.  I was  willing to accept this 
possibility but it's seeming that the issues with using glm in this way 
might run more deep.  Another option would be to consider the 
presence\background as strata with different sampling probabilities and 
use the survey package svyglm but I'm not sure how to do the automatic 
model selection in that case. 

I've noticed that many papers and software programs use R code with non 
integer weights set in this or a similar way: BIOMOD uses the glm with 
weights and stepwise model selection without any consideration of the 
above issues, Phillips and Elith (Logistic Methods for Resource Selection 
Functions and Presence-Only Species Distribution Models), Guisan, Edwards 
and Hastie (Generalized linear and generalized additive models in studies 
of species distributions: setting the scene) though they use a custom 
stepwise selection based on the deviance rather than the likelihood. 

Anyway, if anyone has any insight on how to appropriately set weights in 
glm and use stepwise model selection, I'd really appreciate your 
recommendations. 

Marian Talbert

	[[alternative HTML version deleted]]

