OUTPUT FROM JACKNIFING

OUTPUT FROM JACKNIFING - OUTPUTFROMJACKNIFINGCODEINR.TXT

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
OUTPUT FROM “JACKNIFING CODE IN R.TXT” > # JACKNIFE VALIDATION OF COGNITION DATASET > > cognition < as.matrix(read.csv("cognition.csv",header=TRUE, colClasses="numeric")) > temp < na.omit(cognition) > colmeans < apply(temp, 2, mean) > colstdv < sqrt(apply(temp, 2, var)) > numobs < length(temp[,1]) > stemp < matrix(0, nrow=numobs, ncol=19) > for (i in 1:19) {stemp[,i] = (temp[,i] colmeans[i])/colstdv[i]} > > PCA.original < princomp(temp[,2:19], cor=TRUE, scores=TRUE) > original.scores< matrix(0, nrow=numobs, ncol = 2) > > for ( i in 1:numobs) + { + original.scores[i,1] < PCA.original$loadings[,1] %*% stemp[i,2:19] + original.scores[i,2] < PCA.original$loadings[,2] %*% stemp[i,2:19] + } > orig.var1 < sqrt(var(original.scores[,1])) > orig.var2 < sqrt(var(original.scores[,2])) > > jackknife.scores < matrix(0, nrow=numobs, ncol = 2) > > for (i in 1:numobs) + { + PCA.j < princomp(temp[ i,2:19], cor=TRUE, scores=TRUE) + jackknife.scores[i,1] <
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

OUTPUT FROM JACKNIFING - OUTPUTFROMJACKNIFINGCODEINR.TXT

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online