Displaying 2 results from an estimated 2 matches for "cumprop".
Did you mean:
cumprod
2009 Oct 16
1
Frequencies, proportions & cumulative proportions
...est scores
> myValues <- c(70:95)
> Score <- ( sample( myValues, size=1000, replace=TRUE) )
> head(Score)
[1] 77 71 81 88 83 93
>
> # Get frequencies & proportions
> myTable <- data.frame( table(Score) )
> myTable$Prop <- prop.table( myTable$Freq )
> myTable$CumProp <- cumsum( myTable$Prop )
>
> # Print result
> myTable
Score Freq Prop CumProp
1 70 44 0.044 0.044
2 71 42 0.042 0.086
3 72 40 0.040 0.126
4 73 40 0.040 0.166
5 74 43 0.043 0.209
6 75 45 0.045 0.254
7 76 46 0.046 0.300
8...
2004 Feb 17
1
Comparison of % variance explained by each PC before AND after rotation
...I would like to compare the % variance explained by each PC
before and after rotation.
< code follows >
data(USArrests)
pca = prcomp(USArrests, scale = TRUE)
# proportion variance explained by each PC
prop = pca$sdev^2/sum(pca$sdev^2)
# cumulative proportion variance explained by each PC
cumProp = cumsum(prop)
# following print statements also can be obtained
# from print(summary(pca))
#print(prop)
#print(cumProp)
print(summary(pca))
# Rotate the PCA loadings through PCs 1 and 2 using VARIMAX rotation
rot = varimax(pca$rotation[,1:2], normalize = TRUE, eps = 1e-5)
< end code >...