BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Xinhui
Obsidian | Level 7

I run the regression by following code:  

proc reg data= hw3q1;

model y= x1 x2;

run;

next, I want to test following three null hypothesis:

1) coefficient on x1 is 5

2) coefficient on x2 is 2

3) the joint hypothesis that the coeffienct on x1 is 5 and the coefficient on x2 is 2; 

 

But I don't know how to do those three hypothesis test in SAS. 

I'm appreciate for your help. 

Thanks in advance. 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Something like this perhaps:

proc reg data= sashelp.class;
   model weight= age height ;
   ag: test age=1;
   ht: test height= 3;
   bt: test age=1, height=3 ;

run;
quit;

Not that that would be a very good model. But you should be able to run the code. The values of 1 and 3 were chosen above after running the regression once to use plausible values to test given the data. The coefficients reported were age = 1.278 and height 3.597 (rounded) so testing 1 and 3 seemed reasonable. You really want to provide the labels on your test as the label text appears in the tables as "Test ag Results for Dependent variable …" So you can refer back to your code to know which test is shown.

 

With the relatively large errors for the coefficients it isn't surprising that these tests fail to reject the test value. If you use AGE=8 for the AG test you can see what a possible rejection of the test value might look like.

View solution in original post

9 REPLIES 9
Xinhui
Obsidian | Level 7

I ran the regression, in my model I have two dependent variables. I want to test following null hypothesis: 

(i) the coefficient on  is 5;

(ii) the coefficient on  is 2;

and (iii) the joint hypothesis that the coefficient on  is 5 and the coefficient on  is 2.

 

How can I do those hypothesis in SAS? Please let me know how to code.

 

Thanks in advance

Xinhui
Obsidian | Level 7
I ran the regression in SAS, in my model I have two independent variables. I want to test following null hypothesis: 

(i) the coefficient on  is 5;

(ii) the coefficient on  is 2;

and (iii) the joint hypothesis that the coefficient on  is 5 and the coefficient on  is 2.

 

How can I do those hypothesis in SAS? Please let me know how to code.

 

Thanks in advance

ballardw
Super User

As an absolute minimum you should show the code you used to run your regression.

There are more than a dozen regression procedures and they have different options. Without knowing the options and procedures used it takes a lot of "did you do this" back and forth questioning.

 

Second is WHICH coefficient? (Likely helped by showing the procedure code used) But most models will create at least 2 coefficients: intercept plus coefficients for each independent variable for example with linear regression.

 

Third, since you only mention one coefficient it really is not clear on what a joint hypothesis would be. I suspect that the code would provide better details to approach that.

 

Best would actually be to provide code plus and example data set that the code can run against. The data should be provided as a data step. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against. Posting in a code box is critical as the message windows will reformat text and pasted data step code will sometimes not run because of that.

Xinhui
Obsidian | Level 7

Sorry for the confusion; 

the following is the code I used: 

proc reg data= hw3q1;

model y= x1 x2;

run;

next, I want to test following three null hypothesis:

1) coefficient on x1 is 5

2) coefficient on x2 is 2

3) the joint hypothesis that the coeffienct on x1 is 5 and the coefficient on x2 is 2; 

 

But I don't know how to do those three hypothesis test in SAS. 

I'm appreciate for your help. 

Thanks in advance. 

ballardw
Super User

Something like this perhaps:

proc reg data= sashelp.class;
   model weight= age height ;
   ag: test age=1;
   ht: test height= 3;
   bt: test age=1, height=3 ;

run;
quit;

Not that that would be a very good model. But you should be able to run the code. The values of 1 and 3 were chosen above after running the regression once to use plausible values to test given the data. The coefficients reported were age = 1.278 and height 3.597 (rounded) so testing 1 and 3 seemed reasonable. You really want to provide the labels on your test as the label text appears in the tables as "Test ag Results for Dependent variable …" So you can refer back to your code to know which test is shown.

 

With the relatively large errors for the coefficients it isn't surprising that these tests fail to reject the test value. If you use AGE=8 for the AG test you can see what a possible rejection of the test value might look like.

Xinhui
Obsidian | Level 7

Helpful. Thanks

Xinhui
Obsidian | Level 7

I run the regression by following code:  

proc reg data= hw3q1;

model y= x1 x2;

run;

next, I want to test following three null hypothesis:

1) coefficient on x1 is 5

2) coefficient on x2 is 2

3) the joint hypothesis that the coeffienct on x1 is 5 and the coefficient on x2 is 2; 

 

But I don't know how to do those three hypothesis test in SAS. 

I'm appreciate for your help. 

Thanks in advance. 

Reeza
Super User

You've now asked the question 4 times with two responses - I'll merge them all into this one shortly. Does the TEST statement not work for you?

Show the code you tried and please indicate what isn't working.

 

https://communities.sas.com/t5/Statistical-Procedures/Coefficient-test/m-p/631087

 

https://communities.sas.com/t5/New-SAS-User/Hypothesis-test/m-p/631085#M20885

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 9 replies
  • 1673 views
  • 2 likes
  • 4 in conversation