49
Capital asset pricing model in domain frequency Francisco Javier Parra Rodríguez Universidad de Cantabria (UNICAN), España [email protected] Abstract The capital asset pricing model provides a theoretical structure for the pricing of assets with uncertain returns. The security market line (SML) and its relation to expected return (the difference between the expected rate of return and the risk-free rate) and systematic risk (β) show how the market must price individual securities in relation to their security risk class. The value of β may be calculated in regression analysis utilizing historic data, assuming uncorrelacted the expected return market and the random term on OLS. In this paper, a multivariate model is estimated by Regression Band Spectrum (RBS) when the random term are correlated to the market premium. Classification JEL (Journal of Economic Literature): E22, E44,G11 The CAPM Model The CAPM was introduced by Jack Treynor (1961, 1962),[4] William F. Sharpe (1964), John Lintner (1965a,b) and Jan Mossin (1966) independently, building on the earlier work of Harry Markowitz on diversification and modern portfolio theory. The CAPM is a model for pricing an individual security or portfolio. For individual securities, we make use of the security market line (SML) and its relation to expected return and systematic risk (beta) to show how the market must price individual securities in relation to their security risk class. The SML enables us to calculate the reward-to-risk ratio for any security in relation to that of the overall market. The equilibrium relationship to decribe CAPM is: E(r i )= r f + β i (E(r m ) - r f ) where: . E(r i ) is the expected return on the capital asset . r f is the risk-free rate of interest such as interest arising from government bonds . β - i(the beta) is the sensitivity of the expected excess asset returns to the expected excess market returns, or also Cov(ri,rm) V ar(rm) ,. r m is the expected return of the market . E(r m ) - r f is sometimes known as the market premium (the difference between the expected market rate of return and the risk-free rate of return). . E(r i ) - r f is also known as the risk premium Restated, in terms of risk premium, we find that: E(r i ) - r f = β i (E(r m ) - r f ) which states that the individual risk premium equals the market premium times β. The market risk premium is determined from the slope of the SML. The intercept is the nominal risk-free rate available for the market, while the slope is the market premium, E(r m ) - r f . The securities market line can be regarded as representing a single-factor model of the asset price, where β is exposure to changes in value of the Market. The equation of the SML is thus: SML : E(r i )= r f + β i (E(r m ) - r f ) The CAPM implies that all securities and portfolios will plot along SML line. It shows that expected returns will be linearly related to market risk. The value of β may be given an interpretation similar to that found in regression analysis utilizing historic data (β exceeding one signify more than average “riskiness”;β below one indicate lower than average), although in the context of the CAPM it is to be interpreted strictly as an ex ante value based on probabilistic beliefs about future outcomes (Sharpe,1990). The relationship between ¯ R i and ¯ R m , the stochastic returns on security i and the market portfolio, respectively, can be written as: 1

Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España [email protected]

  • Upload
    others

  • View
    14

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

Capital asset pricing model in domain frequencyFrancisco Javier Parra RodríguezUniversidad de Cantabria (UNICAN), Españ[email protected] The capital asset pricing model provides a theoretical structure for the pricing of assets withuncertain returns. The security market line (SML) and its relation to expected return (the difference betweenthe expected rate of return and the risk-free rate) and systematic risk (β) show how the market must priceindividual securities in relation to their security risk class. The value of β may be calculated in regressionanalysis utilizing historic data, assuming uncorrelacted the expected return market and the random term onOLS.In this paper, a multivariate model is estimated by Regression Band Spectrum (RBS) when the random termare correlated to the market premium.Classification JEL (Journal of Economic Literature): E22, E44,G11The CAPM ModelThe CAPM was introduced by Jack Treynor (1961, 1962),[4] William F. Sharpe (1964), John Lintner (1965a,b)and Jan Mossin (1966) independently, building on the earlier work of Harry Markowitz on diversification andmodern portfolio theory.The CAPM is a model for pricing an individual security or portfolio. For individual securities, we make useof the security market line (SML) and its relation to expected return and systematic risk (beta) to show howthe market must price individual securities in relation to their security risk class. The SML enables us tocalculate the reward-to-risk ratio for any security in relation to that of the overall market.The equilibrium relationship to decribe CAPM is:E(ri) = rf + βi(E(rm)− rf )where: . E(ri) is the expected return on the capital asset . rf is the risk-free rate of interest such as interestarising from government bonds . β − i(the beta) is the sensitivity of the expected excess asset returns to theexpected excess market returns, or also Cov(ri,rm)

V ar(rm) , . rm is the expected return of the market . E(rm)− rf issometimes known as the market premium (the difference between the expected market rate of return and therisk-free rate of return). . E(ri)− rf is also known as the risk premiumRestated, in terms of risk premium, we find that:E(ri)− rf = βi(E(rm)− rf )which states that the individual risk premium equals the market premium times β.The market risk premium is determined from the slope of the SML. The intercept is the nominal risk-freerate available for the market, while the slope is the market premium, E(rm)− rf . The securities market linecan be regarded as representing a single-factor model of the asset price, where β is exposure to changes invalue of the Market. The equation of the SML is thus:SML : E(ri) = rf + βi(E(rm)− rf )The CAPM implies that all securities and portfolios will plot along SML line. It shows that expected returnswill be linearly related to market risk.The value of β may be given an interpretation similar to that found in regression analysis utilizing historic data(β exceeding one signify more than average “riskiness”;β below one indicate lower than average), although inthe context of the CAPM it is to be interpreted strictly as an ex ante value based on probabilistic beliefsabout future outcomes (Sharpe,1990). The relationship between Ri and Rm, the stochastic returns on securityi and the market portfolio, respectively, can be written as:

1

Page 2: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

Ri = αi + βimRm + εi (1)

Given the manner in which βim, is defined, it must be the case that εi is uncorrelated Rm . Moreover, αi canbe defined so that the expected value of εi, is zero.

CAPM decomposes the overall risk of the Markowitz portfolio (σ2 =∑i

∑j X(j)X(k)σ[R(j);R(k)] ) by:

σ2i = β2

imσ2m + σ2

εi

The expresion β2imσ

2m is the systematic risk and σ2

εiis the unsystematic risk. The systematic risk or

undiversificable risk, is the portion of an asset’s risk cannot be eliminated via diversification, and unisystematicrisk, which is also called firm-specific or diversificable risk, is the portion of an asset’s total risk that can beeliminated by including the security as a part of a diversificable portfolio.

The key implications of the CAPM (Sharpe, 1990) are that:

1. the market portfolio will be efficient,

2. all efficient portfolios will be equivalent to investment in the market portfolio plus, possibly, lending orborrowing, and

3. there will be a linear relationship between expected return and beta.

Example

The historical monthly return data from December 1977 through December 1987, can be downloaded fromBerndt’s The Practice of Econometrics. Here is the csv file of the returns: http://web.stanford.edu/~clint/berndt/

# testCAPM.r## author: Eric Zivot# created: November 24, 2003# updated: December 2, 2008## comments# 1. requires data in file berndt.csv

# read prices from csv fileberndt.df = read.csv(file="berndtc1.csv",sep=";",dec=",", stringsAsFactors=F)colnames(berndt.df)

## [1] "Año" "MOBIL" "TEXACO" "IBM" "DEC" "DATGEN" "CONED"## [8] "PSNH" "WEYER" "BOISE" "MOTOR" "TANDY" "PANAN" "DELTA"## [15] "CONTIL" "CITGRP" "GERBER" "GENMIL" "MARKET" "RKFREE"

#[1] "Año" "MOBIL" "TEXACO" "IBM" "DEC" "DATGEN" "CONED" "PSNH" "WEYER" "BOISE"#[11] "MOTOR" "TANDY" "PANAN" "DELTA" "CONTIL" "CITGRP" "GERBER" "GENMIL" "MARKET" "RKFREE

# create zooreg object - regularly spaced zoo object

library(zoo)

#### Attaching package: 'zoo'

2

