forked from adfmb/Bayesian-Variable-Selection
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel3.r
More file actions
32 lines (24 loc) · 842 Bytes
/
Copy pathmodel3.r
File metadata and controls
32 lines (24 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
cat("model{
for(i in 1:n){
y[i]~dbin(pi[i],1)
#Funcion Liga
logit(pi[i])<-alpha+x[i,]%*%beta
}
#A priori's
alpha ~ dnorm(0,1.0E-6)
#tau ~ dgamma(1.0E-4,1.0E-4) # Esta no la ponemos porque es la precisión cuando y[i] es normal
tauBeta <-pow(sdBeta,-2); sdBeta ~ dunif(0,20) #tau_in=tauBeta #sd_bet=sdBeta
TauM[1] <- tauBeta*1000; TauM[2] <- tauBeta #TauM[1]=tau[1]; TauM[2]=tau[2]
PInd[2] <- 20/127; PInd[1] <- 1-PInd[2] #PInd[2]=p_ind[1]; PInd[1]=p_ind[2]
for(i in 1:var_expl){
IndA[i] ~ dcat(PInd[])
Ind[i] <- IndA[i]-1 #Ind=gamma
beta[i] ~ dnorm(0, TauM[IndA[i]])
}
#Estimaciones de Ys conocidas con
#La posterior que genera Jags
#for(i in 1:n){
#yest[i]~dbin(pi[i],1)
#}
}"
, file="ssvs_03.txt")