[R] geoRglm with factor variable as covariable

Ruben ruben at kfupm.edu.sa
Sat Oct 6 06:57:28 CEST 2012


On 10/4/2012 10:39 PM, Filoche wrote:
> Dear R users.
>
> I'm trying to fit  a generalised linear spatial mode using the geoRglm
> package. To do so, I'm preparing my data (geodata) as follow:
>
> geoData9093 = as.geodata(data9093, coords.col= 17:18, data.col=15,*
> covar.col=16*)
>
> where covar.col is a factor variable (years in this case 90-91-92-93)).
>
> Then I run the model as follow:
> /
> model.5 = list(cov.pars=c(1,1), cov.model='exponential', beta=1,
> family="poisson")
> mcmc.5 = mcmc.control(S.scale = 0.25, n.iter = 30000, burn.in=50000, thin =
> 100) #trial error
> outmcmc.5 = glsm.mcmc(geoData9093, model= model.5, mcmc.input = mcmc.5)
> mcmcobj.5 = prepare.likfit.glsm(outmcmc.5)
> lik.5 = likfit.glsm(mcmcobj.5, ini.phi = 0.3, fix.nugget.rel = F)/
>
> And the summary of lik.5 is:
>
> likfit.glsm: estimated model parameters:
>       beta   sigmasq       phi tausq.rel
>   "1.2781"  "0.5193"  "0.0977"  "0.0069"
>
>   likfit.glsm : maximised log-likelihood = 43.62
>
> I'm fairly new to geostatistics, but I thought using a factor variable as
> covariable would give me 4 intercepts (beta) as I have 4 levels in my covar.
> But looking at the summary, we see that I only have 1 beta which is equal to
> 1.28. I guess I made mistakes in specifying the model description, but I
> can't find where. Any advices would be welcome.
>
> With regards,
> Phil

You may have covariates in your data but your model (model.5) is set up 
as a model without covariates. You put beta=1, thus, the model is a 
constant.

HTH

Ruben

-- 
Ruben H. Roa-Ureta, Ph. D.
Senior Scientist
Marine Studies Section, Center for Environment and Water,
Research Institute, King Fahd University of Petroleum and Minerals,
KFUPM Box 1927, Dhahran 31261, Saudi Arabia
Office Phone : 966-3-860-7850
Cellular Phone : 966-5-61151014

Save a tree. Don't print this e-mail unless it's really necessary




More information about the R-help mailing list