Page 3: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

## The following objects are masked from 'package:base':#### as.Date, as.Date.numeric

berndt.z = zooreg(berndt.df[,-1], start=c(1978, 1), end=c(1987,12),frequency=12)

index(berndt.z) = as.yearmon(index(berndt.z))

start(berndt.z)

## [1] "ene. 1978"

end(berndt.z)

## [1] "dic. 1987"

nrow(berndt.z)

## [1] 120

# create excess returns by subtracting off risk free rate# note: coredata() function extracts data from zoo objectreturns.mat = as.matrix(coredata(berndt.z))excessReturns.mat = returns.mat - returns.mat[,"RKFREE"]excessReturns.df = as.data.frame(excessReturns.mat)

We also calculated the excess return data set for our further usage in this excess return csv file.The excessreturn is equal to monthly return minus monthly RKFREE interest rate (30-day U.S. Treasure bills).

# CAPM regression for IBM using 1st 5 years of datacapm.fit = lm(IBM~MARKET,data=excessReturns.df,subset=1:60)summary(capm.fit)

#### Call:## lm(formula = IBM ~ MARKET, data = excessReturns.df, subset = 1:60)#### Residuals:## Min 1Q Median 3Q Max## -0.106814 -0.044604 -0.000958 0.030984 0.139757#### Coefficients:## Estimate Std. Error t value Pr(>|t|)## (Intercept) -0.0002481 0.0068359 -0.036 0.97117## MARKET 0.3390122 0.0887990 3.818 0.00033 ***## ---## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1#### Residual standard error: 0.05239 on 58 degrees of freedom## Multiple R-squared: 0.2008, Adjusted R-squared: 0.1871## F-statistic: 14.58 on 1 and 58 DF, p-value: 0.0003298

3

Page 4: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

# plot data and regression lineplot(excessReturns.df$MARKET,excessReturns.df$IBM,

main="CAPM regression for IBM",ylab="Excess returns on IBM",xlab="Excess returns on MARKET")abline(capm.fit) # plot regression lineabline(h=0,v=0) # plot horizontal and vertical lines at 0

−0.2 −0.1 0.0 0.1

−0.

20−

0.10

0.00

0.10

CAPM regression for IBM

Excess returns on MARKET

Exc

ess

retu

rns

on IB

M

We can conduct the regression on the excess returns of each stock and the excess return of market.

The CAPM formula of IBM is:

RIBM = αIBM + βIBM,mRm + εIBM ,

that is,

Expected excess return of IBM = βIBM * Expected excess return of MARKET,

# compute average returns over 1st 5 yearsmu.hat = colMeans(excessReturns.mat[1:60,c(3,18)])mu.hat

## IBM MARKET## 0.003548167 0.011198167

mu.hat = colMeans(excessReturns.mat[1:60,c(18,19)])

4

Page 5: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

The expected excess return of MARKET is the mean value is 0.011198167.

So, the ExpectedexcessreturnofIBM = 0.3390122 ∗ 0.011198167 = 0.003796315.

# compute average returns over 1st 5 yearsvar.hat = diag(var(excessReturns.mat[1:60,-c(18,19)]))var.hat

## MOBIL TEXACO IBM DEC DATGEN CONED## 0.007349944 0.006736332 0.003375956 0.007249466 0.017875233 0.002766001## PSNH WEYER BOISE MOTOR TANDY PANAN## 0.002265528 0.007630441 0.011344264 0.007617433 0.020289765 0.016774746## DELTA CONTIL CITGRP GERBER GENMIL## 0.009598779 0.008188550 0.006039591 0.006491960 0.003606599

According to CAPM, the variance of IBM is:

σ2IBM = βIBMσ

2M + σ2

e

Where,

σ2M is the variance of NYSE, which is 0.005899188, σ2

e is the variance of residual standard error, which is0.052392, as shown in the above output.

So, σ2IBM = 0.3390122 ∗ 0.005899188 + 0.052392 = 0.004744609

Based on the above results, we can further calculate the covariance in pairs of the four stocks by the formulaof σij = βiβjσ

2M . So, for the covariance between IBM and CITCRP:

# CAPM regression for CITCRP (citicorp) using 1st 5 years of datacapm.fit = lm(CITGRP~MARKET,data=excessReturns.df,subset=1:60)summary(capm.fit)

#### Call:## lm(formula = CITGRP ~ MARKET, data = excessReturns.df, subset = 1:60)#### Residuals:## Min 1Q Median 3Q Max## -0.139865 -0.035204 0.006723 0.034690 0.253231#### Coefficients:## Estimate Std. Error t value Pr(>|t|)## (Intercept) 0.0005967 0.0091775 0.065 0.948382## MARKET 0.4466308 0.1192159 3.746 0.000415 ***## ---## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1#### Residual standard error: 0.07033 on 58 degrees of freedom## Multiple R-squared: 0.1948, Adjusted R-squared: 0.181## F-statistic: 14.04 on 1 and 58 DF, p-value: 0.000415

# plot data and regression lineplot(excessReturns.df$MARKET,excessReturns.df$CITCRP,main="CAPM regression for CITCRP",

5

Page 6: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

ylab="Excess returns on CITCRP",xlab="Excess returns on MARKET")abline(capm.fit) # plot regression lineabline(h=0,v=0) # plot horizontal and vertical lines at 0

0 20 40 60 80 100 120

−0.

2−

0.1

0.0

0.1

CAPM regression for CITCRP

Excess returns on MARKET

Exc

ess

retu

rns

on C

ITC

RP

σIBM,CITCRP = βIBMβCITCRPσ2M = 0.3390122 ∗ 0.4466308 ∗ 0.005899188 = 0.0008932155.

In Zivot, E (2008), cab obtain a testCAPM.r porgram to evaluate the coefficients estimated in CAPM model,and calculate SML.

# estimate CAPM and test alpha=0 for all assets using 1st 5 years of data# trick use S-PLUS function apply to do this all at once

capm.tstats = function(r,market) {capm.fit = lm(r~market) # fit capm regressioncapm.summary = summary(capm.fit) # extract summary infot.stat = coef(capm.summary)[1,3] # t-stat on interceptt.stat

}# test functiontmp = capm.tstats(excessReturns.mat[1:60,1],excessReturns.mat[1:60,"MARKET"])tmp

## [1] 0.08595583

6

Page 7: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

# check out apply function

colnames(excessReturns.mat[,-c(18,19)])

## [1] "MOBIL" "TEXACO" "IBM" "DEC" "DATGEN" "CONED" "PSNH"## [8] "WEYER" "BOISE" "MOTOR" "TANDY" "PANAN" "DELTA" "CONTIL"## [15] "CITGRP" "GERBER" "GENMIL"

tstats = apply(excessReturns.mat[1:60,-c(18,19)],2,FUN=capm.tstats,market=excessReturns.mat[1:60,"MARKET"])

tstats

## MOBIL TEXACO IBM DEC DATGEN CONED## 0.08595583 -0.40444639 -0.03630053 0.03092165 -1.04296670 1.21411728## PSNH WEYER BOISE MOTOR TANDY PANAN## -0.27454911 -0.51999713 -0.11656027 0.59618507 1.99703362 -0.89396008## DELTA CONTIL CITGRP GERBER GENMIL## 0.62136933 -0.67030349 0.06501986 -0.06884828 0.54110492

# test H0: alpha = 0 using 5% testabs(tstats) > 2

## MOBIL TEXACO IBM DEC DATGEN CONED PSNH WEYER BOISE MOTOR## FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE## TANDY PANAN DELTA CONTIL CITGRP GERBER GENMIL## FALSE FALSE FALSE FALSE FALSE FALSE FALSE

any(abs(tstats) > 2)

## [1] FALSE

## plot average return against beta#

# compute beta over 1st 5 yearscapm.betas = function(r,market) {

capm.fit = lm(r~market) # fit capm regressioncapm.beta = coef(capm.fit)[2] # extract coefficientscapm.beta

}

