贝叶斯线性回归

library(LearnBayes)
data(birdextinct)
attach(birdextinct)
birdextinct
logtime=log(time)
fit=lm(logtime ~ nesting+size+status,
         data=birdextinct, x=TRUE, y=TRUE)
summary(fit)
theta.sample <- blinreg(fit$y,fit$x,5000)
par(mfrow=c(2,2))
hist(theta.sample$beta[,2], main="NESTING",
       xlab=expression(beta[1]))
hist(theta.sample$beta[,3], main="SIZE",
       xlab=expression(beta[2]))
hist(theta.sample$beta[,4], main="STATUS",
       xlab=expression(beta[3]))
hist(theta.sample$sigma, main="ERROR SD",
       xlab=expression(sigma))

apply(theta.sample$beta,2, quantile, c(.05,.5,.95))
quantile(theta.sample$sigma,c(.05,.5,.95))

评论

此博客中的热门博文

V2ray websocket(ws)+tls+nginx分流

Rstudio 使用代理