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。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。