GenCompSize: Generate CompetitorSize from a dataset of portfolio weights...

Description Usage Arguments Value Examples

Description

Generate CompetitorSize from a dataset of portfolio weights and a dataset of fund sizes

Usage

1
2
GenCompSize(pw, size, fund.id = "wficn", date.id = "date",
  stock.id = "permno", w.var = "w", size.var = "fund.size")

Arguments

pw

data.table (or data.frame) of portfolio weights (or other measure based on which fund similarity should be calculated). Must be a long-form dataset, with columns specifying fund, stock, date, and the corresponding portfolio weight.

size

data.table (or data.frame) of fund sizes. Must be a long-form dataset, with columns corresponding to fund, date, and the size measure.

fund.id

Name of the variable (supplied as a character string) containing fund identifiers. Defaults to "wficn".

date.id

Name of the variable (supplied as a character string) conteining time identifiers. Defaults to "date".

stock.id

Name of the variable (supplied as a character string) containing security identifiers. Defaults to "permno".

w.var

Name of the variable (supplied as a character string) based on which fund similarity is to be calculated. Defaults to "w". In Jakab (2018), w.var is market-adjusted portfolio weights.

fund.size

Name of the variable (supplied as a character string) based on which competitor size is to be calculated. In Jakab (2018), fund.size is FundSize, i.e. total net assets normalized by the market capitalization of all common equity in CRSP.

Value

A data.table of fund.ids, dates, and CompetitorSize (labeled comp.size).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
pw <- data.table(
  wficn  = paste0("fund", rep(1:2, each = 50)),
  date   = paste0("date", rep(rep(1:2, each = 25), 2)),
  permno = paste0("stock", rep(1:25, 4)),
  w      = runif(100))
pw[, w := w / sum(w), by = .(wficn, date)]
size <- data.table(
  wficn = paste0("fund", rep(1:2, each = 2)),
  date  = paste0("date", rep(1:2, 2)),
  fund.size = c(.1, .11, .2, .25))
GenCompSize(pw, size)

laszlo-jakab/compsizer documentation built on May 17, 2019, 7:30 p.m.