icasamp {ica} | R Documentation |
Sample from Various Source Signal Distributions
Description
Sample observations from the 18 source signal distributions used in Bach and Jordan (2002). Can also return density values and kurtosis for each distribution. Use icaplot
to plot distributions.
Usage
icasamp(dname, query = c("rnd","pdf","kur"),
nsamp = NULL, data = NULL)
Arguments
dname |
Distribution name: letter "a" through "r" (see Bach & Jordan, 2002). |
query |
What to return: |
nsamp |
Number of observations to sample. Only used if |
data |
Data values for density evaluation. Only used if |
Details
Inspired by usr_distrib.m
from Bach's (2002) kernel-ica
MATLAB toolbox.
Value
If query="rnd"
, returns random sample of size nsamp
.
If query="pdf"
, returns density for input data
.
If query="kur"
, returns kurtosis of distribution.
Author(s)
Nathaniel E. Helwig <helwig@umn.edu>
References
Bach, F.R. (2002). kernel-ica. MATLAB toolbox (ver 1.2) http://www.di.ens.fr/~fbach/kernel-ica/.
Bach, F.R. & Jordan, M.I. (2002). Kernel independent component analysis. Journal of Machine Learning Research, 3, 1-48.
Examples
########## EXAMPLE ##########
# sample 1000 observations from distribution "f"
set.seed(123)
mysamp <- icasamp("f","rnd",nsamp=1000)
xr <- range(mysamp)
hist(mysamp,freq=FALSE,ylim=c(0,.8),breaks=sqrt(1000))
# evaluate density of distribution "f"
xseq <- seq(-5,5,length.out=1000)
mypdf <- icasamp("f","pdf",data=xseq)
lines(xseq,mypdf)
# evaluate kurtosis of distribution "f"
icasamp("f","kur")