R တွင် dt၊ qt၊ pt၊ & rt လမ်းညွှန်
ကျောင်းသား၏ t ဖြန့်ဝေမှုသည် စာရင်းဇယားများတွင် အသုံးအများဆုံး ဖြန့်ဝေမှုတစ်ခုဖြစ်သည်။ ဤသင်ခန်းစာတွင် dt() ၊ qt() ၊ pt() နှင့် rt() လုပ်ဆောင်ချက်များကို အသုံးပြု၍ R တွင် ကျောင်းသား t ဖြန့်ဝေမှုနှင့် မည်သို့လုပ်ဆောင်ရမည်ကို ရှင်းပြထားသည်။
dt
လုပ်ဆောင်ချက် dt သည် အချို့သော ကျပန်းပြောင်းလဲနိုင်သော x နှင့် လွတ်လပ်မှု df ဒီဂရီတို့အား ကျောင်းသား၏ t ဖြန့်ဖြူးမှု၏ ဖြစ်နိုင်ခြေသိပ်သည်းမှုလုပ်ဆောင်ချက် (pdf) တန်ဖိုးကို ပြန်ပေးသည်။ dt ကိုအသုံးပြုရန်အတွက် syntax မှာ အောက်ပါအတိုင်းဖြစ်သည်။
dt(x၊ df)
အောက်ပါကုဒ်သည် လုပ်ဆောင်ချက်တွင် dt ၏ နမူနာအချို့ကို သရုပ်ပြသည်-
#find the value of the Student t distribution pdf at x = 0 with 20 degrees of freedom dt(x = 0, df = 20) #[1] 0.3939886 #by default, R assumes the first argument is x and the second argument is df dt(0, 20) #[1] 0.3939886 #find the value of the Student t distribution pdf at x = 1 with 30 degrees of freedom dt(1, 30) #[1] 0.2379933
ပုံမှန်အားဖြင့်၊ Student’s t distribution ကို အသုံးပြု၍ ဖြစ်နိုင်ခြေဆိုင်ရာ မေးခွန်းများကို ဖြေရှင်းရန် ကြိုးစားသောအခါ၊ သင်သည် dt အစား pt ကို မကြာခဏ အသုံးပြုလိမ့်မည်။ သို့သော် dt ၏ အသုံးဝင်သော အသုံးချပလီကေးရှင်းသည် R တွင် ကျောင်းသား t ဖြန့်ချီရေးကွက်တစ်ခုကို ဖန်တီးရန်ဖြစ်သည်။ အောက်ပါကုဒ်သည် ၎င်းကို မည်သို့လုပ်ဆောင်ရမည်ကို သရုပ်ဖော်ထားသည်။
#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, using 20 degrees of freedom y <- dt(x = x, df = 20) #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"))
၎င်းသည် အောက်ပါကွက်ကွက်ကို ထုတ်ပေးသည်-
pt
pt လုပ်ဆောင်ချက်သည် အချို့သော ကျပန်းပြောင်းလဲနိုင်သော x နှင့် လွတ်လပ်မှု ဒီဂရီ df ကိုပေးသော ကျောင်းသား၏ t ဖြန့်ဖြူးမှု၏ တန်ဖိုးကို ပြန်ပေးသည်။ pnorm အသုံးပြုခြင်းအတွက် syntax မှာ အောက်ပါအတိုင်းဖြစ်သည်။
pt(x၊ df)
ရိုးရိုးရှင်းရှင်းပြောရရင် pt သည် ကျောင်းသား၏ t ဖြန့်ဖြူးမှုတွင် ပေးထားသော x တန်ဖိုးတစ်ခု၏ ဘယ်ဘက်သို့ ပြန်ပေးသည်။ ပေးထားသော x တန်ဖိုးတစ်ခု၏ ညာဘက်ရှိ ဧရိယာကို သင်စိတ်ဝင်စားပါက၊ အကြောင်းပြချက် lower.tail = FALSE ကို ရိုးရိုးရှင်းရှင်းထည့်နိုင်သည်။
pt(x၊ df၊ lower.tail = FALSE)
အောက်ပါဥပမာများသည် pt ကို အသုံးပြု၍ ဖြစ်နိုင်ခြေမေးခွန်းအချို့ကို ဖြေရှင်းနည်းကို သရုပ်ဖော်သည်။
ဥပမာ 1- -0.785 နှင့် လွတ်လပ်မှု 14 ဒီဂရီတန်ဖိုးရှိသော t-statistic ၏ ဘယ်ဘက် ရှိ ဧရိယာကိုရှာပါ။
pt(-0.785, 14)
#[1] 0.2227675
ဥပမာ 2- -0.785 နှင့် လွတ်လပ်မှု 14 ဒီဂရီတန်ဖိုးရှိသော t-statistic တစ်ခု၏ ညာဘက် ရှိ ဧရိယာကိုရှာပါ။
#the following approaches produce equivalent results
#1 - area to the left
1 - pt(-0.785, 14)
#[1] 0.7772325
#area to the right
pt(-0.785, 14, lower.tail = FALSE)
#[1] 0.7772325
ဥပမာ 3- ကျောင်းသား၏ t ဖြန့်ဖြူးမှုတွင် စုစုပေါင်းဧရိယာကို -0.785 သို့မဟုတ် 0.785 ၏ ဘယ်ဘက်တွင်ရှိသော လွတ်လပ်မှု 14 ဒီဂရီဖြင့် ရှာဖွေပါ။
pt (-0.785, 14) + pt (0.785, 14, lower.tail = FALSE) #[1] 0.4455351
qt
လုပ်ဆောင်ချက် qt သည် အချို့သော ကျပန်းပြောင်းလဲနိုင်သော x နှင့် လွတ်လပ်မှု df ဒီဂရီတို့အား ကျောင်းသား၏ t ဖြန့်ဖြူးမှု၏ ပြောင်းပြန် စုစည်းသိပ်သည်းမှု လုပ်ဆောင်ချက် (cdf) ၏တန်ဖိုးကို ပြန်ပေးသည်။ qt အသုံးပြုခြင်းအတွက် syntax မှာ အောက်ပါအတိုင်းဖြစ်သည်။
qt(x၊ df)
ရိုးရိုးရှင်းရှင်းပြောရရင်၊ ကျောင်းသားရဲ့ t-ဖြန့်ဝေမှုရဲ့ pth quantile ရဲ့ t-score က ဘာလဲဆိုတာ ရှာဖို့ qt ကို သုံးနိုင်ပါတယ်။
အောက်ပါကုဒ်သည် လုပ်ဆောင်မှုတွင် qt ၏ နမူနာအချို့ကို သရုပ်ပြသည်-
#find the t-score of the 99th quantile of the Student t distribution with df = 20 qt(.99, df = 20) #[1][1]2.527977 #find the t-score of the 95th quantile of the Student t distribution with df = 20 qt(.95, df = 20) #[1]1.724718 #find the t-score of the 90th quantile of the Student t distribution with df = 20 qt(.9, df = 20) #[1]1.325341
qt မှတွေ့ရှိသော အရေးပါသောတန်ဖိုးများသည် t ဖြန့်ဖြူးရေးဇယားတွင်တွေ့ရသော အရေးပါသောတန်ဖိုးများနှင့် ဆက်စပ်နေမည်ဖြစ်သလို inverse t distribution calculator ဖြင့်တွေ့နိုင်သော အရေးကြီးသောတန်ဖိုးများကို သတိပြုပါ။
rt
လုပ်ဆောင်ချက် rt သည် vector length n နှင့် လွတ်လပ်မှု df ဒီဂရီများပေးထားသည့် Student’s t ဖြန့်ကျက်မှုနောက်တွင် ကျပန်းပြောင်းလဲနိုင်သော vector တစ်ခုကို ထုတ်ပေးသည်။ rt ကိုအသုံးပြုရန်အတွက် syntax မှာ အောက်ပါအတိုင်းဖြစ်သည်။
rt(n၊ df)
အောက်ပါကုဒ်သည် လုပ်ဆောင်မှုတွင် rt ၏ နမူနာအချို့ကို သရုပ်ပြသည်-
#generate a vector of 5 random variables that follows a Student t distribution #with df = 20 rt(n = 5, df = 20) #[1] -1.7422445 0.9560782 0.6635823 1.2122289 -0.7052825 #generate a vector of 1000 random variables that follows a Student t distribution #with df = 40 narrowDistribution <- rt(1000, 40) #generate a vector of 1000 random variables that follows a Student t distribution #with df = 5 wideDistribution <- rt(1000, 5) #generate two histograms to view these two distributions side by side, and specify #50 bars in histogram, par(mfrow=c(1, 2)) #one row, two columns hist(narrowDistribution, breaks=50, xlim = c(-6, 4)) hist(wideDistribution, breaks=50, xlim = c(-6, 4))
၎င်းက အောက်ပါ ဟီစတိုဂရမ်များကို ထုတ်ပေးသည်-
ကျယ်ပြန့်သောဖြန့်ဖြူးမှုသည် ကျဉ်းမြောင်းသောဖြန့်ဖြူးမှုထက် မည်ကဲ့သို့ကျယ်ပြန့်သည်ကို သတိပြုပါ။ အမှန်မှာ၊ ကျယ်ပြန့်သောဖြန့်ဖြူးမှုတွင် လွတ်လပ်မှုဒီဂရီသည် ကျဉ်းမြောင်းသောဖြန့်ဖြူးမှုတွင် 40 နှင့် နှိုင်းယှဉ်လျှင် 5 ဖြစ်သည်။ လွတ်လပ်မှု ဒီဂရီ နည်းပါးလေ၊ ကျောင်းသား၏ ဖြန့်ဖြူးမှု ကျယ်ပြန့်လေ ဖြစ်သည်။
နောက်ထပ်ဖတ်ရန်:
R တွင် dnorm၊ pnorm၊ qnorm နှင့် rnorm လမ်းညွှန်
R တွင် dbinom၊ pbinom၊ qbinom နှင့် rbinom လမ်းညွှန်ချက်