JiscMail Logo
Email discussion lists for the UK Education and Research communities

Help for BUGS Archives


BUGS Archives

BUGS Archives


BUGS@JISCMAIL.AC.UK


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

BUGS Home

BUGS Home

BUGS  October 2011

BUGS October 2011

Options

Subscribe or Unsubscribe

Subscribe or Unsubscribe

Log In

Log In

Get Password

Get Password

Subject:

Re: JAGS in Linux

From:

Martyn Plummer <[log in to unmask]>

Reply-To:

Martyn Plummer <[log in to unmask]>

Date:

Wed, 5 Oct 2011 18:14:05 +0200

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (163 lines)

Dear Eric,

It looks like you are not getting your data into the model properly.
This would explain why the posteriors look like the priors. It also
explains why the run time is almost independent of the number of
samples. If a model has no data, then every node is forward-sampled from
its prior. This forward sampling is extremely efficient, so the run time
is dominated by the (relatively slow) compilation of the model.

You can extract the data from a jags model with the member function
data(), e.g.

modelInit$data()

Try this and see what it gives you.

Martyn


to see whether the 
On Mon, 2011-10-03 at 18:54 -0500, eric magar wrote:
> Dear BUGS users:
> 
> I am having trouble fitting an IRT model in Linux with JAGS and wonder
> if this is the appropriate forum to seek help. Suggestions will be
> much appreciated.
> 
> I have used winBUGS (via R2winBUGS) for some time with success, but am
> now confronting a model with thousands of parameters and a fairly
> large dataset. Updating takes very long --- 5k iterations with 3
> chains can take up to four hours, and I need many many more. Attempts
> to use snow for parallel computation in the quad core processor have
> failed beyond my understanding, so I abandoned that route.
> 
> I am now attempting to fit in Linux to compare speed using R's
> system.time, and for this I migrated from BUGS to JAGS. My first Linux
> trial run with 20 iterations appeared very promising --- the model
> reports to run much much faster:
> 
> > Compiling model graph
> >    Resolving undeclared variables
> >    Allocating nodes
> >    Graph Size: 838547
> >
> > Initializing model
> >
> >    user  system elapsed
> >  97.310   0.440  97.806
> 
> The equivalent triad in winBugs was about 241, .32, and 242, a
> substantial improvement --- apparently. I then attempted a more
> serious 10k burnin with 10k iterations. To my astonishment, the
> reported system.time was virtually identical and the posterior sample
> looks unmodified compared to the priors. There is, evidently, a
> problem that is going unreported.
> 
> Can anyone offer clues about what may be going on and how I can
> attempt to fix it? The model and key commands appear below for
> reference.
> 
> Many thanks!
> 
> Eric Magar
> Ciencia Política, ITAM
> Mexico City
> +52 55 5628 4079
> @emagar
> 
> 
> ###########
> ## MODEL ##
> ###########
> # rjags version
> cat("
> model {
> for (j in 1:J){
>     for (i in 1:I){
>       v.star[j,i] ~ dnorm(mu[j,i],1)T(lo.v[j,i],hi.v[j,i]);   ##
> truncated normal sampling (BUGS uses I)
>       mu[j,i] <- beta[i]*x[j] - alpha[i] + delta[i]*y[j]
>                   }
>                 }
>   ## priors ################
> for (j in 1:J){
>     x[j] ~  dnorm(0, 1)
>     y[j] ~  dnorm(0, 1)
>     }
> for(i in 1:(west-1)){
>     alpha[i] ~ dnorm( 0, 1)
>     beta[i]  ~ dnorm( 0, 1)
>     delta[i] ~ dnorm( 0, 1)
>     }
> alpha[west] ~ dnorm( 0, 1)
> beta[west]  ~ dnorm(-4, 20)  ## informative
> delta[west] ~ dnorm(-4, 20)  ## informative
> for(i in (west+1):(east-1)){
>     alpha[i] ~ dnorm( 0, 1)
>     beta[i]  ~ dnorm( 0, 1)
>     delta[i] ~ dnorm( 0, 1)
>     }
> alpha[east] ~ dnorm( 0, 1)
> beta[east]  ~ dnorm(-4, 20)  ## informative
> delta[east] ~ dnorm( 4, 20)  ## informative
> for(i in (east+1):(north-1)){
>     alpha[i] ~ dnorm( 0, 1)
>     beta[i]  ~ dnorm( 0, 1)
>     delta[i] ~ dnorm( 0, 1)
>     }
> alpha[north] ~ dnorm( 0, 1)
> beta[north]  ~ dnorm( 4, 20)  ## informative
> delta[north] ~ dnorm( 4, 20)  ## informative
> for(i in (north+1):I){
>     alpha[i] ~ dnorm( 0, 1)
>     beta[i]  ~ dnorm( 0, 1)
>     delta[i] ~ dnorm( 0, 1)
>     }
> }"
> , file="model.jag")
> #end model##############
> ##
> dip.parameters <- c("delta","beta", "alpha", "x", "y")
> dip.inits<-function() {
>   list(v.star=vstar, x = rnorm(J), y = rnorm(J), alpha = rnorm(I),
> delta = rnorm(I), beta = rnorm(I))
>   }
> dip.data <- list ("J"=J, "I"=I, "lo.v"=lo.v, "hi.v"=hi.v, "west"=west,
> "east"=east, "north"=north)
> ##
> #test ride to see program works
> myWrap <- function(){
>     modelInit <- jags.model (
>          "model.jag",
>          inits=dip.inits,
>          data=dip.data,
>          n.chains=3,
>          n.adapt=10)
>     dip.60 <- coda.samples (modelInit,
>          dip.parameters,
>          n.iter=10,
>          thin=2)
>     return(dip.60)
> }
> print(system.time(myWrap()))


-----------------------------------------------------------------------
This message and its attachments are strictly confidential. If you are
not the intended recipient of this message, please immediately notify 
the sender and delete it. Since its integrity cannot be guaranteed, 
its content cannot involve the sender's responsibility. Any misuse, 
any disclosure or publication of its content, either whole or partial, 
is prohibited, exception made of formally approved use
-----------------------------------------------------------------------

-------------------------------------------------------------------
This list is for discussion of modelling issues and the BUGS software.
For help with crashes and error messages, first mail [log in to unmask]
To mail the BUGS list, mail to [log in to unmask]
Before mailing, please check the archive at www.jiscmail.ac.uk/lists/bugs.html
Please do not mail attachments to the list.
To leave the BUGS list, send LEAVE BUGS to [log in to unmask]
If this fails, mail [log in to unmask], NOT the whole list

Top of Message | Previous Page | Permalink

JiscMail Tools


RSS Feeds and Sharing


Advanced Options


Archives

March 2024
January 2024
December 2023
August 2023
March 2023
December 2022
November 2022
August 2022
May 2022
March 2022
February 2022
December 2021
November 2021
October 2021
September 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
December 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
May 2017
April 2017
March 2017
February 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
2006
2005
2004
2003
2002
2001
2000
1999
1998


JiscMail is a Jisc service.

View our service policies at https://www.jiscmail.ac.uk/policyandsecurity/ and Jisc's privacy policy at https://www.jisc.ac.uk/website/privacy-notice

For help and support help@jisc.ac.uk

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager