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

Re: [amibroker] r-squared and regression analysis


  • To: amibroker@xxxxxxxxxxxxxxx
  • Subject: Re: [amibroker] r-squared and regression analysis
  • From: Anthony Faragasso <ajf1111@xxxxxxxx>
  • Date: Sat, 15 Feb 2003 19:18:40 -0800
  • In-reply-to: <b2lkln+sus8@eGroups.com>

PureBytes Links

Trading Reference Links

I think this is what you want to do:

load into Indicator builder and

Insert your base market ( index )  and then change the Periods to your
setting.

Then when you open a chart with a mutual fund..you will see the Alpha ,
beta, and R_squared..

Anthony



//Alpha AND Beta Indicators

//Ver.1.00, 2/10/02

//coded by Anthony Faragasso

//e-mail: ajf1111@xxxxxxxx

//Insert your Stock_index,Composite_index, S&P,etc.

//as the **Base Market**.

MaxGraph=5;

/***Base Market************/

Mkt="^ndx";//Must be enclosed in "....."Quotations.

P=Foreign(Mkt,"C",1);

/**************************/

Periods=14;//Set the period of Observation

//****Beta***********************/

Beta=(( Periods * Sum(ROC( C,1) * ROC(P,1),Periods )) -
(Sum(ROC(C,1),Periods) * Sum(ROC( P,1),Periods))) / ((Periods *
Sum((ROC(P,1)^2 ),Periods)) - (Sum(ROC(P,1 ),Periods)^2 ));

/******************************************/

//*****Alpha*********************/

Alpha=(Sum(ROC( C,1) ,Periods) - ( Beta ) * Sum( ROC( P,1) ,Periods ) )
/ Periods;

/******************************************/

/***R-Squared*****************/

R2=Correlation(P,C,Periods)^2;

/************************************/

Plot(beta,"Beta",colorRed,styleLine);

Plot(Alpha,"Alpha",colorBlue,styleLine);

/**R_squared graphing*****/

Plot(r2,"R2",colorYellow,styleLine);

/*************************/

Title=Name()+" "+"ALPHA
"+EncodeColor(colorBlue)+"("+WriteVal(Alpha,format=1.2)+")"+"
"+EncodeColor(colorBlack)+" BETA
"+EncodeColor(colorRed)+"("+WriteVal(Beta,format=1.2)+")"+"\n
"+EncodeColor(colorBlack)+" R_SQUARED
"+EncodeColor(colorYellow)+"("+WriteVal(r2,format=1.2)+")";

/**Notes***/

//You've got to start with r-squared, which is an

//indicator of the validity of the beta AND alpha

//measures. Because the r-squared measures just how

//closely the Stock OR fund tracks the

//index with which it is being compared.

//An r-squared of 1.0 indicates

//A perfect match. AND, in that case, you can

//trust that the beta AND alpha measures are

//valid, too. But, the lower the r-squared, the less

//reliable beta AND alpha measures are.

//"[Betas and alphas on] a Stock or fund with an r-squared that's below
//0.50 are completely meaningless.

//Assuming the r-squared is, say, 0.75 OR higher, you can move on to the
//beta.



"dom1_1998 " wrote:

>  Hi Anthony:
>
> When I used to subscribe to Morningstar which rated mutual funds, the
> meaing of R2 referred to how much of the mutual fund point movement
> was due to its comparative index, usually the S&P 500.  If the fund
> had an R2 of 80, that meant 80 percent of the funds movement will be
> due to the index.     The other 20% was attributed to the individual
> characteristics of that fund.
>
> You would think the above would have been beta but it's not.
> Is your R2 and the one above the same?  If not could a code be written
>
> to determine the R2 for a set number of periods?
>
> TIA,
>
> Dominick
>
>
>                    Yahoo! Groups Sponsor
                        ADVERTISEMENT


