# stata **Repository Path**: Maryddd/stata ## Basic Information - **Project Name**: stata - **Description**: stata - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-11-23 - **Last Updated**: 2022-12-29 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README *p41.do *输出结果p41.log见课件网站 **当Excel文件数据量较少时,可直接从Excel文件中通过“复制粘贴”到Stata的“数据编辑器”中, **然后保存为Stata的dta文件。 *********************************************** use p41.dta, clear //数据文件见课件网站 sum scatter y x reg y x twoway (scatter y x)(lfit y x) //散点图上同时画出回归直线 twoway (scatter y x) /* */ (lfit y x), /* */ title("散点图和线性拟合图") graph save p41.gph, replace **计算被解释变量的拟合值,并将其记为y_hat predict y_hat **计算“残差”(residual),并将其记为 e predict e,r //选择项“residual”(r)表示预测残差,其他如xb等 //如果没有选择项,“默认值”(default)计算拟合值(xb) list format y_hat %6.2f format e %8.3f list ****************************************************************