ff3.Capm.estimation: Fama French (Three factors) and CAPM Estimation

ff3.Capm.estimationR Documentation

Fama French (Three factors) and CAPM Estimation

Description

A function estimating the parameters of the Fama-French three factors model and the coefficients of the CAPM model. The Fama-French three factors are: the market factor, SMB (Small Minus Big), HML (High Minus Low).

Usage

ff3.Capm.estimation(ticker, from, to)

Arguments

ticker

A single character variable storing the ticker of the stock to be downloaded. Note that since data are downloaded from Yahoo finance, the ticker should be the same as the ones reported on Yahoo finance. See examples. This variable can also be a data.frame with either two columns (one with dates in format %Y%m%d and one with daily return of the portfolio), or one column with the daily returns of the portfolio and as rownames the dates.

from

A single character variable storing the starting date from which we want to download the data. The format should be "yyyy-mm-dd"

to

A single character variable storing the ending date up to the day in which we want to download the stock data. The format should be "yyyy-mm-dd"

Examples

## Not run: 
ff3.Capm.estimation("AAPL", "2015-01-01", "2020-01-01")

returns <- rnorm(n = 1827, mean = 0 , sd = 2.5)
dates <- seq(as.Date("2015-01-01"), as.Date("2020-01-01"), by = "days")
df <- data.frame(returns)
rownames(df) <- dates
ff3.Capm.estimation(df, "2015-01-01" , "2020-01-01")


returns <- rnorm(n = 1827, mean = 0 , sd = 2.5)
dates <- seq(as.Date("2015-01-01"), as.Date("2020-01-01"), by = "days")
df <- data.frame(dates, returns)
ff3.Capm.estimation(df, "2015-01-01" , "2020-01-01")


## End(Not run)

gabrielebonvicini/plotFin documentation built on Oct. 11, 2023, 1:36 a.m.