Calcite | Level 5

## 1) are the two lines coincident? 2) are the slopes different? 3) are the intercepts different?

I want to answer the following questions:

• are the lines coincident?
• are the slopes different?
• are the intercepts different?

For that, I have used the following piece of code:

PROC REG DATA=ALL;

MODEL Y = X Z1 Z2  XZ1 XZ2 Z1Z2;

INTERCEP: TEST Z1, Z2;

SLOPE: TEST XZ1, XZ2;

COINCID: TEST Z1, Z2, XZ1, XZ2;

RUN;

How can I interpret the results?

Best,

Santiago

1 ACCEPTED SOLUTION

Accepted Solutions
Super User

## Re: 1) are the two lines coincident? 2) are the slopes different? 3) are the intercepts different?

Sometimes a picture is worth a lot of tests:

```proc sgplot data=have;
reg x=x y=y/group=z1;
run;```

Or set ods graphics one and use the PLOTS statement of Proc Reg or Proc GLm or ...

7 REPLIES 7
Diamond | Level 26

## Re: 1) are the two lines coincident? 2) are the slopes different? 3) are the intercepts different?

More explanation is needed.

What are the variables X Z1 Z2 XZ1 XZ2 Z1Z2?

--
Paige Miller
Calcite | Level 5

## Re: 1) are the two lines coincident? 2) are the slopes different? 3) are the intercepts different?

X is a continuous explanatory variable; Y is a continuous dependent variable, Z1 and Z2 are dichotomous variables. An example of the data is:

 Y X Z1 Z2 0.38448 11134.94 1 0 0.42872 10280.34 1 0 0.45391 12595.40 1 0 0.26954 7461.27 1 0 0.49276 13352.59 1 0 1.09706 33692.40 1 0 0.31529 8987.04 1 0 0.20629 5190.80 1 0 0.49011 15962.34 1 0 0.23585 6454.96 1 0 0.54901 14717.25 1 0 0.26269 7757.72 1 0 0.62173 14394.44 1 0 0.60383 18041.02 1 0 0.47756 13406.98 1 0 0.44168 11272.19 1 0 0.09205 2349.10 1 0 0.32221 8780.78 1 0 0.19188 5586.24 1 0 0.19467 4797.40 1 0 0.08793 2121.80 1 0 0.13247 3744.60 1 0 0.22353 5683.04 1 0 0.09343 2175.01 1 0 0.47902 13764.63 0 1 0.21821 5703.75 0 1 0.08321 1954.22 0 1 0.15906 4490.16 0 1 0.50418 15138.00 0 1 0.08847 2178.00 0 1 0.16686 4471.20 0 1 0.17571 4435.76 0 1 0.27287 7337.30 0 1 0.05631 1362.18 0 1 0.13135 3717.12 0 1 0.41391 11741.91 0 1 0.13025 3207.24 0 1 0.34055 10097.38 0 1 0.32904 8126.60 0 1 0.47509 12354.75 0 1 0.80383 23064.00 0 1 0.66650 18758.08 0 1
Super User

## Re: 1) are the two lines coincident? 2) are the slopes different? 3) are the intercepts different?

Sometimes a picture is worth a lot of tests:

```proc sgplot data=have;
reg x=x y=y/group=z1;
run;```

Or set ods graphics one and use the PLOTS statement of Proc Reg or Proc GLm or ...

Diamond | Level 26

## Re: 1) are the two lines coincident? 2) are the slopes different? 3) are the intercepts different?

I'm surprised you don't get an error from PROC REG since Z1 and Z2 are perfectly correlated. But I really don't use PROC REG much any more.

I would do this in PROC GLM (in which case Z2 is not needed)

``````proc glm data=have;
class z1;
model y=x z1 x*z1;
run; quit;``````

If the statistical test of the effect of Z1 is statistically significant then the intercepts are different. If the effect of X*Z1 is significant, then the slopes are different. I might want to think about this a little more, but if the tests for both Z1 and X*Z1 are both not significant, then the lines are coincident (except for random noise).

--
Paige Miller
Calcite | Level 5

## Re: 1) are the two lines coincident? 2) are the slopes different? 3) are the intercepts different?

Calcite | Level 5

## Re: 1) are the two lines coincident? 2) are the slopes different? 3) are the intercepts different?

Thanks so much for your support...

Diamond | Level 26

## Re: 1) are the two lines coincident? 2) are the slopes different? 3) are the intercepts different?

So in your original problem statement, you were performing statistical testing in PROC REG. Then you mark correct the answer which just draws plots. I don't think plots is the correct answer, although it may be very helpful to have a plot, there is no statistical testing going on.

--
Paige Miller
From SAS Users blog