线未在交互图中显示-y轴太短?

杜比亚

我正在尝试根据析因设计的数据创建交互作用图,但是线条未显示。我的数据框是

dr
   Nr. Bruch Keimf Einw Temp Zeit
1   h1  2.63    54    0   30    4
2   h2  1.71    51    4   30    4
3   h3  2.37    56    0   50    4
4   h4  4.00    51    4   50    4
5   h5  1.63    55    0   30   10
6   h6  1.47    55    4   30   10
7   h7  3.11    43    0   50   10
8   h8  2.42    60    4   50   10
9   c1  2.07    51    2   40    7
10  c2  2.37    46    2   40    7
11  c3  2.48    39    2   40    7

我的情节代码是

dr$temp=factor(dr$Temp)
interaction.plot(dr$Zeit,dr$Temp,dr$Keimf, 
                 main="Interactionplot Zeit*Temp",
                 xlab="Zeit (h)", ylab="Keimf (%)", col="olivedrab3", lwd=3, trace.label=deparse(substitute(Temperatur)))

我得到了预期的以下图形,但未显示线条

[][1]


  [1]: https://i.stack.imgur.com/u18KA.png

我检查了https://rdrr.io/r/stats/interaction.plot.html,认为问题可能是yaxis并未涵盖所有值,但是添加会ylim=c(30,65)导致错误消息并且无法正常工作。我在论坛中找到了一个interactplot的另一个示例但是整体代码过于嵌套和复杂,以至于无法通过,因为它是r的新手。您是否认为yaxis是问题,还是我监督了其他事情?

卡盘P:

根据您的评论,是的,这是缺乏数据。这是一个包含模拟数据的示例,该示例显示了您的代码以及您可能喜欢的自定义交互绘图功能都很好。

伪造一些数据。使用您的代码。


mock_dr <- data.frame(
   Temp = sample(x = c(30, 40, 50), size = 45, replace = TRUE),
   Zeit = sample(x = c(4, 7, 10), size = 45, replace = TRUE),
   Keimf = sample(x = 39:60, size = 45, replace = TRUE)
)

interaction.plot(mock_dr$Zeit, mock_dr$Temp, mock_dr$Keimf,
                 main="Interactionplot Zeit*Temp",
                 xlab="Zeit (h)", ylab="Keimf (%)", col="olivedrab3", lwd=3, trace.label=deparse(substitute(Temperatur)))

您希望自定义的功能将来会有用

CGPfunctions::Plot2WayANOVA(Keimf ~ Zeit * Temp, mock_dr)


#> Converting Zeit to a factor --- check your results
#> 
#> Converting Temp to a factor --- check your results
#> Warning in qt(confidence/2 + 0.5, n() - 1): NaNs produced
#> 
#>              --- WARNING! ---
#>      You have an unbalanced design. Using Type II sum of 
#>             squares, to calculate factor effect sizes eta and omega.
#>             Your two factors account for 0.204 of the type II sum of 
#>             squares.
#>                term    sumsq  meansq df statistic p.value etasq partial.etasq
#> Zeit           Zeit  203.060 101.530  2     2.818   0.073 0.125         0.135
#> Temp           Temp  102.773  51.386  2     1.426   0.253 0.063         0.073
#> Zeit:Temp Zeit:Temp   27.253   6.813  4     0.189   0.943 0.017         0.021
#> ...4      Residuals 1297.086  36.030 36        NA      NA    NA            NA
#>           omegasq partial.omegasq epsilonsq cohens.f power
#> Zeit        0.079           0.075     0.080    0.396 0.554
#> Temp        0.018           0.019     0.019    0.281 0.307
#> Zeit:Temp  -0.070          -0.078    -0.072    0.145 0.091
#> ...4           NA              NA        NA       NA    NA
#> 
#> Measures of overall model fit
#> # A tibble: 1 x 5
#>   logLik   AIC   BIC deviance  nobs
#>    <dbl> <dbl> <dbl>    <dbl> <int>
#> 1  -139.  299.  317.    1297.    45
#> 
#> Table of group means
#> # A tibble: 9 x 15
#> # Groups:   Zeit [3]
#>   Zeit  Temp  TheMean TheSD TheSEM CIMuliplier LowerBoundCI UpperBoundCI
#>   <fct> <fct>   <dbl> <dbl>  <dbl>       <dbl>        <dbl>        <dbl>
#> 1 4     30       53.2  3.27   1.46        2.78         49.1         57.3
#> 2 4     40       49   NA     NA         NaN            NA           NA  
#> 3 4     50       54.3  3.21   1.86        4.30         46.3         62.3
#> 4 7     30       48.7  5.05   2.06        2.57         43.4         54.0
#> 5 7     40       48    6.32   2.58        2.57         41.4         54.6
#> 6 7     50       52.6  4.83   2.16        2.78         46.6         58.6
#> 7 10    30       47.9  7.54   2.85        2.45         40.9         54.8
#> 8 10    40       44.7  7.59   2.87        2.45         37.7         51.7
#> 9 10    50       47.8  5.63   2.52        2.78         40.8         54.8
#> # … with 7 more variables: LowerBoundSEM <dbl>, UpperBoundSEM <dbl>,
#> #   LowerBoundSD <dbl>, UpperBoundSD <dbl>, N <int>, LowerBound <dbl>,
#> #   UpperBound <dbl>
#> 
#> Post hoc tests for all effects that were significant
#> [1] "No signfiicant effects"
#> 
#> Testing Homogeneity of Variance with Brown-Forsythe
#> Levene's Test for Homogeneity of Variance (center = median)
#>       Df F value Pr(>F)
#> group  8  0.5877 0.7812
#>       36
#> 
#> Testing Normality Assumption with Shapiro-Wilk
#> 
#>  Shapiro-Wilk normality test
#> 
#> data:  MyAOV_residuals
#> W = 0.95464, p-value = 0.07623
#> 
#> Interaction graph plotted...

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章