繁体   English   中英

带有betar的mgcv GAM

[英]mgcv GAM with betar

有谁知道如何从模型输出(具有beta分布的mgcv GAM)中获取拟合的phi参数?

参考提供的betar gam示例

library(mgcv)
## Simulate some beta data...
set.seed(3);n<-400
dat <- gamSim(1,n=n)
mu <- binomial()$linkinv(dat$f/4-2)
phi <- .5
a <- mu*phi;b <- phi - a;
dat$y <- rbeta(n,a,b) 

bm <- gam(y~s(x0)+s(x1)+s(x2)+s(x3),family=betar(link="logit"),data=dat)

输出显示“ Family:Beta回归”下的phi估计值

> bm

Family: Beta regression(0.491) 
Link function: logit 

Formula:
y ~ s(x0) + s(x1) + s(x2) + s(x3)

Estimated degrees of freedom:
1.73 1.63 5.62 1.00  total = 10.98 

在拟合过程中,gam函数调用betar(),该函数随后估计称为theta的phi参数。 我引用了以下功能的说明:

描述:

  Family for use with 'gam' or 'bam', implementing regression for beta distributed data on (0,1). A linear predictor controls the mean, mu of the beta distribution, while the variance is then mu(1-mu)/(1+phi), with parameter phi being estimated during fitting, alongside the smoothing parameters. 

用法:

  betar(theta = NULL, link = "logit",eps=.Machine$double.eps*100) Arguments: theta: the extra parameter (phi above). 

使用您已有的示例,您只需要查看gam对象下方:

bm <- gam(y~s(x0)+s(x1)+s(x2)+s(x3),family=betar(link="logit"),data=dat)
exp(bm$family$getTheta())
[1] 0.4913482

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM