说明:检查因变量和自变量是否存在U型或倒U形关系。主要步骤包括:
生成二次项并进行回归,观察二次项系数是否显著数据区间端点处的斜率转折点的置信区间是否在数据区间内。参见2016SMJ上的Thinking about U: Theorizing and testing U - and inverted U-shaped relationships in strategy researchutset检验 use "数据.dta"/// 固定效应和回归xtset Company yearxtreg ywincome sum_i_id c.sum_i_id#c.sum_i_id ln_A number reins reserve lev ROA i.year, fe vce(robust)/// 绘制散点图和拟合曲线predict yhat, xb * 生成预测值twoway (scatter ywincome sum_i_id) (line yhat sum_i_id), title("关系图:ywincome vs sum_i_id") legend(off)/// 绘制残差图predict resid, residuals * 生成残差预测值scatter resid sum_i_id, title("Residuals vs sum_i_id")reg ywincome sum_i_id c.sum_i_id#c.sum_i_id ln_A number reins reserve lev ROA i.yearrvfplot, yline(0) //残差与拟合值(y bar)散点图rvpplot sum_i_id , yline(0) //残差与x散点图scatter resid sum_i_id, title("Residuals vs sum_i_id")/// White 检验异方差ssc install whitetstestat imtest, whitextreg ywincome sum_i_id c.sum_i_id#c.sum_i_id ln_A number reins reserve lev ROA i.year, fe vce(robust)/// 计算转折点和其置信区间* 提取系数scalar b1 = _b[sum_i_id]scalar b2 = _b[c.sum_i_id#c.sum_i_id]* 计算转折点scalar inflection_point = -b1 / (2 * b2)display "拐点位置:" inflection_point* 使用 delta 方法估计转折点的置信区间nlcom (-_b[sum_i_id] / (2 * _b[c.sum_i_id#c.sum_i_id]))/// utset检验U型关系(最重要!!!)ssc install utestgen sum_i_id2 = sum_i_id*sum_i_idxtreg ywincome sum_i_id sum_i_id2 ln_A number reins reserve lev ROA i.year, fe vce(robust)utest sum_i_id sum_i_id2, fieller level(99)sum sum_i_id由此可见,真正的核心命令在于
检查一次项和二次项系数是否显著以及正负号。
通过utset命令进一步检查结果。
结果如下,其中极值点6.43超过了upper bound=5.39,由此无法拒绝原假设, 不存在U型关系。
utest sum_i_id sum_i_id2, fieller level(99)(487 missing values generated)Specification: f(x)=x^2Extreme point: 6.430802Test: H1: Inverse U shape vs. H0: Monotone or U shape ------------------------------------------------- | Lower bound Upper bound-----------------+-------------------------------Interval | 0 5.389072Slope | .7011772 .1135842-------------------------------------------------Extremum outside interval - trivial failure to reject H099% Fieller interval for extreme point: [-Inf; +Inf]