Learn R Programming

GraphPCA (version 1.1)

PrepHistogram: This function transform standard variables into histogram-valued variable (PrepHistogram)

Description

This function transforms quantitative variable into histogram-valued variable.

Usage

PrepHistogram(X, Z = NULL, k = 3,group=NULL)

Arguments

X

X quantitative variable that need to be transformed into symbolic histogram

Z

Z categorical variable that need to be used for the purpose of clustering

k

k number of bins of histogram-valued variables

group

Data group

Value

Returns a list including :

mido

return the class centres of class and the min and the max of histograms

Vhistogram

dataframe containing the relative frequency of histogram variables

References

Makosso-Kallyth, Sun; Diday, Edwin. Adaptation of interval PCA to symbolic histogram variables. Advances in Data Analysis and Classification. Volume 6. n 2. 2012. pages 147-159. Springer.

See Also

http://www.ivisualizations.com

Examples

Run this code
# NOT RUN {
###  example1 from iris data

## preparation of histogram-valued variables (k= 3 bins)

Sepal.LengthHistogram=PrepHistogram(X=iris[,1],Z=iris[,5])$Vhistogram
Sepal.WidthHistogram=PrepHistogram(X=iris[,2],Z=iris[,5])$Vhistogram
Petal.LengthHistogram=PrepHistogram(X=iris[,3],Z=iris[,5])$Vhistogram
Petal.WidthHistogram=PrepHistogram(X=iris[,4],Z=iris[,5])$Vhistogram

############################     Hitsogram PCA   #################################
HistPCA(Variable=list(Sepal.LengthHistogram,Sepal.WidthHistogram,
        Petal.LengthHistogram,Petal.WidthHistogram),
        Row.names=names(table(iris[,5])),
		Col.names=colnames(iris)[1:4])


###  example2 from iris data

## preparation of histogram-valued variables (k= 4 bins)

Sepal.LengthHistogram=PrepHistogram(X=iris[,1],Z=iris[,5],k=2)$Vhistogram
Sepal.WidthHistogram=PrepHistogram(X=iris[,2],Z=iris[,5],k=2)$Vhistogram
Petal.LengthHistogram=PrepHistogram(X=iris[,3],Z=iris[,5],k=2)$Vhistogram
Petal.WidthHistogram=PrepHistogram(X=iris[,4],Z=iris[,5],k=2)$Vhistogram


############################     Hitsogram PCA   #################################

HistPCA(Variable=list(Sepal.LengthHistogram,Sepal.WidthHistogram,
Petal.LengthHistogram,Petal.WidthHistogram),
Row.names=names(table(iris[,5])),Col.names=colnames(iris)[1:4])
# }

Run the code above in your browser using DataLab