It turns out that when I use GUI (file-change dir) to set the working
directory, R will crash.
If I use setwd() instead, the example runs well.

Regards,

On 4 April 2011 00:17, Wincent <ronggui.hu...@gmail.com> wrote:

> OK, I dig into the problem and found that Chinese character in the path
> should be blamed.
> Once the path rename to English only, it works.
>
> Regards,
>
> On 3 April 2011 23:43, Douglas Bates <ba...@stat.wisc.edu> wrote:
>
>> On Sun, Apr 3, 2011 at 9:53 AM, Wincent <ronggui.hu...@gmail.com> wrote:
>> > Does any one run the example without problem?
>> > I download the example and try to run line and seeds from vol1. R
>> crashes.
>> >> library(rjags)
>> > Loading required package: coda
>> > Loading required package: lattice
>> > module basemod loaded
>> > module bugs loaded
>> >> sessionInfo()
>> > R version 2.12.2 (2011-02-25)
>> > Platform: i386-pc-mingw32/i386 (32-bit)
>> > locale:
>> > [1] LC_COLLATE=Chinese (Simplified)_People's Republic of China.936
>> > [2] LC_CTYPE=Chinese (Simplified)_People's Republic of China.936
>> > [3] LC_MONETARY=Chinese (Simplified)_People's Republic of China.936
>> > [4] LC_NUMERIC=C
>> > [5] LC_TIME=Chinese (Simplified)_People's Republic of China.936
>> > attached base packages:
>> > [1] stats     graphics  grDevices utils     datasets  methods   base
>> > other attached packages:
>> > [1] rjags_2.2.0-4   coda_0.14-2     lattice_0.19-17
>> > loaded via a namespace (and not attached):
>> > [1] grid_2.12.2
>>
>> I didn't have any problem with the seeds examples
>> > library(rjags)
>> Loading required package: coda
>> module basemod loaded
>> module bugs loaded
>> > setwd("/var/tmp/classic-bugs/vol1/seeds/")
>> > source("../../R/Rcheck.R")
>> > load.module("glm")
>> module glm loaded
>> > d <- read.jagsdata("seeds-data.R")
>> > inits <- read.jagsdata("seeds-init.R")
>> > m <- jags.model("seeds.bug", d, inits, n.chains=2, n.adapt=2500)
>> Compiling model graph
>>   Resolving undeclared variables
>>   Allocating nodes
>>   Graph Size: 167
>>
>> > update(m, 2500)
>>  |**************************************************| 100%
>> > x <- coda.samples(m, c("alpha0", "alpha1","alpha2","alpha12","sigma"),
>> +                   n.iter=10000, thin=10)
>>  |**************************************************| 100%
>> > source("bench-test1.R")
>> > check.fun()
>>      alpha0       alpha1      alpha12       alpha2        sigma
>>  0.027439417 -0.022922026  0.025170384 -0.065288678  0.001678632
>> OK
>> > m <- jags.model("seedszro.bug", d, inits, n.chains=2, n.adapt=2500)
>> Compiling model graph
>>   Resolving undeclared variables
>>   Allocating nodes
>>   Graph Size: 190
>>
>> > update(m, 2500)
>>  |**************************************************| 100%
>> > x <- coda.samples(m, c("alpha0", "alpha1","alpha2","alpha12","sigma"),
>> +                   n.iter=10000, thin=10)
>>  |**************************************************| 100%
>> > source("bench-test2.R")
>> > check.fun()
>>     alpha0      alpha1     alpha12      alpha2       sigma
>> -0.00216258  0.00196343  0.02732117 -0.01017020 -0.01976949
>> OK
>> > m <- jags.model("seedssig.bug", d, inits, n.chains=2, n.adapt=2500)
>> Compiling model graph
>>   Resolving undeclared variables
>>   Allocating nodes
>>   Graph Size: 185
>>
>>  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100%
>> > update(m, 2500)
>>  |**************************************************| 100%
>> > x <- coda.samples(m, c("alpha0", "alpha1","alpha2","alpha12","sigma"),
>> +                   n.iter=10000, thin=10)
>>  |**************************************************| 100%
>> > source("bench-test3.R")
>> > check.fun()
>>     alpha0      alpha1     alpha12      alpha2       sigma
>>  0.06600343 -0.01107823  0.02933205 -0.04117105 -0.03376439
>> OK
>> > m <- jags.model("seedsuni.bug", d, inits, n.chains=2, n.adapt=2500)
>> Compiling model graph
>>   Resolving undeclared variables
>>   Allocating nodes
>>   Graph Size: 186
>>
>>  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100%
>> > update(m, 2500)
>>  |**************************************************| 100%
>> > x <- coda.samples(m, c("alpha0", "alpha1","alpha2","alpha12","sigma"),
>> +                   n.iter=10000, thin=10)
>>  |**************************************************| 100%
>> > source("bench-test4.R")
>> > check.fun()
>>     alpha0      alpha1     alpha12      alpha2       sigma
>> -0.04482849  0.05603658 -0.01204552  0.03653643 -0.00798445
>> OK
>>
>> > On 1 April 2011 04:00, Martyn Plummer <plumm...@iarc.fr> wrote:
>> >>
>> >> I'm sorry, the whole project is somewhat under-documented at the
>> moment,
>> >> but in addition the glm module is a work in progress.
>> >>
>> >> >From a user point of view, it should be fairly transparent. Using
>> rjags,
>> >> you type
>> >>
>> >> R> loadModule("glm")
>> >>
>> >> before calling jags.model().  If your model contains a GLM then JAGS
>> >> should recognize it and provide samplers that do block updating of the
>> >> parameters in the linear predictor.
>> >>
>> >> To see if it is working, call list.samplers(m) where m is the JAGS
>> model
>> >> object. The return value is a named list: the names correspond to the
>> >> sampling method, and the values are the names of the nodes that are
>> >> updated by that sampler. Samplers have names prefixed by the module
>> >> name, so if you have any entries in the sampler list called "glm::*"
>> >> then it is working.
>> >>
>> >> For some examples, you can download the classic bugs examples from
>> >> http://sourceforge.net/projects/mcmc-jags/files/Examples/2.x/
>> >>
>> >> The subdirectories "epil", "oxford", and "seeds" (in vol1) contain R
>> >> scripts that you can run using rjags, or scripts with the name
>> test*.cmd
>> >> that you can run using jags in batch mode.
>> >>
>> >> Under the hood, most of the samplers use data augmentation to reduce
>> the
>> >> model from a GLM to an LM, then the block updating relies on Tim
>> Davis's
>> >> libraries for sparse matrix algebra (Very much following your lead here
>> >> but with a much more basic use of the sparse matrix algebra).  Variance
>> >> parameters for the random effects are still a problem and can show poor
>> >> mixing even when everything else is working properly.  As I said, it is
>> >> a work in progress.
>> >>
>> >> I hope this helps.
>> >> Martyn
>> >>
>> >> On Wed, 2011-03-30 at 13:11 -0500, Douglas Bates wrote:
>> >> > In reading about the glm module in JAGS it seems that it is suitable
>> >> > for sampling from the posterior distribution of the parameters in a
>> >> > generalized linear mixed model.  However, I haven't been able to find
>> >> > documentation on how to use this module in particular.  Section 5.6
>> of
>> >> > the JAGS User Manual for version 2.2.0 hints at abilities but doesn't
>> >> > really expand on how to use them.
>> >> >
>> >> > Can anyone point me to further documentation or examples?
>> >>
>> >>
>> >> -----------------------------------------------------------------------
>> >> This message and its attachments are strictly
>> confidenti...{{dropped:8}}
>> >>
>> >> _______________________________________________
>> >> r-sig-mixed-mod...@r-project.org mailing list
>> >> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>> >
>> >
>> >
>> > --
>> > Wincent Ronggui HUANG
>> > Sociology Department of Fudan University
>> > PhD of City University of Hong Kong
>> > http://asrr.r-forge.r-project.org/rghuang.html
>> >
>>
>
>
>
> --
> Wincent Ronggui HUANG
> Sociology Department of Fudan University
> PhD of City University of Hong Kong
> http://asrr.r-forge.r-project.org/rghuang.html
>
>


-- 
Wincent Ronggui HUANG
Sociology Department of Fudan University
PhD of City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

        [[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to