NNS.PDF: NNS PDF

Description Usage Arguments Value Author(s) References Examples

View source: R/Partial_Moments.R

Description

This function generates an empirical PDF using dy.dx on NNS.CDF.

Usage

1
NNS.PDF(variable, degree = 1, target = NULL, bins = NULL, plot = TRUE)

Arguments

variable

a numeric vector.

degree

integer; (degree = 0) is frequency, (degree = 1) (default) is area.

target

a numeric range of values [a,b] where a < b. NULL (default) uses the variable min and max observations respectively.

bins

integer; NULL Selects number of bins. Bin width defaults to density(x)$bw.

plot

logical; plots PDF.

Value

Returns a data.table containing the intervals used and resulting PDF of the variable.

Author(s)

Fred Viole, OVVO Financial Systems

References

Viole, F. and Nawrocki, D. (2013) "Nonlinear Nonparametric Statistics: Using Partial Moments" https://www.amazon.com/dp/1490523995/ref=cm_sw_su_dp

Examples

1
2
3
4
5
6
set.seed(123)
x <- rnorm(100)
NNS.PDF(x)

## Custom target range
NNS.PDF(x, target = c(-5, 5))

Example output

Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE 
3: .onUnload failed in unloadNamespace() for 'rgl', details:
  call: fun(...)
  error: object 'rgl_quit' not found 
     Intervals          PDF
  1: -2.309169 0.0001908930
  2: -2.264204 0.0003890644
  3: -2.219239 0.0004040456
  4: -2.174274 0.0004199092
  5: -2.129309 0.0004367259
 ---                       
 97:  2.007473 0.0014780900
 98:  2.052438 0.0011915263
 99:  2.097403 0.0009296535
100:  2.142368 0.0008033076
101:  2.187333 0.0003484623
     Intervals PDF
  1:      -5.0   0
  2:      -4.9   0
  3:      -4.8   0
  4:      -4.7   0
  5:      -4.6   0
 ---              
 97:       4.6   0
 98:       4.7   0
 99:       4.8   0
100:       4.9   0
101:       5.0   0

NNS documentation built on June 26, 2021, 1:07 a.m.