betas = apply(excessReturns.mat[1:60,-c(18,19)],2,FUN=capm.betas,market=excessReturns.mat[1:60,"MARKET"])

betas

## MOBIL TEXACO IBM DEC DATGEN CONED

7

Page 8: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

## 0.67977729 0.64326107 0.33901221 0.70677295 1.00561709 0.14049874## PSNH WEYER BOISE MOTOR TANDY PANAN## 0.21801661 0.70788726 0.88464464 0.55595797 1.03081022 0.74664275## DELTA CONTIL CITGRP GERBER GENMIL## 0.39209800 0.38854870 0.44663080 0.46316113 0.09873775

# compute average returns over 1st 5 yearsmu.hat = colMeans(excessReturns.mat[1:60,-c(18,19)])mu.hat

## MOBIL TEXACO IBM DEC DATGEN## 0.008381500 0.003714833 0.003548167 0.008181500 -0.003718500## CONED PSNH WEYER BOISE MOTOR## 0.009798167 0.000831500 0.003248167 0.008648167 0.012198167## TANDY PANAN DELTA CONTIL CITGRP## 0.042664833 -0.005301833 0.012014833 -0.003185167 0.005598167## GERBER GENMIL## 0.004531500 0.005348167

# plot average returns against betasplot(betas,mu.hat,main="Ave return vs. beta")

0.2 0.4 0.6 0.8 1.0

0.00

0.01

0.02

0.03

0.04

Ave return vs. beta

betas

mu.

hat

# estimate regression of ave return on betasml.fit = lm(mu.hat~betas)sml.fit

8

Page 9: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

#### Call:## lm(formula = mu.hat ~ betas)#### Coefficients:## (Intercept) betas## 0.0008966 0.0107175

summary(sml.fit)

#### Call:## lm(formula = mu.hat ~ betas)#### Residuals:## Min 1Q Median 3Q Max## -0.0153928 -0.0040759 -0.0009818 0.0033933 0.0307205#### Coefficients:## Estimate Std. Error t value Pr(>|t|)## (Intercept) 0.0008966 0.0057814 0.155 0.879## betas 0.0107175 0.0093424 1.147 0.269#### Residual standard error: 0.01048 on 15 degrees of freedom## Multiple R-squared: 0.08066, Adjusted R-squared: 0.01937## F-statistic: 1.316 on 1 and 15 DF, p-value: 0.2693

# intercept should be zero and slope should be excess return on marketmean(excessReturns.mat[1:60,"MARKET"])

## [1] 0.01119817

plot(betas,mu.hat,main="TRUE and Estimated SML")abline(sml.fit)abline(a=0,b=mean(excessReturns.mat[1:60,"MARKET"]),lty=1, col="orange", lwd=2)legend(0.2, 0.04, legend=c("Estimated SML","TRUE SML"),

lty=c(1,1), col=c("black","orange"))

9

Page 10: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

0.2 0.4 0.6 0.8 1.0

0.00

0.01

0.02

0.03

0.04

TRUE and Estimated SML

betas

mu.

hat

Estimated SMLTRUE SML

# compute average returns over 2nd 5 yearsmu.hat2 = colMeans(excessReturns.mat[61:120,-c(18,19)])mu.hat2

## MOBIL TEXACO IBM DEC DATGEN## 0.010324667 0.006491333 0.002008000 0.017641333 0.005008000## CONED PSNH WEYER BOISE MOTOR## 0.013541333 -0.022942000 0.002341333 0.011024667 0.010441333## TANDY PANAN DELTA CONTIL CITGRP## -0.006325333 -0.001342000 -0.002308667 -0.012692000 0.004441333## GERBER GENMIL## 0.014591333 0.014141333

betas2 = apply(excessReturns.mat[61:120,-c(18,19)],2,FUN=capm.betas,market=excessReturns.mat[61:120,"MARKET"])

betas2

## MOBIL TEXACO IBM DEC DATGEN CONED## 0.78146833 0.57241684 0.65448596 1.09928950 1.09229391 0.02001884## PSNH WEYER BOISE MOTOR TANDY PANAN## 0.18050799 1.01411692 1.03227574 1.33812449 1.03501175 0.72584473## DELTA CONTIL CITGRP GERBER GENMIL## 0.63952500 1.29443411 1.03701118 0.91216187 0.56697377

10

Page 11: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

# plot average returns against betasplot(betas2,mu.hat2,main="Ave return vs. beta")

0.0 0.2 0.4 0.6 0.8 1.0 1.2

−0.

02−

0.01

0.00

0.01

Ave return vs. beta

betas2

mu.

hat2

# estimate regression of ave return on betasml.fit2 = lm(mu.hat2~betas2)sml.fit2

#### Call:## lm(formula = mu.hat2 ~ betas2)#### Coefficients:## (Intercept) betas2## 0.0008614 0.0036970

summary(sml.fit2)

#### Call:## lm(formula = mu.hat2 ~ betas2)#### Residuals:## Min 1Q Median 3Q Max## -0.0244707 -0.0048868 0.0001084 0.0065742 0.0127159

11

Page 12: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

#### Coefficients:## Estimate Std. Error t value Pr(>|t|)## (Intercept) 0.0008614 0.0067792 0.127 0.901## betas2 0.0036970 0.0075801 0.488 0.633#### Residual standard error: 0.01092 on 15 degrees of freedom## Multiple R-squared: 0.01561, Adjusted R-squared: -0.05002## F-statistic: 0.2379 on 1 and 15 DF, p-value: 0.6328

# intercept should be zero and slope should be excess return on marketmean(excessReturns.mat[61:120,"MARKET"])

## [1] 0.003108

plot(betas2,mu.hat2,main="TRUE and Estimated SML")abline(sml.fit2)abline(a=0,b=mean(excessReturns.mat[61:120,"MARKET"]),lwd=2, col="orange")legend(0.2, -0.01, legend=c("Estimated SML","TRUE SML"),

lty=c(1,1), col=c("black","orange"))

0.0 0.2 0.4 0.6 0.8 1.0 1.2

−0.

02−

0.01

0.00

0.01

TRUE and Estimated SML

betas2

mu.

hat2

Estimated SMLTRUE SML

## prediction test II of CAPM# estimate beta using 1st 5 years of data and# compute average returns using 2nd 5 years of data

12

Page 13: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

#

# estimate regression of 2nd period ave return on# 1st period betasml.fit12 = lm(mu.hat2~betas)sml.fit12

#### Call:## lm(formula = mu.hat2 ~ betas)#### Coefficients:## (Intercept) betas## 0.002414 0.002684

summary(sml.fit12)

#### Call:## lm(formula = mu.hat2 ~ betas)#### Residuals:## Min 1Q Median 3Q Max## -0.0259406 -0.0057593 0.0008292 0.0065358 0.0133310#### Coefficients:## Estimate Std. Error t value Pr(>|t|)## (Intercept) 0.002414 0.006053 0.399 0.696## betas 0.002684 0.009782 0.274 0.788#### Residual standard error: 0.01098 on 15 degrees of freedom## Multiple R-squared: 0.004993, Adjusted R-squared: -0.06134## F-statistic: 0.07527 on 1 and 15 DF, p-value: 0.7876

plot(betas,mu.hat2,main="TRUE and Estimated SML",xlab="1st period betas",ylab="2nd period ave returns")abline(sml.fit12)abline(a=0,b=mean(excessReturns.mat[61:120,"MARKET"]),lty=2,col="orange")legend(0.2, -0.01, legend=c("Estimated SML","TRUE SML"),lty=c(1,2))

13

Page 14: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

0.2 0.4 0.6 0.8 1.0

−0.

02−

0.01

0.00

0.01

TRUE and Estimated SML

1st period betas

2nd

perio

d av

e re

turn

s

Estimated SMLTRUE SML

Extension

