Marx Max中文
Menu

Stata analysis

Open in Marx Max

An executed example using Stata’s bundled auto data: two regressions with robust standard errors. Inspect estimates and confidence intervals, download code, CSV, a run log and figures, and follow the guide to try the workflow.

Using Stata bundled auto data, compare regressions of price on weight and of price on weight plus mpg on the same complete-case sample, both with robust SEs. Retain code, actual logs, coefficients and 95% intervals. Read README.md, download the public package into reference/, retain reference outputs and rerun in a fresh licensed Stata session into rerun/. Confirm 74 observations in both models; reference logs are not evidence of this run and associations are not causal effects.
Weight estimates and 95% confidence intervals for the baseline and add-mpg models, both using 74 observations and robust standard errors.
Horizontal lines show each model’s 95% confidence interval; this plot does not test the difference between coefficients.

Download the complete case package (ZIP)

This case extends the guide’s first analysis: establish the data and sample, compare specifications, and retain reproducible code and outputs. The calculations below were actually executed in Stata using its bundled auto data. They illustrate model comparison, not a causal study of car prices.

Start with the Stata guide: connect, ask, and check output

Task and execution conditions

The calculation used Stata 19.5 without third-party commands. Both models use the same 74 observations with nonmissing price, weight and mpg and vce(robust). Readers with licensed Stata can rerun the program below. When using the request in Marx Max, check the code and output actually produced.

What did the two models produce?

ModelWeight coefficientRobust SE95% CINR²
Weight only2.0440.3901.267–2.821740.290
Add mpg1.7470.7780.196–3.298740.293

After adding mpg, the weight coefficient changes from about 2.044 to 1.747; the robust standard error and confidence interval become larger. Because the sample is fixed, this change is not due to excluded observations. The specification has changed, however: the second model is not automatically more correct, and neither establishes a causal effect of weight on price.

Download code and actual outputs

The package contains the complete do-file, actual run log, all model coefficients in CSV, SVG and PNG figures, and rerun instructions. It does not include Stata software or the source auto dataset.

How to rerun and check the results

  1. Extract into a fresh empty directory, separate from your research files.
  2. In a new Stata practice session, set the working directory to the extracted folder and run do analysis.do.
  3. Check the log for errors, confirm 74 observations and robust standard errors in both models, and compare the CSV coefficients and intervals.
  4. In Marx Max, first follow the guide to check the connection, then run the complete program in a new practice notebook. Retain code and output and investigate unexpected results from the actual log.

The program’s clear replaces data in memory; replace overwrites named outputs in the practice directory. Save current analyses first and use a new session and empty folder. This calculation ran in Stata 19.5 on macOS; rerunning on Windows hardware is not covered.

What to retain for your own research

Keep the sequence: define inputs and sample, execute specified models, inspect actual output, and save code and artifacts. Establish paths, variable meanings, controls, and standard errors for your research. Replacing auto with another file does not justify carrying over interpretations. Start with a bounded task and retain source material, reasons for changes, and the mapping from code to results.

Return to the Stata guide · Check research data processing