simulation: creating panels

Questions related to panel (pooled cross-section time series) data.
randal_verbrugge
Posts: 14
Joined: Mon Sep 23, 2013 10:43 am

simulation: creating panels

Unread post by randal_verbrugge »

RATS does not like me to do this, although it seems to be implied as OK in UG 394:

calendar(panelobs=14,a) 2001:1
allocate 3000//2014:1

dec vector[series] age(3000)
dec vector[series] rooms(3000)
do i=1,3000
compute tempage = fix(%uniform(1,99)) ; *initial age = 1,...,99, uniform.
compute temproom = fix(%uniform(4,14)) ; *generates rooms 4 to 13
set rooms(i) = temproom ;*IT IS FINE with this. :D
compute age(i//1) = tempage ;*HERE is where it complains about mixed data types or something. :evil:
do j=2,14
compute age(i//j) = age(i//j-1) + 1 ;*HERE is where it complains about mixed data types or something. :evil:
end do j
end do i

even if I work around this using a command like

set age 1 3000//14 = 0.0

which allows me to execute

compute age(i//1) = tempage ... and the rest of the commands in that block,

I run into problems when I later try to:

do i=1,3000
compute lrent(i//1) = 7.5 +.02*rooms(i//1) + .2*quality(i//1) - .005*age(i//1) ;*HERE is where it complains :evil:
do j=2,14
if (age(i//j).le.10) {
compute lrent(i//j) = lrent(i//j-1) - .005 - BRI(i//j)*.002
}
else {
compute lrent(i//j) = lrent(i//j-1) + .0015 -
}
end do j

Thanks,
Randy
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: simulation: creating panels

Unread post by TomDoan »

Code: Select all

calendar(panelobs=14,a) 2001:1
allocate 3000//2014:1

dec vector[series] age(3000)
dec vector[series] rooms(3000)
What are AGE and ROOMS supposed to be? As you've defined this at this point, they will each have 3000 series with 3000 individuals and 14 observations.

It looks like this is what you want:

Code: Select all

calendar(panelobs=14,a) 2001:1
allocate 3000//2014:1
dec vect initage(3000)
dec vect initrooms(3000)
ewise initage(i)=%RANINTEGER(1,99)
ewise initrooms(i)=%raninteger(4,14)
set age = initage(%indiv(t))+(%period(t)-1)
set rooms = initroots(%indiv(t))
randal_verbrugge
Posts: 14
Joined: Mon Sep 23, 2013 10:43 am

Re: simulation: creating panels

Unread post by randal_verbrugge »

Thanks very much!
Post Reply