Displaying 5 results from an estimated 5 matches for "dwish".
Did you mean:
wish
2010 Apr 08
1
a small question about R with Winbugs
...# Stick breaking prior
p[1] <- r[1]
for (j in 2:C) {p[j] <- r[j]*(1-r[j-1])*p[j-1]/r[j-1]}
p.sum <- sum(p[])
for (j in 1:C) {r[j] ~ dbeta(1,alpha); pi[j] <- p[j]/p.sum}
# Baseline distribution
for (j in 1:C) {mu.star[j,1:2] ~
dmnorm(theta[],tau.star[j,,]);tau.star[j,1:2,1:2] ~ dwish(T[,],3)}
theta[1:2] ~ dmnorm(theta0[],S2[,])
T[1:2,1:2] ~ dwish(S3[,],3)
# DPP Precision Parameter
alpha ~ dgamma(1,1)
# Programming for calculating summary statistics
for(i in 1:N) {for (j in 1:C) {SC[i,j] <- equals(j,S[i])}}
# total clusters K
for (j in 1:C) {cl[j] <- step(...
2013 Jun 24
0
Running MCMC using R2WinBUGS
...)<-p1[j,i]
Y[j,i] ~ dbin(p[j,i],n)
}
}
# Hyper-priors:
gamma[1:2] ~ dmnorm(mn[1:2],prec[1:2 ,1:2])
mn<-c(-1.59,-2.44)
prec<-structure(.Data = c(.001,0,0,.001),.Dim = c(2, 2))
expit[1]<-exp(gamma[1])/(1+exp(gamma[1]))
expit[2]<-exp(gamma[2])/(1+exp(gamma[2]))
T[1:2 ,1:2] ~ dwish(R[1:2 ,1:2], 2)
sigma2[1:2, 1:2] <-inverse(T[,])
rho <- sigma2[1,2]/sqrt(sigma2[1,1]*sigma2[2,2])
R<-structure(.Data = c(.001,0,0,.001),.Dim = c(2, 2))
}
# R2WinBUGS code to run MCMC
library("R2WinBUGS")
bugs.output <- list()
for(i in 1:2){
Y<-(matrix[[i]])...
2010 Apr 09
0
rjags syntax error
...;-lam[29]*xi[i,15]+alp[44]
mu[i,45]<-lam[30]*xi[i,15]+alp[45]
xi[i,1:45]~dmnorm(u[1:15],phi[1:15,1:15])
}
for(j in 1:45){alp[j]~dnorm(0.0, 1.0)}
for(j in 1:30){lam[j]~dnorm(0.8,psi[j]}
for(j in 1:P){
psi[j]~dgamma(9.0, 4.0)
sgm[j]<-1/psi[j]
}
psd~dgamma(9.0, 4.0)
sgd<-1/psd
phi[1:3,1:3]~dwish(R[1:3,1:3], 5)
phx[1:3,1:3]<-inverse(phi[1:3,1:3])
}
2012 Aug 13
0
rjags error. Error parsing model file:,syntax error on line 5 near ""
...dnorm(0,psi[11])
lam[12] ~ dnorm(0,psi[12])
lam[13] ~ dnorm(0,psi[13])
lam[14] ~ dnorm(0,psi[14])
lam[15] ~ dnorm(0,psi[15])
#---------------------------------------
#Priors on Precisions
for(j in 1:nIndicators) {
psi[j] ~ dgamma(9.0, 4.0) # Error variances
sgm[j] <- 1/psi[j]
}
phi[1:2,1:2] ~ dwish(R[1:2,1:2], 5) # Precision matrix
phx[1:2,1:2] <- inverse(phi[1:2,1:2]) # Variance/Covariance matrix
}
"
writeLines(modelstring,con="model.txt")
#--------------------------------------------------------
# READ IN DATA AND PREPARE FOR JAGS
cfadata = read.csv("~/Desktop/rjags...
2011 Jun 23
0
Fwd: Re: Help with winbugs code
...e <http://var.ae> <-8.0*psae psae~dgamma(10,8) sgae<-1/psae
#beta
beta[1] ~dnorm(0.4,var.pk <http://var.pk>)
beta[2] ~dnorm(0.5,var.sp)
beta[3] ~dnorm(0.6,var.sp)
beta[4] ~dnorm(0.6,var.nm)
beta[5] ~dnorm(0.5,var.nm)
beta[6] ~dnorm(0.4,var.ae <http://var.ae>)
phi[1:5,1:5] ~dwish(R[1:5,1:5],30)
phx[1:5,1:5]<-inverse(phi[1:5,1:5])
}
#end of model
DATA
list(N=43, P=30,
R=structure(
.Data=c(10,0,0,0,0,
0,10,0,0,0,
0,0,10,0,0,
0,0,0,10,0,
0,0,0,0,10
),
.Dim=c(5,5)),
thd=structure(
.Data=c(-250,-1.99072046156042,-1.08241139430414,0.983052916910141,250,-250,-200,-1.47752529...