Tweedie
位於 mgcv
包(package)。 說明
Tweedie 係列,設計用於與 mgcv
庫中的 gam
一起使用。限製為 1 到 2 之間的方差函數冪。當需要完全似然時,這是 quasi
的有用替代方案。 Tweedie
用於固定 p
。 tw
用於在擬合期間估計 p
時。對於介於 1 和 2 之間的固定 p
,Tweedie 是指數族分布,其方差由均值的冪 p
給出。
tw
隻能與 gam
和 bam
一起使用,但不能與 gamm
一起使用。 Tweedie
適用於所有三個。
用法
Tweedie(p=1, link = power(0))
tw(theta = NULL, link = "log",a=1.01,b=1.99)
參數
p |
觀測值的方差與其均值的冪 |
link |
鏈接函數: |
theta |
與 |
a |
用於優化的 |
b |
|
細節
1<p<2 的 Tweedie 隨機變量是 N
gamma 隨機變量的總和,其中 N
具有泊鬆分布。 p=1 的情況是泊鬆分布的推廣,並且是在尺度參數的整數倍上支持的離散分布。對於 1<p<2,分布在點質量為零的正實數上得到支持。 p=2 是伽瑪分布。當 p 非常接近 1 時,連續分布開始收斂於 p=1 時離散支持的極限,因此是高度多峰的。有關此行為的更多信息,請參閱ldTweedie
。
Tweedie
部分基於 poisson
係列,部分基於 statmod
包中的 tweedie
。它包含可與所有 mgcv
GAM 擬合方法以及 aic
函數配合使用的額外組件。
Tweedie 密度涉及一個沒有閉合形式的歸一化常數,因此使用 Dunn 和 Smyth (2005) 的級數評估方法進行評估,並進行擴展以計算關於 Tweedie 密度的導數。 p
和比例參數。如果不將 p
限製為 (1,2),Tweedie 密度的計算會更加困難,並且目前似乎沒有一種實現能夠比 quasi
提供任何優勢。如果您需要這種情況,那麽可以從 tweedie
包開始。
值
對於 Tweedie
,繼承自類 family
的對象,帶有附加元素
dvar |
該函數給出方差函數的一階導數。 |
d2var |
該函數給出方差函數的二階導數。 |
ls |
返回 3 元素數組的函數:飽和對數似然值及其前 2 個導數。尺度參數。 |
對於 tw
,類 extended.family
的對象。
例子
library(mgcv)
set.seed(3)
n<-400
## Simulate data...
dat <- gamSim(1,n=n,dist="poisson",scale=.2)
dat$y <- rTweedie(exp(dat$f),p=1.3,phi=.5) ## Tweedie response
## Fit a fixed p Tweedie, with wrong link ...
b <- gam(y~s(x0)+s(x1)+s(x2)+s(x3),family=Tweedie(1.25,power(.1)),
data=dat)
plot(b,pages=1)
print(b)
## Same by approximate REML...
b1 <- gam(y~s(x0)+s(x1)+s(x2)+s(x3),family=Tweedie(1.25,power(.1)),
data=dat,method="REML")
plot(b1,pages=1)
print(b1)
## estimate p as part of fitting
b2 <- gam(y~s(x0)+s(x1)+s(x2)+s(x3),family=tw(),
data=dat,method="REML")
plot(b2,pages=1)
print(b2)
rm(dat)
作者
Simon N. Wood simon.wood@r-project.org.
參考
Dunn, P.K. and G.K. Smyth (2005) Series evaluation of Tweedie exponential dispersion model densities. Statistics and Computing 15:267-280
Tweedie, M. C. K. (1984). An index which distinguishes between some important exponential families. Statistics: Applications and New Directions. Proceedings of the Indian Statistical Institute Golden Jubilee International Conference (Eds. J. K. Ghosh and J. Roy), pp. 579-604. Calcutta: Indian Statistical Institute.
Wood, S.N., N. Pya and B. Saefken (2016), Smoothing parameter and model selection for general smooth models. Journal of the American Statistical Association 111, 1548-1575 doi:10.1080/01621459.2016.1180986
也可以看看
相關用法
- R vcov.gam 從 GAM 擬合中提取參數(估計器)協方差矩陣
- R gam.check 擬合 gam 模型的一些診斷
- R null.space.dimension TPRS 未懲罰函數空間的基礎
- R gam.reparam 尋找平方根懲罰的穩定正交重新參數化。
- R extract.lme.cov 從 lme 對象中提取數據協方差矩陣
- R scat 用於重尾數據的 GAM 縮放 t 係列
- R choldrop 刪除並排名第一 Cholesky 因子更新
- R smooth.construct.cr.smooth.spec GAM 中的懲罰三次回歸樣條
- R bandchol 帶對角矩陣的 Choleski 分解
- R gam.side GAM 的可識別性邊條件
- R cox.ph 附加 Cox 比例風險模型
- R mgcv.parallel mgcv 中的並行計算。
- R gamm 廣義加性混合模型
- R pdTens 實現張量積平滑的 pdMat 類的函數
- R Predict.matrix GAM 中平滑項的預測方法
- R Predict.matrix.soap.film 皂膜光滑度預測矩陣
- R smooth.construct.bs.smooth.spec GAM 中的懲罰 B 樣條
- R gamlss.gH 計算回歸係數的對數似然導數
- R plot.gam 默認 GAM 繪圖
- R mvn 多元正態加性模型
- R gfam 分組家庭
- R smooth.construct GAM 中平滑項的構造函數
- R pcls 懲罰約束最小二乘擬合
- R gam.fit3 使用 GCV、UBRE/AIC 或 RE/ML 導數計算進行 P-IRLS GAM 估計
- R rTweedie 生成 Tweedie 隨機偏差
注:本文由純淨天空篩選整理自R-devel大神的英文原創作品 GAM Tweedie families。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。