Multiple regression model ကိုအသုံးပြု၍ r တွင်တန်ဖိုးများကိုခန့်မှန်းနည်း


တပ်ဆင်ထားသော multiple linear regression model ကို အသုံးပြု၍ R တွင် တန်ဖိုးများကို ခန့်မှန်းရန် အောက်ပါအခြေခံ syntax ကို သင်အသုံးပြုနိုင်သည်-

 #define new observation
new <- data. frame (x1=c(5), x2=c(10), x3=c(12.5))

#use fitted model to predict the response value for the new observation
predict(model, newdata=new)

အောက်ဖော်ပြပါ ဥပမာသည် ဤလုပ်ဆောင်ချက်ကို လက်တွေ့အသုံးချနည်းကို ပြသထားသည်။

ဥပမာ- တပ်ဆင်ထားသော multiple linear regression model ကို အသုံးပြု၍ တန်ဖိုးများကို ခန့်မှန်းခြင်း။

R တွင် ဘတ်စကက်ဘောကစားသမားများအကြောင်း အချက်အလက်ပါရှိသော အောက်ပါဒေတာအတွဲကို ကျွန်ုပ်တို့တွင်ရှိသည်ဆိုပါစို့။

 #create data frame
df <- data. frame (rating=c(67, 75, 79, 85, 90, 96, 97),
                 points=c(8, 12, 16, 15, 22, 28, 24),
                 assists=c(4, 6, 6, 5, 3, 8, 7),
                 rebounds=c(1, 4, 3, 3, 2, 6, 7))

#view data frame
df

  rating points assists rebounds
1 67 8 4 1
2 75 12 6 4
3 79 16 6 3
4 85 15 5 3
5 90 22 3 2
6 96 28 8 6
7 97 24 7 7

ယခု ကျွန်ုပ်တို့သည် ကြိုတင်ခန့်မှန်းကိန်းရှင်များနှင့် တုံ့ပြန်မှုကိန်းရှင်အဖြစ် အဆင့်သတ်မှတ်ချက်များ အဖြစ် အမှတ်များကူညီမှုများ နှင့် ပြန်လည်တုံ့ပြန်မှု များကို အသုံးပြုကာ မျဉ်းကြောင်းပြန်ဆုတ်မှုပုံစံတစ်ခုအား ဖြည့်သွင်းသည်ဆိုပါစို့။

 #fit multiple linear regression model
model <- lm(rating ~ points + assists + rebounds, data=df)

#view model summary
summary(model)

Call:
lm(formula = rating ~ points + assists + rebounds, data = df)

Residuals:
      1 2 3 4 5 6 7 
-1.5902 -1.7181 0.2413 4.8597 -1.0201 -0.6082 -0.1644 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)   
(Intercept) 66.4355 6.6932 9.926 0.00218 **
points 1.2152 0.2788 4.359 0.02232 * 
assists -2.5968 1.6263 -1.597 0.20860   
rebounds 2.8202 1.6118 1.750 0.17847   
---
Significant. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 3.193 on 3 degrees of freedom
Multiple R-squared: 0.9589, Adjusted R-squared: 0.9179 
F-statistic: 23.35 on 3 and 3 DF, p-value: 0.01396

Estimate ကော်လံရှိ တန်ဖိုးများမှ တပ်ဆင်ထားသော ဆုတ်ယုတ်မှုပုံစံကို ရေးနိုင်သည်-

ရမှတ် = 66.4355 + 1.2151 (မှတ်များ) – 2.5968 (ကူညီမှု) + 2.8202 (ပြန်ကျော့ခြင်း)

အမှတ် 20 ၊ 5 assists နှင့် 2 rebounds ရှိသော ကစားသမားအသစ်၏ အဆင့်သတ်မှတ်မှုကို ခန့်မှန်းရန် အောက်ပါကုဒ်ကို အသုံးပြုနိုင်ပါသည်။

 #define new player
new <- data. frame (points=c(20), assists=c(5), rebounds=c(2))

#use the fitted model to predict the rating for the new player
predict(model, newdata=new)

       1 
83.39607 

ဤကစားသမားအသစ်သည် အဆင့်သတ်မှတ်ချက် 83.39607 ရှိမည်ဟု မော်ဒယ်က ခန့်မှန်းသည်။

တပ်ဆင်ထားသော ဆုတ်ယုတ်မှုညီမျှခြင်းတွင် ကစားသမားအသစ်၏တန်ဖိုးများကို ထည့်သွင်းခြင်းဖြင့် ၎င်းသည် မှန်ကန်ကြောင်း ကျွန်ုပ်တို့ အတည်ပြုနိုင်သည်-

  • ရမှတ် = 66.4355 + 1.2151 (မှတ်များ) – 2.5968 (ကူညီမှု) + 2.8202 (ပြန်ကျော့ခြင်း)
  • အဆင့်သတ်မှတ်ချက် = 66.4355 + 1.2151(20) – 2.5968(5) + 2.8202(2)
  • ရမှတ် = 83.39

၎င်းသည် R တွင် ခန့်မှန်းချက်() လုပ်ဆောင်ချက်ကို အသုံးပြု၍ ကျွန်ုပ်တို့တွက်ချက်ထားသော တန်ဖိုးနှင့် ကိုက်ညီပါသည်။

ထပ်လောင်းအရင်းအမြစ်များ

အောက်ဖော်ပြပါ သင်ခန်းစာများသည် R တွင် အခြားဘုံအလုပ်များကို မည်သို့လုပ်ဆောင်ရမည်ကို ရှင်းပြသည်-

R တွင် ရိုးရှင်းသော linear regression လုပ်နည်း
R တွင် linear regression အများအပြားလုပ်ဆောင်နည်း
R တွင်ကျန်ရှိသောကွက်ကွက်ဖန်တီးနည်း

မှတ်ချက်တစ်ခုထည့်ပါ။

သင့် email လိပ်စာကို ဖော်ပြမည် မဟုတ်ပါ။ လိုအပ်သော ကွက်လပ်များကို * ဖြင့်မှတ်သားထားသည်