在 R 中绘制正态、左右偏斜分布 [英] Plot normal, left and right skewed distribution in R

查看:68
本文介绍了在 R 中绘制正态、左右偏斜分布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了说明目的,我想创建 3 个图:- 正态分布- 右偏分布- 左偏分布

I want to create 3 plots for illustration purposes: - normal distribution - right skewed distribution - left skewed distribution

这应该是一个简单的任务,但我发现只有 这个链接,它只显示正态分布.剩下的我怎么办?

This should be an easy task, but I found only this link, which only shows a normal distribution. How do I do the rest?

推荐答案

最后我得到了它的工作,但是在你们的帮助下,但我依赖于 本网站.

Finally I got it working, but with both of your help, but I was relying on this site.

 N <- 10000
 x <- rnbinom(N, 10, .5)
 hist(x, 
 xlim=c(min(x),max(x)), probability=T, nclass=max(x)-min(x)+1, 
   col='lightblue', xlab=' ', ylab=' ', axes=F,
   main='Positive Skewed')
lines(density(x,bw=1), col='red', lwd=3)

这也是一个有效的解决方案:

This is also a valid solution:

curve(dbeta(x,8,4),xlim=c(0,1))
title(main="posterior distrobution of p")

这篇关于在 R 中绘制正态、左右偏斜分布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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