R တွင် dnorm၊ pnorm၊ qnorm နှင့် rnorm လမ်းညွှန်
ပုံမှန်ဖြန့်ဖြူးမှုသည် စာရင်းဇယားများတွင် အသုံးအများဆုံး ဖြန့်ဖြူးမှုဖြစ်သည်။ ဤသင်ခန်းစာသည် dnorm ၊ pnorm ၊ rnorm နှင့် qnorm လုပ်ဆောင်ချက်များကို အသုံးပြု၍ R တွင် ပုံမှန်ဖြန့်ဝေမှုကို မည်သို့အသုံးပြုရကြောင်း ရှင်းပြထားသည်။
dnormous
dnorm လုပ်ဆောင်ချက်သည် အချို့သော ကျပန်းပြောင်းလဲနိုင်သော x ၊ လူဦးရေပျမ်းမျှ μ နှင့် လူဦးရေစံသွေဖည် σ တို့အား ပုံမှန်ဖြန့်ဖြူးမှု၏ ဖြစ်နိုင်ခြေသိပ်သည်းဆလုပ်ဆောင်မှု (pdf) တန်ဖိုးကို ပြန်ပေးသည်။ dnorm အသုံးပြုခြင်းအတွက် syntax မှာ အောက်ပါအတိုင်းဖြစ်သည်။
dnorm(x၊ ဆိုလိုရင်း၊ sd)
အောက်ပါကုဒ်သည် လုပ်ဆောင်ချက်တွင် dnorm ၏ နမူနာအချို့ကို သရုပ်ပြသည်-
#find the value of the standard normal distribution pdf at x=0 dnorm(x=0, mean=0, sd=1) #[1]0.3989423 #by default, R uses mean=0 and sd=1 dnorm(x=0) #[1]0.3989423 #find the value of the normal distribution pdf at x=10 with mean=20 and sd=5 dnorm(x=10, mean=20, sd=5) #[1]0.01079819
ပုံမှန်အားဖြင့်၊ ပုံမှန်ဖြန့်ဝေမှုကို အသုံးပြု၍ ဖြစ်နိုင်ခြေဆိုင်ရာ မေးခွန်းများကို ဖြေရှင်းရန် ကြိုးစားသောအခါတွင်၊ သင်သည် pnorm အစား dnorm ကို မကြာခဏ အသုံးပြုလိမ့်မည်။ သို့သော် dnorm ၏ အသုံးဝင်သော အသုံးချပလီကေးရှင်းတစ်ခုသည် R တွင် ပုံမှန်ဖြန့်ဝေကွက်တစ်ခုကို ဖန်တီးရန်ဖြစ်သည်။ အောက်ပါကုဒ်သည် ၎င်းကို မည်သို့လုပ်ဆောင်ရမည်ကို သရုပ်ဖော်ထားသည်။
#Create a sequence of 100 equally spaced numbers between -4 and 4 x <- seq(-4, 4, length=100) #create a vector of values that shows the height of the probability distribution #for each value in x y <- dnorm(x) #plot x and y as a scatterplot with connected lines (type = "l") and add #an x-axis with custom labels plot(x,y, type = "l", lwd = 2, axes = FALSE, xlab = "", ylab = "") axis(1, at = -3:3, labels = c("-3s", "-2s", "-1s", "mean", "1s", "2s", "3s"))
၎င်းသည် အောက်ပါကွက်ကွက်ကို ထုတ်ပေးသည်-
pnorm
pnorm လုပ်ဆောင်ချက်သည် အချို့သော ကျပန်းပြောင်းလဲနိုင်သော q ၊ လူဦးရေပျမ်းမျှ μ နှင့် လူဦးရေစံသွေဖည် σ တို့အား ပေးသော ပုံမှန်ဖြန့်ဖြူးမှု၏ စုစည်းသိပ်သည်းမှုလုပ်ဆောင်ချက် (cdf) ၏တန်ဖိုးကို ပြန်ပေးသည်။ pnorm အသုံးပြုခြင်းအတွက် syntax မှာ အောက်ပါအတိုင်းဖြစ်သည်။
pnorm(q၊ ဆိုလိုရင်း၊ sd)
ရိုးရိုးရှင်းရှင်းအားဖြင့် pnorm သည် ပုံမှန်ဖြန့်ဖြူးမှုတွင် ပေးထားသောတန်ဖိုး x ၏ဘယ်ဘက်သို့ ပြန်ပေးသည်။ ပေးထားသော q တန်ဖိုး၏ ညာဘက်ရှိ ဧရိယာကို သင်စိတ်ဝင်စားပါက၊ အကြောင်းပြချက် lower.tail = FALSE ကို ရိုးရိုးရှင်းရှင်းထည့်နိုင်သည်။
pnorm(q၊ ပျမ်းမျှ၊ sd၊ lower.tail = FALSE)
အောက်ပါဥပမာများသည် pnorm ကိုအသုံးပြု၍ ဖြစ်နိုင်ခြေမေးခွန်းအချို့ကို မည်သို့ဖြေရှင်းရမည်ကို ဖော်ပြသည်။
ဥပမာ 1- အချို့ကျောင်းရှိ အမျိုးသားများ၏ အရပ်အမြင့်ကို ပုံမှန်အားဖြင့် စံသွေဖည်မှု
#find percentage of males that are taller than 74 inches in a population with #mean = 70 and sd = 2 pnorm(74, mean=70, sd=2, lower.tail=FALSE) # [1]0.02275013
ဤကျောင်းတွင် ယောက်ျား 2,275% သည် အရပ် 74 လက်မကျော်ရှိသည်။
ဥပမာ 2- အချို့ဖျံမျိုးစိတ်များ၏ အလေးချိန်ကို ပုံမှန်အားဖြင့် စံသွေဖည်မှု ဖြင့် ဖြန့်ဝေသည်ဆိုပါစို့။
#find percentage of otters that weight less than 22 lbs in a population with #mean = 30 and sd = 5 pnorm(22, mean=30, sd=5) # [1]0.05479929
ဤဖျံမျိုးစိတ်များ၏ 5.4799% ခန့်သည် အလေးချိန် 22 ပေါင်အောက်သာရှိသည်။
ဥပမာ 3- အချို့သောဒေသရှိ အပင်များ၏ အမြင့်သည် ပုံမှန်အားဖြင့် စံသွေဖည်
#find percentage of plants that are less than 14 inches tall, then subtract the #percentage of plants that are less than 10 inches tall, based on a population #with mean = 13 and sd = 2 pnorm(14, mean=13, sd=2) - pnorm(10, mean=13, sd=2) # [1]0.6246553
ဤဒေသရှိ အပင်များ၏ 62.4655% ခန့်သည် အရပ် 10 မှ 14 လက်မကြားရှိသည်။
qnorm
qnorm လုပ်ဆောင်ချက်သည် အချို့သော ကျပန်းပြောင်းလဲနိုင်သော p ၊ လူဦးရေပျမ်းမျှ μ နှင့် လူဦးရေစံသွေဖည် σ တို့အား ပုံမှန်ဖြန့်ဖြူးမှု၏ ပြောင်းပြန် စုစည်းသိပ်သည်းမှုလုပ်ဆောင်ချက် (cdf) ၏တန်ဖိုးကို ပြန်ပေးသည်။ qnorm အသုံးပြုခြင်းအတွက် syntax မှာ အောက်ပါအတိုင်းဖြစ်သည်။
qnorm (p, mean, sd)
ရိုးရှင်းသောအသုံးအနှုန်းဖြင့်၊ ပုံမှန်ဖြန့်ဖြူးမှု၏ pth quantile ၏ Z ရမှတ်ကိုရှာဖွေရန် qnorm ကို သုံးနိုင်သည်။
အောက်ပါကုဒ်သည် လုပ်ဆောင်မှုတွင် qnorm ၏ နမူနာအချို့ကို ပြသသည်-
#find the Z-score of the 99th quantile of the standard normal distribution qnorm(.99, mean=0, sd=1) #[1]2.326348 #by default, R uses mean=0 and sd=1 qnorm(.99) #[1]2.326348 #find the Z-score of the 95th quantile of the standard normal distribution qnorm(.95) #[1]1.644854 #find the Z-score of the 10th quantile of the standard normal distribution qnorm(.10) #[1]-1.281552
rnorm
rnorm function သည် vector length n ၊ လူဦးရေပျမ်းမျှ μ နှင့် လူဦးရေစံသွေဖည် σ ကို ပေးသော ပုံမှန်ဖြန့်ဝေထားသော ကျပန်း variable များကိုထုတ်ပေးပါသည်။ rnorm အသုံးပြုခြင်းအတွက် syntax မှာ အောက်ပါအတိုင်းဖြစ်သည်။
rnorm(n၊ ဆိုလိုရင်း၊ sd)
အောက်ပါကုဒ်သည် လုပ်ဆောင်မှုတွင် rnorm ၏ နမူနာအချို့ကို သရုပ်ပြသည်-
#generate a vector of 5 normally distributed random variables with mean=10 and sd=2 five <- rnorm(5, mean = 10, sd = 2) five # [1] 10.658117 8.613495 10.561760 11.123492 10.802768 #generate a vector of 1000 normally distributed random variables with mean=50 and sd=5 narrowDistribution <- rnorm(1000, mean = 50, sd = 15) #generate a vector of 1000 normally distributed random variables with mean=50 and sd=25 wideDistribution <- rnorm(1000, mean = 50, sd = 25) #generate two histograms to view these two distributions side by side, specify #50 bars in histogram and x-axis limits of -50 to 150 par(mfrow=c(1, 2)) #one row, two columns hist(narrowDistribution, breaks=50, xlim=c(-50, 150)) hist(wideDistribution, breaks=50, xlim=c(-50, 150))
၎င်းက အောက်ပါ ဟီစတိုဂရမ်များကို ထုတ်ပေးသည်-
ကျယ်ပြန့်သော ဖြန့်ဖြူးမှုသည် ကျဉ်းမြောင်းသော ဖြန့်ဖြူးမှုထက် ပိုမိုကျယ်ပြန့်သည်ကို သတိပြုပါ။ အမှန်မှာ၊ ကျယ်ပြန့်သောဖြန့်ဖြူးမှုတွင် စံသွေဖည်မှု 25 ဖြစ်သည်၊ ကျဉ်းမြောင်းသောဖြန့်ဖြူးမှုတွင် 15 သာရှိသည်နှင့်နှိုင်းယှဉ်ပါက ကျွန်ုပ်တို့သတ်မှတ်ထားသည်။ ဟစ်စတိုဂရမ်နှစ်ခုလုံးသည် ပျမ်းမျှ 50 ပတ်လည်တွင် ဗဟိုပြုထားကြောင်းကိုလည်း သတိပြုပါ။