%FRACTILES

Use this forum to post questions about syntax problems or general programming issues. Questions on implementing a particular aspect of econometrics should go in "Econometrics Issues" below.
comac
Posts: 25
Joined: Mon Jun 29, 2009 7:31 am

%FRACTILES

Unread post by comac »

One quick question.

I have a distribution of scalars (called 'beta') which are the results of bootstrapping. The code below computes the quantiles at 2.5 and 97.5% respectively. My question is: what's the easiest way to ask RATS to print the corresponding fractiles such that beta=1?

Code: Select all

dec rect[vect] fract(1,1)
dec vect onevect(bootdraws)
dec integer k
do i=1,1
   do j=1,1
   ewise onevect(k)=beta(k)(i,j)
      compute fract(i,j)=%fractiles(onevect,||.025,.975||)
      end do j
 end do i
Thanks for your help!
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: %FRACTILES

Unread post by TomDoan »

If you want the percentile that's less than 1, that would be done with

dec rect[vect] fract(1,1)
dec rect betaf(1,1)
dec vect onevect(bootdraws)
dec integer k
do i=1,1
do j=1,1
sstats 1 bootdraws (%beta(t)(i,j)<1.0)>>betaf(i,j)
end do j
end do i
comac
Posts: 25
Joined: Mon Jun 29, 2009 7:31 am

Re: %FRACTILES

Unread post by comac »

Dear Tom, many thanks. This is helpful.

One more point: how easily could I get some descriptive statistics for my 'beta'? 'Beta' as the result of bootstrap is, by definition, a vect[rect] whose dimension is (1 X bootdraws). I would like to have the same statisitcs provided with the STATISTICS instruction.

Should I execute in the loop a command at a time to get (%MAXIMUM, %MINIMUM, %SKEWNESS, %KURTOSIS, etc.), or is there a way to do this more efficiently?

Thanks again!
moderator
Site Admin
Posts: 269
Joined: Thu Oct 19, 2006 4:33 pm

Re: %FRACTILES

Unread post by moderator »

You would have to copy each of the cross sections into a series in order to do that. (Though you might find that setting this all up as a RECT[SERIES] would be easier). If you keep the same arrangement, you would need something like (for statistic (i,j))

set temp 1 bootdraws = beta(t)(i,j)

then do the STATISTICS on TEMP.
Post Reply