simulation: creating panels
Posted: Wed Apr 09, 2014 2:06 pm
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.
compute age(i//1) = tempage ;*HERE is where it complains about mixed data types or something.
do j=2,14
compute age(i//j) = age(i//j-1) + 1 ;*HERE is where it complains about mixed data types or something.
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
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
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.
compute age(i//1) = tempage ;*HERE is where it complains about mixed data types or something.
do j=2,14
compute age(i//j) = age(i//j-1) + 1 ;*HERE is where it complains about mixed data types or something.
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
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