Hi:
There are 74 (N) units (firms) and some have repeated observations (uneven time), thus giving me a total of 300 (NT) obs. My data matrix has 300 rows. I have an indicator variable cntrid[i] to identify the firms. I want to control for firm henerogeneity and run the model. Then I also want
to make the heterogeneity term bi and function of two variables.
(I ran this hierarchical model I allow the intercept term to represent heterogeneity bi using an indicator variable cntrid.. using bi[cntrid[i]] in the mui[i] function. Then I present bi distribution subsequently in a different loop (j: 1to N) . I got sensible results. Did
I do it right to capture the firm heterogeneity?)
Now I want to make this heterogeneity term bi a function of two variables: say lpopm which does not change within the group (i.e., over time) and ginm which vary across the entire samples. (In the rectangular form I supply the same values for the lpopm variable within the same group. The rest of the variables are different in the entire sample) How can I modified the program below to do what I am trying to do using the data structure that I have?
Not crucial for now, but any idea to add a lagged dynamic term in this framework would also help me understand this modeling procedure. Any paper
or codes --on the idea of the lagged term in this dynamic panel framework--
anywhere?
I am a new BUG user so your kind help would be highly appreciated.
Thanks
Alok Bohara
model
{
# NT = 300 total observations; N = 74 clusters
for(i in 1: NT) {
.
...var transformation statements
.
corm[i] <-?..
polm[i] <- ?.
lpopm[i] <- (lpop[i] - mean(lpop[])) / sd(lpop[]);
ginm[i] <- (gin[i] - mean(gin[])) / sd(gin[]);
}
for (i in 1: NT) {
mu[i] <- bi[cntrid[i]] + b[1]*corm[i] + b[2]*polm[i];
tr5[i] ~ dnorm(mu[i],tau)
}
#N = 74 groups;
for (j in 1:N) {
bi[j] ~ dnorm(bi.c,bi.tau)
}
b[1] ~ dnorm(0, 1.0E-6)
b[2] ~ dnorm(0,1.0E-6)
tau ~ dgamma(.001,.001)
sigma <- 1/sqrt(tau);
bi.c ~ dnorm(0,.00001)
sigma.bi ~ dgamma(.001,.001)
}
#initial values
list( b = c(.821,-.13,), bi.c = .5, bi.tau=.21, tau = 1,sigma.bi=1)
#
list(NT = 300,N=74)
#retangular data
tr2[] tr5[] tr3[] lgdpp[] cor[] corrpltres[] corrfhres[] fse[] pol[] ltr[]
lf[] gvt[] lpop[] eurorest[] gin[] conf[] year2[] vhnum2[] cntrid[] od2[]
0 2 2 -0.2983229 4.76 0.5365142 0.490395 4.5 7 0.0771935 0.582724 2.75 17.36421 0 47.59 0 1 6 1 0
0 2 2 -0.2547274 6.59 2.490171 2.426226 4.5 7 0.1550191 0.695318 2.55 17.37712 0 47.59 0 2 6 1 0
0 3 2 -0.1899758 7.19 3.168595 3.102018 4.5 7 0.2541261 1.035406 2.6 17.38988 0 47.59 0 3 6 1 0
1 4 3 -0.1659851 7 3.10424 3.014805 4.5 7 0.2433266 0.6669789 2.3 17.4025 0
47.59 0 4 6 1 0
1 4 3 -0.2117273 7 3.098776 2.960348 4 7 0.0830646 1.708784 2.1 17.41501 0 47.59 0 5 6 1 0
0 1 1 0.7357944 1.2 -1.427046 -1.389094 6 10 1.077404 1.515463 2.05 16.70938 1 41.72 0 1 8 2 1
0 2 2 0.7585659 1.4 -1.194134 -1.158316 6 10 1.124225 1.270061 2.05 16.72307 1 41.72 0 2 8 2 1
0 3 2 0.7916203 1.14 -1.436683 -1.397093 6 10 1.108069 1.314358 2.15 16.73502 1 41.72 0 3 8 2 1
0 2 2 0.825291 1.3 -1.152209 -1.132949 6 10 1.019012 1.139395 1.9 16.74676 1 41.72 0 4 8 2 1
0 2 2 0.8572728 1.3 -1.105986 -1.089722 6 10 0.9880376 1.049936 1.9 16.75821 1 41.72 0 5 8 2 1
0 2 2 1.075947 2.87 0.7194198 0.7289315 6 10 1.914788 0.5089927 2.1 15.90081 1 28.9449 0 1 9 3 1
0 2 2 1.091264 2.41 0.2815575 0.2896339 6 10 1.899935 1.218721 2.1 15.9023 1 28.9449 0 2 9 3 1
0 2 2 1.102053 2.39 0.2771502 0.2842156 6 10 1.873786 0.8892635 2.1 15.90393 1 28.9449 0 3 9 3 1
0 2 2 1.129732 2.5 0.4271547 0.4316265 6 10 1.912293 1.362189 2.1 15.90465 1 28.9449 0 4 9 3 1
-------------------------------------------------------------------
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
|