geoRglm with factor variable as covariable

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

geoRglm with factor variable as covariable

Filoche
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

Reply | Threaded
Open this post in threaded view
|

Re: geoRglm with factor variable as covariable

Ruben
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

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: geoRglm with factor variable as covariable

Filoche
Thank you Ruben.

You were absolutly right. I'm using trend option now to specify my model.

Thank for the help,
Phil