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.
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.
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
(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
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.
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.
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.
Helpful. Thanks
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.
Look at the doc for the TEST statement.
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
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: