Spanish Discourses _Pg3

3. Speeches trajectory


Previous syntax

load("C:/RData/SpanishDisc.RData")
library(Xplortext)

Or

load(url("http://www.xplortext.org/Rdata/SpanishDisc.RData"))
swu <- c("consiguiente", "ello", "hacia", "punto", "Señorías", "si", "Sus", "vista", "A", "B", "C", "D", "E", "F", "a", "b", "c", "d")

 

To build a new TextDataObject with a minimum of 10 frequency of words and at least in 2 documents.

TD <- TextData(SpanishDisc, var.text=c(1), context.quanti="year", Fmin=10, Dmin=2, idiom="es", lower=FALSE, remov.number=TRUE, stop.word.tm=TRUE, stop.word.user=swu, graph=FALSE)

 

CA from speeches x words table

To obtain a Correspondence Analysis from speeches x words table using default parameters:

resCA <- LexCA(TD, graph=TRUE)

The summary of the Correspondence Analysis results for 11 documents, the first 10 words and 5 dimensions:

summary(resCA, ndoc=11)

ellipseLexCA funtion draws confidence ellipses around all the documents (speeches) for axes 1-2:

ellipseLexCA(resCA, selWord=NULL, selDoc="ALL", col.doc="black",cex=1, title="Confidence ellipses around speeches. Plan(1,2)")
lines(resCA$row$coord[1:11,1],resCA$row$coord[1:11,2],lwd=2,col="blue")

And for axes 1-3:

ellipseLexCA(resCA, selWord=NULL, selDoc="ALL", axes=c(1,3), col.doc="black",cex=1, title="Confidence ellipses around speeches. Plan(1,3)") lines(resCA$row$coord[1:11,1],resCA$row$coord[1:11,3],lwd=2,col="blue")

 

Three-dimensional representation of documents:

library(scatterplot3d)
coord <- resCA$row$coord
s <- c(1:(nrow(coord)-1))
gr3D <- scatterplot3d(coord[,1],coord[,2],coord[,3], color="red", type="h", main="Investiture speeches from the Spanish democracy",
xlab="dim1", ylab="dim2", zlab="dim3", pch=20, cex.axis=.6, angle=65)
gr3D.coords <- gr3D$xyz.convert(coord[,1],coord[,2],coord[,3])
text(gr3D.coords$x, gr3D.coords$y,labels=rownames(coord), cex=.9, pos=2)
segments(gr3D.coords$x[s], gr3D.coords$y[s], gr3D.coords$x[s+1], gr3D.coords$y[s+1],col= 'blue', lwd= 2)

Representation of words

Using plot.LexCA function, the words with a contribution over 6 times the average word contribution on any of the two axes are plotted (meta 6) for axes 1-2 and 1-3:

plot(resCA, selDoc=NULL, selWord="meta 6", cex=0.8, axes=c(1,2), title="Representation of metakeys. Plan (1,2)")

plot(resCA, selDoc=NULL, selWord="meta 6", cex=0.8, axes=c(1,3), title="Representation of metakeys. Plan (1,3)")

It is possible to do a joint representation

plot(resCA, selDoc="ALL", selWord=c("españoles","persona", "Comunidad"), cex=0.8, axes=c(1,2), title="Conjoint representation of speeches and three words. Plan (1,2)")

It is possible to do a joint representation of some documents and words confidence ellipses:

ellipseLexCA(resCA, selDoc="ALL", selWord=c("español", "española" ,"españoles","españolas", "persona", "Comunidad"), cex=0.8, axes=c(1,2), title="Conjoint representation of speeches and some words. Plan (1,2)")

 

To show CA results for the words whose contribution is over 3 times the average word contribution:

summary(resCA, metaWords=TRUE)