BookmarkSubscribeRSS Feed
Lilo
Fluorite | Level 6

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; 

 

6 REPLIES 6
PeterClemmensen
Tourmaline | Level 20

What is your hypothesis?

Lilo
Fluorite | Level 6

Hypothesis: Ho equals 0 against H1 does not equal 0

PaigeMiller
Diamond | Level 26

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?

--
Paige Miller
ballardw
Super User

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.

PaigeMiller
Diamond | Level 26

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.

 

 

--
Paige Miller
Ksharp
Super User
F test is for ANOVA . But you don't have CLASS variable .

SAS Innovate 2025: Call for Content

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!

Submit your idea!

SAS Enterprise Guide vs. SAS Studio

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 4671 views
  • 0 likes
  • 5 in conversation