The initial approach to capital asset pricing in Sharpe (1961), assumed that returns were generated by amodel with the condition that the residual values were uncorrelated across securities. Other approaches toportfolio selection, assumed that returns were generated by a model similar to that of equation (1), made asimilar assumption. Such a “single index” or “single factor” model represents a special case of a factor modelof security returns. Multi-factor models have been explored by a number of researchers and currently enjoywidespread use in financial practice .

A factor model of security returns identifies a relatively few key factors to which a security’s return is assumedto be linearly related, in the following manner(Sharpe, 1990):

Ri = αi +∑βilFil + εi (2)

In such a model the εi values are assumed to be uncorrelated across securities.

Bollerslev, R., Engle, R. and J. Wooldridge (1988), propose a multivariate, generalized-autoregressive,conditional, heteroscedastic (GARCH) proccess, that agent update their estimates of the means and covariancesof returns each period using the newly revealed surprises in last period’s assets returns. In this model b_ichange time depending.

From another point of view, if bi change time depending. We can think to the βi oscillates around this centerof gravity (the market premium ) with cyclical patterns, periodic and no-periodic.

The relationship (1) when ,would be specified by a Fourier development:

Ri = αi + βimRm +∑Ss=1[as cos(ωs) + bj sin(ωs) + εi (3)

were, S = T2 , ωs = 2π jS ,and υj a random variable with zero mean, constant variance, σ2, and independent

(cov(ej , es) = 0).

14

Page 15: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

The function (3) contain cycles of different frequencies and amplitudes and such combinations of frequenciesand amplitudes may yield cyclical patterns which appear non-periodic with irregular amplitude. Given theerror term uncorrelated, the more frequent cyclical variations on the tendency line (βim) could be considerateas a part of the systematic risk.

To estimate (3) is presented below a series of functions based R (Parra, 2015), the target is make a regressionband spectrum (RBS) (Engle, 1974), using the Durbin test (Durbin, 1969) to select the oscillations band.

Test based on residuals from frequency domain regresion

Durbin (1967 and 1969) desing a technique for studying the general nature of the serial dependence in asatacionary time series.

Suppose β is an estimator of β. The n x 1 vector of residuals is then defined by

u = y −Xβ

pj denotes the ordinate of the periodogram de u at frequency λj = 2πj/n, and vj denote the j − th elementof v, then

pj = v22j + v2

2j+1

j = 1, ...n2 − 1 to n even, and j = 1, ...n−12 to n odd,

pj = v22j

j = n2 − 1 n even

p0 = v21

As regards test statistics, if β is the OLS estimator of β then the elements of v may be used directly inDurbin’s cumulative periodogram test. This test is based on the quantities

sj =∑jr=1 pr∑mr=1 pr

where m = 12n for n even and 1

2 (n − 1) for n odd. The procedure is a bounds test and upper and lowercritical values may be constructed using the tables provided in Durbin (1969). Note that po does not enterinto the test statistic as po does not enter in to test statitstic as po = v1 = 0.

X0.1 <- c(0.4 ,0.35044 ,0.35477 ,0.33435 ,0.31556 ,0.30244 ,0.28991 ,0.27828 ,0.26794 ,0.25884 ,0.25071 ,0.24325 ,0.23639 ,0.2301 ,0.2243 ,0.21895 ,0.21397 ,0.20933 ,0.20498 ,0.20089 ,0.19705 ,0.19343 ,0.19001 ,0.18677 ,0.1837 ,0.18077 ,0.17799 ,0.17037 ,0.1728 ,0.17037 ,0.16805 ,0.16582 ,0.16368 ,0.16162 ,0.15964 ,0.15774 ,0.1559 ,0.15413 ,0.15242 ,0.15076 ,0.14916 ,0.14761 ,0.14011 ,0.14466 ,0.14325 ,0.14188 ,0.14055 ,0.13926 ,0.138 ,0.13678 ,0.13559 ,0.13443 ,0.133 ,0.13221 ,0.13113 ,0.13009 ,0.12907 ,0.12807 ,0.1271 ,0.12615 ,0.12615 ,0.12431 ,0.12431 ,0.12255 ,0.12255 ,0.12087 ,0.12087 ,0.11926 ,0.11926 ,0.11771 ,0.11771 ,0.11622 ,0.11622 ,0.11479 ,0.11479 ,0.11341 ,0.11341 ,0.11208 ,0.11208 ,0.11079 ,0.11079 ,0.10955 ,0.10955 ,0.10835 ,0.10835 ,0.10719 ,0.10719 ,0.10607 ,0.10607 ,0.10499 ,0.10499 ,0.10393 ,0.10393 ,0.10291 ,0.10291 ,0.10192 ,0.10192 ,0.10096 ,0.10096 ,0.10002)

X0.05 <- c(0.45,0.44306,0.41811,0.39075 ,0.37359 ,0.35522 ,0.33905 ,0.32538 ,0.31325 ,0.30221 ,0.29227 ,0.2833 ,0.27515 ,0.26767 ,0.26077 ,0.25439 ,0.24847 ,0.24296 ,0.23781 ,0.23298 ,0.22844 ,0.22416 ,0.22012 ,0.2163 ,0.21268 ,0.20924 ,0.20596 ,0.20283 ,0.19985 ,0.197 ,0.19427 ,0.19166 ,0.18915 ,0.18674 ,0.18442 ,0.18218 ,0.18003 ,0.17796 ,0.17595 ,0.17402 ,0.17215 ,0.17034 ,0.16858 ,0.16688 ,0.16524 ,0.16364 ,0.16208 ,0.16058 ,0.15911 ,0.15769 ,0.1563 ,0.15495 ,0.15363 ,0.15235 ,0.1511 ,0.14989 ,0.1487 ,0.14754 ,0.14641 ,0.1453 ,0.1453 ,0.14361 ,0.14361 ,0.14112 ,0.14112 ,0.13916 ,0.13916 ,0.13728 ,0.13728 ,0.13548 ,0.13548 ,0.13375 ,0.13375 ,0.13208 ,0.13208 ,0.13048 ,0.13048 ,0.12894 ,0.12894 ,0.12745 ,0.12745 ,0.12601 ,0.12601 ,0.12464 ,0.12464 ,0.12327 ,0.12327 ,0.12197 ,0.12197 ,0.12071 ,0.12071 ,0.11949 ,0.11949 ,0.11831 ,0.11831 ,0.11716 ,0.11716 ,0.11604 ,0.11604 ,0.11496)

X0.025 <- c(0.475 ,0.50855 ,0.46702 ,0.44641 ,0.42174 ,0.40045 ,0.38294 ,0.3697 ,0.35277 ,0.34022 ,0.32894 ,0.31869 ,0.30935 ,0.30081 ,0.29296 ,0.2857 ,0.27897 ,0.2727 ,0.26685 ,0.26137 ,0.25622 ,0.25136 ,0.24679 ,0.24245 ,0.23835 ,0.23445 ,0.23074 ,0.22721 ,0.22383 ,0.22061 ,0.21752 ,0.21457 ,0.21173 ,0.20901 ,0.20639 ,0.20337 ,0.20144 ,0.1991 ,0.19684 ,0.19465 ,0.19254 ,0.1905 ,0.18852 ,0.18661 ,0.18475 ,0.18205 ,0.1812 ,0.1795 ,0.17785 ,0.17624 ,0.17468 ,0.17361 ,0.17168 ,0.17024 ,0.16884 ,0.16748 ,0.16613 ,0.16482 ,0.16355 ,0.1623 ,0.1623 ,0.1599 ,0.1599 ,0.1576 ,0.1576 ,0.1554 ,0.1554 ,0.15329 ,0.15329 ,0.15127 ,0.15127 ,0.14932 ,0.14932 ,0.14745 ,0.14745 ,0.14565 ,0.14565 ,0.14392 ,0.14392 ,0.14224 ,0.14224 ,0.14063 ,0.14063 ,0.13907 ,0.13907 ,0.13756 ,0.13756 ,0.1361 ,0.1361 ,0.13468 ,0.13468 ,0.13331 ,0.13331 ,0.13198 ,0.13198 ,0.1307 ,0.1307 ,0.12944 ,0.12944 ,0.12823)

X0.01 <- c( 0.49 ,0.56667 ,0.53456 ,0.50495 ,0.47629 ,0.4544 ,0.43337 ,0.41522 ,0.39922 ,0.38481 ,0.37187 ,0.36019 ,0.34954 ,0.3398 ,0.33083 ,0.32256 ,0.31489 ,0.30775 ,0.30108 ,0.29484 ,0.28898 ,0.28346 ,0.27825 ,0.27333 ,0.26866 ,0.26423 ,0.26001 ,0.256 ,0.25217 ,0.24851 ,0.24501 ,0.24165 ,0.23843 ,0.23534 ,0.23237 ,0.22951 ,0.22676 ,0.2241 ,0.22154 ,0.21906 ,0.21667 ,0.21436 ,0.21212 ,0.20995 ,0.20785 ,0.20581 ,0.20383 ,0.2119 ,0.20003 ,0.19822 ,0.19645 ,0.19473 ,0.19305 ,0.19142 ,0.18983 ,0.18828 ,0.18677 ,0.18529 ,0.18385 ,0.18245 ,0.18245 ,0.17973 ,0.17973 ,0.17713 ,0.17713 ,0.17464 ,0.17464 ,0.17226 ,0.17226 ,0.16997 ,0.16997 ,0.16777 ,0.16777 ,0.16566 ,0.16566 ,0.16363 ,0.16363 ,0.16167 ,0.16167 ,0.15978 ,0.15978 ,0.15795 ,0.15795 ,0.15619 ,0.15619 ,0.15449 ,0.15449 ,0.15284 ,0.15284 ,0.15124 ,0.15124 ,0.1497 ,0.1497 ,0.1482 ,0.1482 ,0.14674 ,0.14674 ,0.14533 ,0.14533 ,0.14396)

X0.005 <- c(0.495 ,0.59596 ,0.579 ,0.5421 ,0.51576 ,0.48988 ,0.4671 ,0.44819 ,0.43071 ,0.41517 ,0.40122 ,0.38856 ,0.37703 ,0.36649 ,0.35679 ,0.34784 ,0.33953 ,0.33181 ,0.32459 ,0.31784 ,0.31149 ,0.30552 ,0.29989 ,0.29456 ,0.28951 ,0.28472 ,0.28016 ,0.27582 ,0.27168 ,0.26772 ,0.26393 ,0.2603 ,0.25348 ,0.25348 ,0.25027 ,0.24718 ,0.24421 ,0.24134 ,0.23857 ,0.23589 ,0.2331 ,0.23081 ,0.22839 ,0.22605 ,0.22377 ,0.22377 ,0.21943 ,0.21753 ,0.21534 ,0.21337 ,0.21146 ,0.20961 ,0.2078 ,0.20604 ,0.20432 ,0.20265 ,0.20101 ,0.19942 ,0.19786 ,0.19635 ,0.19635 ,0.19341 ,0.19341 ,0.19061 ,0.19061 ,0.18792 ,0.18792 ,0.18534 ,0.18534 ,0.18288 ,0.18288 ,0.18051 ,0.18051 ,0.17823 ,0.17823 ,0.17188 ,0.17188 ,0.17392 ,0.17392 ,0.17188 ,0.17188 ,0.16992 ,0.16992 ,0.16802 ,0.16802 ,0.16618 ,0.16618 ,0.1644 ,0.1644 ,0.16268 ,0.16268 ,0.16101 ,0.16101 ,0.1594 ,0.1594 ,0.15783 ,0.15783 ,0.15631 ,0.15631 ,0.15483)

TestD <- data.frame(X0.1,X0.05,X0.025,X0.01,X0.005)

15

Page 16: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

Fuction td (a,b)

Calculates and shows the results of testing Durbin (Durbin, 1969), applied to the variable a and thesignificance level b to b = 0.1(significance=1); b = 0.05 (significance=2); b = 0.025 (significance=3); b = 0.01(significance=4) and b = 0.005 (significance=5) (Durbin; 1969)

td <- function(y,significance) {# Author: Francisco Parra Rodríguez# Some ideas from:#Harvey, A.C. (1978), Linear Regression in the Frequency Domain, International Economic Review, 19, 507-512.# DURBIN, J., "Tests for Serial Correlation in Regression Analysis based on the Periodogram ofLeast-Squares Residuals," Biometrika, 56, (No. 1, 1969), 1-15.# http://econometria.wordpress.com/2013/08/21/estimation-of-time-varying-regression-coefficients/per <- periodograma(y)p <- as.numeric(per$densidad)n <- length(p)s <- p[1]t <- 1:nfor(i in 2:n) {s1 <-p[i]+s[(i-1)]s <- c(s,s1)s2 <- s/s[n]}while (n > 100) n <- 100if (significance==1) c<- c(TestD[n,1]) else {if (significance==2) c <- c(TestD[n,2]) else {if (significance==3) c <- c(TestD[n,3]) else {if (significance==4) c <- c(TestD[n,4])c <- c(TestD[n,5])}}}min <- -c+(t/length(p))max <- c+(t/length(p))data.frame(s2,min,max)}

c) Fuction gtd (a,b)

Plot to the Durbin test (Durbin, 1969), applied to the variable a and the significance level b.

gtd <- function (y,significance) {S <- td(y,significance)plot(ts(S), plot.type="single", lty=1:3,main = "Test Durbin",ylab = "densidad acumulada",xlab="frecuencia")}

Alternatively you can use the cpgram function from MASS package (src/library/stats/R/cpgram.R).

d) Function rdf (y,x, significance)

