pcamap {GeoXp} | R Documentation |
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.
pcamap(long,lat,dataset,name.dataset=NULL,direct=c(1,2),weight=rep(1/nrow(dataset),length=nrow(dataset)), metric=diag(ncol(dataset)), center=NULL, reduce=TRUE,qualproj=FALSE, listvar=NULL, listnomvar=NULL,criteria=NULL,carte=NULL,label="",cex.lab=1, pch=16, col="grey", axes=FALSE, xlab=as.character(direct[1]), ylab=as.character(direct[2]), lablong="", lablat="")
long |
a vector x of size n |
lat |
a vector y of size n |
dataset |
matrix n x p of variables |
name.dataset |
List of Names of dataset |
direct |
Two-dimension vector containing the numbers of principal axes to plot |
weight |
vector of size n of weight (by default : weight=t(1/n,...,1/n)) |
metric |
matrix p x p (by default : metric=Identity matrix) |
center |
A vector of size p of the gravity center which by default is equal to bar(X) |
reduce |
if TRUE, reduced PCA |
qualproj |
if TRUE, print the quality of representation of individuals |
listvar |
matrix of variables which permit to add graphics such as histogram, etc. and plot bubbles on map using the tlclk window |
listnomvar |
names of variables from listvar |
criteria |
a vector of size n of boolean which permit to represent preselected sites with a cross, using the tcltk window |
carte |
matrix with 2 columns for drawing spatial polygonal contours : x and y coordinates of the vertices of the polygon |
label |
a list of character of size n with name of site. Names are printed on map after a selection |
cex.lab |
character size of label |
pch |
16 by default, symbol for selected points |
col |
"grey" by default, color of the two graphics |
axes |
TRUE for drawing axes on the map |
xlab |
a title for the two graphics x-axis |
ylab |
a title for the two graphics y-axis |
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 |
Let
D=diag(lambda_1,...,lambda_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(lambda_1)(sum_ilambda_i),...,frac(lambda_p)(sum_ilambda_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))
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 x p of indivuduals, `varcoord' matrix n x p of principal components.
Thomas-Agnan C., Aragon Y., Ruiz-Gazen A., Laurent T., Robidou L.
Aragon Yves, Perrin Olivier, Ruiz-Gazen Anne, Thomas-Agnan Christine (2009), 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.
# Data Colombus example(columbus) coords <- coordinates(columbus) cont<-spdf2list(columbus)$poly obs<-pcamap(coords[,1], coords[,2],columbus@data[,6:12], label=columbus@data$NEIGNO, carte=cont,listvar=columbus@data, qualproj=TRUE,listnomvar=names(columbus@data),name.dataset=names(columbus@data[,6:12]), cex.lab=0.7, pch=6, col="purple") # data boston data(boston) obs<-pcamap(boston.utm[,1],boston.utm[,2],boston.c[,12:15],label=boston.c$TOWN, listvar=boston.c,listnomvar=names(boston.c),name.dataset=names(boston.c[,12:15]), cex.lab=0.3,center=c(0,0,0,0))