Is there someone who can help me decide which t-test I should use in this scenario:
I want to test if there is a significant difference between the means of blood sugar under two conditions.
I have a group of people who got their blood sugar measured twice. First time with the lights turned off and second time with the lights turned on. My outcome is the difference between the two blood sugar measurements.
I am not sure which test to use as I have already paired the data when using the difference as outcome.
Thanks,
Use the Wilcoxon signed-rank test in PROC UNIVARIATE on the difference.
Use the Wilcoxon signed-rank test in PROC UNIVARIATE on the difference.
Hi @StatDave May i seek your clarification as to why not a Paired T test assuming the samples are normally distributed?
You could use the t-test in UNIVARIATE if desired. That would be fine if the data are approximately normal in which case it will be a more powerful test.
Thank you!
Well.. next problem, I have a lot of conditions to test if they have an influence on the difference. How do I write the code, so I only look at one condition at the time?
@lone0708 wrote:
Well.. next problem, I have a lot of conditions to test if they have an influence on the difference. How do I write the code, so I only look at one condition at the time?
Give an example of "lot of conditions".
light on/off
fasting yes/no
standing yes/no
coffee yes/no
Sometimes the conditions are the same for blood sugar 1 and 2, meaning light could be on at both times, but sometimes they are not. I want to test, if fx light have an influence on the difference between first and second measurement
my dataset looks like this:
Patient number blood sugar 1 blood sugar 2 blood sugar difference light fasting standing
patient 1
patient 2
patient 3
In PROC UNIVARIATE, place all the variable names (light, fasting, standing, coffee, ...) into the VAR statement.
Thanks PaigeMiller,
When I write my code.
proc univariate data = have;
var difference light fasting standing coffee; run;
I get a procedure for every variable (obviously...), how will I know if the "condition"-variables influence on the difference?
It's the same output as for the blood sugar difference.
See the example here:
https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/procstat/procstat_univariate_examples13.htm
at the bottom, it says "Signed Rank" and under p-value, it has the number 0.5278. If this number is less than 0.05 (that's the usual cutoff), then the two groups are considered to have a different mean. Since, in the example, it is greater than 0.05, then the two groups are considered to not have a different mean. * This is the layman's explanation, statisticians use other words to explain this to other statisticians.
Your data is still not entirely clear. If each patient is measured only twice and if the settings of light, standing, fasting, and coffee are recorded for each of those two measurements, then you need to fit a model that includes the four variables as predictors and that can adjust for the correlation between the two values within each patient. There are various modeling approaches, but one is a Generalized Estimating Equations model as can be fit by PROC GEE. You need to rearrange your data so that each patient has two observations with the response value and the setting of light, standing, fasting, and coffee recorded. Also a patientID variable that has the same value for the two observations from one patient. You can then fit a model like the following. The test of the parameter for each of the four variables is a test of the effect of the variable.
proc gee;
class light standing fasting coffee;
model bloodsugar = light standing fasting coffee;
repeated subject=patientID;
run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.