pcamap {GeoXp}R Documentation

Generalized Principal Component Analysis and map

Description

The function `pcamap' draws the plots summarizing a generalized Principal Component Analysis (PCA), made with `genpca.r'. It draws the scatterplot of the individuals projected on a chosen principal component plane (with their percentage of inertia), together with the scatterplot of the variables projected into the same plane with the quality of representation in order to interpret the principal component axes. The individuals scatterplot interacts with the map.

Usage

pcamap(long,lat,dataset,direct=c(1,2),weight=rep(1/nrow(dataset),length=nrow(dataset)), 
       metric=diag(1,ncol(dataset),ncol(dataset)), center=TRUE, reduce=TRUE,namedata=NULL,
       qualproj=0,listvar=NULL, listnomvar=NULL,criteria=NULL,
       carte=NULL,label="",symbol=0,color=1,axis=FALSE,
       lablong="", lablat="")

Arguments

long a vector $x$ of size $n$
lat a vector $y$ of size $n$
dataset matrix $n times p$ of variables
direct Number of component analysis to draw
weight vector of size $n$ of weight (by default : $weight=t(1/n,...,1/n)$)
metric matrix $p times p$ (by default : metric=Identity matrix)
center boolean. if TRUE, centred PCA (by default : center=TRUE)
reduce boolean. if TRUE, reduced PCA (by default : reduce=TRUE)
namedata List of Names of dataset
qualproj possibility to print the quality of representation of individuals (0 no print (by default) and 1 print)
listvar matrix of variables
listnomvar names of variables from $listvar$
criteria a vector of size $n$ of boolean with TRUE on specific sites (these for non interactive selection)
carte matrix with 2 columns for drawing spatial polygonal contours : $x$ and $y$ coordinates of the vertices of the polygon
label vector of character of size $n$ with name of each site
color 0 or 1 (by default), choice of representation of selected points (if user has selected a barplot as an additionnal graph). If 0, sites are represented in blue, if 1, sites are represented with different colors for each factor
symbol 0 (by default) or 1, choice of representation of selected points. If 0, selected points are circles, if 1, selected points are stars
axis a boolean with TRUE for drawing axes on the map
lablong name of the x-axis that will be printed on the map
lablat name of the y-axis that will be printed on the map

Details

Let

D=diag(λ_1,...,λ_p)

1_p=(1,...,1)'

Let the coordinates of individuals in the principals components

CC=(C_1',...,C_n')'

with C_i=(C_i^1,...,C_i^p)
Let the coordinates of variables in the principals components

CC=(V_1',...,V_p')'

with V_i=(V_i^1,...,V_i^p)
Part of inertia :

(frac{λ_1}{sum_iλ_i},...,frac{λ_p}{sum_iλ_i})'

Quality of representation of individual k projected on plane (i,j):

Qu=sqrt{frac{(C_k^i)^2+(C_k^j)^2}{sum_l(C_k^l)^2}}

Quality of representation of variable k projected on plane (i,j):

VQu=sqrt{frac{(V_k^i)^2+(V_k^j)^2}{sum_l(V_k^l)^2}}

Value

Return `obs', vector of size $n$ of boolean with sites selected, `inertia' vector of size $p$ with percent of inertia of each component, `casecoord' matrix $n times p$ of indivuduals, `varcoord' matrix $p times p$ of principal components.

Author(s)

Thomas-Agnan C., Aragon Y., Ruiz-Gazen A., Laurent T., Robidou L.

References

Aragon Yves, Perrin Olivier, Ruiz-Gazen Anne, Thomas-Agnan Christine (2006), ``Statistique et Econométrie pour données géoréférencées : modèles et études de cas''

Caussinus H., Fekri M., Hakam S., Ruiz-Gazen A. (2003) , ``A monitoring display of Multivariate Outliers'', Computational Statistics and Data Analysis, vol. 44, 1-2, 237-252.

See Also

clustermap,genpca

Examples

# Data Colombus
#x <- read.shape(system.file("shapes/columbus.shp", package="maptools")[1])
#colombus.contours<-map2list(x)
#colombus<-x$att.data
#obs<-pcamap(colombus.contours$X,colombus.contours$Y,
#colombus[,6:12],label=colombus$NEIGNO, carte=colombus.contours$poly,
#listvar=colombus,listnomvar=names(colombus),namedata=names(colombus[,6:12]))

# data boston
data(boston)
obs<-pcamap(boston$x,boston$y,boston[,15:22],label=boston$TOWN, 
listvar=boston,listnomvar=names(boston),namedata=names(boston[,15:22]))


[Package GeoXp version 1.0 Index]