>
> Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> (Web page: http://groups.yahoo.com/group/amiquote/messages/)
>
> Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 


Alpha and Beta:

                     In security analysis, a lot of focus is given to a stock's beta. 
                     The beta is the stock's coefficient measure of how volitile
                     it is as compared to the rest of the market (represented by
                     the S&P 500).  Thus a stock with a beta of 1 means it moves
                     in perfect harmony with the market.  The market goes up
                     10% in one week, that stock will go up 10% in that same week. 
                     If the market goes down 10%, expect that stock to do the
                     same.  Stocks with a beta greater than 1 means that the stock
                     will move greater than the market.  For example if the market
                     moves up 10% in one week and the beta for a certain stock is
                     2, that stock will move up 20% or twice the market.  A beta of
                     less than 1 means that the stock will move less than the
                     market.  If a stock has a beta of 0.5 and the market goes up
                     10%, the stock will go up only 5%.  You can also assume the
                     reverse to be true as well.
                     But a beta only gives you part of the picture.  To get a better
                     sense of the nature of a stock, one should look at the alpha.  A
                     stock's alpha is a coefficient that measures return from
                     nonmarket risk.  Basically alpha is saying "Hey, ignoring the
                     effects of the market, what would this company's return be?" 
                     An alpha of say 1.15 tells us that ignoring all other factors, we
                     should expect this stock to appreciate 15% per year.  Now I
                     know what you are going to say, "Is it realistic to ignore how the
                     market effects the price of a stock?"  If alpha is just used alone
                     then no, it would not be.  But when used it tandem with beta
                     and a few other factors, it can give you a clearer picture.  A
                     simple hypothetical example of this would be:
                     Company XYZ @ $45 per share
                     Alpha - 1.19
                     Beta - 1.50
                     If the projected gain in the S&P 500 was 11% for the year, the
                     beta is telling us that XYZ will appreciate 16.50%.  Adding on
                     alpha, it wouldn't surprise if XYZ came out ahead 19%.  But
                     what if the market goes flat for the year with only minimal gain
                     or a small loss?  Factoring in alpha you can have a range from
                     a 2.50% gain (alpha of 19% minus 16.50%) to a 19% gain (the
                     basic alpha).  Now lets say the projected loss of the S&P 500
                     was -11%.  Beta tells us that XYZ would go down 16.50%.  But
                     once again factoring in alpha, it would be possible that XYZ
                     could ink out a gain of 2.50%.  As you can see, alpha can give
                     you the ability to run different senario returns for a
                     stock.  Just another tool in your analysis box to make more
                     informed investment decisions.
QUESTION: Can you explain how to use the
                    alpha and beta measurements for evaluating
                    mutual fund performance? If the beta of a
                    mutual fund is +1.17 and the alpha is -9.58,
                    what exactly does that mean? 

                                           — Anita Bowser

                    ANSWER: Alpha, beta and their companion,
                    r-squared, are statistics related to Modern
                    Portfolio Theory. They are derived by comparing
                    a fund or security's returns and volatility to an
                    index. Here's how to use them when evaluating
                    mutual funds. 

                    You've got to start with r-squared, which is an
                    indicator of the validity of the beta and alpha
                    measures. That's because the r-squared
                    measures just how closely the fund tracks the
                    index with which it is being compared.
                    (Generally, equity funds are measured relative
                    to the S&P 500 and fixed-income funds relative
                    to Treasury bills.) An r-squared of 1.0 indicates
                    a perfect match. And, in that case, you can
                    trust that the beta and alpha measures are
                    valid, too. But, the lower the r-squared, the less
                    reliable beta and alpha measures are. The
                    Fidelity Japan Small Companies (FJSCX)
                    fund, for instance, has an r-squared of 0.11, indicating little correlation with the
                    S&P 500. "[Betas and alphas on] a fund with an r-squared that's below 0.50 are
                    completely meaningless," explains Dr. John Markese, president of the American
                    Association of Individual Investors. 

                    Assuming the r-squared is, say, 0.75 or higher, you can move on to the beta. This
                    figure measures the fund's volatility relative to the benchmark index. The beta of
                    the benchmark, or index, is 1.00. So a fund with a beta coefficient of 1.00 has
                    experienced up and down movements of roughly the same magnitude as the
                    benchmark. Generally, a fund with a beta of 1.25 is expected to do 25% better
                    than its benchmark in an up market and 25% worse in a down market.
                    Conversely, a fund with a beta of 0.75 is expected to do 25% worse than its
                    benchmark in a rising market and 25% better in a falling market. A low beta,
                    however, does not necessarily mean lower volatility -- just that the fund does not
                    have a high correlation with its benchmark. 

                    Now comes alpha. This is the most controversial of the three figures, since it is
                    viewed by many as an indicator of just how effective a fund's management is,
                    explains Markese. It does this by comparing the fund's performance to the
                    expected performance based on the fund's beta. A positive alpha means that the
                    fund has performed better than expected, given its beta. But a fund with an alpha
                    of -9.58 (like the one you mentioned) suggests that the fund has performed 9.58%
                    below its expected returns. Of course, the validity of the alpha depends upon a
                    close relationship with the benchmark index. Which brings us back to the
                    r-squared.