plot_dens: Plot the projection estimator of a density

Description Usage Arguments Value Examples

View source: R/plot_dens.R

Description

Plot the estimated density function (see est_dens) for a given set of data using a given orthonormal basis of some dimension. If known, compare the plot to the plot of the actual density function.

Usage

1
2
plot_dens(basis, data, D, pd = perfect_D(basis, data), resol = 300,
  dens = NULL, compare = FALSE)

Arguments

basis

an object of class Basis

data

a numeric vector containing a sample of i.i.d. real random variables with common density.

D

a numeric value, the dimension of the subspace in which the estimation will be calculated.

pd

a numeric value. Another dimension of a subspace in which the estimation can be calculated in. The default is the dimension given by the model selection algorithm (see perfect_D).

resol

a numeric value, specifying the quality of the plot (length.out of processed values). The default is 300.

dens

a function, the true density of the distribution. Since the true density may not be known, the default is NULL.

compare

logical value. If TRUE the projection estimator (see est_dens) using D is compared to (if default is used) the projection estimator of the dimension generated by the model selection algorithm (see perfect_D) and (if passed) the true density dens. If FALSE (the default) only the estimated density is plotted.

Value

no return

Examples

1
2
3
4
5
6
7
8
trig_bas <- Trig_Basis$new(1000)
data <- rnorm(100, 0.5, 0.088)
plot_dens(trig_bas, data, 5)
## Not run: 
dens1 <- function(x) dnorm(x, 0.5, 0.088)
plot_dens(trig_bas, data, 5, dens = dens1, compare = TRUE)

## End(Not run)

nschaefer1211/OSE documentation built on Dec. 31, 2020, 12:59 a.m.