Hello,
I am trying to find the appropriate code to run a F test to test a hypothesis but so far no luck
Here's the data:
data reghwk4;
input X Y;
datalines;
29.7 16.6
68.4 49.1
120.7 121.7
217.2 219.6
313.5 375.5
419.1 570.8
535.9 648.2
641.5 755.6
;
run;
This is what I have tried so far:
proc ttest data= reghwk4 / h0=0 sides=1;
class X;
var Y;
run;
proc anova data=reghwk4;
class Y X;
model Y=X;
run;
proc reg data= reghwk4;
model y=x;
run;
What is your hypothesis?
Hypothesis: Ho equals 0 against H1 does not equal 0
Hypothesis: Ho equals 0 against H1 does not equal 0
This explains nothing. What statistic are you comparing to zero? Means? Standard Deviations? Kurtosis?
Statistic is equal to zero on what variable? X or Y or both or something else?
Does your actual data have any repeats of values?
You probably want ANOVA but without Y as a class variable. But when there are no repeat values for the Class variable (or combinations) then the dependent variable has no variance. So the test doesn't report any results for the tests.
See this:
data reghwk4; input X Y; datalines; 29.7 16.6 68.4 49.1 120.7 121.7 217.2 219.6 313.5 375.5 419.1 570.8 535.9 648.2 641.5 755.6 29.7 16. 68.4 49. 120.7 121. 217.2 219. 313.5 375. 419.1 570. 535.9 648. 641.5 755. ; run; proc anova data=reghwk4; class X; model Y=X; run; quit;
Now there are multiple values for Y for each of the X's an so some variance to analyze.
You want to end Proc Anova with a Quit statement. It is one of the procedures you an use interactively with multiple model and optional statements and will be considered as "running" until a quit is supplied or another procedure runs.
Are you comparing mean of X to the mean of Y? It would really be good if you state that clearly. Are you doing a "paired t-test" or an "unpaired t-test" (which is called "Independent Sample t-test" at that link). None of these produce an F-test.
Are you testing the linear relationship between X and Y? It would be good if you state that clearly. It's not clear why you are using a CLASS statement when none of your variables are CLASS. Please explain.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.