pcafreq: Principal Component Analysis

Description Usage Arguments Details Value See Also Examples

View source: R/pcafreq.R View source: R/pcafreq.R

Description

It computes a principal component analysis with sumplementary quantitative and qualitative variables. It is wrapper of PCA.

Usage

1
2
3
4
5
pcafreq(data, freq = NULL, scale.unit = TRUE, ncp = 5, quantisup = NULL,
  qualisup = NULL, colw = NULL, graph = TRUE, axes = c(1, 2))

.pcafreq(tfq, scale.unit = TRUE, ncp = 5, quantisup = NULL,
  qualisup = NULL, colw = NULL, graph = TRUE, axes = c(1, 2))

Arguments

data

a data frame

freq

a name of the variable specifying frequency weights

scale.unit

a boolean, if TRUE (value set by default) then data are scaled to unit variance

ncp

number of dimensions kept in the results

quantisup

a vector indicating the names of the quantitative supplementary variables

qualisup

a vector indicating the names of the categorical supplementary variables

colw

an optional column weights (by default, uniform column weights)

graph

boolean, if TRUE a graph is displayed

axes

a length 2 vector specifying the components to plot

tfq

a table of frequencies

Details

This function calls PCA with the the frequency weights as row.w. Any variable present in freq are removed from the data.

Value

It returns a list described in PCA.

See Also

PCA, link{tablefreq}

Examples

1
2
3
4
pcafreq(iris,  qualisup="Species", graph=TRUE)

tfq <- tablefreq(iris)
.pcafreq(tfq,  qualisup="Species", graph=TRUE)

Example output

dev.new(): using pdf(file="Rplots1.pdf")
**Results for the Principal Component Analysis (PCA)**
The analysis was performed on 149 individuals, described by 5 variables
*The results are available in the following objects:

   name                description                                          
1  "$eig"              "eigenvalues"                                        
2  "$var"              "results for the variables"                          
3  "$var$coord"        "coord. for the variables"                           
4  "$var$cor"          "correlations variables - dimensions"                
5  "$var$cos2"         "cos2 for the variables"                             
6  "$var$contrib"      "contributions of the variables"                     
7  "$ind"              "results for the individuals"                        
8  "$ind$coord"        "coord. for the individuals"                         
9  "$ind$cos2"         "cos2 for the individuals"                           
10 "$ind$contrib"      "contributions of the individuals"                   
11 "$quali.sup"        "results for the supplementary categorical variables"
12 "$quali.sup$coord"  "coord. for the supplementary categories"            
13 "$quali.sup$v.test" "v-test of the supplementary categories"             
14 "$call"             "summary statistics"                                 
15 "$call$centre"      "mean of the variables"                              
16 "$call$ecart.type"  "standard error of the variables"                    
17 "$call$row.w"       "weights for the individuals"                        
18 "$call$col.w"       "weights for the variables"                          
dev.new(): using pdf(file="Rplots2.pdf")
dev.new(): using pdf(file="Rplots3.pdf")
**Results for the Principal Component Analysis (PCA)**
The analysis was performed on 149 individuals, described by 5 variables
*The results are available in the following objects:

   name                description                                          
1  "$eig"              "eigenvalues"                                        
2  "$var"              "results for the variables"                          
3  "$var$coord"        "coord. for the variables"                           
4  "$var$cor"          "correlations variables - dimensions"                
5  "$var$cos2"         "cos2 for the variables"                             
6  "$var$contrib"      "contributions of the variables"                     
7  "$ind"              "results for the individuals"                        
8  "$ind$coord"        "coord. for the individuals"                         
9  "$ind$cos2"         "cos2 for the individuals"                           
10 "$ind$contrib"      "contributions of the individuals"                   
11 "$quali.sup"        "results for the supplementary categorical variables"
12 "$quali.sup$coord"  "coord. for the supplementary categories"            
13 "$quali.sup$v.test" "v-test of the supplementary categories"             
14 "$call"             "summary statistics"                                 
15 "$call$centre"      "mean of the variables"                              
16 "$call$ecart.type"  "standard error of the variables"                    
17 "$call$row.w"       "weights for the individuals"                        
18 "$call$col.w"       "weights for the variables"                          

freqweights documentation built on May 29, 2017, 12:01 p.m.