重新创建minitab正常概率图 [英] Recreate minitab normal probability plot

查看:568
本文介绍了重新创建minitab正常概率图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



.imgur.com / Ain27.jpgalt =alt text>



The probplot 可以让你获得大部分途径。不幸的是,我无法弄清楚如何在此图上添加置信区间带。



同样,ggplot的 stat_qq()似乎呈现了一个变换后的x轴的类似信息。看来 geom_smooth()可能会成为添加乐队的候选人,但我还没有弄清楚。



最后,获得遗传学完成家伙描述了类似的一些类似的东西。 htmlrel =nofollow noreferrer>>



示例数据重新创建上面的图表:

  x <-c(40.2,43.1,45.5,44.5,39.5,38.5,40.2,41.0,41.6,43.1,44.9,42.8)


$ b

如果任何人有基本图形或ggplot的解决方案,我会很感激它!



编辑



在查看 probplot 的详细信息后,我已经确定这是它如何在图上生成拟合线:

 > x1 < - 分位数(x,c(0.25,0.75))
> (c(0.25,0.75))
>斜率< - diff(yl)/ diff(xl)
> int< - yl [1] - 斜率* x1 [1]
>斜坡
75%
0.4151
> int
75%
-17.36

的确,将这些结果与您出来probplot对象似乎比较好:

 >检查<  -  probplot(x)
> str(check)
3
$的列表qdist:function(p)
$ int:命名的数字-17.4
..- attr(*,names)= chr 75%
$ slope:命名数字0.415
..- attr(*,names)= chr75%
- attr(*,class)= chr probplot
>

但是,将这些信息合并到ggplot2或基本图形中并不会产生相同的结果。

  probplot(x)



对比: p>

  ggplot(data = df,aes(x = x,y = y))+ geom_point()+ geom_abline(intercept = int,斜坡=斜率)



<$ p $ ($)
$($ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ p>

最后,我了解到图例的最后两行是指Anderson-Darling测试的正常性,可以用 nortest 包。

 > ad.test(x)

Anderson-Darling常态测试

数据:x
A = 0.2303,p值= 0.7502


解决方案

也许这是您可以建立的基础。默认情况下,stat_smooth()使用level = 0.95。

  df < -  data.frame(sort(x),ppoints( x))
colnames(df)< -c(x,y)

ggplot(df,aes(x,y))+
geom_point )+
stat_smooth()+
scale_y_continuous(limits = c(0,1),breaks = seq(from = 0.05,to = 1,by = 0.05),formatter =percent)


I am trying to recreate the following plot with R. Minitab describes this as a normal probability plot.

The probplot gets you most of the way there. Unfortunately, I cannot figure out how to add the confidence interval bands around this plot.

Similarly, ggplot's stat_qq() seems to present similar information with a transformed x axis. It seems that geom_smooth() would be the likely candidate to add the bands, but I haven't figure that out.

Finally, the Getting Genetics Done guys describe something similar here.

Sample data to recreate the plot above:

x <- c(40.2, 43.1, 45.5, 44.5, 39.5, 38.5, 40.2, 41.0, 41.6, 43.1, 44.9, 42.8)

If anyone has a solution with base graphics or ggplot, I'd appreciate it!

EDIT

After looking at the details of probplot, I've determined this is how it generates the fit line on the graph:

> xl <- quantile(x, c(0.25, 0.75))
> yl <- qnorm(c(0.25, 0.75))
> slope <- diff(yl)/diff(xl)
> int <- yl[1] - slope * xl[1]
> slope
   75% 
0.4151 
> int
   75% 
-17.36 

Indeed, comparing these results to what you get out of the probplot object seem to compare very well:

> check <- probplot(x)
> str(check)
List of 3
 $ qdist:function (p)  
 $ int  : Named num -17.4
  ..- attr(*, "names")= chr "75%"
 $ slope: Named num 0.415
  ..- attr(*, "names")= chr "75%"
 - attr(*, "class")= chr "probplot"
> 

However, incorporating this information into ggplot2 or base graphics does not yield the same results.

probplot(x)

Versus:

ggplot(data = df, aes(x = x, y = y)) + geom_point() + geom_abline(intercept = int, slope = slope)

I get similar results using R's base graphics

plot(df$x, df$y)
abline(int, slope, col = "red")

Lastly, I've learned that the last two rows of the legend refer to the Anderson-Darling test for normality and can be reproduced with the nortest package.

> ad.test(x)

    Anderson-Darling normality test

data:  x 
A = 0.2303, p-value = 0.7502

解决方案

Perhaps this will be something you can build on. By default, stat_smooth() uses level=0.95.

df <- data.frame(sort(x), ppoints(x))
colnames(df) <- c("x","y")

ggplot(df, aes(x,y)) + 
geom_point() + 
stat_smooth() + 
scale_y_continuous(limits=c(0,1),breaks=seq(from=0.05,to=1,by=0.05), formatter="percent")

这篇关于重新创建minitab正常概率图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