본문 바로가기
LANG/R

R / agricolae / cv 찾기

by 하하IT 2020. 4. 16.

#install.packages("agricolae")

 

library(agricolae)

tr=rep(c("A","S","U"), each=3)

rp=rep(c(1:3),3)

d=c(3.3,2.9,3.1,

    3.1,2.7,3.3,

    25.0,20.1,23.0) 

eff=data.frame(tr,rp,d)

eff$tr=as.factor(eff$tr)

eff$rp=as.factor(eff$rp)

fix(eff)

eff.aov=aov(d~tr+rp, data=eff)

summary(eff.aov)

dmrt=duncan.test(eff.aov, "tr")

#print(dmrt)

print(dmrt[["statistics"]]["CV"])

 

------------------------------------------------------------

 

 

 

 

 

 

 

 

> #install.packages("agricolae")

> library(agricolae)

Warning message:

패키지 ‘agricolae’는 R 버전 3.6.2에서 작성되었습니다 

> tr=rep(c("A","S","U"), each=3)

> rp=rep(c(1:3),3)

> d=c(3.3,2.9,3.1,

+     3.1,2.7,3.3,

+     25.0,20.1,23.0) 

> eff=data.frame(tr,rp,d)

> eff$tr=as.factor(eff$tr)

> eff$rp=as.factor(eff$rp)

> fix(eff)

> eff.aov=aov(d~tr+rp, data=eff)

> summary(eff.aov)

            Df Sum Sq Mean Sq F value   Pr(>F)    

tr           2  770.9   385.5 225.715 7.71e-05 ***

rp           2    5.6     2.8   1.632    0.303    

Residuals    4    6.8     1.7                     

---

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

> dmrt=duncan.test(eff.aov, "tr")

> #print(dmrt)

> print(dmrt)

$statistics

   MSerror Df     Mean       CV

  1.707778  4 9.611111 13.59697

 

$parameters

    test name.t ntr alpha

  Duncan     tr   3  0.05

 

$duncan

     Table CriticalRange

2 3.926503      2.962518

3 4.012542      3.027434

 

$means

          d      std r  Min  Max   Q25  Q50  Q75

A  3.100000 0.200000 3  2.9  3.3  3.00  3.1  3.2

S  3.033333 0.305505 3  2.7  3.3  2.90  3.1  3.2

U 22.700000 2.463737 3 20.1 25.0 21.55 23.0 24.0

 

$comparison

NULL

 

$groups

          d groups

U 22.700000      a

A  3.100000      b

S  3.033333      b

 

attr(,"class")

[1] "group"

'LANG > R' 카테고리의 다른 글

R / rstudio / 개발환경설정  (0) 2020.04.16
R / example  (0) 2020.04.16