statsmodels.duration.hazard_回归.PHReg.预测¶
-
PHReg.predict(params, exog=
None, cov_params=None, endog=None, strata=None, offset=None, pred_type='lhr', pred_only=False)[source]¶ 返回比例风险回归模型的预测值。
- Parameters:¶
- paramsarray_like
比例风险模型参数。
- exogarray_like
用作 exog 以形成预测的数据。如果没有提供,则使用用于拟合数据的模型的 exog 值。
- cov_paramsarray_like
估计的params向量的协方差矩阵, 用于在pred_type=’lhr’时获取预测误差, 否则为可选。
- endogarray_like
预测的时间值。仅在pred_type为‘cumhaz’或‘surv’时使用。如果使用模型exog,默认使用模型endog(时间),但可以显式提供以在其他时间进行预测。
- strataarray_like
用于形成预测的分层值向量。 如果 pred_type 是 ‘lhr’ 或 ‘hr’,则不使用(可能为 ‘None’)。 如果 exog 为 None,则使用模型的分层值。 如果 exog 不为 None 且 pred_type 是 ‘surv’ 或 ‘cumhaz’, 则必须提供分层值(除非只有一个分层)。
- offsetarray_like
用于创建预测值的偏移值。
- pred_type
str 如果为‘lhr’,返回对数风险比,如果为‘hr’返回风险比,如果为‘surv’返回生存函数,如果为‘cumhaz’返回累积风险函数。
- pred_onlybool
如果为真,则仅返回一个预测值数组。否则返回一个包含预测值和标准误差的集合。
- Returns:¶
Abunchcontainingtwofields: predicted_valuesand- standard_errors.
注释
标准误差仅在预测对数风险比时返回(pred_type 为 ‘lhr’)。
类型 surv 和 cumhaz 需要估计累积危险函数。
Last update:
Oct 16, 2024