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

Consider the following simple linear regression model:

PRICE = β0 +β1 POOL +ε

In the data set, verify that POOL is 1 if a house has a swimming pool, 0 otherwise. Using the proc ttest output, complete the table below.  Use only the proc ttest output.

saza_0-1648148893155.png

 

So I was trained to use proc reg on a question like this but was asked to use proc t-test. I think this should be my code since "1" means there is a pool and "0" means there isn't a pool

proc ttest data=sarah.homeprices;
var price;
class pool;
run;

 

saza_1-1648148916153.png

The problem is that when I run a proc ttest I don't see the model parameter or point estimate like proc reg

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

Yes. Most estimates are "point estimates" with the exception of confidence intervals, which we call "interval estimates."

 

The equivalent regression code is not PROC REG because PROC REG does not support a CLASS statement. The equivalent regression procedure is PROC GLM. Compare your TTEST output to the output of this call to PROC GLM:

proc GLM data=sarah.homeprices plots=none;
class pool;
model price = pool / solution;
quit;

View solution in original post

11 REPLIES 11
PaigeMiller
Diamond | Level 26

When POOL=1, the mean is 163050. When POOL=0, the mean is 169672. Therefore, the difference is –6622. This would be the point estimate. From there, you can read the confidence interval from the table, making sure to change the sign.

--
Paige Miller
saza
Quartz | Level 8
So I was able to run a proc reg to get my answer for the perameter estimate to be -6622 but was wondering how the -6622 came to be. Thank you for explaining that! Is the perameter estimate the same as point estimate?
Rick_SAS
SAS Super FREQ

Yes. Most estimates are "point estimates" with the exception of confidence intervals, which we call "interval estimates."

 

The equivalent regression code is not PROC REG because PROC REG does not support a CLASS statement. The equivalent regression procedure is PROC GLM. Compare your TTEST output to the output of this call to PROC GLM:

proc GLM data=sarah.homeprices plots=none;
class pool;
model price = pool / solution;
quit;
saza
Quartz | Level 8
So PRICE = β0 +β1 POOL +β2(SIZE −2200)+ε the code would have to use proc reg instead of proc glm?
Rick_SAS
SAS Super FREQ

Neither procedure has syntax for the term β2(SIZE −2200). You would need to create a new variable (SIZE22 = SIZE - 2200) and then use that variable in the model.

 

In general, PROC GLM can fit all the linear models that PROC REG fits. GLM is more useful when you have classification variables that contain more than two levels or when you have character variables.

 

saza
Quartz | Level 8
data newprices;
set sarah.homeprices;
size2200 = (size - 2200);
run;

proc reg data=newprices;
model price = size2200 pool;
run;

for some reason its making a new dataset with just the variable size2200
Rick_SAS
SAS Super FREQ

> for some reason its making a new dataset with just the variable size2200

 

??? The NEWPRICES data set should contain all the original variables, plus the new SIZE2200 variable.

saza
Quartz | Level 8
Thats exactly my confusion. I'm trying to post what I get when I run the following code:
data newprices;
set sarah.homeprices;
size2200 = (size - 2200);
run;
For some reason the screenshot won't paste but its basically a blank table. I ran my libname again and it still the same.
Rick_SAS
SAS Super FREQ

Run 
PROC CONTENTS data=sarah.homeprices; run;

 

Is it possible that you accidentally overwrote sarah.homeprices?  Sometimes novices try to modify a data set in place like this:

 

/* DON'T DO THIS. A MISTAKE CAN DELETE THE DATA */
data sarah.homeprices;
set sarah.homeprices;
/* more lines go here....
   but an ERROR muight result in overwriting the data with 0 obs */
run;
saza
Quartz | Level 8
I was able to obtain my point estimate and parameter model value using the following code you guided me through however, I was wondering if I can obtain the CI 95% intervals by manipulating this code?
data newprices;
set sarah.homeprices;
size2200 = (size - 2200);
run;

proc reg data=newprices;
model price = size2200 pool;
run;

I tried running a proc ttest but it would not let me use my new variable 'size2200' since it has two levels
Rick_SAS
SAS Super FREQ

95% confidence limits for what? The regression coefficients? You can use 

model price = size2200 pool / CLB;

 

The documentation for PROC REG discusses other options that produce different confidence intervals. Please read about the options on the MODEL statement. 

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 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 11 replies
  • 2520 views
  • 4 likes
  • 3 in conversation