Export the results of Bootstrap mediation effect test in Stata: Save the results: bootstrap post Create variable list: local vars: coef se ci Export results (CSV): export delimited results.csv, varlist(`vars') replace comma nolabel
How to export the Stata command results of Bootstrap to test the mediation effect
Use bootstrapping technology to test in Stata When mediating effects, you may wish to export the analysis results for further presentation or analysis. The following steps illustrate how to export the results of the bootstrap command:
1. Save the bootstrap results
After running the bootstrap command, you can save the results in the following ways:
bootstrap post
2. Create a variable list to be exported
Create a variable list containing the names of variables to be exported. For example, if you want to export coefficient estimates (coef), standard errors (se), and confidence intervals (ci), the list of variables is as follows:
local vars: coef se ci
3. Export the results
Use theexport
command to export the results to an external file. For example, to export the results to a comma-separated values (CSV) file namedresults.csv
, use the following command:
export delimited results.csv, varlist(`vars') replace
4. Specify output options## The
#export delimitedcommand provides some output options, such as:
: overwrites any existing data.
: Use comma as delimiter (CSV format).
: Do not include variable labels.
Sample Code
The following code example demonstrates how to save bootstrap results and export coefficient estimates, standard errors, and confidence intervals:// 运行 bootstrapping 命令 bootstrap, reps(1000): mediate y x z // 保存结果 bootstrap post // 创建变量列表 local vars: coef se ci // 导出结果到 CSV 文件 export delimited results.csv, varlist(`vars') replace comma nolabel
The above is the detailed content of How to export the results of bootstrap test mediation effect stata command. For more information, please follow other related articles on the PHP Chinese website!