Page 1 of 1

%FRACTILES

Posted: Thu Sep 20, 2012 5:35 am
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!

Re: %FRACTILES

Posted: Thu Sep 20, 2012 9:08 am
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

Re: %FRACTILES

Posted: Tue Sep 25, 2012 10:37 am
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!

Re: %FRACTILES

Posted: Tue Sep 25, 2012 11:59 am
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.