statsmodels.gam.generalized_加性_模型.GLMGam

class statsmodels.gam.generalized_additive_model.GLMGam(endog, exog=None, smoother=None, alpha=0, family=None, offset=None, exposure=None, missing='none', **kwargs)[source]

广义加性模型 (GAM)

这继承自 GLM

警告:并非所有继承的方法都能正确考虑惩罚项。包括偏移和暴露在内的所有选项尚未完全验证。

Parameters:
endogarray_like

响应变量。

exogarray_like or None

这些解释变量被视为线性的。在这种情况下,模型是一个部分线性模型。

smootherinstance of additive smoother class

平滑实例的示例包括B样条或循环三次样条。

alphafloat or list of floats

平滑项的惩罚权重。列表的长度需要与smoother中的平滑项数量相同。

familyinstance of GLM family

查看广义线性模型(GLM)。

offsetNone or array_like

查看广义线性模型(GLM)。

exposureNone or array_like

查看广义线性模型(GLM)。

missing‘none’

此类不支持缺失值处理。

**kwargs

在调用超类时使用了额外的关键字。

Attributes:
endog_names

内生变量的名称。

exog_names

外生变量的名称。

注释

状态: 实验性。对于高斯和泊松(不带偏移量和暴露量)的核心结果,已经进行了全面的单元测试覆盖。其他选项和附加结果可能尚未得到正确支持。(二项分布带计数,即带n_trials,在pirls中很可能是错误的。用户指定的var或freq权重也很可能对所有结果不正确。)

方法

estimate_scale(mu)

估计离散度/尺度。

estimate_tweedie_power(mu[, method, low, high])

Tweedie 特定函数用于估计尺度参数和方差参数。

fit([start_params, maxiter, method, tol, ...])

估计参数并创建GLMGamResults类的实例

fit_constrained(约束[, start_params])

拟合受线性等式约束的模型

fit_regularized([方法, alpha, ...])

返回一个正则化的线性回归模型的拟合结果。

from_formula(公式, 数据[, 子集, 删除列])

从公式和数据框创建模型。

get_distribution(params[, scale, exog, ...])

返回预测分布的一个实例。

hessian(params[, pen_weight])

模型在参数处的Hessian

hessian_factor(params[, scale, observed])

计算Hessian的权重

hessian_numdiff(params[, pen_weight])

基于有限差分的Hessian矩阵

information(参数[, 尺度])

费舍尔信息矩阵。

initialize()

初始化一个广义线性模型。

loglike(params[, pen_weight])

模型在参数处的对数似然值

loglike_mu(mu[, scale])

评估广义线性模型的对数似然值。

loglikeobs(params[, pen_weight])

模型观测值在参数处的对数似然

predict(params[, exog, exposure, offset, ...])

返回设计矩阵的预测值

score(params[, pen_weight])

模型在参数处的梯度

score_factor(params[, scale])

每个观测值的分数权重

score_numdiff(params[, pen_weight, method])

基于有限差分导数的分数

score_obs(params[, pen_weight])

模型观测值在参数处的梯度

score_test(params_constrained[, ...])

用于限制条件或遗漏变量的得分检验

select_penweight([criterion, start_params, ...])

通过最小化结果准则来找到alpha

select_penweight_kfold([alphas, ...])

通过k折交叉验证找到alpha值

属性

endog_names

内生变量的名称。

exog_names

外生变量的名称。


Last update: Oct 16, 2024