ECONOMETRICS • COMPUTATION • REPRODUCIBLE ANALYSIS
Computer applications in econometrics turn raw observations into statistical evidence. However, useful evidence requires more than a regression button: analysts must import data correctly, choose a defensible model, check assumptions, and explain uncertainty.
This guide connects those tasks through Excel, EViews, and SAS. Along the way, you will reproduce descriptive statistics, compare means, estimate regressions, investigate serial correlation, and interpret unit root and Granger causality tests.
Scope and provenance: The supplied chapter photographs, pages 266–282, provide the teaching examples and historical output discussed here. Explanations are original, and calculations use the visible observations wherever complete data appear. Historical ADF and Granger results are interpreted from the supplied output rather than presented as newly estimated results. The examples illustrate methods; they are not current agricultural or commercial estimates.
What do computer applications in econometrics actually do?
Econometrics combines economic questions, mathematical models, and observed data. Computers make the repetitive calculations feasible, while software helps analysts inspect results and compare specifications. Nevertheless, the researcher still owns the decisions that make an estimate meaningful.
Consider a production question: does fertilizer use predict corn output? A spreadsheet can calculate the relationship in seconds. Yet the result alone cannot separate fertilizer effects from weather, technological change, land quality, or farmers’ expectations.
Therefore, begin with the question rather than the software menu. Decide whether you need a description, a forecast, a hypothesis test, or a causal estimate. Each goal changes the necessary data and the interpretation of the output.
| Task | Computer contribution | Researcher responsibility |
|---|---|---|
| Import | Reads rows, columns, dates, and values | Verify types, units, identifiers, and missing codes |
| Describe | Calculates summaries and draws charts | Choose meaningful groups and scales |
| Estimate | Fits coefficients and residuals | Specify the model and justify the sample |
| Test | Calculates statistics and probabilities | Check assumptions and state the null |
| Forecast | Projects outcomes from a fitted model | Prevent future information from entering training |
| Communicate | Exports tables and figures | Explain uncertainty and avoid causal overclaims |
Choose software around the analysis
Excel makes small datasets and cell-level calculations easy to inspect. EViews organizes dated economic series and offers specialized time-series tools. Meanwhile, SAS supports explicit data-processing programs and repeatable statistical procedures.
For a teaching project, one tool may cover the entire workflow. In a larger study, you might inspect a file in Excel and estimate the final model through a saved program. Above all, use the same observations and specification when comparing outputs.
| Feature | Excel | EViews | SAS |
|---|---|---|---|
| Small-data inspection | Worksheet and formulas | Series and group views | PRINT and data exploration procedures |
| OLS regression | Analysis ToolPak; LINEST | Equation estimation | PROC REG |
| Time-series diagnostics | Usually require additional work | Dedicated series and equation views | SAS/ETS procedures such as AUTOREG |
| Repeatability | Saved formulas and documented steps | Saved workfiles and programs | Saved DATA and PROC steps |
| Main beginner risk | Ranges and references drift | Dates or lag specifications differ | Import assumptions or missing-value rules differ |
Reference: Microsoft: Analysis ToolPak capabilities.
Data formats: the first econometric decision
A statistical model cannot rescue a wrongly imported dataset. For example, a program may read a decimal comma as a column separator, treat an identification code as a number, or confuse a missing observation with zero. Consequently, data import deserves the same care as model estimation.
Delimited files versus fixed-width files
A delimited file separates fields with characters such as commas, tabs, or semicolons. By contrast, a fixed-width file assigns each variable to specified character positions. Neither format guarantees that the program will infer the correct meaning.
| Format | Illustration | Important check |
|---|---|---|
| Comma-delimited | 1,6 | Specify delimiter, quotation rules, and decimal convention |
| Tab-delimited | Two values separated by a tab | Distinguish tabs from repeated spaces |
| Semicolon-delimited | 1;6 | Commonly accompanies decimal-comma exports |
| Fixed-width | ID in characters 1–4; value in 6–12 | Read the codebook before assigning positions |
Suppose a location is “New York.” A naive whitespace split creates two fields from one name. However, a correctly quoted CSV record keeps the location together:
location,population_millions
"New York",18.2
"North Carolina",7.7
These numbers reproduce a historical format example; they do not represent current populations. Similarly, an ID such as 0017 should remain text if the leading zeros carry meaning. A numeric conversion would silently change its representation.
Build a small data dictionary
Before estimating anything, describe each variable’s name, unit, frequency, source, and missing-value convention. Then document the observational unit: one student, one store, one country-year, or one calendar month. Otherwise, rows that look comparable may describe different things.
| Variable | Meaning | Unit or type | Validation |
|---|---|---|---|
| year | Observation year | Annual integer | Unique and ordered in this dataset |
| corn | Output measure in the teaching example | Original example units | Positive values; verify original unit definition |
| fertilizer | Fertilizer input | Original example units | Nonnegative values |
| insecticide | Second production input | Original example units | Nonnegative values |
| ratio | fertilizer divided by corn | Input units per output unit | Undefined if corn is zero |
Run five import checks
- Compare the imported row count with the source.
- Inspect the first and last observations.
- Check minimums, maximums, and missing counts.
- Confirm unique keys and correctly ordered dates.
- Recalculate at least one value manually.
For instance, the first production ratio below must equal 6/40 = 0.15. If your software gives 6.40, 15, or a missing value, investigate the import or formula before continuing. A one-minute check can prevent a fully formatted but incorrect report.
Descriptive statistics: verify the small example first
The score example contains ten observations: 6, 7, 6, 8, 5, 7, 6, 9, 10, 6. Because the dataset is short, you can check every result directly. This makes it a useful benchmark for validating software settings.
Mean, median, mode, and dispersion
| Statistic | Result | Excel formula with scores in B2:B11 |
|---|---|---|
| Count | 10 | =COUNT(B2:B11) |
| Mean | 7.000000 | =AVERAGE(B2:B11) |
| Median | 6.5 | =MEDIAN(B2:B11) |
| Mode | 6 | =MODE.SNGL(B2:B11) |
| Sample variance | 2.444444 | =VAR.S(B2:B11) |
| Sample standard deviation | 1.563472 | =STDEV.S(B2:B11) |
| Population variance | 2.2 | =VAR.P(B2:B11) |
| Coefficient of variation | 22.3353% | =STDEV.S(B2:B11)/AVERAGE(B2:B11) |
The squared deviations sum to 22. Therefore, the sample variance equals 22/9, while the population variance equals 22/10. Those different denominators explain a common disagreement between programs.
The mean exceeds the median because the high scores pull the average upward. Meanwhile, the mode identifies 6 as the most frequent observation. None of these measures substitutes for inspecting the full distribution.
A frequency chart with explicit categories
For these integer scores, one category per score avoids arbitrary bin boundaries. An ordinary histogram for a continuous variable instead requires a defensible set of intervals. Consequently, charts from two programs may look different even when both imported identical data.
| Score | Frequency | Cumulative share |
|---|---|---|
| 5 | 1 | 10% |
| 6 | 4 | 50% |
| 7 | 2 | 70% |
| 8 | 1 | 80% |
| 9 | 1 | 90% |
| 10 | 1 | 100% |
Standardize scores without moving the reference cells
A score of 6 has z ≈ −0.6396; a score of 10 has z ≈ 1.9188. Thus, the highest observation sits about 1.92 sample standard deviations above the mean. Standardization changes the scale, but it does not turn the distribution into a normal distribution.
=(B2-AVERAGE($B$2:$B$11))/STDEV.S($B$2:$B$11)Copy this formula down the rows. The relative reference B2 changes, whereas the dollar signs keep the summary range fixed. As a final check, the standardized observations should have a mean close to zero and a sample standard deviation close to one.
Use the coefficient of variation carefully
The coefficient of variation divides the standard deviation by the mean. However, a meaningful interpretation generally requires a meaningful zero and a mean away from zero. For test scores, report the numerical value cautiously: changing the scoring origin can alter the ratio without changing relative performance.
Comparing means with t-tests and ANOVA
The packaging example asks whether sales differ across three alternatives. Each group contains five observations. First, inspect the raw values rather than jumping straight to a p-value.
| Observation | Packaging 1 | Packaging 2 | Packaging 3 |
|---|---|---|---|
| 1 | 87 | 78 | 90 |
| 2 | 83 | 81 | 91 |
| 3 | 79 | 79 | 84 |
| 4 | 81 | 82 | 82 |
| 5 | 80 | 80 | 88 |
| Mean | 82 | 80 | 87 |
| Sample variance | 10 | 2.5 | 15 |
Example 1: does Packaging 1 have a mean of 85?
State the hypotheses before calculating: H₀: μ = 85 and H₁: μ ≠ 85. Because the population standard deviation is unknown, use a one-sample t statistic. Under independent normal observations, the reference distribution has n − 1 degrees of freedom.
Here, df = 4 and the two-sided p-value is approximately 0.10119. Therefore, the sample does not reject a mean of 85 at the 5% level. It also falls just outside a 10% rejection rule.
However, this finding does not establish that the true mean equals 85. The 95% confidence interval is approximately 78.07 to 85.93, which shows the uncertainty directly. A small sample can leave a practically relevant difference unresolved.
=(AVERAGE(A2:A6)-85)/(STDEV.S(A2:A6)/SQRT(COUNT(A2:A6)))
=T.DIST.2T(ABS(t_statistic_cell),COUNT(A2:A6)-1)
Example 2: do Packaging 1 and Packaging 2 have equal means?
The historical exercise specifies a pooled, equal-variance comparison. Accordingly, its pooled variance is 6.25, its t statistic is 1.26491, and its degrees of freedom equal 8. The resulting two-sided p-value is approximately 0.24150.
Therefore, the pooled test does not reject equality at 5%. Nevertheless, the observed variances differ, and the dataset contains little information about population variances. In a new analysis without a justified equal-variance assumption, consider Welch’s comparison.
=T.TEST(A2:A6,B2:B6,2,2) /* two-sided pooled test */
=T.TEST(A2:A6,B2:B6,2,3) /* two-sided Welch test */The comments explain the formulas; do not paste the comments into worksheet cells. These ranges apply to the packaging sheet only.
Also determine whether the observations are independent or paired. Measurements from the same stores under two designs may call for a paired analysis. In contrast, separate randomly assigned stores support an independent-samples comparison.
Reference: Microsoft: T.TEST arguments and test types.
Example 3: compare all three packaging means
A one-way ANOVA tests H₀: μ₁ = μ₂ = μ₃. Its alternative states that at least one population mean differs. Consequently, rejection does not imply that every pair differs.
| Variation source | Sum of squares | df | Mean square | F |
|---|---|---|---|---|
| Between groups | 130 | 2 | 65 | 7.09091 |
| Within groups | 110 | 12 | 9.16667 | — |
| Total | 240 | 14 | — | — |
The p-value is approximately 0.00927, so the test rejects equal means at 5%. Moreover, the sample effect-size ratio η² = 130/240 ≈ 0.5417 indicates that group membership accounts for about 54.17% of the total sum of squares in these observations.
That percentage describes this sample, not a proven causal contribution from packaging. Random assignment, independence, and the absence of competing differences matter for a causal interpretation. For specific pairwise conclusions, use planned contrasts or a suitable multiple-comparison procedure.
The classical ANOVA model assumes independent errors, a common error variance, and normally distributed errors for exact small-sample inference. With only five observations per group, neither a normality test nor a tidy chart can establish those assumptions. Therefore, inspect the study design as well as the output.
Reference: NIST: one-way ANOVA model and assumptions.
Regression: from a fitted line to an economic interpretation
The production example provides ten annual observations from 1971 through 1980. Use the full table below to reproduce the calculations. Although the labels describe agricultural inputs and output, the supplied pages do not establish all physical unit definitions, so interpret slopes in the original example units.
| Year | Corn output Y | Fertilizer X₁ | Insecticide X₂ | X₁/Y |
|---|---|---|---|---|
| 1971 | 40 | 6 | 4 | 0.150000 |
| 1972 | 44 | 10 | 4 | 0.227273 |
| 1973 | 46 | 12 | 5 | 0.260870 |
| 1974 | 48 | 14 | 7 | 0.291667 |
| 1975 | 52 | 16 | 9 | 0.307692 |
| 1976 | 58 | 18 | 12 | 0.310345 |
| 1977 | 60 | 22 | 14 | 0.366667 |
| 1978 | 68 | 24 | 20 | 0.352941 |
| 1979 | 74 | 26 | 21 | 0.351351 |
| 1980 | 80 | 32 | 24 | 0.400000 |
Example 4: covariance and correlation
Fertilizer and corn move together strongly in this sample. The sample covariance equals 106.2222, while the Pearson correlation is approximately 0.985418. However, covariance changes with measurement units, whereas correlation removes those units.
In a production sheet with year in A, corn in B, fertilizer in C, and insecticide in D, use =CORREL(B2:B11,C2:C11). For sample covariance, use =COVARIANCE.S(B2:B11,C2:C11). Keep both ranges aligned by year.
Because both variables rise over time, the correlation alone provides weak evidence about a production mechanism. For example, a common technology trend could lift output while farmers also increase inputs. A scatterplot helps describe the pattern but cannot remove that ambiguity.
Example 5: estimate simple ordinary least squares
Ŷt = 27.1250 + 1.659722X1t
Ordinary least squares chooses coefficients that minimize the sum of squared residuals. Here, the fitted slope associates one additional fertilizer unit with approximately 1.6597 additional output units. Importantly, “associates” does not mean that a controlled intervention would produce the same change.
The model has R² ≈ 0.971049 and a residual sum of squares of 47.30556. With an intercept and one regressor, it uses two coefficients and leaves eight residual degrees of freedom. The fitted intercept describes an extrapolation to zero fertilizer, which lies outside the observed range of 6 to 32.
Example 6: add a second input
Next, include insecticide alongside fertilizer. The multiple regression estimates a partial association for each input while holding the other included input constant. It does not hold every unobserved production condition constant.
| Measure | Simple regression | Multiple regression |
|---|---|---|
| Observations | 10 | 10 |
| Estimated coefficients, including intercept | 2 | 3 |
| Residual degrees of freedom | 8 | 7 |
| Fertilizer slope | 1.659722 | 0.650051 |
| Insecticide slope | Not included | 1.109868 |
| R² | 0.971049 | 0.991634 |
| Residual sum of squares | 47.305556 | 13.670397 |
| Residual standard error | 2.431706 | 1.397467 |
The fertilizer coefficient falls from about 1.66 to 0.65 after adding insecticide. Thus, the simple-regression coefficient partly reflects variation that fertilizer shares with the second input. This comparison illustrates specification sensitivity, although it does not establish that the multiple model has eliminated omitted-variable bias.
At fertilizer = 18 and insecticide = 12, the multiple model predicts 57. Actual output is 58, so the residual equals +1. That concrete check verifies the coefficient order and the residual sign.
A hidden issue: excellent fit can coexist with multicollinearity
The two inputs also move together strongly. Regressing either input on the other and an intercept gives a variance inflation factor of approximately 18.46. Therefore, the dataset contains limited independent movement for separating their partial associations.
A large VIF does not automatically bias OLS coefficients. Instead, it signals that collinearity inflates coefficient variance relative to a comparable design with independent predictors. In this ten-row example, avoid interpreting a precise-looking decimal as evidence of a stable economic parameter.
Also remember that adding a regressor cannot increase the minimized in-sample SSE when the sample stays fixed. As a result, a higher unadjusted R² is not a sufficient model-selection rule. Examine theory, diagnostics, adjusted fit, and performance on genuinely unseen observations.
Read residuals before trusting the regression table
| Year | Actual output | Fitted output | Residual |
|---|---|---|---|
| 1971 | 40 | 40.320448 | -0.320448 |
| 1972 | 44 | 42.920651 | +1.079349 |
| 1973 | 46 | 45.330621 | +0.669379 |
| 1974 | 48 | 48.850458 | -0.850458 |
| 1975 | 52 | 52.370295 | -0.370295 |
| 1976 | 58 | 57.000000 | +1.000000 |
| 1977 | 60 | 61.819939 | -1.819939 |
| 1978 | 68 | 69.779247 | -1.779247 |
| 1979 | 74 | 72.189217 | +1.810783 |
| 1980 | 80 | 79.419125 | +0.580875 |
With an intercept, OLS residuals sum to approximately zero, apart from floating-point rounding. However, that algebraic property does not establish a well-specified model. Inspect residuals against fitted values, time, and each explanatory variable.
Curvature may indicate a missing nonlinear relationship. Meanwhile, a widening spread may suggest heteroskedasticity, and runs of positive or negative residuals may suggest serial dependence. A residual chart directs attention; a formal test and economic reasoning help evaluate the suspected problem.
Ratios reveal a subtle weighting problem
The fertilizer-to-output ratio equals fertilizer divided by corn. It measures input intensity in input units per output unit. Unless numerator and denominator share compatible units, calling it a percentage or a “proportion” would mislead the reader.
In the first year, the ratio equals 0.15; in the last year, it equals 0.40. Across all ten years, the arithmetic mean of the annual ratios is approximately 0.301881. However, dividing total fertilizer by total corn gives 180/570 ≈ 0.315789.
| Calculation | Value | Question answered |
|---|---|---|
| Mean of yearly ratios | 0.301881 | What is the average annual intensity, with equal weight per year? |
| Ratio of totals | 0.315789 | How much fertilizer accompanies one output unit across the combined observations? |
| Difference | 0.013909 | How much does output weighting change the summary? |
The ratio of totals weights each annual ratio by that year’s output. Consequently, higher-output years matter more. In this dataset, those years also tend to have higher input intensity, so the weighted result exceeds the simple average.
This distinction also appears in finance, labor economics, and business dashboards. For example, an average of branch profit margins generally differs from the company margin calculated from total profit and total revenue. Neither summary is universally correct; the intended question determines the weighting.
Guard against denominator problems
A zero denominator makes the ratio undefined. Moreover, a very small denominator can create an extreme value even when the numerator changes little. Therefore, flag denominator issues explicitly rather than converting every error to zero.
=IF(B2=0,NA(),C2/B2)For datasets with missing values, add a separate missing-data check before division. Otherwise, spreadsheet arithmetic may treat an empty cell differently from a statistical package. Record whether the ratio describes individual observations or aggregated totals.
Serial correlation: test the residuals, not just the series
A time series can display persistence without invalidating every regression that uses it. The relevant regression question concerns the disturbance process after conditioning on the model. Accordingly, distinguish a series correlogram from a residual correlogram.
What the Durbin–Watson statistic measures
The simple production regression gives DW ≈ 1.7836, and the multiple regression gives DW ≈ 2.1141. In contrast, regressing the input-intensity ratio on an intercept alone gives DW ≈ 0.2842. The third result reflects pronounced persistence in deviations from the ratio’s sample mean.
Values near two often suggest little first-order residual correlation. Nevertheless, that rule of thumb is not a hypothesis test. Formal interpretation depends on the model, regressors, sample size, and relevant critical values.
Why “DW near two” is not a clean bill of health
A model can have higher-order dependence even when its first-order diagnostic looks unremarkable. Moreover, the conventional Durbin–Watson testing framework does not apply straightforwardly when lagged dependent variables enter the regression. Therefore, use diagnostics that match the specification.
EViews provides residual correlograms and serial-correlation LM testing. In its equation window, the documented residual-diagnostics menu includes the LM test and a choice of test order. Save that order alongside the reported result so another analyst can reproduce the check.
Reference: EViews: residual diagnostics.
Choose a repair that matches the problem
| Possible problem | Potential response | What the response does not guarantee |
|---|---|---|
| Omitted seasonal or dynamic structure | Add theoretically justified terms | Causal identification |
| Autoregressive disturbances | Estimate a regression with AR errors | Correct mean specification |
| Valid coefficient model but dependent errors | Consider HAC standard errors | Removal of coefficient bias or nonstationarity |
| Unit roots or cointegration | Choose a suitable time-series specification | Validity of arbitrary differencing |
| Structural change | Investigate break dates and stability | Reliable inference from very short samples |
ut = ρut−1 + εt
An AR-error model describes persistence in the disturbance. By contrast, adding a lagged dependent variable changes the conditional mean equation. Those choices can lead to different economic interpretations, so avoid treating them as interchangeable buttons.
SAS documents autoregressive-error estimation through PROC AUTOREG. Its documentation also explains that sign conventions for reported AR parameters require care. Consequently, compare the actual model equations before comparing an EViews coefficient with a SAS coefficient.
Reference: SAS: regression with autocorrelated errors and parameter signs.
Unit root testing: specify the question before the test
Many economic series trend or remain highly persistent. A standard levels regression can then produce impressive fit without a meaningful stable relationship. Before applying conventional time-series inference, investigate the process that generates the observations.
The augmented Dickey–Fuller equation
The ADF null hypothesis is γ = 0, which represents a unit root in this specification. A sufficiently negative statistic provides evidence against that null. However, ordinary Student’s t critical values do not apply to the unit-root statistic.
Choose whether to include an intercept, a trend, or neither. Then choose the number of lagged differences and the sample. These decisions affect both the reference distribution and the test’s ability to detect departures from the null.
EViews allows analysts to select the series transformation, deterministic terms, and lag settings. Its documentation also warns that an ordinary unit-root test on estimated regression residuals needs different critical values for cointegration testing. Therefore, use the appropriate cointegration routine rather than reusing a standalone ADF threshold.
Reference: EViews: unit root testing and specification choices.
What the historical ADF output supports
The supplied chapter first reports a levels test that does not reject a unit root. It then reports a first-difference test statistic around −2.711. In that second output, the statistic crosses the displayed 10% threshold but not the 5% threshold.
Thus, the result offers weaker evidence against a unit root in the differenced series than a conventional 5% rejection would provide. Avoid saying that the test “accepts” a unit root or definitively proves an integration order. Failure to reject may reflect limited power, especially with a small sample.
The underlying series for this historical ADF exercise is not fully supplied in the photographs. Accordingly, these statements interpret the displayed output rather than claim an independent replication. A reproducible new study must retain the full series and exact test settings.
Differencing is a modeling choice, not a cleanup command
First differences describe period-to-period changes. Log differences approximately describe proportional changes when the changes are small. As a result, differencing changes the economic question as well as the statistical properties.
Furthermore, cointegrated nonstationary variables may contain a meaningful long-run relationship. An error-correction model can combine that relationship with short-run movements. Automatically differencing everything can discard information that the research question needs.
Granger causality: predictive information and a lag budget
A Granger causality test asks whether past values of one variable improve prediction of another after accounting for specified information already in the model. It addresses predictive content. A successful test alone does not establish a causal effect from an intervention.
The restricted and unrestricted comparison
H0: c1 = c2 = … = cp = 0
The unrestricted equation includes both sets of lags. By contrast, the restricted equation omits the lagged X terms. Therefore, the test compares the improvement in fit with the number of restrictions and the remaining residual degrees of freedom.
In a two-variable model with an intercept and p lags of each variable, kᵤ = 1 + 2p. With T consecutive complete observations and no additional sample loss, nₑff = T − p. Consequently, the residual degrees of freedom equal T − 3p − 1.
Why six lags can be expensive
The supplied example begins with 35 annual observations and uses six lags. Accordingly, the reported estimation sample contains 29 observations. Each unrestricted equation includes 13 coefficients, leaving just 16 residual degrees of freedom.
| Lags p | Effective observations | Coefficients per equation | Residual df |
|---|---|---|---|
| 1 | 34 | 3 | 31 |
| 2 | 33 | 5 | 28 |
| 4 | 31 | 9 | 22 |
| 6 | 29 | 13 | 16 |
| 8 | 27 | 17 | 10 |
| 10 | 25 | 21 | 4 |
At ten lags, only four residual degrees of freedom remain. Therefore, a seemingly modest lag change can greatly reduce precision. More data history does not automatically justify more parameters when the effective sample is short.
Read both directions separately
| Null hypothesis | Reported F | Reported p-value | Decision at 5% |
|---|---|---|---|
| X does not Granger-cause Y | 2.59601 | 0.05957 | Do not reject |
| Y does not Granger-cause X | 0.53553 | 0.77363 | Do not reject |
At 5%, neither direction rejects its null. Under a preselected 10% rule, the X-to-Y direction would reject, while the reverse direction would not. However, choosing a significance threshold after seeing the p-value weakens the interpretation.
The first p-value also does not mean there is a 5.957% probability that the null is true. It describes the extremeness of the test statistic under the null and the test assumptions. Report the numerical result and uncertainty rather than forcing a dramatic yes-or-no causal narrative.
EViews documents the command cause(6) x y for a six-lag pairwise test. The standard pairwise specification includes an intercept and lags of the two variables; it does not automatically control for every other series in a workfile. Additional conditioning variables require a suitable broader model.
Reference: EViews: pairwise Granger causality command and regressors.
Check the time-series framework first
Ordinary finite-order Granger testing requires a suitable stationary framework for its conventional reference distribution. If the variables are integrated or cointegrated, choose an appropriate formulation, such as a justified error-correction approach or a carefully implemented augmented-VAR method. Simply copying the lag count from an old example does not establish validity.
Also consider omitted common drivers, release timing, and residual dependence. A variable published later may appear to predict another only because the dataset assigns both values to the same reference period. For operational forecasting, align observations by when the information became available.
Computer applications in econometrics across three tools
The following workflows use the same production table. Their purpose is to preserve the model across interfaces. Nevertheless, menu names and installation details can differ by version, so consult the linked vendor documentation for your environment.
Excel: make the worksheet auditable
- Create a production sheet with headers: year, corn, fertilizer, insecticide.
- Place the ten observations in rows 2 through 11.
- Keep an untouched copy of the source values.
- Activate the Analysis ToolPak if the Data Analysis command is unavailable.
- Choose Regression, using corn as Y and both inputs as X.
- Match the Labels option to whether your ranges include headers.
- Request residuals and save the output beside the sample definition.
Alternatively, the formula below requests coefficients and additional regression statistics. For the stated column arrangement, the first returned row orders the slopes as insecticide, fertilizer, and then intercept. Thus, labeling coefficients without checking array order can reverse the economic interpretation.
=LINEST(B2:B11,C2:D11,TRUE,TRUE)Keep the intercept unless theory justifies a zero-intercept model. Moreover, do not mix a chart’s rounded trendline equation with full-precision coefficients for subsequent calculations. Use the underlying regression output when calculating predictions and residuals.
Reference: Microsoft: LINEST syntax, returned coefficient order, and statistics.
EViews: define the dates and save the equation
Create an annual workfile covering 1971–1980, then import the production table with the correct variable names. Verify the year alignment before estimating. Afterward, retain the equation object and the sample selection.
' After importing and checking the annual series:
smpl 1971 1980
series ratio = fertilizer/corn
equation eq_simple.ls corn c fertilizer
equation eq_multiple.ls corn c fertilizer insecticide
' A different disturbance specification, for investigation:
equation eq_ar1.ls corn c fertilizer insecticide ar(1)The AR(1) line illustrates a different specification; it is not an instruction to add AR errors automatically. In particular, inspect residual diagnostics and the available sample before choosing that model. Small datasets offer limited room for additional parameters.
For ADF testing, record the transformation, deterministic terms, and lag-selection method. Likewise, for Granger testing, record both directions, the lag count, and the effective sample. Those settings matter more for reproducibility than a screenshot of the toolbar.
SAS: import explicitly and inspect the log
The following program embeds the ten observations so that no external path is necessary. In practice, replace the inline data with an explicitly configured import from your source file. Then inspect the log for conversion problems, missing values, and unexpected row counts.
data production;
infile datalines dsd truncover;
input year corn fertilizer insecticide;
if corn > 0 then ratio = fertilizer/corn;
else ratio = .;
datalines;
1971,40,6,4
1972,44,10,4
1973,46,12,5
1974,48,14,7
1975,52,16,9
1976,58,18,12
1977,60,22,14
1978,68,24,20
1979,74,26,21
1980,80,32,24
;
run;
proc print data=production;
run;
proc means data=production n nmiss mean std min max;
var corn fertilizer insecticide ratio;
run;
proc corr data=production;
var corn fertilizer insecticide;
run;
proc reg data=production;
model corn = fertilizer insecticide / vif;
output out=regcheck p=fitted r=residual;
run;
quit;The DSD option handles comma-delimited input and consecutive delimiters as missing fields. Meanwhile, PROC REG estimates the linear model and writes fitted values and residuals to a separate dataset. These saved objects make later checks easier to reproduce.
Reference: SAS DATA step statements: INFILE and DSD.
Reference: SAS: PROC REG reference.
For an exploratory AR(1)-error specification in an installation with SAS/ETS, the corresponding procedure is:
proc autoreg data=production;
model corn = fertilizer insecticide / nlag=1 method=ml;
run;However, matching an AR-error order across programs does not ensure identical likelihood conventions or treatment of initial observations. Record the estimation method and compare the retained sample. The code examples are templates; the numerical benchmarks in this article come from independent calculations, not claimed live runs of Excel, EViews, or SAS.
Reference: SAS: autoregressive error model estimation methods.
Reproducibility: explain why two programs disagree
When coefficients differ across programs, investigate the inputs before questioning the numerical algorithm. Often, the packages estimated different models or used different observations. A systematic comparison usually reveals the source of the discrepancy.
| Check | How a mismatch changes results |
|---|---|
| Observation count | Missing values or lags alter the estimation sample |
| Dates and sort order | Misalignment changes pairings and time-series calculations |
| Intercept | Dropping it changes coefficients and fit measures |
| Units and transformations | Percent versus proportion or level versus log changes scale |
| Variance estimator | Classical, robust, and HAC errors produce different inference |
| Test direction | One-sided and two-sided p-values answer different questions |
| Degrees of freedom | Sample and population formulas use different denominators |
| Precision | Rounded coefficients generate different fitted values |
| Optimization and initialization | Dynamic models can use different estimation conventions |
Use numerical invariants as quick error detectors
Several identities provide inexpensive checks. For example, an intercept-only OLS estimate must equal the sample mean. In a simple OLS regression with an intercept and the same complete observations, R² must equal the squared Pearson correlation.
Likewise, the ANOVA sums of squares must reconcile: 130 + 110 = 240. For the multiple production regression, fitted values plus residuals must recover actual output. Therefore, these checks can expose a range mismatch without requiring a second software package.
Do not let revised economic data leak into historical forecasts
Real economic databases can revise previously published observations. As a result, today’s value for a past period may differ from the value an analyst knew at that time. A historical forecast experiment should respect that information boundary.
The Federal Reserve Bank of St. Louis explains that FRED displays updated vintages while ALFRED preserves earlier releases. Accordingly, use vintage information when your question concerns real-time decisions. Saving only a download date may be insufficient for reconstructing the information set available at an earlier forecast origin.
Reference: Federal Reserve Bank of St. Louis: Data Revisions with FRED.
Save a compact analysis record
Keep the raw file, data dictionary, cleaning rules, software version, model formula, and sample definition together. Then retain the output and enough code or formulas to rebuild it. Finally, record which values came from original data, which came from transformations, and which results you transcribed from a historical source.
For a time-series model, add the observation frequency, date range, lag structure, deterministic terms, and covariance estimator. Additionally, for a hypothesis test, state the null, alternative, significance level, and assumptions. Clear reporting often prevents more confusion than another page of coefficients.
Twelve checkpoints connecting the chapter topics
| Checkpoint | Your verification target |
|---|---|
| 1. Explain the computer’s role | Separate calculation from model justification |
| 2. Distinguish data formats | Identify delimiters or fixed character positions |
| 3. Import text safely | Preserve spaces in names and inspect missing values |
| 4. Describe and standardize | Mean 7; sample SD 1.563472 |
| 5. Compare packaging means | One-sample p 0.10119; ANOVA p 0.00927 |
| 6. Fit a simple production model | Slope 1.659722; R² 0.971049 |
| 7. Add the second input | Fertilizer slope 0.650051; R² 0.991634 |
| 8. Move data between tools | Retain ten correctly dated observations |
| 9. Calculate input intensity | Mean ratio 0.301881 |
| 10. Investigate serial dependence | Ratio-on-constant DW 0.2842 |
| 11. Read an ADF result | Identify null, deterministic terms, lags, and threshold |
| 12. Interpret Granger output | 29 usable observations; 16 residual df per unrestricted equation |
Frequently asked questions
Can Excel handle econometric analysis?
Excel can support descriptive statistics, mean comparisons, and standard linear regression. However, more specialized time-series work requires additional implementation or suitable software. Choose the tool according to the model, then verify the actual capabilities of your installed version.
Which is better for beginners: Excel, EViews, or SAS?
The best starting point depends on your learning goal. Excel makes individual calculations visible, while EViews provides an organized environment for dated series. Meanwhile, SAS encourages explicit data-processing and estimation programs.
Does an R² above 0.99 mean the model is correct?
No. A high R² describes in-sample fit under a particular specification. For example, common trends, omitted variables, or overfitting can produce excellent fit without reliable causal interpretation or forecasting performance.
Should I always correct autocorrelation by adding AR(1)?
No. First investigate whether the problem reflects omitted dynamics, a trend, seasonality, nonstationarity, or the disturbance process. Then choose a response that matches the economic and statistical problem.
Does Granger causality establish real-world causation?
No. It tests incremental predictive information within a specified information set and lag structure. A causal claim additionally requires assumptions or a research design that addresses confounding and the meaning of an intervention.
Why do my results differ slightly from the printed example?
Small differences may come from rounding, sample selection, or software conventions. Larger differences often indicate a data entry error, a misplaced variable, or a changed specification. Compare the raw observations and model settings before interpreting the discrepancy.
How many observations do I need?
No single minimum works for every model. The answer depends on parameter count, signal strength, dependence, and the inferential goal. As the lag-budget table shows, 35 observations can leave only four residual degrees of freedom in a ten-lag bivariate equation.
Conclusion: make every result traceable
Computer applications in econometrics work best when every result connects to a clear question, a documented dataset, and a defensible model. Start with import checks, verify simple calculations, and only then move to regression and time-series inference. This sequence makes errors easier to find and conclusions easier to defend.
The examples also show why careful interpretation matters. A mean ratio differs from a ratio of totals, a higher R² can hide collinearity, and additional lags can consume most of a small sample. Therefore, the strongest analysis combines reliable computation with transparent reasoning about what the data can support.
