R绘制因子的组合水平(ggpredict)

时间:2019-12-07 15:59:51

标签: r ggplot2 plot lme4 multilevel-analysis

我正在使用ggpredict函数显示lmer模型的结果。

模型具有一个连续X(RT),一个连续Y(RC1)和4个离散因子(2x2x2x14)。     型号:

/home/marcus/Documents/projects/nowwhatdoiread/nwdir-server/app/Server.hs:19:23: error:
    • No instance for (MonadIO ScottyM)
        arising from a use of ‘withPersist’
    • In the second argument of ‘scotty’, namely ‘(withPersist router)’
      In the expression: scotty 4200 (withPersist router)
      In an equation for ‘server’:
          server = scotty 4200 (withPersist router)
   |
19 | server = scotty 4200 (withPersist router)
   |                       ^^^^^^^^^^^^^^^^^^

/home/marcus/Documents/projects/nowwhatdoiread/nwdir-server/app/Server.hs:23:3: error:
    • No instance for (MonadTrans (SeldaT SQLite))
        arising from a use of ‘lift’
    • In a stmt of a 'do' block: lift $ get "/book/:id" searchBook
      In the expression: do lift $ get "/book/:id" searchBook
      In an equation for ‘router’:
          router = do lift $ get "/book/:id" searchBook
   |
23 |   lift $ get "/book/:id" searchBook
   |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

/home/marcus/Documents/projects/nowwhatdoiread/nwdir-server/app/Server.hs:27:12: error:
    • No instance for (MonadSelda
                         (Web.Scotty.Internal.Types.ActionT
                            Data.Text.Internal.Lazy.Text IO))
        arising from a use of ‘query’
    • In a stmt of a 'do' block: books <- query selectBookQuery
      In the expression:
        do books <- query selectBookQuery
           json books
      In an equation for ‘searchBook’:
          searchBook
            = do books <- query selectBookQuery
                 json books
            where
                selectBookQuery
                  = do book <- select goodreadsBooks
                       ....
   |
27 |   books <- query selectBookQuery
   |            ^^^^^^^^^^^^^^^^^^^^^

由于太大而没有14级因子的情节示例

问题1: 为了简化图表,我希望组m3和m4的组合得到结果。我试过了:

SailorJupiter <- lmer(RT~RC1*m2*m3*m5*m4 + (1|Trial:sonTrial) + (1|Subject) + (1|Trial) + (1|sonleft) + (1|sonright), data=audiostim, REML=FALSE)

library(see)
library(ggeffects)

a <- ggpredict(SailorJupiter, c("RC1","m2","m3","m4","m5"), dependencies=TRUE)
plot(a)

但这不起作用。

问题2:是否有一种方法可以只使用一个因子水平来简化绘图?我知道其他一些绘图程序包也允许它,但是在 a <- ggpredict(SailorJupiter, c("RC1","m2","m3:m4","m5"), dependencies=TRUE) plot(a) 中找不到它。

0 个答案:

没有答案