2013-02-28 76 views
2

是否有簡單的方法來對彙總元素進行後續數學計算?我有通過anova分析運行的日誌轉換數據。我想計算彙總輸出的反對數。對彙總元素進行計算

我有以下代碼:

require(multcomp) 
inc <- log(Inc) 
myanova <- aov(inc ~ educ)  
tukey <- glht(myanova, linfct = mcp(educ = "Tukey")) 
summary(tukey) 

如下產生一個輸出:

     Estimate Std. Error t value Pr(>|t|)  
12 - under12 == 0  0.32787 0.08493 3.861 0.00104 ** 
13to15 - under12 == 0 0.49187 0.08775 5.606 < 0.001 *** 
16 - under12 == 0  0.89775 0.09217 9.740 < 0.001 *** 
over16 - under12 == 0 0.99856 0.09316 10.719 < 0.001 *** 
13to15 - 12 == 0  0.16400 0.04674 3.509 0.00394 ** 
etc. 

如何可以容易地在估計值來執行反對數計算?

+0

看看'屬性(tukey)'' – 2013-02-28 04:57:05

回答

1

這是一個小問題,所以我建議進一步檢查,但如果你想要看到指數估計和標準錯誤,我認爲類似於下面的東西將工作(我使用不同的數據)。

> amod <- aov(breaks ~ tension, data = warpbreaks) 
> tukey = glht(amod, linfct = mcp(tension = "Tukey")) 

> tsum = summary(tukey) 
> tsum[[10]]$coefficients = exp(tsum[[10]]$coefficients) 
> tsum[[10]]$sigma = exp(tsum[[10]]$sigma) 
> tsum 

如果你想使用COEF(杜克),給你估計,你會扭轉變換搭配:

exp(coef(tukey)) 
0

我認爲這應該工作:

 coef(tukey) 

得到估計值。這裏一個例子:

amod <- aov(breaks ~ tension, data = warpbreaks) 
    tukey <- glht(amod, linfct = mcp(tension = "Tukey")) 

現在,如果想讓你輸入你申請headtail獲得與摘要元素命名列表中的所有杜克摘要元素。

head(summary(tukey)) 
$model 
Call: 
    aov(formula = breaks ~ tension, data = warpbreaks) 

Terms: 
       tension Residuals 
Sum of Squares 2034.259 7198.556 
Deg. of Freedom  2  51 

Residual standard error: 11.88058 
Estimated effects may be unbalanced 

$linfct 
     (Intercept) tensionM tensionH 
M - L   0  1  0 
H - L   0  0  1 
H - M   0  -1  1 
attr(,"type") 
[1] "Tukey" 

$rhs 
[1] 0 0 0 

$coef 
(Intercept) tensionM tensionH 
    36.38889 -10.00000 -14.72222 

$vcov 
      (Intercept) tensionM tensionH 
(Intercept) 7.841564 -7.841564 -7.841564 
tensionM  -7.841564 15.683128 7.841564 
tensionH  -7.841564 7.841564 15.683128 

$df 
[1] 51