簡體   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