View source: R/download_data_stambaugh_yuan.R
| download_data_stambaugh_yuan | R Documentation |
Downloads and processes the mispricing factor data of Stambaugh and Yuan
(2017) from
Stambaugh's data library.
The four-factor model (M4) combines the market and size factors with two
mispricing factors, mgmt (management) and perf (performance). The
function downloads the requested frequency, aligns the date, renames the
columns to the package conventions, and optionally filters the data based on
a provided date range.
download_data_stambaugh_yuan(
dataset = "monthly",
start_date = NULL,
end_date = NULL,
url = "https://finance.wharton.upenn.edu/~stambaug/"
)
dataset |
The data frequency to download, either |
start_date |
Optional. A character string or Date object in "YYYY-MM-DD" format specifying the start date for the data. If not provided, the full dataset is returned. |
end_date |
Optional. A character string or Date object in "YYYY-MM-DD" format specifying the end date for the data. If not provided, the full dataset is returned. |
url |
The base URL from which to download the dataset files. The file
name ( |
Returns are already expressed as plain numeric (decimal) values in the source data, so no rescaling is applied. The source files currently end in December 2016; a requested date range that lies entirely outside the available data emits a warning and returns an empty tibble.
A tibble with the columns date (aligned to the beginning of the
month for monthly data), mkt_excess (the market excess return), smb
(size), mgmt (the management mispricing factor), perf (the performance
mispricing factor), and risk_free (the risk-free rate). All returns are
plain numeric (decimal) values, filtered by the specified date range if
start_date and end_date are provided.
Stambaugh, R. F., & Yuan, Y. (2017). Mispricing factors. Review of Financial Studies, 30(4), 1270-1315. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1093/rfs/hhw107")}
Other download functions:
download_data(),
download_data_constituents(),
download_data_factors_ff(),
download_data_factors_q(),
download_data_fred(),
download_data_huggingface(),
download_data_jkp(),
download_data_macro_predictors(),
download_data_osap(),
download_data_pastor_stambaugh(),
download_data_risk_free(),
download_data_stock_prices(),
download_factor_library_grid(),
download_factor_library_ids()
download_data_stambaugh_yuan(
start_date = "2015-01-01", end_date = "2016-12-31"
)
download_data_stambaugh_yuan(
dataset = "daily", start_date = "2016-01-01", end_date = "2016-12-31"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.