_覓 | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁 |
FrontPage › 覿磯
|
|
[edit]
1 螳 #
[edit]
2 覓伎 企慨蠍 #use tempdb; --drop table 煙 create table 煙 ( 糾 int , 蟆一 int , int ); insert 煙 values (85, 3, 65); insert 煙 values (74, 7, 50); insert 煙 values (76, 5, 55); insert 煙 values (90, 1, 65); insert 煙 values (85, 3, 55); insert 煙 values (87, 3, 70); insert 煙 values (94, 1, 65); insert 煙 values (98, 2, 70); insert 煙 values (81, 4, 55); insert 煙 values (91, 2, 70); insert 煙 values (76, 3, 50); insert 煙 values (74, 4, 55); > library("RODBC") > conn <- odbcConnect("26") > data <- sqlQuery(conn, "SELECT 糾, , 蟆一 FROM tempdb.dbo.煙") > a <- aov(糾 ~ + 蟆一, data) > a Call: aov(formula = 糾 ~ + 蟆一, data = data) Terms: 蟆一 Residuals Sum of Squares 541.6927 61.9657 124.5916 Deg. of Freedom 1 1 9 Residual standard error: 3.720687 Estimated effects may be unbalanced > summary(a) Df Sum Sq Mean Sq F value Pr(>F) 1 541.69 541.69 39.1297 0.0001487 *** 蟆一 1 61.97 61.97 4.4762 0.0634803 . Residuals 9 124.59 13.84 --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 > 蟆郁骸伎
[edit]
3 殊 覿磯 #c1 <- c(3.6, 4.1, 4.0) c2 <- c(3.1, 3.2, 3.9) c3 <- c(3.2, 3.5, 3.5) c4 <- c(3.5, 3.8, 3.9) data <- data.frame(c1,c2,c3,c4) #一危磯ゼ 襷れ伎 . stack() data <- stack(data) summary(aov(values ~ ind, data)) 蟆郁骸 れ螻 螳.
Df Sum Sq Mean Sq F value Pr(>F) ind 3 0.56250 0.18750 2.25 0.1598 Residuals 8 0.66667 0.08333 蟆郁骸 伎
[edit]
4 覦覲旧 れ 覿 覿 #ろ <- c(rep("1",4), rep("2",4), rep("3",4)) <- c(rep(c("A","B","C","D"),3)) 蟯豸′ <- c(3.6,3.1,3.2,3.5,4.1,3.2,3.5,3.8,4.0,3.9,3.5,3.8) data <- data.frame(蟯豸′, ろ, ) data summary(aov(蟯豸′ ~ + ろ), data) 蟆郁骸 れ螻 螳.
> data 蟯豸′ ろ 1 3.6 1 A 2 3.1 1 B 3 3.2 1 C 4 3.5 1 D 5 4.1 2 A 6 3.2 2 B 7 3.5 2 C 8 3.8 2 D 9 4.0 3 A 10 3.9 3 B 11 3.5 3 C 12 3.8 3 D > summary(aov(蟯豸′ ~ + ろ), data) Df Sum Sq Mean Sq F value Pr(>F) (Intercept) 1 155.520 155.520 4241.4545 8.813e-10 *** 3 0.540 0.180 4.9091 0.04692 * ろ 2 0.420 0.210 5.7273 0.04062 * Residuals 6 0.220 0.037 --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 Warning messages: 1: In model.matrix.default(mt, mf, contrasts) : variable '' converted to a factor 2: In model.matrix.default(mt, mf, contrasts) : variable 'ろ' converted to a factor 3: In Ops.factor(left) : ! 語 伎 覓伎覩誤 4: In Ops.factor(left) : ! 語 伎 覓伎覩誤 > 蟆郁骸 伎
[edit]
5 覦覲旧 れ 覿磯 #"覦覲旧 "企 詞 れ螻 螳 詞企. 讀, 譴覲給 一危郁 詩. ("select distinct 蠍, 讌"螻 "select 蠍, 讌" るゴ.)
讌 <-c(rep("",4), rep("譴覿",4), rep("覿",4)) 蠍 <- rep(c("","","",""), 3) 蟯豸′ <- c(74,78,70,74,78,74,68,72,68,72,60,64) data <- data.frame(蟯豸′, 讌, 蠍) > data 蟯豸′ 讌 蠍 1 74 2 78 3 70 4 74 5 78 譴覿 6 74 譴覿 7 68 譴覿 8 72 譴覿 9 68 覿 10 72 覿 11 60 覿 12 64 覿 覦覲旧 れ 覿磯 れ 蟆曙, 螳 襾殊 蟲語 讌 危エ覲伎 . 蟲語 蟲語(interaction plot) 伎覃 . R 蟆曙 れ螻 螳 覃 .
par(mfrow=c(1,2)) interaction.plot(讌,蠍,蟯豸′) interaction.plot(蠍,讌,蟯豸′) 蟆郁骸 れ螻 螳. 襷 蟲語 覦る 蠏碁螳 蟲谿 覿覿 蠍企.
蟲語 蟆 讌襷 蠏碁 覯 蟲語 讌 危エ覲企襦 .
summary(aov(蟯豸′ ~ 蠍 + 讌 + 蠍:讌, data)) 蟆郁骸 螳.
Df Sum Sq Mean Sq F value Pr(>F) (Intercept) 1 60492 60492 7561.5 1.558e-10 *** 蠍 1 108 108 13.5 0.01040 * 讌 2 152 76 9.5 0.01382 * 蠍:讌 2 8 4 0.5 0.62974 Residuals 6 48 8 --- Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1 Warning messages: 1: In model.matrix.default(mt, mf, contrasts) : variable '蠍' converted to a factor 2: In model.matrix.default(mt, mf, contrasts) : variable '讌' converted to a factor 3: In Ops.factor(left) : ! 語 伎 覓伎覩誤 4: In Ops.factor(left) : ! 語 伎 覓伎覩誤 蟆郁骸伎
[edit]
6 觜覈 覦覯 #
> # 蠏碁9 蠍郁讌 襷覈 煙 豸′ 蟆郁骸 > x <- c(2.9, 3.0, 2.5, 2.6, 3.2) # > y <- c(3.8, 2.7, 4.0, 2.4) # 蠍磯讌 > z <- c(2.8, 3.4, 3.7, 2.2, 2.0) #覃危讀 > data <- data.frame(x,y,z) 危 data.frame(x, y, z) : 語 るジ 伎襯 覩誤 5, 4 > kruskal.test(data) Kruskal-Wallis rank sum test data: data Kruskal-Wallis chi-squared = 0.7714, df = 2, p-value = 0.68 > 蟆郁骸伎
s <- c(x,y,z) g <- rep(1:3, c(length(x),length(y),length(z))) data <- data.frame(s,g) kruskal.test(s,g) > s <- c(x,y,z) > g <- rep(1:3, c(length(x),length(y),length(z))) > data <- data.frame(s,g) > kruskal.test(s,g) Kruskal-Wallis rank sum test data: s and g Kruskal-Wallis chi-squared = 0.7714, df = 2, p-value = 0.68 > [edit]
7 襴譴.. #{ろ螻覯, 覦燕, 覩殊} 3.1
#3-1 x <- read.table(header=T, text=" factorLevel characteristicValue A1 8.44 A1 8.36 A1 8.28 A2 8.59 A2 8.91 A2 8.6 A3 9.34 A3 9.41 A3 9.69 A4 8.92 A4 8.92 A4 8.74") head(x) aov.out <- aov(characteristicValue~factorLevel, data=x) summary(aov.out) drop1(aov.out,~.,test="F") model.tables(aov.out, type="means", se=T) model.tables(aov.out, type="effects", se=T) TukeyHSD(aov.out) plot(TukeyHSD(aov.out)) library(gplots) plotmeans(characteristicValue~factorLevel, data=x) lm.out <- lm(characteristicValue~factorLevel, data=x) summary(lm.out) summary.aov(lm.out) #焔 蟆 bartlett.test(characteristicValue~factorLevel, data=x) fligner.test(characteristicValue~factorLevel, data=x) #library(HH) #hov(characteristicValue~factorLevel, data=x) #library(lawstat) #levene.test(characteristicValue~factorLevel, data=x)
鏤
|
螳讌襦 襯 觸願鍵 覲企 觜襦 覲願鍵 覲狩讌襷 訖襴襯 企Μ蠍 磯 螳 . |