_覓 | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁 |
FrontPage › 譯殊焔覿
|
|
襾殊 螻螳螻 螻覯″襯 危危.
[edit]
1 Data Sample #use tempdb go if object_id('dbo.pc') is not null drop table dbo.pc; create table dbo.pc( varchar(20) , 蟲 int , int , int ); insert dbo.pc values('A', 1, 2, 3); insert dbo.pc values('B', 2, 1, 2); insert dbo.pc values('C', 3, 3, 1); insert dbo.pc values('D', 4, 5, 5); insert dbo.pc values('E', 5, 4, 4); [edit]
2 譯殊焔 覿 #library("RODBC") conn <- odbcConnect("26") data <- sqlQuery(conn, "SELECT 蟲, , FROM tempdb.dbo.pc") p <- prcomp(na.exclude(data), scale=FALSE) #一危一 螳 るゼ 蟆曙 scale=TRUE p Standard deviations: [1] 1.5299582 0.7125957 0.3891468 Rotation: PC1 PC2 PC3 蟲 0.5708394 0.6158420 0.5430295 0.6210178 0.1087985 -0.7762086 0.5371026 -0.7803214 0.3203424 summary(p) Importance of components: PC1 PC2 PC3 Standard deviation 1.53 0.713 0.3891 --> 譴ク谿 Proportion of Variance 0.78 0.169 0.0505 --> 蠍一 Cumulative Proportion 0.78 0.950 1.0000 --> 蠍一 predict(p) PC1 PC2 PC3 1 -1.762697 -1.3404825 -0.3098503 2 -2.349978 -0.0531175 0.6890453 3 -1.074205 1.5606429 -0.6406848 4 2.887080 -0.7272039 -0.3687029 5 2.299799 0.5601610 0.6301927 > biplot(p) plot(p) [edit]
3 伎 #
select , 蟲 , , , 0.57 * (蟲-蟲危蠏) + 0.62 * (-危蠏) + 0.54 * (-蠏) 1譯殊焔 , 蟲 + + 豐 from pc [edit]
4 譬 #<- c(85,30,40,75,55,55,70,30) <- c(60,40,30,60,45, 65,40,20) d <- data.frame(,) head(d) p <- princomp(d) #prcomp:螻覯″一伎, princomp:轟願 覿伎伎 summary(p) biplot(p) plot(p) > p Call: princomp(x = d) Standard deviations: Comp.1 Comp.2 22.746992 8.736382 2 variables and 8 observations. > summary(p) Importance of components: Comp.1 Comp.2 Standard deviation 22.7469916 8.7363823 Proportion of Variance 0.8714537 0.1285463 Cumulative Proportion 0.8714537 1.0000000 > p$loadings [1:2, 1:2] Comp.1 Comp.2 -0.8228691 0.5682310 -0.5682310 -0.8228691 > p$scores Comp.1 Comp.2 [1,] -33.209538 4.7038937 [2,] 23.412882 -10.0914296 [3,] 20.866501 3.8195713 [4,] -24.980847 -0.9784163 [5,] 0.000000 0.0000000 [6,] -11.364620 -16.4573817 [7,] -9.501881 12.6378104 [8,] 34.777502 6.3659521 > #豕譬 > p$scores[,1] * -1 [1] 33.209538 -23.412882 -20.866501 24.980847 0.000000 11.364620 [7] 9.501881 -34.777502
<- c(85,30,40,75,55,55,70,30) <- c(60,40,30,60,45, 65,40,20) d <- data.frame(,) cov.mat <- cov.wt(d, cor=TRUE)$cov e.vec <- eigen(cor.mat)$vectors comp1 <- e.vec[1,1]*( - mean()) + e.vec[2,1]*( - mean()) comp2 <- e.vec[1,2]*( - mean()) + e.vec[2,2]*( - mean())
鏤
|
蠍 企 襷る 讌る 殊螳 豺蟲螳 る 蟆 蟾蟆 蟆企. |