Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Programming
- /
- SAS Procedures
- /
- Re: t-stat for intercept difference

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 09-17-2019 03:54 AM
(640 views)

Hi

I have run a regression on a dataset that has 2 different IDs, there is one X and one Y variable. I have an intercept and a coefficient for each one of these two IDs. My ultimate purpose is to Subtract intercept of ID5 from the intercept of ID1 (b0 (ID5) - b0 (ID1)) and measure NeweyWest t-stat of this difference. Please guide me in this regard, thanks.

See the code below that I am using for regression:

```
ods exclude all;
proc model data=Have;
by ID;
endo Y;
exog X;
instruments _exog_;
parms b0 b1;
Y=b0 + b1*X;
fit Y / gmm kernel=(bart,5,0) vardef=n;
ods output parameterestimates=Want;
run;
ods exclude none;
```

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

What is the model? Are the Month and Year variables important? Do you want the slopes to depend on the ID, or just the intercepts?

If the model is Y = X and the ID only affects the intercept, you can use

```
proc glm data=Have;
class ID(ref='5');
model Y = X ID / solution;
run;
```

In the ParameterEstimates table, the row for 'ID 1' shows the difference between the ID=1 level and the reference level (which is ID=5). The 't Value' column gives the value of the t statistic and the ''Pr > |t|)' column is the p value for the statistic.

5 REPLIES 5

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Do you want OLS or time series regression?

For OLS regression, you can use the CLASS statement and set the reference level of the ID variable to ID1. For example, here is an example that sets the reference level for the TYPE variable in an OLS regression?

```
proc glm data=sashelp.cars;
where type in ('Sedan' 'SUV' 'Truck' 'Wagon' 'Sports');
class type(ref='SUV'); /* set reference level for classification variable */
model mpg_city = weight type / solution;
run;
```

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

@Rick_SAS: Thanks for your reply. I think my question was not very clear. I have attached a sample of my data. I want to run OLS regression (not time series) on this data, and find t-stat for the difference in intercepts of these two IDs. Please guide. Thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

What is the model? Are the Month and Year variables important? Do you want the slopes to depend on the ID, or just the intercepts?

If the model is Y = X and the ID only affects the intercept, you can use

```
proc glm data=Have;
class ID(ref='5');
model Y = X ID / solution;
run;
```

In the ParameterEstimates table, the row for 'ID 1' shows the difference between the ID=1 level and the reference level (which is ID=5). The 't Value' column gives the value of the t statistic and the ''Pr > |t|)' column is the p value for the statistic.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

@Rick_SAS: My Y variable is monthly Returns, and X is Volatility. I want to run a simple OLS model i.e. Y=a+bX, grouped by ID. This means one intercept and beta from ID1, and one intercept and beta from ID5 should be shown by the regression. Year and Month are not of a concern in this regression. I am using proc model because I need Newey-West corrected standard errors and t-stat. If proc glm is used to measure the significance of intercepts difference, how would Newey-West approach be applied then? Please guide. Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

I believe I answered your first question. The intercept for ID=5 is the Intercept term in the model. The intercept for ID=1 is (Intercept + the estimate for ID=1). If you also want the slope to depend on the ID variable, change the model to

MODEL Y = X | ID / solution;

I don't know anything about Newey-West corrected standard errors, but you can ask questions about PROC MODEL and time series in the SAS Forecasting and Econometric community. From Wikipedia, it appears that Newey-West corrections are for autocorrelated and heteroskedastic errors in time series data. OLS regression assumes that you do not have autocorrelation or heteroskedasticity.

⏰

Time is running out to save with the early bird rate. Register by Friday, March 1 for just $695 - $100 off the standard rate.

Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events.** **

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.