filter.RMT(h, hint, ..., type = 'kernel')getRandomMatrix(m, t)
mp.theory(Q, sigma, e.values = NULL, steps = 200)
mp.density.hist(h, breaks = NULL, cutoff = 0.01)
mp.density.kernel(h, ...)
## S3 method for class 'default':
mp.density.kernel(h, ...)
## S3 method for class 'returns':
mp.density.kernel(h, ...)
## S3 method for class 'covariance':
mp.density.kernel(h, ...)
## S3 method for class 'correlation':
mp.density.kernel(h, adjust = 0.2, kernel = 'e', ...)
# Fit the appropriate MP curve to the data. This will estimate Q and sigma.
mp.fit.hist(hist)
mp.fit.kernel(hist)
# Marcenko-Pastur theoretical minimum and maximum eigenvalues
mp.eigen.max(Q, sigma)
mp.eigen.min(Q, sigma)
# Generate eigenvalues for theoretical MP distribution
mp.lambdas(Q, sigma, steps)
# This provides the density of the eigenvalues
mp.rho(Q, sigma, e.values)
r.normalize(h)
cor.empirical(h)
denoise(hist, lambda.plus = 1.6, h = NULL)
When using the kernel density estimate (the default), it is important to set n to a reasonable number. In the implementation, the kernel estimator's default is used which may not be optimum. For shorter windows it is suitable but larger windows (e.g. greater than 500 days) requires manually setting n. A value that seems to work well is 4096. See density for more information. In the future, this may be changed to include a heuristic to determine a good value for n.
tawny, optimizePortfolio# This is autorun outside of examples
tawny:::.init()
# Fit the appropriate MP curve to the data. This will estimate Q and sigma.
# hist is a histogram object
h <- getRandomMatrix(1000, 6000)
hist <- mp.density.hist(h)
o <- optim(c(6,1), mp.fit.hist(hist))
# Calculate and plot the theoretical density distribution
rho <- mp.theory(6,1)
clean <- filter.RMT(h, c(6,1))Run the code above in your browser using DataLab