Library: | xclust |
See also: | cartsplit cartsplitopt cartcv leafnum maketr pred prederr prune prunecv pruneseq prunetot ssr |
Quantlet: | dentoreg | |
Description: | transforms density data to regression data using variance stabilizing transform. Divides the sample space into bins, calculates the counts y_i of observations from every bin, and gives the values 2*sqrt(y_i+3/8) as a regression variable. |
Usage: | y = dentoreg (dendat, binlkm) | |
Input: | ||
dendat | n x p matrix, data matrix of i.i.d. observations. | |
binlkm | integer >=2, number of bins for a single dimension | |
Output: | ||
y | list, consisting of y.dep, y.ind | |
y.dep | (binlkm^p) x 1 vector, contains the values of the new response variable. | |
y.ind | (binlkm^p) x p matrix, contains the coordinates of the centers of the bins, these are the new regression variables. |
; loads the library xclust library("xclust") ; generates the density data randomize(1) dendat=uniform(10)~(uniform(10)+1) dendat ; transforms the density data to regression data regdat=dentoreg(dendat,4) regdat
Contents of dendat [ 1,] 0.0004325 1.9277 [ 2,] 0.73471 1.3192 [ 3,] 0.024197 1.7042 [ 4,] 0.50398 1.917 [ 5,] 0.036124 1.9803 [ 6,] 0.11705 1.8379 [ 7,] 0.74053 1.1587 [ 8,] 0.17788 1.6727 [ 9,] 0.13673 1.5017 [10,] 0.76021 1.9453 Contents of regdat.dep [ 1,] 1.2247 [ 2,] 1.2247 [ 3,] 1.2247 [ 4,] 3.0822 [ 5,] 2.3452 [ 6,] 1.2247 [ 7,] 1.2247 [ 8,] 1.2247 [ 9,] 3.0822 [10,] 1.2247 [11,] 1.2247 [12,] 1.2247 [13,] 3.6742 [14,] 1.2247 [15,] 2.3452 [16,] 2.3452 Contents of regdat.ind [ 1,] 0.095404 1.2614 [ 2,] 0.28535 1.2614 [ 3,] 0.47529 1.2614 [ 4,] 0.66523 1.2614 [ 5,] 0.095404 1.4668 [ 6,] 0.28535 1.4668 [ 7,] 0.47529 1.4668 [ 8,] 0.66523 1.4668 [ 9,] 0.095404 1.6722 [10,] 0.28535 1.6722 [11,] 0.47529 1.6722 [12,] 0.66523 1.6722 [13,] 0.095404 1.8776 [14,] 0.28535 1.8776 [15,] 0.47529 1.8776 [16,] 0.66523 1.8776