# Regression Analysis for Paired Data SAS

#### Mai Mehanna

##### New Member
Hi Everybody,

I want to analyze paired data using regression analysis to adjust for covariates. I used PROC MIXED statement in SAS and I modeled the difference as the Y in the model with my covariates as Xs. I have a problem regarding the interpretation of the output. So, basically, I want to know the difference in response adjusted for my covariates. However, the output gives me the parameter estimate for each predictor (for example, the difference in response between males and females for the gender covariates). How can I know the value of the actual difference adjusted for the covariates in the model?

So, basically, in independent data, I had a "Drug" column in my data to compare the difference in response between the 2 drugs (some patients took drug A and others took drug B). I did multiple linear regression using PROC GLM statement in SAS and I put the difference in response as Y and "Drug" as one of the Xs in my model beside other covariates.

Regarding the paired data, I don't have the "Drug" column because every patient took the 2 drugs. I want to compare the difference in response between the 2 drugs in each patient. So, here is my SAS code:

PROC MIXED DATA=PRA.PAIRED_1;
BY RACE;
MODEL DIFF_PAIRED = SEX pre_CSBP_BB pre_CSBP_TD / SOLUTION CLPARM;
RUN;
QUIT;
DIFF_PAIRED is the difference in response between the 2 drugs.

The output:

Covariance Parameter Estimates
Cov Parm Estimate
Residual 323.59

Fit Statistics
-2 Res Log Likelihood 1018.5
AIC (Smaller is Better) 1020.5
AICC (Smaller is Better) 1020.5
BIC (Smaller is Better) 1023.3

Solution for Fixed Effects
Effect Estimate Standard Error DF t Value Pr > |t| Alpha Lower Upper
Intercept -59.6842 25.3976 115 -2.35 0.0205 0.05 -109.99 -9.3765
SEX -7.7764 3.2996 115 -2.36 0.0201 0.05 -14.3122 -1.2406
pre_CSBP_BB -0.8725 0.1466 115 -5.95 <.0001 0.05 -1.1628 -0.5821
pre_CSBP_TD 1.3641 0.1476 115 9.24 <.0001 0.05 1.0717 1.6566

Type 3 Tests of Fixed Effects
Effect Num DF Den DF F Value Pr > F
SEX 1 115 5.55 0.0201
pre_CSBP_BB 1 115 35.42 <.0001
pre_CSBP_TD 1 115 85.38 <.0001
So, how can I know the difference between the 2 drugs adjusted for the covariates in the model, like the case of unpaired data (I used the "Drug" parameter estimate from the output).

#### hlsmith

##### Omega Contributor
So you just subtracted the two drug outcome values and used that as the DV? If you did that, why did you use the mixed model, especially without any random effects in the model?

#### Mai Mehanna

##### New Member
Do you mean that I can use PROC GLM with the calculated differences, even with the paired data?
I have another question too. If I used the GLM code, I would have the same problem which is how to get the predicted adjusted mean difference between the 2 drugs since I don't have "Drug" independent variable because all the patients received the same 2 drugs

#### hlsmith

##### Omega Contributor
Good point. Were treatments randomly ordered or systematic? Is there a washout or comparable reset?

Don't use diff, use actual values in mixed model with subject=subject _id _ variable option. You will also need to have a variable for treatment.

#### Mai Mehanna

##### New Member
The treatments were randomly assigned and yes, there was a washout period between the 2 drugs for each patient.
So, if I used the actual values for each drug (not the calculated differences between them) in a mixed model, do you mean that I would put the actual difference for drug A as the dependent variables= the actual difference for drug B, subject ID with the other covariates to be adjusted for? So, putting the patient ID in the model would give me the difference in each patient, not the predicted mean value

#### hlsmith

##### Omega Contributor
I will try to remember to write a piece of code in morning.

#### hlsmith

##### Omega Contributor
You need something like below. Also, you had race in class statement, but not in model?

Code:
``````[FONT=Courier New][SIZE=2][COLOR=#000080][FONT=Courier New][SIZE=2][COLOR=#000080][FONT=Courier New][SIZE=2][COLOR=#000080][B]proc MIXED [/B][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]data[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]=yourdata[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2];[/SIZE][/FONT][/SIZE][/FONT]
[FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT]
[FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]    class[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] Race ([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]ref[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]=[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]'1'[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]) / [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]param[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]=ref ;[/SIZE][/FONT][/SIZE][/FONT]
[FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]model[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] Outcome[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] = treatment_group SEX pre_CSBP_BB pre_CSBP_TD race;[/SIZE][/FONT][/SIZE][/FONT]
[FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]random[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] intercepts / [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]subject[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] = subject_id[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2];[/SIZE][/FONT][/SIZE][/FONT]
[FONT=Courier New][SIZE=2][COLOR=#000080][FONT=Courier New][SIZE=2][COLOR=#000080][FONT=Courier New][SIZE=2][COLOR=#000080][B]run[/B][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2];[/SIZE][/FONT][/SIZE][/FONT]``````