2

Is there an easy way to run followup mathematical calculations on elements of a summary? I have log transformed data that is run through an anova analysis. I would like to calculate the antilog of the summary output.

I have the following code:

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

Which produces an output as follows:

                      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.

How can I easily execute an antilog calculation on the Estimate values?

4

2 に答える 2

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(tukey) を使用して推定値を取得する場合は、次のように逆変換します。

exp(coef(tukey))
于 2013-02-28T05:19:19.277 に答える
0

私はこれがうまくいくと思います:

      coef(tukey)

推定値を取得します。ここに例があります:

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

ここで、入力したすべての 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
于 2013-02-28T05:25:14.163 に答える