Hello!
I have a set of data with two independent measurements, these are of two different valves (let's call them valve 1 and valve 2) placed on a patient during specific procedures that measure different pressures. I am looking for the best statistical method using SAS to analyze my data so that I can answer the following question: Will a change in the measurement/pressure of valve 1 allow me to predict a change in valve 2?
The measurements have been recorded multiple times of the same subject in different situations so that to make sure to capture the change in pressure of valve 1 and valve 2 if any at different times (thinking it would help with the statistical analysis/prediction that if something changes in valve 1 it'll allow us to predict a change coming in valve 2). The data is numeric.
Thanks!
If you are in a class, you should use the method that you have learned about in class. For example, you could use PROC GLM if you choose to ignore that the measurements are for different subjects. If you want a model that takes subjects into account, you could use a mixed model, like the following:
data Have;
length Position $8;
input Subject Position valve1 valve2;
datalines;
1 Standing 120 115
1 Sitting 90 86
2 Standing 118 114
2 Sitting 89 83
3 Standing 112 106
3 Sitting 80 76
4 Standing 116 112
4 Sitting 87 82
5 Standing 119 115
5 Sitting 85 80
;
proc sgplot data=Have;
scatter x=Valve1 y=Valve2 / group=Position;
run;
proc mixed data=Have;
class Subject Position(ref='Sitting');
model Valve2 = Valve1 Position / s chisq outpred=MixedOut;
random intercept / subject=Subject; /* each subject gets its own intercept */
run;
proc sort data=MixedOut; by Position Valve1; run;
proc sgplot data=MixedOut;
scatter x=Valve1 y=Valve2 / group=Position;
series x=Valve1 y=Pred / group=Position;
run;
Others might have alternative suggestions.
From your description, it sounds like the first variable is "Independent," meaning that you can control its value, and the measurement at the second valve is observed, which means it is dependent on the first.
This sounds like a classic regression problem in which you model the pressure at valve 2 as a function of the pressure at valve 1.
Which procedure you use depends on the design of the experiment and how you want to model the relationship.
I would feel comfortable using a classic regression, however, my variables are both independent. Meaning pressure in valve 1 does not cause the pressure in valve 2 and vice versa. I have multiple subjects and multiple measurements for each subject.
Regression is not about causality. You have an observational study in which you are observing two variables. You want to know whether you can predict P2 (conditionally) from the observed value of P1. Regression can do that without requiring that P1 causes P2.
If you really mean you have two correlated independent variables rather than one independent and one dependent variable, the the first principal component dimension will allow this prediction. (In this case linear regression gives different answers depending on which independent variable you choose as the dependent variable.)
It sounds to me like the pressure in valve 1 does not "cause" the pressure in valve 2, and vice versa, the pressure in valve 2 does not "cause" the pressure in value 1, but they are correlated? Is this correct?
Yes! That is correct, I do have two independent variables. The pressure in valve 1 does not cause the pressure in valve 2 and vice versa but they are correlated. And so I want to know how well a change in valve 1 will allow me to predict a change in valve 2
I forgot to mention that I do have multiple measurements of those two valves (at different time frames) on the same subjects
Please provide some sample data so we can see its structure and the names of variables. Maybe your variables are something like
Subject Time Pressure1 Pressure2
Subject valve 1 pressure standing position valve 2 pressure standing position valve 1 pressure sitting position valve 2 pressure sitting position etc.
1 120 115 90 86
2 118 114 89 83
3 112 106 80 76
4 116 112 87 82
5 119 115 85 80
Well, other than the multiple measurements, this is a job for using the first Principal Components vector to do the predictions. Once you include the multiple measurements at different time periods, I don't know how to do this. I'll have to think about it.
@Yughaber wrote:
Subject valve 1 pressure standing position valve 2 pressure standing position valve 1 pressure sitting position valve 2 pressure sitting position etc.
1 120 115 90 86
2 118 114 89 83
3 112 106 80 76
4 116 112 87 82
5 119 115 85 80
Where are the different time frames that you mentioned?
By "different" do you mean that one subject/observation could be measured at times 1 3 and 5 while another subject/observation could be measured at times 1 3 8 10?
Actually, I found out that the time frames don't matter in answering the question. The change of positions have also been done to ensure that a change in pressure in valve 1 will still allow us to predict a change in valve 2.
If you are in a class, you should use the method that you have learned about in class. For example, you could use PROC GLM if you choose to ignore that the measurements are for different subjects. If you want a model that takes subjects into account, you could use a mixed model, like the following:
data Have;
length Position $8;
input Subject Position valve1 valve2;
datalines;
1 Standing 120 115
1 Sitting 90 86
2 Standing 118 114
2 Sitting 89 83
3 Standing 112 106
3 Sitting 80 76
4 Standing 116 112
4 Sitting 87 82
5 Standing 119 115
5 Sitting 85 80
;
proc sgplot data=Have;
scatter x=Valve1 y=Valve2 / group=Position;
run;
proc mixed data=Have;
class Subject Position(ref='Sitting');
model Valve2 = Valve1 Position / s chisq outpred=MixedOut;
random intercept / subject=Subject; /* each subject gets its own intercept */
run;
proc sort data=MixedOut; by Position Valve1; run;
proc sgplot data=MixedOut;
scatter x=Valve1 y=Valve2 / group=Position;
series x=Valve1 y=Pred / group=Position;
run;
Others might have alternative suggestions.
This looks very nice, thank you!!
I guess my question remains with the proc mixed part of the code. Does that carry out a regression? and the (ref='Sitting') is what I am not clear on as well.
I have some impending deadlines, but I suspect that others can answer your remaining questions. Good luck.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.