Displaying 7 results from an estimated 7 matches for "dbern".
Did you mean:
  bern
  
2012 May 23
1
how a latent state matrix is updated using package R2WinBUGS
...phi ~ dunif(0, 1)  # Prior for mean survival
mean.p ~ dunif(0, 1)    # Prior for mean recapture
# Likelihood 
for (i in 1:nind){
        # Define latent state at first capture
        z[i,f[i]] <- 1
        for (t in (f[i]+1):n.occasions){
                # State process
                z[i,t] ~ dbern(mu1[i,t])
                mu1[i,t] <- phi[i,t-1] * z[i,t-1]
                # Observation process
                y[i,t] ~ dbern(mu2[i,t])
                mu2[i,t] <- p[i,t-1] * z[i,t]
                } #t
        } #i
}
# Call WinBUGS from R
cjs.c.c <- bugs(
data = list(z = known.z, <...
2012 Jan 27
0
Error in JAGS, cannot monitor z
...or for mean survival
	beta[t] ~ dbeta(1, 1)           # Prior for mean recapture
}  
                 # Prior for mean recapture
# Likelihood 
for (i in 1:nind){
   # Define latent state at first capture
   z[i,f[i]] <- 1
   for (t in (f[i]+1):n.occasions){
      # State process
      z[i,t] ~ dbern(mu1[i,t])
      mu1[i,t] <- phi[i,t-1] * z[i,t-1]
      # Observation process
      y[i,t] ~ dbern(mu2[i,t])
      mu2[i,t] <- p[i,t-1] * z[i,t]
      } #t
   } #i
}
ni <- 10000
nt <- 6
nb <- 5000
nc <- 3
cjs.ran <- jags.model(file="cjs22time.jags",data=bugs.data, n...
2011 May 27
1
Error with BRugs 0.53 and 0.71, on Win7 with R 2.12.2 and 2.13.0 (crashes R GUI)
...d_packages
> library(BRugs)
Loading required package: coda
Loading required package: lattice
Welcome to BRugs running on OpenBUGS version 3.0.3
> # Specify the model in BUGS language, but save it as a string in R:
> modelString = "
+ model {
+ for ( i in 1:nFlips ) {
+ y[i] ~ dbern( theta )
+ }
+ theta ~ dunif( priorA , priorB )
+ priorA <- 0.6
+ priorB <- 1.0
+ }
+ " # close quote to end modelString
> 
> # Write the modelString to a file, using R commands:
> writeLines(modelString,con="model3.txt")
> # Use BRugs to send the model.tx...
2010 Oct 15
1
Problem using BRugs
...o=rho_o_0, rho_d=rho_d_0,
rho_w=rho_w_0)}
parameters<-c("beta", "rho_o", "rho_d", "rho_w")
probit.sim<-BRugsFit(data,inits,parameters,modelFile="spatial.openbugs.txt",numChains=1,nIter=2000)
# my model
model {
for (i in 1:676) {
y[i] ~ dbern(p[i])
wwy[i]<- inprod(ww[i, 1:676] , y[])
woy[i]<- inprod(wo[i, 1:676] , y[])
wdy[i]<- inprod(wd[i, 1:676] , y[])
probit(p[i])<- rho_o * woy[i] + rho_d * wdy[i] + rho_w * wwy[i] + beta[1] +
beta[2] * cap2[i] + beta[3] * pol2[i] + beta[4] * cap1[i] + beta[5] *
pol1[i] + beta[6] * g[i...
2012 Oct 26
1
Openbugs- Array Index
...# proportion of number of species among groups
for(i in 1:g){
prop[i] ~ dgamma(1,1)
prob[i] <- prop[i]/sum(prop[])
 }
for(i in 1:(S+m)){
r[i] ~ dnorm(mu.r,tau.r) I(-2,2)# generating parameters related to
detectability
p[i] <- 1/(1+exp(-(r[i])))# individual-level detection probability
w[i] ~ dbern(psi)# indicator variable whether each species is exposed to
sampling or not
G[i] ~ dcat(prob[1:g])# group identity
for(h in 1:2){# habitat effects
habitat.eff[i,h] ~ dnorm(mu.h[G[i],h],tau.h[G[i],h]) I(-2,2)
 }
for(j in 1:4){# fitting process
# ecological process model
lambda[i,j] <-  exp(habita...
2010 Apr 19
1
BRugs
Hi. I am new here, and I am writing this Winbugs code with BRugs.
n=length(bi.bmi)
Lagegp=13
Lgen=2
Lrace=5
Lstra=15
Lpsu=2
#model gen x race
bi.bmi.model=function(){
# likelihood
for (i in 1:n){
	bi.bmi[i]~ dbern(p[i])
	logit(p[i])<- a0 + a1[agegp[i]]+a2[gen[i]]+a3[race[i]]
			   + a12[agegp[i], gen[i]]
			  + gam[stra[i]]+ u[psu[i],stra[i]]		}
# constraints for a1, a2, a3, a12
a1[1]<-0.0
a2[1]<-0.0
a3[1]<-0.0
a12[1,1]<-0.0
#
for(k in 2:Lgen){ a12[1,k]<-0.0}
for(j in 2:13){ a12[j,1]<-0....
2012 Jul 13
3
Help with R2 OpenBUGs
...tion of number of species among groups
for(i in 1:g){
	prop[i] ~ dgamma(1,1)
	prob[i] <- prop[i]/sum(prop[])
	}
for(i in 1:(S+m)){
	r[i] ~ dnorm(mu.r,tau.r) I(-5,5)		# generating parameters related to
detectability
	p[i] <- 1/(1+exp(-(r[i])))		# individual-level detection probability
	w[i] ~ dbern(psi)				# indicator variable whether each species is exposed
to sampling or not
	G[i] ~ dcat(prob[1:g])			# group identity
for(h in 1:3){	# habitat effects
	habitat.eff[i,h] ~ dnorm(mu.h[G[i],h],tau.h[G[i],h]) I(-5,5)
	}
for(j in 1:20){	# fitting process
	# ecological process model
	lambda[i,j] <...