Learn R Programming

psy (version 1.2)

mdspca: Graphical representation of a correlation matrix using a Principal Component Analysis

Description

Similar to many routines, the interest is in the possible representation of both variables and subjects (and by the way categorical variables) with active and supplementary points. Missing data are omitted.

Usage

mdspca(datafile, supvar="no", supsubj="no", namesupvar=colnames(supvar,do.NULL=FALSE),
       namesupsubj=colnames(supsubj, do.NULL=FALSE), dimx=1, dimy=2, cx=0.75)

Arguments

datafile

name of datafile

supvar

matrix corresponding to supplementary variables (if any), supvar="no" by default

supsubj

matrix corresponding to supplementary subjects (if any), supsubj="no" by default

namesupvar

names of the points corresponding to the supplementary variables

namesupsubj

names of the points corresponding to the supplementary subjects

dimx

rank of the component displayed on the x axis (1 by default)

dimy

rank of the component displayed on the y axis (2 by default)

cx

size of the lettering (0.75 by default, 1 for bigger letters, 0.5 for smaller)

Value

A diagram (two diagrams if supplementary subjects are used)

Examples

Run this code
# NOT RUN {
data(sleep)

mdspca(sleep[,c(2:5,7:11)])
## three consistent groups of variables, paradoxical sleep (in other words: dream)
## is negatively correlated with danger

mdspca(sleep[,c(2:5,7:11)],supvar=sleep[,6],namesupvar="Total.sleep",supsubj=sleep[,1],
       namesupsubj="",cx=0.5)
## Total.sleep is here a supplementary variable since it is deduced
## from Paradoxical.sleep and Slow.wave.sleep
## The variable Species is displayed in the subject plane,
## Rabbit and Cow have a high level of danger
# }

Run the code above in your browser using DataLab