[R] R2BayesX

Shanley Chong Shanley.Chong at sswahs.nsw.gov.au
Thu Feb 5 22:35:09 CET 2015


Many thanks Z and Nikolaus! Much appreciated! Have a great weekend!
Kind regards,
Shanley

-----Original Message-----
From: Achim Zeileis [mailto:Achim.Zeileis at uibk.ac.at] 
Sent: Thursday, 5 February 2015 8:01 PM
To: Shanley Chong
Cc: r-help at r-project.org; Nikolaus.Umlauf at uibk.ac.at
Subject: Re: [R] R2BayesX

Shanley,

thanks for the example.

> Thank you for your help.
> Here is my R codes:
>
>> data("MunichBnd")
>
>> N <- length(MunichBnd); n <- N*5
>> dat <- data.frame(x1 = runif(n, -3, 3),id = 
>> as.factor(rep(names(MunichBnd), length.out = n))) dat$sp <- with(dat, 
>> sort(runif(N, -2, 2), decreasing = TRUE)[id]) dat$re_poi <- with(dat, 
>> rpois(N, 10)[id]) dat$y_poi <- with(dat, 1.5 + sin(x1) + sp + re_poi 
>> + rpois(n, 10)) b_poi <- bayesx(y_poi ~ sx(x1) +  sx(id, bs = "mrf", 
>> map = MunichBnd) + sx(id, bs = "re"), method = "MCMC", data = dat, 
>> family='poisson')
>
> Warning message:
> running command 
> '"C:/Users/ChongS/Documents/R/win-library/3.1/BayesXsrc/libs/x64/Bayes
> X.exe" 
> C:/Users/ChongS/AppData/Local/Temp/RtmpqMhw3Z/bayesx/bayesx.estim.inpu
> t.prg' had status 3
>
> If I run the model using family='gaussian', it doesn't have problem.
> b_poi <- bayesx(y_poi ~ sx(x1) +   sx(id, bs = "mrf", map = MunichBnd) +  sx(id, bs = "re"), method = "MCMC", data = dat, family='gaussian')

This appears to be a problem in BayesX for combination of bs="re", method="MCMC" and family="poisson". If at least one of these is changed, everything works. An even simpler example is:

set.seed(1)
d <- data.frame(y = rpois(1000, 5))
d$x <- rep(1:100, each = 10)

Then:

bayesx(y ~ sx(x, bs = "re"), data = d, method = "MCMC", family = "poisson") ## -> problem processing BayesX!

whereas

bayesx(y ~ sx(x),            data = d, method = "MCMC", family = "poisson")
bayesx(y ~ sx(x, bs = "re"), data = d, method = "REML", family = "poisson") bayesx(y ~ sx(x, bs = "re"), data = d, method = "MCMC", family = "gaussian")

are all ok. Niki has contacted the original BayesX authors who might be able to give more insight. For the moment, I would recommend to use method="REML".

Best,
Z

> Kind regards,
> Shanley
>
>
> -----Original Message-----
> From: Achim Zeileis [mailto:Achim.Zeileis at uibk.ac.at]
> Sent: Wednesday, 4 February 2015 8:20 PM
> To: Shanley Chong
> Cc: r-help at r-project.org; Nikolaus.Umlauf at uibk.ac.at
> Subject: Re: [R] R2BayesX
>
> Shanley:
>
>> I am trying to run STAR logistic/binomial model using R2BayesX . A 
>> warning message came up every time when i included a random effect, 
>> bs='re', (unstructured spatial effect) into the model. The warning 
>> message is : Warning message: running command 
>> '"C:/Users/ChongS/Documents/R/win-library/3.1/BayesXsrc/libs/x64/BayesX.exe"
>> C:/Users/ChongS/AppData/Local/Temp/RtmpCW8QY9/bayesx33/bayesx.estim.input.prg'
>> had status 5
>
> I haven't seen this problem before. Maybe you can provide "commented, minimal, self-contained, reproducible code" (as the posting guide asks)?
>
> I'm also cc'ing the package maintainer (Nikolaus Umlauf) as he might be able to give more insight.
>
> Best,
> Z
>
>> The model is fine when i just ran the model using mrf, bs='mrf', (structured spatial effect).
>>
>> And when i tried to run STAR using family=Gaussian (response is normally distributed) with structured and unstructured spatial effect, it is fine too.
>>
>> Can anyone please help?
>>
>> Regards,
>>
>> Shanley
>>
>>
>> _____________________________________________________________________
>> This email has been scanned for the Sydney & South Western Sydney Local Health Districts by the MessageLabs Email Security System.
>> Sydney & South Western Sydney Local Health Districts regularly monitor email and attachments to ensure compliance with the NSW Ministry of Health's Electronic Messaging Policy.
>> 	[[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see 
>> 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.
>>
>
> _____________________________________________________________________
> This email has been scanned for the Sydney & South Western Sydney Local Health Districts by the MessageLabs Email Security System.
> Sydney & South Western Sydney Local Health Districts regularly monitor email and attachments to ensure compliance with the NSW Ministry of Health's Electronic Messaging Policy.
>
> _____________________________________________________________________
> This email has been scanned for the Sydney & South Western Sydney Local Health Districts by the MessageLabs Email Security System.
> Sydney & South Western Sydney Local Health Districts regularly monitor email and attachments to ensure compliance with the NSW Ministry of Health's Electronic Messaging Policy.
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see 
> 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.
>

_____________________________________________________________________
This email has been scanned for the Sydney & South Western Sydney Local Health Districts by the MessageLabs Email Security System.
Sydney & South Western Sydney Local Health Districts regularly monitor email and attachments to ensure compliance with the NSW Ministry of Health's Electronic Messaging Policy.

_____________________________________________________________________ 
This email has been scanned for the Sydney & South Western Sydney Local Health Districts by the MessageLabs Email Security System.
Sydney & South Western Sydney Local Health Districts regularly monitor email and attachments to ensure compliance with the NSW Ministry of Health's Electronic Messaging Policy.



More information about the R-help mailing list