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  March 2015

BUGS March 2015

Options

Subscribe or Unsubscribe

Subscribe or Unsubscribe

Log In

Log In

Get Password

Get Password

Subject:

problem fitting binomial mixture model OpenBUGS

From:

Curtis Burkhalter <[log in to unmask]>

Reply-To:

Curtis Burkhalter <[log in to unmask]>

Date:

Mon, 16 Mar 2015 20:38:40 +0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (119 lines)

Hello everyone,

I'm having a problem trying to get my binomial mixture model to update. I'm able to compile the model, but I reach a problem when I load initial values. I load the initial values for my regression parameters, the abundance estimates(N) and the detection probability(p), but OpenBUGS states that I still have uninitialized parameters so I hit the 'gen inits' button provided on the model specification tab and I get the error message 'error for node y[3,3,1] of type GraphBinomial.Node second argument invalid integer value given'. 

I'm unsure of why this is happening or what to do to fix this error so any help would be greatly appreciated. I've pasted my code and the data structures below.  Thank you in advance.

model {

#Priors 

for (k in 1:7) {
p[k]~dunif(0,1)
}

alpha0~dunif(-10,10)
alpha1~dunif(-10,10)


#Likelihood
#Ecological model for true abundance (process model)
for (k in 1:7) {												#Loop over years
	for (i in 1:R) {											#Loop over R sites
		N[i,k]~dpois(lambda[i,k])					 #Abundance
		log(lambda[i,k])<-alpha0+alpha1*well[i,k]

		#Observation model for replicated counts
		for (j in 1:T) {										#Loop over repeated counts
			y[i,j,k] ~dbin(p[k],N[i,k])					#Detection
			
			
			#Assess model fit using Chi-squared discrepancy
			#Compute fit statistic "E" for observed data
			eval[i,j,k]<-p[k]*N[i,k]					#Expected values
			E[i,j,k]<-pow((y[i,j,k]-eval[i,j,k]),2)/(eval[i,j,k]+0.5)
			
			#Generate replicate data and compute fit stats for them
			y.new[i,j,k]~dbin(p[k],N[i,k])
			E.new[i,j,k]<-pow((y.new[i,j,k]-eval[i,j,k]),2)/(eval[i,j,k]+0.5)
			
			}#j
			
		}#i
		
}#k

#Derived and other quantities

#for(k in 1:7) {

#totalN[k]<-sum(N[,k])								#Total pop. size across all sites
#mean.abundance[k]<-exp(alpha.lam[k])

#}


fit<-sum(E[,,])
fit.new<-sum(E.new[,,])
}

#Data
list(R=669,T=3)


#inits
list(alpha0=0.92,alpha1=-0.57)

 str(y)
'data.frame':   669 obs. of  21 variables:
 $ y..1.1.: int  8 5 0 14 21 6 4 5 18 0 ...
 $ y..1.2.: int  23 0 0 15 32 4 8 5 35 0 ...
 $ y..1.3.: int  14 0 0 10 30 18 19 2 19 2 ...
 $ y..1.4.: int  8 2 5 21 32 0 6 0 21 0 ...
 $ y..1.5.: int  9 0 23 15 20 0 0 0 19 0 ...
 $ y..1.6.: int  0 0 0 5 1 9 10 3 19 0 ...
 $ y..1.7.: int  6 0 0 2 18 0 10 0 11 0 ...
 $ y..2.1.: int  20 6 0 21 30 12 15 8 5 0 ...
 $ y..2.2.: int  21 0 0 16 34 5 0 3 NA 0 ...
 $ y..2.3.: int  14 0 0 NA 12 23 7 0 16 0 ...
 $ y..2.4.: int  9 0 5 18 30 4 16 5 11 0 ...
 $ y..2.5.: int  1 0 4 24 40 2 15 4 13 0 ...
 $ y..2.6.: int  6 0 NA 2 10 0 12 NA 11 0 ...
 $ y..2.7.: int  17 NA 0 14 18 4 22 1 5 0 ...
 $ y..3.1.: int  10 5 NA 7 13 10 0 0 18 2 ...
 $ y..3.2.: int  19 NA 1 9 22 2 NA NA NA 0 ...
 $ y..3.3.: int  12 NA 0 NA 5 8 12 0 20 0 ...
 $ y..3.4.: int  7 1 5 16 10 2 29 8 11 0 ...
 $ y..3.5.: int  6 0 2 21 6 0 16 8 16 0 ...
 $ y..3.6.: int  0 0 NA NA 0 12 NA NA 12 0 ...
 $ y..3.7.: int  17 NA 0 12 36 8 13 0 7 0 ...
> str(wells)
'data.frame':   669 obs. of  7 variables:
 $ well..1.: num  0 0 0 0 0 ...
 $ well..2.: num  0 0 0 0 0 ...
 $ well..3.: num  0 0 0 0 0 ...
 $ well..4.: num  0 0 0 0 0 ...
 $ well..5.: num  0 0 0 0 0 ...
 $ well..6.: num  0 0 0 0 0 ...
 $ well..7.: num  0 0 0 0 0 ...
 str(initialN)
'data.frame':   669 obs. of  7 variables:
 $ N..1.: int  13 5 0 14 21 9 6 4 14 1 ...
 $ N..2.: int  21 0 0 13 29 4 3 3 12 0 ...
 $ N..3.: int  13 0 0 3 16 16 13 1 18 1 ...
 $ N..4.: int  8 1 5 18 24 2 17 4 14 0 ...
 $ N..5.: int  5 0 10 20 22 1 10 4 16 0 ...
 $ N..6.: int  2 0 0 2 4 7 7 1 14 0 ...
 $ N..7.: int  13 0 0 9 24 4 15 0 8 0 ...
> str(initialp)
 $ p..: num  0.694 0.663 0.807 0.455 0.798 ...

-------------------------------------------------------------------
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