Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Maximizing correlation based on data resulting from an alogrithm containing conditional statements


From   Stas Kolenikov <[email protected]>
To   [email protected]
Subject   Re: st: Maximizing correlation based on data resulting from an alogrithm containing conditional statements
Date   Tue, 15 Jun 2010 22:35:39 -0400

So basically you need to write a good evaluator for optimize, right?
The easiest thing to do would be the d0-type evaluator. It will take
the vector of thresholds as parameters; it will also take two lists of
variable names, one for the GDP (say "y") and another for the
collection of the index components (say "X"). Then within the
evaluator, you:

1. set up the views for y and X;
2. create the matrix of -1/0/1 based on the logical conditions for X
(Z[.,k] = -1 + (X[.,k]>first threshold) + (X[,.k]>second threshold)
3. compute a bunch of -cross-es between y and Z
4. compute the correlation based on those cross-products.

I imagine this will fit into about 20-30 lines of Mata code.

On Tue, Jun 15, 2010 at 5:09 PM, Ryan McCann
<[email protected]> wrote:
> After failing to do this in excel using the software's "solver" function, I
> am now trying Stata.  I am creating a diffusion index to describe where GDP
> may be going.  The diffusion index assigns a -1, 0, or 1 to 15 individual
> components in a given month.  The difference in the percentage of components
> with 1's and the percentage of components with -1's gives the index number.
> I want to maximize the correlation between my index time series and a GDP
> time series.  -1, 0, 1 values are assign based on a conditional statement
> that test whether the raw values of the components are above, below, or
> within some thresholds.  The threshold can be defined as one number for each
> component.  I want to allow the thresholds to vary and maximize the
> correlation of the Index and GDP on the vector of thresholds.  I know that
> -optimize-  allows for optimization, but I don't see how it's possible to
> include this multi-step algorithm that stands between the thresholds that I
> want to allow to vary, and the correlation which is what I am trying to
> maximize.
>
> Your consideration is greatly appreciated.
>
> Ryan McCann
> Senior Analyst
> Keybridge Research LLC
> Office: 202.965.9487 | Mobile: 774.521.8874
>
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>



-- 
Stas Kolenikov, also found at http://stas.kolenikov.name
Small print: I use this email account for mailing lists only.

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index