Consider now the linear regression model

yt = βtxt + ut

where xt is an n x 1 vector of fixed observations on the independent variable, βt is a n x 1 vector ofparameters,y is an n x 1 vector of observations on the dependent variable, and ut is an n x 1 vector de erroresdistribuidos con media cero y varianza constante.

Whit the assumption that any series, yt,xt,βt and ut, can be transformed into a set of sine and cosine wavessuch as:

16

Page 17: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

yt = ηy +N∑j=1

[ayj cos(ωj) + byj sin(ωj)

xt = ηx +N∑j=1

[ayj cos(ωj) + byj sin(ωj)]

βt = ηβ +N∑j=1

[aβj cos(ωj) + bβj sin(ωj)]

Pre-multiplying (6) by Z:

y = xβ + u

where y = Zy,x = Zx, β = Zβ y u = Zu

The system (8) can be rewritten as (see appendix):

y = ZxtInZT β + ZInZ

T u

If we call e = ZInZT u, It can be found the β that minimize the sum of squared errors ET = ZT e.

Once you have found the solution to this optimization, the series would be transformed into the time domainfor the system (8).

In the function , y is the dependent variable, x is the independent variables,and significance the significancefor the Durbin test.

The algorithm calculation is performed in phases:

a) Gets the cross-periodogram to x and y.

Let x a vector n x 1, in frequency domain x = Wx

Let y a vector n x 1, in frequency domain y = Wy

pj denotes the ordinate of the cross-periodogram to x and y at frequency λj = 2πj/n, and xj the j-th elementto x and yj the j-th element to y, then

{pj = x2j y2j + x2j+1y2j+1 ∀j = 1, ...n−1

2pj = x2j y2j ∀j = n

2 − 1

p0 = x1y1

b) Order the co - spectrum by the absolute value of pj and make a index.

c) Calculate the matrix WxtInWT , the matrix rows are ordered by index.

d) Calculate e = WInWT u, add a vector by constant term, (1, 0, ...0)n, then calculate the model by

constant term and the de two first regressors to ordered matrix WxtInWT , cthen calculate the model

by the constant and the de fourt first regressors, then for six, to complete the n regressors to orderedmatrix.

e) Testing for serial correlation all model to α = 0.1; 0.05; 0.025; 0.01; 0.005.

17

