MyNixOS website logo
Description

Tidy Finance Helper Functions.

Helper functions for empirical research in financial economics, addressing a variety of topics covered in Scheuch, Voigt, and Weiss (2023) <doi:10.1201/b23237>. The package is designed to provide shortcuts for issues extensively discussed in the book, facilitating easier application of its concepts. For more information and resources related to the book, visit <https://www.tidy-finance.org/r/index.html>.

tidyfinance

Project Status: Active - The project has reached a stable, usablestate and is being activelydeveloped. R-CMD-check

This repository contains an R package that collects helper functions for developers and researchers familiar with Tidy Finance with R. The functions provide shortcuts to selected issues that the book discusses in detail.

Installation

You can install the released version of tidyfinancefrom CRAN via:

install.packages("tidyfinance")

You can install the development version of tidyfinance from GitHub via:

# install.packages("pak")
pak::pak("tidy-finance/r-tidyfinance")

Usage

Download Data

The main functionality of the tidyfinance package centers around data download. You can download most of the data that we used in Tidy Finance with R using the download_data() function or its children. For instance, both functions give the same result:

download_data(
  type = "factors_ff_3_monthly", 
  start_date = "2000-01-01", 
  end_date = "2020-12-31"
)

download_data_factors_ff(
  type = "factors_ff_3_monthly", 
  start_date = "2000-01-01", 
  end_date = "2020-12-31"
)

You can also download data directly from WRDS (if you have set your credentials via Sys.setenv(WRDS_USER = "your_username", WRDS_PASSWORD = "your_password")), e.g.,

download_data(
  type = "wrds_compustat_annual", 
  start_date = "2000-01-01", 
  end_date = "2020-12-31"
)

If you want to fetch additional columns that are not included in our default selection, then pass them as additional arguments in the corresponding child function:

download_data_wrds_compustat(
  type = "wrds_compustat_annual",  
  start_date = "2000-01-01", 
  end_date = "2020-12-31",
  additional_columns = c("acoxar", "amc", "aldo")
)

You can get a list of all currently supported types via list_supported_types(). Please open an issue on GitHub to request additional supported types.

Other Helpers

We include functions to check out content from tidy-finance.org:

list_tidy_finance_chapters()
open_tidy_finance_website()

There are also some simple helpers for regression analyses:

winsorize()
trim()
create_summary_statistics()

We also include (experimental) functions that can be used for different applications, but note that they might heavily change in future package versions as we try to make them more general:

# For portfolio sorts
?assign_portfolio()

# For model estimation
?estimate_model()

# For beta estimation
?estimate_betas()

# For beta estimation
?estimate_fama_macbeth()
Metadata

Version

0.4.3

License

Unknown

Platforms (77)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows