Learn R Programming

LIHNPSD (version 0.2.1)

standardfit: Standard utility to perform nonlinear PSD fit

Description

Standard utility to perform nonlinear PSD fit

Usage

standardfit(d, r, hist, trace, iter, plotqq, weights, merge_tails)

Arguments

d
A PSD S3 object representing initial guess of the PSD parameters
r
Input log-return series
hist
Input histogram
trace
TRUE/FALSE: turn trace on/off
iter
Maximum number of iterations
plotqq
TRUE/FALSE: Plot intermediate charts oor not
weights
Specify the weights of each component in the nonlinear fit, defaults are 1.
merge_tails
Specify the numbers of data points to merge in both tails when processing histogram

Value

dist
A PSD S3 object representing best nonlinear fit
psdout
The output of optmix/psg function. This is for debugging purpose only.

See Also

LIHNPSD_standardfit_fn

Examples

Run this code
  # Load the daily log-return data of DJIA 
  data(szd_logr)

  # Prepare the input data set
  merge_tails <- c(1,3)
  dt <- LIHNPSD_prepare_data(szd_logr, breaks=68, merge_tails=merge_tails)

  # Prepare the input PSD 
  dist <- list( sigma= 0.0036, alpha= 0.9, gamma= 0.0, beta= -0.014 )
  class(dist) <- "LIHNPSD"
  dist <- rawmean(dist)
  dist$location <- 0.00014

  # Invoke the nonlinear fit (This will take some time!)
  #fit <- standardfit(dist, dt$logr, dt$h, trace=1, iter=10,
  #       plotqq=1, weights=list(m3=5,m4=1,qq_df=4), merge_tails=merge_tails )
  
  # The final PSD
  #dist <- fit$dist

Run the code above in your browser using DataLab