Page 18: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

f) Select the lowest degree of freedom models with random term uncorrelated. If any is uncorrelatedreturns the OLS.

rdf <- function (y,x,significance) {# Author: Francisco Parra Rodríguez# http://rpubs.com/PacoParra/24432# Leemos datos en forma matriza <- matrix(y, nrow=1)b <- matrix(x, nrow=1)n <- length(a)# calculamos el cros espectro mediante la funcion cperiodogramacperiodograma <- function(y,x) {

# Author: Francisco Parra Rodríguez# http://econometria.wordpress.com/2013/08/21/estimation-of-time-varying-regression-coefficients/cfx <- gdf(y)n <- length(y)cfy <- gdf(x)if (n%%2==0) {m1x <- c(0)m2x <- c()for(i in 1:n){if(i%%2==0) m1x <-c(m1x,cfx[i]) else m2x <-c(m2x,cfx[i])}m2x <- c(m2x,0)m1y <- c(0)m2y <- c()for(i in 1:n){if(i%%2==0) m1y <-c(m1y,cfy[i]) else m2y <-c(m2y,cfy[i])}m2y <-c(m2y,0)frecuencia <- seq(0:(n/2))frecuencia <- frecuencia-1omega <- pi*frecuencia/(n/2)periodos <- n/frecuenciadensidad <- (m1x*m1y+m2x*m2y)/(4*pi)tabla <- data.frame(omega,frecuencia, periodos,densidad)tabla$densidad[(n/2+1)] <- 4*tabla$densidad[(n/2+1)]data.frame(tabla[2:(n/2+1),])}else {m1x <- c(0)m2x <- c()for(i in 1:(n-1)){if(i%%2==0) m1x <-c(m1x,cfx[i]) else m2x <-c(m2x,cfx[i])}m2x <-c(m2x,cfx[n])m1y <- c(0)m2y <- c()for(i in 1:(n-1)){if(i%%2==0) m1y <-c(m1y,cfy[i]) else m2y <-c(m2y,cfy[i])}m2y <-c(m2y,cfy[n])frecuencia <- seq(0:((n-1)/2))frecuencia <- frecuencia-1omega <- pi*frecuencia/(n/2)periodos <- n/frecuenciadensidad <- (m1x*m1y+m2x*m2y)/(4*pi)tabla <- data.frame(omega,frecuencia, periodos,densidad)data.frame(tabla[2:((n+1)/2),])}}

18

Page 19: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

cper <- cperiodograma(a,b)# Ordenamos de mayor a menor las densidades absolutas del periodograma, utilizando la funcion "sort.data.frame" function, Kevin Wright. Package taRifx

S1 <- data.frame(f1=cper$frecuencia,p=abs(cper$densidad))S <- S1[order(-S1$p),]id <- seq(2,n)m1 <- cbind(S$f1*2,evens(id))if (n%%2==0) {m2 <- cbind(S$f1[1:(n/2-1)]*2+1,odds(id))} else{m2 <- cbind(S$f1*2+1,odds(id))}

m <- rbind(m1,m2)colnames(m) <- c("f1","id")M <- sort.data.frame (m,formula=~id)M <- rbind(c(1,1),M)# Obtenemos la funcion auxiliar (cdf) del predictor y se ordena segun el indice de las mayores densidades absolutas del co-espectro.cx <- cdf(b)id <- seq(1,n)S1 <- data.frame(cx,c=id)S2 <- merge(M,S1,by.x="id",by.y="c")S3 <- sort.data.frame (S2,formula=~f1)m <- n+2X1 <- S3[,3:m]X1 <- rbind(C=c(1,rep(0,(n-1))),S3[,3:m])# Se realizan las regresiones en el dominio de la frecuencia utilizando un modelo con constante, pendiente y los arm?nicos correspondientes a las frecuencias mas altas de la densidad del coespectro. Se realiza un test de durbin para el residuo y se seleccionan aquellas que son significativas.par <- evens(id)i <- 1D <- 1resultado <- cbind(i,D)for (i in par) {X <- as.matrix(X1[1:i,])cy <- gdf(a)B1 <- solve(X%*%t(X))%*%(X%*%cy)Y <- t(X)%*%B1F <- gdt(Y)res <- (t(a) - F)T <- td(res,significance)L <- as.numeric(c(T$min<T$s2,T$s2<T$max))LT <- sum(L)if (n%%2==0) {D=LT-n} else {D=LT-(n-1)}resultado1 <- cbind(i,D)resultado <- rbind(resultado,resultado1)resultado}

resultado2 <-data.frame(resultado)criterio <- resultado2[which(resultado2$D==0),]sol <- as.numeric(is.na(criterio$i[1]))if (sol==1) {"no encuentra convergencia"} else {X <- as.matrix(X1[1:criterio$i[1],])

cy <- gdf(a)B1 <- solve(X%*%t(X))%*%(X%*%cy)Y <- t(X)%*%B1F <- gdt(Y)res <- (t(a) - F)datos <- data.frame(cbind(t(a),t(b),F,res))colnames(datos) <- c("Y","X","F","res")

list(datos=datos,Fregresores=t(X),Tregresores= t(MW(n))%*%t(X),Nregresores=criterio$i[1],Betas=B1)}

19

Page 20: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

}

Example

Wiit the historical monthly return data from December 1977 through December 1987, can be downloadedfrom Berndt’s The Practice of Econometrics.

According to the CAPM formula, we will first get the beta of each stock by regressions by OLS; and plotthe residuals periodogram to know that asset were correlated across securities. This problem are present inMOBIL, PANAM and GERBER assets.

library(descomponer)

## Loading required package: taRifx

# Durbin test to random CAPM model

capm.res = function(r,market) {capm.fit = lm(r~market) # fit capm regressioncapm.res = capm.fit$residuals # extract residualscapm.res

}

for (i in 1:17) {resids = capm.res(excessReturns.mat[1:120,i],

market=excessReturns.mat[1:120,"MARKET"])gtd(resids,1)}

20

Page 21: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

Test Durbin

frecuencia

dens

idad

acu

mul

ada

0 10 20 30 40 50 60

0.0

0.2

0.4

0.6

0.8

1.0

21

Page 22: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

Test Durbin

frecuencia

dens

idad

acu

mul

ada

0 10 20 30 40 50 60

0.0

0.2

0.4

0.6

0.8

1.0

22

Page 23: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

Test Durbin

frecuencia

dens

idad

acu

mul

ada

0 10 20 30 40 50 60

0.0

0.2

0.4

0.6

0.8

1.0

23

Page 24: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

Test Durbin

frecuencia

dens

idad

acu

mul

ada

0 10 20 30 40 50 60

0.0

0.2

0.4

0.6

0.8

1.0

24

Page 25: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

Test Durbin

frecuencia

dens

idad

acu

mul

ada

0 10 20 30 40 50 60

0.0

0.2

0.4

0.6

0.8

1.0

25

Page 26: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

Test Durbin

frecuencia

dens

idad

acu

mul

ada

0 10 20 30 40 50 60

0.0

0.2

0.4

0.6

0.8

1.0

26

Page 27: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

Test Durbin

frecuencia

dens

idad

acu

mul

ada

0 10 20 30 40 50 60

0.0

0.2

0.4

0.6

0.8

1.0

27

Page 28: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

Test Durbin

frecuencia

dens

idad

acu

mul

ada

0 10 20 30 40 50 60

0.0

0.2

0.4

0.6

0.8

1.0

28

Page 29: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

Test Durbin

frecuencia

dens

idad

acu

mul

ada

0 10 20 30 40 50 60

0.0

0.2

0.4

0.6

0.8

1.0

29

Page 30: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

Test Durbin

frecuencia

dens

idad

acu

mul

ada

0 10 20 30 40 50 60

0.0

0.2

0.4

0.6

0.8

1.0

30

Page 31: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

Test Durbin

frecuencia

dens

idad

acu

mul

ada

0 10 20 30 40 50 60

