Creates a list of options of class tidyfinance_portfolio_sort_options that
bundles sample construction filters and breakpoint specifications for use
with implement_portfolio_sort().
Usage
portfolio_sort_options(
filter_options = NULL,
breakpoint_options_main,
breakpoint_options_secondary = NULL,
...
)Arguments
- filter_options
A list of class
tidyfinance_filter_optionscreated byfilter_options(), orNULL(the default, which applies no filters). The arguments accepted byfilter_options()includeexclude_financialsA logical indicating whether to exclude financial firms (SIC codes 6000–6799). Defaults toFALSE.exclude_utilitiesA logical indicating whether to exclude utility firms (SIC codes 4900–4999). Defaults toFALSE.min_stock_priceA single positive numeric specifying the minimum stock price required to include an observation.NULL(the default) applies no price filter.min_size_quantileA single numeric strictly between 0 and 1 specifying the minimum cross-sectional size quantile (based on lagged market cap) required to include an observation.NULL(the default) applies no size quantile filter.min_listing_ageA single non-negative integer or numeric specifying the minimum number of months a stock must have been listed in CRSP.NULL(the default) applies no listing age filter.exclude_negative_book_equityA logical indicating whether to exclude observations with non-positive book equity. Defaults toFALSE.exclude_negative_earningsA logical indicating whether to exclude observations with non-positive earnings. Defaults toFALSE.
- breakpoint_options_main
A list of class
tidyfinance_breakpoint_optionscreated bybreakpoint_options(), specifying breakpoints for the primary sorting variable. The arguments accepted bybreakpoint_options()includen_portfoliosAn optional integer specifying the number of equally sized portfolios to create. This parameter is mutually exclusive withpercentiles.percentilesAn optional numeric vector specifying the percentiles for determining the breakpoints of the portfolios. This parameter is mutually exclusive withn_portfolios.breakpoints_exchangesAn optional character vector specifying exchange names to filter the data before computing breakpoints. Exchanges must be stored in a column given bydata_options(defaults toexchange). IfNULL, no filtering is applied.smooth_bunchingAn optional logical parameter specifying if to attempt smoothing non-extreme portfolios if the sorting variable bunches on the extremes (TRUE), or not (FALSE, the default).breakpoints_min_size_thresholdAn optional numeric value between 0 and 1 (exclusive). When set, stocks with market capitalization below this quantile are excluded from breakpoint computation.
- breakpoint_options_secondary
A list of class
tidyfinance_breakpoint_optionscreated bybreakpoint_options(), specifying breakpoints for the secondary sorting variable, orNULL(the default) for univariate sorts. The arguments accepted bybreakpoint_options()are the same as forbreakpoint_options_main.- ...
Additional arguments to be included in the options list.
Examples
portfolio_sort_options(
filter_options = filter_options(exclude_financials = TRUE),
breakpoint_options_main = breakpoint_options(n_portfolios = 10)
)
#> $filter_options
#> $exclude_financials
#> [1] TRUE
#>
#> $exclude_utilities
#> [1] FALSE
#>
#> $min_stock_price
#> NULL
#>
#> $min_size_quantile
#> NULL
#>
#> $min_listing_age
#> NULL
#>
#> $exclude_negative_book_equity
#> [1] FALSE
#>
#> $exclude_negative_earnings
#> [1] FALSE
#>
#> attr(,"class")
#> [1] "tidyfinance_filter_options"
#>
#> $breakpoint_options_main
#> $n_portfolios
#> [1] 10
#>
#> $percentiles
#> NULL
#>
#> $breakpoints_exchanges
#> NULL
#>
#> $smooth_bunching
#> [1] FALSE
#>
#> $breakpoints_min_size_threshold
#> NULL
#>
#> attr(,"class")
#> [1] "tidyfinance_breakpoint_options"
#>
#> $breakpoint_options_secondary
#> NULL
#>
#> attr(,"class")
#> [1] "tidyfinance_portfolio_sort_options"