日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關咨詢
選擇下列產品馬上在線溝通
服務時間:8:30-17:00
你可能遇到了下面的問題
關閉右側工具欄

新聞中心

這里有您想知道的互聯網營銷解決方案
創(chuàng)新互聯R語言教程:R語言標準分布

在來自獨立源的數據的隨機集合中,通常觀察到數據的分布是正常的。 這意味著,在繪制水平軸上的變量值和垂直軸上的值的計數的圖形時,我們得到鐘形曲線。 曲線的中心表示數據集的平均值。 在圖中,50%的值位于平均值的左側,另外50%位于圖表的右側。 這在統計學中被稱為正態(tài)分布。

r語言有四個內置函數來產生正態(tài)分布。 它們描述如下。

dnorm(x, mean, sd)
pnorm(x, mean, sd)
qnorm(p, mean, sd)
rnorm(n, mean, sd)

以下是在上述功能中使用的參數的描述 - 

  • x是數字的向量。
  • p是概率的向量。
  • n是觀察的數量(樣本大?。?。
  • mean是樣本數據的平均值。 它的默認值為零。
  • sd是標準偏差。 它的默認值為1。

dnorm()

該函數給出給定平均值和標準偏差在每個點的概率分布的高度。

# Create a sequence of numbers between -10 and 10 incrementing by 0.1.
x <- seq(-10, 10, by = .1)

# Choose the mean as 2.5 and standard deviation as 0.5.
y <- dnorm(x, mean = 2.5, sd = 0.5)

# Give the chart file a name.
png(file = "dnorm.png")

plot(x,y)

# Save the file.
dev.off()

當我們執(zhí)行上面的代碼,它產生以下結果 -

pnorm()

該函數給出正態(tài)分布隨機數的概率小于給定數的值。 它也被稱為“累積分布函數”。

# Create a sequence of numbers between -10 and 10 incrementing by 0.2.
x <- seq(-10,10,by = .2)
 
# Choose the mean as 2.5 and standard deviation as 2. 
y <- pnorm(x, mean = 2.5, sd = 2)

# Give the chart file a name.
png(file = "pnorm.png")

# Plot the graph.
plot(x,y)

# Save the file.
dev.off()

當我們執(zhí)行上面的代碼,它產生以下結果 -

qnorm()

該函數采用概率值,并給出累積值與概率值匹配的數字。

# Create a sequence of probability values incrementing by 0.02.
x <- seq(0, 1, by = 0.02)

# Choose the mean as 2 and standard deviation as 3.
y <- qnorm(x, mean = 2, sd = 3)

# Give the chart file a name.
png(file = "qnorm.png")

# Plot the graph.
plot(x,y)

# Save the file.
dev.off()

當我們執(zhí)行上面的代碼,它產生以下結果 -

RNORM()

此函數用于生成分布正常的隨機數。 它將樣本大小作為輸入,并生成許多隨機數。 我們繪制一個直方圖來顯示生成的數字的分布。

# Create a sample of 50 numbers which are normally distributed.
y <- rnorm(50)

# Give the chart file a name.
png(file = "rnorm.png")

# Plot the histogram for this sample.
hist(y, main = "Normal DIstribution")

# Save the file.
dev.off()

當我們執(zhí)行上面的代碼,它產生以下結果 -


網頁名稱:創(chuàng)新互聯R語言教程:R語言標準分布
標題網址:http://www.5511xx.com/article/dhigcpp.html