_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
FrontPage › 譯殊焔覿

Contents

1 Data Sample
2 譯殊焔 覿
3
4
5 谿瑚襭


襾殊 螻螳螻 螻覯″襯 危危.

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);

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)

3 #

  • 譯殊焔
    • 1譯殊焔: z1 = 0.57x1 + 0.62x2 + 0.54x3, 蠍一 = 78%
    • 2譯殊焔: z2 = 0.62x1 + 0.11x2 - 0.78x3, 蠍一 = 17%
    • 3譯殊焔: z3 = 0.54x1 - 0.78x2 + 0.32x3, 蠍一 = 5%
  • 1譯殊焔: 覈 襦 譬襯 企 譯殊焔朱 伎 .
  • 2譯殊焔: x3() 螻螳 朱 蟆 螳 企り襦 譬 螳 伎 覩誤. 讀, 譬 磯 蟆一 襯 り 伎 .
  • 2譯殊焔蟾讌 蠍一 95%伎襷, 譬 1譯殊焔襷朱 豢覿 る.
  • 伎 覦 讌襷 朱朱 70~80%伎 蠍一蟾讌 豈.

select 
	
,	蟲
,	
,	
,	0.57 * (蟲-蟲危蠏) + 0.62 * (-危蠏) + 0.54 * (-蠏) 1譯殊焔
,	蟲 +  +  豐
from pc


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

  • 譯殊焔覿 Score 覿瑚 覦. 蠏碁 -1 螻燕伎が.
  • 豌覯讌 譯殊焔 襯 螻壱覃 (-0.822869 * (85-55) + -0.5682310 * (60-45)) * -1 .


螻襯 覦螳覃..
 <- 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())
蠍 蠍郁鍵..
企: : るジ讓曙 襦螻豺 企Ν 譯殊語. 襦螻豺
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2019-02-26 22:47:48Anonymous