qqnorm and qqline in ggplot2

后端 未结 8 1753
隐瞒了意图╮
隐瞒了意图╮ 2020-12-04 06:37

Say have a linear model LM that I want a qq plot of the residuals. Normally I would use the R base graphics:

qqnorm(residuals(LM), ylab=\"Residuals\")
qqline         


        
8条回答
  •  臣服心动
    2020-12-04 07:13

    ggplot2 v.3.0.0 now has an qqline stat. From the help page:

    df <- data.frame(y = rt(200, df = 5))
    p <- ggplot(df, aes(sample = y))
    p + stat_qq() + stat_qq_line()
    

    !ggplot2 v3.0.0 Example stats equivalent to qqnorm plus abline]1

提交回复
热议问题