Compute the coefficients corresponding to the decomposition of some density in a given orthonormal polynomial basis.

orthoBasis_coef(
data,
comp.dist = NULL,
comp.param = NULL,
supp = c("Real", "Integer", "Positive", "Bounded.continuous"),
degree,
m = 3,
other = NULL
)

## Arguments

data Observed sample from which the coefficients are calculated. Can be NULL if 'comp.dist' and 'comp.param' are specified. (default to NULL) A list with two elements corresponding to component distributions (specified with R native names for these distributions) involved in the admixture model. Unknown elements must be specified as 'NULL' objects (for instance unknown 'f': list(f=NULL, g='norm')). (default to NULL) A list with two elements corresponding to the parameters of the component distributions, each element being a list itself. The names used in this list must correspond to the native R argument names for these distributions. Unknown elements must be specified as 'NULL' objects. For instance if 'f' is unknown: list(f = NULL, g = list(mean=0,sd=1)). Support of the density considered. Degree up to which the polynomial basis is built. (default to 3) Only used when support is 'Integer'. Corresponds to the mean of the reference measure, i.e. Poisson(m). (default to NULL) A list to precise bounds when the support is bounded, where the second and fourth elements give bounds.

## Value

The list composed of 'degree' elements, each element being a numeric vector (with sample size) where each value represents the k-th order coefficient found when decomposing the density in the orthonormal polynomial basis.

## Author

Xavier Milhaud xavier.milhaud.research@gmail.com

## Examples

## Simulate data:
sample1 <- rnorm(n = 7000, mean = 3, sd = 1)
## Compute the expansion coefficients in the orthonormal polynomial basis:
coeff <- orthoBasis_coef(data = sample1, comp.dist = NULL, comp.param = NULL, supp = 'Real',
degree = 3, m = 3, other = NULL)
sapply(coeff, mean)
#> [1]  3.015972  6.439259 11.253154## No observed data and decomposition of the known component of the admixture model:
coeff <- orthoBasis_coef(data = NULL, comp.dist = list(NULL, 'norm'),
comp.param=list(NULL,list(mean=3,sd=1)), supp = 'Real', degree=3, m=3, other = NULL)
sapply(coeff, mean)
#> [1]  3.000558  6.365906 11.027697