0.0

0.2

0.4

0.6

0.8

1.0

31

Page 32: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

Test Durbin

frecuencia

dens

idad

acu

mul

ada

0 10 20 30 40 50 60

0.0

0.2

0.4

0.6

0.8

1.0

32

Page 33: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

Test Durbin

frecuencia

dens

idad

acu

mul

ada

0 10 20 30 40 50 60

0.0

0.2

0.4

0.6

0.8

1.0

33

Page 34: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

Test Durbin

frecuencia

dens

idad

acu

mul

ada

0 10 20 30 40 50 60

0.0

0.2

0.4

0.6

0.8

1.0

34

Page 35: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

Test Durbin

frecuencia

dens

idad

acu

mul

ada

0 10 20 30 40 50 60

0.0

0.2

0.4

0.6

0.8

1.0

35

Page 36: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

Test Durbin

frecuencia

dens

idad

acu

mul

ada

0 10 20 30 40 50 60

0.0

0.2

0.4

0.6

0.8

1.0

36

Page 37: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

Test Durbin

frecuencia

dens

idad

acu

mul

ada

0 10 20 30 40 50 60

0.0

0.2

0.4

0.6

0.8

1.0

Estimate RBS model to PANAM:

# Estimate CAPM by RBS to PANAM

PANAM=excessReturns.mat[1:120,12]MARKET=excessReturns.mat[1:120,"MARKET"]capm.fit.RBS = rdf(PANAM,MARKET,1)summary(capm.fit.RBS)

## Length Class Mode## datos 4 data.frame list## Fregresores 2640 -none- numeric## Tregresores 2640 -none- numeric## Nregresores 1 -none- numeric## Betas 22 -none- numeric

# Durbin test to random CAPM model

gtd(capm.fit.RBS$datos$res,1)

37

Page 38: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

Test Durbin

frecuencia

dens

idad

acu

mul

ada

0 10 20 30 40 50 60

0.0

0.2

0.4

0.6

0.8

1.0

cpgram(capm.fit.RBS$datos$res)

38

Page 39: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

0.0 0.1 0.2 0.3 0.4 0.5

0.0

0.2

0.4

0.6

0.8

1.0

frequency

Series: capm.fit.RBS$datos$res

By OLS we can estimate (2), were Fil, are the time domain selected regressors to RBS model:

# Estimate CAPM by multifactor model ussing time domain regressors to PANAM.

capm.fit.RBS.2 <- lm(PANAM~0+capm.fit.RBS$Tregresores)summary(capm.fit.RBS.2)

#### Call:## lm(formula = PANAM ~ 0 + capm.fit.RBS$Tregresores)#### Residuals:## Min 1Q Median 3Q Max## -0.26277 -0.06629 -0.00611 0.06705 0.38655#### Coefficients:## Estimate Std. Error t value Pr(>|t|)## capm.fit.RBS$TregresoresC -0.07542 0.14047 -0.537 0.5925## capm.fit.RBS$Tregresores1 5.92535 2.40631 2.462 0.0155 *## capm.fit.RBS$Tregresores72 3.53383 2.50486 1.411 0.1615

39

Page 40: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

## capm.fit.RBS$Tregresores73 0.30968 2.16642 0.143 0.8866## capm.fit.RBS$Tregresores106 1.11055 2.23219 0.498 0.6199## capm.fit.RBS$Tregresores107 -1.76979 2.41283 -0.733 0.4650## capm.fit.RBS$Tregresores18 -1.09217 2.40383 -0.454 0.6506## capm.fit.RBS$Tregresores19 1.14904 2.16845 0.530 0.5974## capm.fit.RBS$Tregresores4 0.79788 2.37093 0.337 0.7372## capm.fit.RBS$Tregresores5 -1.06856 2.33190 -0.458 0.6478## capm.fit.RBS$Tregresores6 -0.27926 2.27368 -0.123 0.9025## capm.fit.RBS$Tregresores7 0.54824 2.40305 0.228 0.8200## capm.fit.RBS$Tregresores108 -1.12167 2.43094 -0.461 0.6455## capm.fit.RBS$Tregresores109 -1.28743 2.46854 -0.522 0.6032## capm.fit.RBS$Tregresores116 -0.71097 2.36961 -0.300 0.7648## capm.fit.RBS$Tregresores117 0.89728 2.36412 0.380 0.7051## capm.fit.RBS$Tregresores12 -2.39999 2.34962 -1.021 0.3096## capm.fit.RBS$Tregresores13 1.57655 2.27898 0.692 0.4907## capm.fit.RBS$Tregresores56 3.93398 2.31457 1.700 0.0924 .## capm.fit.RBS$Tregresores57 2.74521 2.16378 1.269 0.2075## capm.fit.RBS$Tregresores28 -3.74645 2.45579 -1.526 0.1303## capm.fit.RBS$Tregresores29 1.10685 2.32763 0.476 0.6355## ---## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1#### Residual standard error: 0.1237 on 98 degrees of freedom## Multiple R-squared: 0.2776, Adjusted R-squared: 0.1154## F-statistic: 1.711 on 22 and 98 DF, p-value: 0.03908

# Durbin test to random CAPM model

gtd(capm.fit.RBS.2$residuals,1)

40

Page 41: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

Test Durbin

frecuencia

dens

idad

acu

mul

ada

0 10 20 30 40 50 60

0.0

0.2

0.4

0.6

0.8

1.0

cpgram(capm.fit.RBS.2$residuals)

41

Page 42: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

0.0 0.1 0.2 0.3 0.4 0.5

0.0

0.2

0.4

0.6

0.8

1.0

frequency

Series: capm.fit.RBS.2$residuals

# Estimate CAPM by single-factor model to PANAM.

capm.fit.OLS.2 <- lm(PANAM~MARKET)summary(capm.fit.OLS.2)

#### Call:## lm(formula = PANAM ~ MARKET)#### Residuals:## Min 1Q Median 3Q Max## -0.35878 -0.06450 -0.01259 0.06534 0.39242#### Coefficients:## Estimate Std. Error t value Pr(>|t|)## (Intercept) -0.008576 0.011248 -0.762 0.447## MARKET 0.734508 0.163739 4.486 1.7e-05 ***## ---## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

42

Page 43: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

#### Residual standard error: 0.1225 on 118 degrees of freedom## Multiple R-squared: 0.1457, Adjusted R-squared: 0.1384## F-statistic: 20.12 on 1 and 118 DF, p-value: 1.697e-05

# Durbin test to random CAPM model

gtd(capm.fit.OLS.2$residuals,1)

Test Durbin

frecuencia

dens

idad

acu

mul

ada

0 10 20 30 40 50 60

0.0

0.2

0.4

0.6

0.8

1.0

cpgram(capm.fit.OLS.2$residuals)

43

Page 44: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

0.0 0.1 0.2 0.3 0.4 0.5

0.0

0.2

0.4

0.6

0.8

1.0

frequency

Series: capm.fit.OLS.2$residuals

The tendency line in frequency domain is LT = βimRm and βim = LTRm

, the periodic oscilations into tendencyline RBS model are Rs,i =

∑Ss=1[as cos(ωs) + bj sin(ωs).

# Tendency line and periodic oscilations in frequency domain.

LT.f=capm.fit.RBS$Fregresores[,2]*capm.fit.RBS$Betas[2]R_ms.f=capm.fit.RBS$Fregresores[,3:22]%*%capm.fit.RBS$Betas[3:22]

# plot data and regression line

plot(MARKET,PANAM,main="CAPM regression for PANAM",ylab="Excess returns on PANAM",xlab="Excess returns on MARKET")lines(MARKET,gdt(LT.f),type="l",col="red") # plot tendency lines in RBSlines(MARKET,capm.fit.OLS.2$fitted.values,type="l",col="blue") # plot regression linelines(MARKET,gdt(R_ms.f),type="p",col="green") # plot periodic oscilations pointsabline(h=0,v=0)legend(-0.25, 0.4, legend=c("Estimated slope RBS","Estimated slope OLS","Estimated periodic RBS"),

lty=c(1,1,1), col=c("red","blue","green"))

