ffp_moments {ffp} | R Documentation |
Moments with Flexible Probabilities
Description
Computes the location and dispersion statistics under flexible probabilities.
Usage
ffp_moments(x, p = NULL)
## Default S3 method:
ffp_moments(x, p = NULL)
## S3 method for class 'numeric'
ffp_moments(x, p = NULL)
## S3 method for class 'matrix'
ffp_moments(x, p = NULL)
## S3 method for class 'xts'
ffp_moments(x, p = NULL)
## S3 method for class 'data.frame'
ffp_moments(x, p = NULL)
## S3 method for class 'tbl_df'
ffp_moments(x, p = NULL)
Arguments
x |
A tabular (non-tidy) data structure. |
p |
An object of the |
Value
A list
with 2 elements: mu
and sigma
.
Examples
x <- matrix(diff(log(EuStockMarkets)), ncol = 4)
colnames(x) <- colnames(EuStockMarkets)
p <- stats::runif(nrow(x))
p <- p / sum(p)
ffp_moments(x = x, p = p)
# compare with the standard approach
colMeans(x)
cov(x)
[Package ffp version 0.2.2 Index]