您好,登錄后才能下訂單哦!
本文小編為大家詳細(xì)介紹“R語(yǔ)言混合線(xiàn)性模型中BLUE值和BLUP值實(shí)例分析”,內(nèi)容詳細(xì),步驟清晰,細(xì)節(jié)處理妥當(dāng),希望這篇“R語(yǔ)言混合線(xiàn)性模型中BLUE值和BLUP值實(shí)例分析”文章能幫助大家解決疑惑,下面跟著小編的思路慢慢深入,一起來(lái)學(xué)習(xí)新知識(shí)吧。
最佳線(xiàn)性無(wú)偏預(yù)測(cè)(best linear unbiased prediction, 簡(jiǎn)稱(chēng)BLUP),又音譯為“布拉普”[1],是統(tǒng)計(jì)學(xué)上用于線(xiàn)性混合模型對(duì)隨機(jī)效應(yīng)進(jìn)行預(yù)測(cè)的一種方法。最佳線(xiàn)性無(wú)偏預(yù)測(cè)由C.R. Henderson提出。隨機(jī)效應(yīng)的最佳線(xiàn)性無(wú)偏預(yù)測(cè)(BLUP)等同于固定效應(yīng)的最佳線(xiàn)性無(wú)偏估計(jì)(best linear unbiased estimates, BLUE)(參見(jiàn)高斯-馬爾可夫定理)。因?yàn)閷?duì)固定效應(yīng)使用估計(jì)一詞,而對(duì)隨機(jī)效應(yīng)使用預(yù)測(cè),這兩個(gè)術(shù)語(yǔ)基本是等同的。BLUP被大量使用于動(dòng)物育種?!獁iki
BLUP值,相當(dāng)于是對(duì)混合線(xiàn)性模型中隨機(jī)因子的預(yù)測(cè);
BLUE值,相當(dāng)于是對(duì)混合線(xiàn)性模型中固定因子的估算
predict means:預(yù)測(cè)均值,固定因子和隨機(jī)因子都可以預(yù)測(cè)均值,它的尺度和表型值尺度一致
將處理作為固定因子
將處理作為固定因子 setwd("D:\\02 ASReml\\blue VS blup") library(asreml) library(tidyverse) dat <- read.csv("MaizeRILs.csv",head=T) for (i in 1:4) dat[,i] <- as.factor(dat[,i]) as1 <- asreml(height ~ location/rep + location*RIL,data=dat) ASReml: Tue May 08 11:07:55 2018 LogLik S2 DF wall cpu -723.8797 64.8862 244 11:07:55 0.1 -723.8797 64.8862 244 11:07:55 0.0 Finished on: Tue May 08 11:07:55 2018 LogLikelihood Converged #計(jì)算品種的BLUE值 ablue <- coef(as1)$fixed blue1 <- ablue[grep("^RIL_RIL*",rownames(ablue)),] %>% as.data.frame() head(blue1) #計(jì)算品種的預(yù)測(cè)均值(predict means) pv1 <- predict(as1,"RIL")$predictions$pvals ASReml: Tue May 08 11:13:33 2018 LogLik S2 DF wall cpu -723.8797 64.8862 244 11:13:33 0.0 -723.8797 64.8862 244 11:13:33 0.0 Finished on: Tue May 08 11:13:33 2018 LogLikelihood Converged head(pv1) # 類(lèi)似SAS中的lsmeans #運(yùn)行模型:因素作為隨機(jī)因子 as2 <- asreml(height ~ 1,random = ~location/rep + location*RIL,data=dat) ASReml: Tue May 08 11:13:34 2018 LogLik S2 DF wall cpu -1646.5302 233.5135 495 11:13:34 0.0 -1569.0397 137.9186 495 11:13:34 0.0 -1507.3257 94.6888 495 11:13:34 0.0 -1471.3354 74.5149 495 11:13:34 0.0 -1462.9209 67.6142 495 11:13:34 0.0 -1461.7649 65.3553 495 11:13:34 0.0 -1461.7228 64.9069 495 11:13:34 0.0 -1461.7228 64.8863 495 11:13:34 0.0 -1461.7228 64.8862 495 11:13:34 0.0 Finished on: Tue May 08 11:13:34 2018 LogLikelihood Converged blup <- coef(as2)$random blup2 <- blup[grep("^RIL_RIL-*",rownames(blup)),] %>% as.data.frame() head(blup2) #預(yù)測(cè)均值 pv2 <- predict(as2,"RIL")$predictions$pvals ASReml: Tue May 08 11:13:34 2018 LogLik S2 DF wall cpu -1461.7228 64.8862 495 11:13:34 0.0 -1461.7228 64.8862 495 11:13:34 0.0 -1461.7228 64.8862 495 11:13:34 0.0 -1461.7228 64.8862 495 11:13:34 0.0 Finished on: Tue May 08 11:13:34 2018 LogLikelihood Converged head(pv2) #計(jì)算遺傳力 summary(as2)$varcomp str(dat) 'data.frame': 496 obs. of 9 variables: $ location: Factor w/ 4 levels "ARC","CLY","PPAC",..: 1 1 2 2 3 3 4 4 1 1 ... $ rep : Factor w/ 2 levels "1","2": 1 2 1 2 1 2 1 2 1 2 ... $ block : Factor w/ 8 levels "1","2","3","4",..: 4 6 5 4 8 5 1 4 1 2 ... $ plot : Factor w/ 122 levels "1","2","3","4",..: 28 47 36 92 64 40 7 27 6 9 ... $ RIL : Factor w/ 62 levels "RIL-1","RIL-11",..: 1 1 1 1 1 1 1 1 2 2 ... $ pollen : int 73 74 71 73 97 95 72 72 69 69 ... $ silking : int 77 79 74 77 101 100 78 78 71 72 ... $ ASI : int 4 5 3 4 4 5 6 6 2 3 ... $ height : num 182 169 213 203 156 ... VSNR::pin(as2,h3 ~ V3/(V3 + V4/4 + V5/(2*4))) 將數(shù)據(jù)保存到excel中 library(openxlsx) write.xlsx(blue1,"blue.xlsx") write.xlsx(blup2,"blup.xlsx") write.xlsx(pv1,"pm1.xlsx") write.xlsx(pv2,"pm2.xlsx") 結(jié)果解析 RIL是基因型 pm2-random是RIL作為隨機(jī)因子的預(yù)測(cè)均值 pm1-fixed是RIL作為固定因子時(shí)的預(yù)測(cè)均值 blue是RIL作為固定因子的BLUE值 blup是RIL作為隨機(jī)因子的BLUP值 pm2-blup 是隨機(jī)因子的預(yù)測(cè)均值 減去 隨機(jī)因子的BLUP值,可以看到得到的是一個(gè)常數(shù)(均值) pm1-mu-random 是固定因子的預(yù)測(cè)均值 減去 固定依著你的BLUE值, 可以看到不是一個(gè)常數(shù) blup/blue_effect=heritibility 是BLUP值 除以 BLUE效應(yīng)值,得到的是遺傳力常數(shù) 備注:blue_effect是用固定因子的預(yù)測(cè)均值 減去 整體均值
讀到這里,這篇“R語(yǔ)言混合線(xiàn)性模型中BLUE值和BLUP值實(shí)例分析”文章已經(jīng)介紹完畢,想要掌握這篇文章的知識(shí)點(diǎn)還需要大家自己動(dòng)手實(shí)踐使用過(guò)才能領(lǐng)會(huì),如果想了解更多相關(guān)內(nèi)容的文章,歡迎關(guān)注億速云行業(yè)資訊頻道。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。