44

Page 45: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

−0.2 −0.1 0.0 0.1

−0.

3−

0.1

0.1

0.3

CAPM regression for PANAM

Excess returns on MARKET

Exc

ess

retu

rns

on P

AN

AM

Estimated slope RBSEstimated slope OLSEstimated periodic RBS

# slope in new model

b_im=gdt(LT.f)/MARKETb_im[1:5]

## [1] 0.5409078 0.5409078 0.5409078 0.5409078 0.5409078

# compute beta in RBScapm.betas.RBS = function(r,market) {

library(descomponer)capm.fit.RBS = rdf(r,market,1) # fit capm regression rbsLT.f=capm.fit.RBS$Fregresores[,2]*capm.fit.RBS$Betas[2] # tendency lines in RBScapm.beta.RBS=gdt(LT.f)/market #Betas en RBScapm.beta.RBS[1]

}

# compute average returns over all periodmu.hat3 = colMeans(excessReturns.mat[61:120,-c(18,19)])mu.hat3

## MOBIL TEXACO IBM DEC DATGEN## 0.010324667 0.006491333 0.002008000 0.017641333 0.005008000## CONED PSNH WEYER BOISE MOTOR

45

Page 46: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

## 0.013541333 -0.022942000 0.002341333 0.011024667 0.010441333## TANDY PANAN DELTA CONTIL CITGRP## -0.006325333 -0.001342000 -0.002308667 -0.012692000 0.004441333## GERBER GENMIL## 0.014591333 0.014141333

# betas all periodbetas3 = apply(excessReturns.mat[1:120,-c(18,19)],2,

FUN=capm.betas,market=excessReturns.mat[1:120,"MARKET"])

betas3

## MOBIL TEXACO IBM DEC DATGEN CONED## 0.71469504 0.61323025 0.45682077 0.84742336 1.03082157 0.09319394## PSNH WEYER BOISE MOTOR TANDY PANAN## 0.21348499 0.82066091 0.93588788 0.84814958 1.05000106 0.73450835## DELTA CONTIL CITGRP GERBER GENMIL## 0.48973643 0.73109061 0.66700948 0.62559196 0.27020988

# betas in RBS all period

betas.rbs = apply(excessReturns.mat[1:120,-c(18,19)],2,FUN=capm.betas.RBS,market=excessReturns.mat[1:120,"MARKET"])

betas.rbs

## MOBIL TEXACO IBM DEC DATGEN CONED## 0.62465437 0.61323025 0.45682077 0.84742336 1.03082157 0.09319394## PSNH WEYER BOISE MOTOR TANDY PANAN## 0.21348499 0.82066091 0.93588788 0.84977073 1.05000106 0.54090784## DELTA CONTIL CITGRP GERBER GENMIL## 0.48973643 0.73109061 0.66700948 0.67155851 0.27020988

# plot average returns against betasplot(betas.rbs,mu.hat3,main="Ave return vs. beta")

46

Page 47: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

0.2 0.4 0.6 0.8 1.0

−0.

02−

0.01

0.00

0.01

Ave return vs. beta

betas.rbs

mu.

hat3

# estimate regression of ave return on betasml.fit.rbs = lm(mu.hat3~betas.rbs)sml.fit.rbs

#### Call:## lm(formula = mu.hat3 ~ betas.rbs)#### Coefficients:## (Intercept) betas.rbs## 0.001202 0.004213

summary(sml.fit.rbs)

#### Call:## lm(formula = mu.hat3 ~ betas.rbs)#### Residuals:## Min 1Q Median 3Q Max## -0.025044 -0.004823 0.000429 0.006491 0.012869#### Coefficients:## Estimate Std. Error t value Pr(>|t|)## (Intercept) 0.001202 0.006879 0.175 0.864

47

Page 48: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

## betas.rbs 0.004213 0.009893 0.426 0.676#### Residual standard error: 0.01094 on 15 degrees of freedom## Multiple R-squared: 0.01195, Adjusted R-squared: -0.05392## F-statistic: 0.1813 on 1 and 15 DF, p-value: 0.6763

# estimate regression of ave return on betasml.fit.3 = lm(mu.hat3~betas3)sml.fit.3

#### Call:## lm(formula = mu.hat3 ~ betas3)#### Coefficients:## (Intercept) betas3## 0.001646 0.003447

summary(sml.fit.3)

#### Call:## lm(formula = mu.hat3 ~ betas3)#### Residuals:## Min 1Q Median 3Q Max## -0.0253236 -0.0055196 0.0004964 0.0062154 0.0130745#### Coefficients:## Estimate Std. Error t value Pr(>|t|)## (Intercept) 0.001646 0.007022 0.234 0.818## betas3 0.003447 0.009916 0.348 0.733#### Residual standard error: 0.01096 on 15 degrees of freedom## Multiple R-squared: 0.007991, Adjusted R-squared: -0.05814## F-statistic: 0.1208 on 1 and 15 DF, p-value: 0.733

# intercept should be zero and slope should be excess return on marketmean(excessReturns.mat[1:120,"MARKET"])

## [1] 0.007153083

plot(betas.rbs,mu.hat3,main="TRUE and Estimated SML")abline(sml.fit.rbs)abline(sml.fit.3,col="red")abline(a=0,b=mean(excessReturns.mat[1:120,"MARKET"]),lwd=2, col="orange")legend(0.2, -0.01, legend=c("Estimated SML RBS","Estimated SML OLS","TRUE SML"),

lty=c(1,1,1), col=c("black","red","orange"))

48

Page 49: Capital asset pricing model in domain frequency · Capital asset pricing model in domain frequency FranciscoJavierParraRodríguez UniversidaddeCantabria(UNICAN),España parra_fj@cantabria.es

0.2 0.4 0.6 0.8 1.0

−0.

02−

0.01

0.00

0.01

TRUE and Estimated SML

betas.rbs

mu.

hat3

Estimated SML RBSEstimated SML OLSTRUE SML

BibliografíaBerndt’s Ernest R. (1991): The Practice of Econometrics .Addison Wesley, 1991, ISBN 0-201-51489-3.Bollerslev, R., Engle, R. and J. Wooldridge (1988) “A Capital Asset Pricing Model with Time VaryingCovariance”, Journal of political economic, 1988,vol 98 nº1: http://public.econ.duke.edu/~boller/Published_Papers/jpe_88.pdfDURBIN, J., “Tests for Serial Correlation in Regression Analysis based on the Periodogram ofLeast-SquaresResiduals,” Biometrika, 56, (No. 1, 1969), 1-15.Engle, Robert F. (1974), Band Spectrum Regression,International Economic Review 15,1-11.Friedman, M., 1957. A theory of the consumption function (Princeton University Press, Princeton, NJ).Friedman, M. and Kuznets, S., 1945. Income from independent professional practice (National Bureau ofEconomic Research, NY).Harvey, A.C. (1978), Linear Regression in the Frequency Domain, International Economic Review, 19, 507-512.Parra F (2015): Seasonal Adjustment by Frequency Analysis. Package R Version 1.2. https://cran.r-project.org/web/packages/descomponer/index.htmlSharpe, W. (1964). “Capital Asset Prices: A Theory of Market Equilibrium Under Conditions of Risk,”,Journal of Finance, 19:425-442.Sharpe, W.. (1990) : CAPITAL ASSET PRICES WITH AND WITHOUT NEGATIVE HOLDINGS. NobelLecture, December 7, 1990: http://www.nobelprize.org/nobel_prizes/economic-sciences/laureates/1990/sharpe-lecture.pdfWikipedia: Capital asset pricing model.https://en.wikipedia.org/wiki/Capital_asset_pricing_modelZivot E. (2008): testCAPM.r : http://faculty.washington.edu/ezivot/econ424/testCAPM.r

49