【问题标题】:a single regression for all of the points in a superposed xyplot (lattice)叠加 xyplot(格)中所有点的单一回归
【发布时间】:2016-12-05 18:31:42
【问题描述】:

我有这段代码,我想为图中的所有组绘制一条回归线(不是每组一个回归)。

我该怎么做? (我有3组沟)

这是我的代码:

VOL<-xyplot(B$Inflow.Vol..During.Adv...m.3.~B$c..cm.|factor(dat$Group),

scales=list(alternating=1, tck = c(1,0)),

groups = B$Furrow,

par.settings = list (superpose.line = list (lty = c(1, 2, 4) , lwd = lin2), superpose.symbol = list (pch = symbols)),

auto.key = list (text = c("Furrow 1", "Furrow 3", "Furrow 5"),rows = 3, corner = c(0.95, 0.6), lines = FALSE , points = TRUE, title = ""),

type = c("p","r"), cex = mycex2, grid=TRUE, xlab = "C", ylab = "Inflow Volume During Advance, m3")

谢谢。

【问题讨论】:

    标签: r regression lattice


    【解决方案1】:

    您没有提供数据。您应该提供数据。

    这是使用iris 数据集的示例。

    xyplot(Sepal.Length~Petal.Length|cut(Sepal.Width,3),iris, groups=Species, panel=function(x,y,...){ l=lm(y~x) panel.xyplot(x,y,...) panel.abline(l) })

    panel 函数中,计算每个面板的回归线,然后绘制数据和拟合线。

    【讨论】:

      猜你喜欢
      • 2012-12-20
      • 1970-01-01
      • 2012-11-02
      • 2012-10-09
      • 2016-01-29
      • 1970-01-01
      • 2013-07-30
      • 1970-01-01
      • 2014-08-03
      相关资源
      最近更新 更多