Attachment 'principalComponent.R'
Download 1 library(languageR)
2
3 ## ---------------------------------------------------
4 # Lexical decision time data
5 #
6 # Q: How can we construct a good/ the best frequency
7 # estimate from a variety of sources?
8 ## ---------------------------------------------------
9 data(lexdec)
10
11 str(lexdec)
12 l <- aggregate(lexdec[,c('Frequency','BNCw','BNCc','BNCd')], by= list(Word = lexdec$Word), FUN= mean)
13 row.names(l) <- l$Word
14 l$Word <- NULL
15
16 p <- princomp(l, center=T)
17
18 # summary of principal components
19 summary(p)
20 plot(p, main="Screeplot of frequency components", xlab="Components", cex.lab=1.2)
21
22 # interpretation of principal components
23 biplot(p, col=c('darkgray','black'))
24 biplot(p, scale=0)
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.