Skip to contents

Give full weight to occurrences that satisfies a logical condition.

Usage

crisp(x, lgl)

# S3 method for default
crisp(x, lgl)

# S3 method for numeric
crisp(x, lgl)

# S3 method for matrix
crisp(x, lgl)

# S3 method for ts
crisp(x, lgl)

# S3 method for xts
crisp(x, lgl)

# S3 method for data.frame
crisp(x, lgl)

# S3 method for tbl_df
crisp(x, lgl)

Arguments

x

An univariate or a multivariate distribution.

lgl

A logical vector with TRUE's and FALSE's indicating which scenarios should considered.

Value

A numerical vector of class ffp with the new probabilities distribution.

Examples

library(ggplot2)
# invariance (stationarity)
ret <- diff(log(EuStockMarkets))

# full weight on scenarios where CAC returns were above 2%
market_condition <- crisp(x = ret, ret[ , 3] > 0.02)
market_condition
#> <ffp[1859]>
#> 1.470588e-32 1.470588e-32 1.470588e-32 1.470588e-32 1.470588e-32 ... 1.470588e-32

autoplot(market_condition) +
  scale_color_viridis_c()