Library: | xclust |
Macro: | dentoreg | |
Description: | Transforms density data to a 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: | regdat = dentoreg (dendat, binlkm) | |
Input: | ||
dendat | n x p matrix: data matrix of i.i.d. observations. | |
binlkm | integer >=2: gives number of bins for a single dimension | |
Output: | ||
regdat | list, consists of regdat.dep, regdat.ind: regdat.dep is (binlkm^p) x 1 vector, it contains the values of the new response variable, regdat.ind is (binlkm^p) x p matrix, it contains the coordinates of the centers of the bins, these are the new regression variables. |
; loads the library xclust library ("xclust") ; generate the density data randomize(1) dendat=uniform(10)~(uniform(10)+1) dendat ; transform the density data to a regression data regdat=dentoreg(dendat,4) regdat
Contents of dendat [ 1,] 0.000433 1.927735 [ 2,] 0.734705 1.319243 [ 3,] 0.024197 1.704184 [ 4,] 0.503982 1.916961 [ 5,] 0.036124 1.980276 [ 6,] 0.117048 1.837946 [ 7,] 0.740534 1.158730 [ 8,] 0.177876 1.672693 [ 9,] 0.136730 1.501657 [10,] 0.760207 1.945274 Contents of regdat.dep [ 1,] 1.224745 [ 2,] 1.224745 [ 3,] 1.224745 [ 4,] 3.082207 [ 5,] 2.345208 [ 6,] 1.224745 [ 7,] 1.224745 [ 8,] 1.224745 [ 9,] 3.082207 [10,] 1.224745 [11,] 1.224745 [12,] 1.224745 [13,] 3.674235 [14,] 1.224745 [15,] 2.345208 [16,] 2.345208 Contents of regdat.ind [ 1,] 0.095404 1.261423 [ 2,] 0.285348 1.261423 [ 3,] 0.475292 1.261423 [ 4,] 0.665236 1.261423 [ 5,] 0.095404 1.466810 [ 6,] 0.285348 1.466810 [ 7,] 0.475292 1.466810 [ 8,] 0.665236 1.466810 [ 9,] 0.095404 1.672196 [10,] 0.285348 1.672196 [11,] 0.475292 1.672196 [12,] 0.665236 1.672196 [13,] 0.095404 1.877583 [14,] 0.285348 1.877583 [15,] 0.475292 1.877583 [16,] 0.665236 1.877583
Library: | xclust |