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

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, 

1 ACCEPTED SOLUTION

Accepted Solutions
StatDave
SAS Super FREQ

Use the Wilcoxon signed-rank test in PROC UNIVARIATE on the difference.

View solution in original post

16 REPLIES 16
StatDave
SAS Super FREQ

Use the Wilcoxon signed-rank test in PROC UNIVARIATE on the difference.

lone0708
Fluorite | Level 6
Genius... thanks ;D
novinosrin
Tourmaline | Level 20

Hi @StatDave  May i seek your clarification as to why not a Paired T test assuming the samples are normally distributed? 

StatDave
SAS Super FREQ

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.

novinosrin
Tourmaline | Level 20

Thank you!

lone0708
Fluorite | Level 6

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? 

PaigeMiller
Diamond | Level 26

@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".

--
Paige Miller
lone0708
Fluorite | Level 6

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

PaigeMiller
Diamond | Level 26

In PROC UNIVARIATE, place all the variable names (light, fasting, standing, coffee, ...) into the VAR statement.

--
Paige Miller
lone0708
Fluorite | Level 6

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?

PaigeMiller
Diamond | Level 26

It's the same output as for the blood sugar difference.

--
Paige Miller
lone0708
Fluorite | Level 6
yes, I get an output for every variable - and then I look at the t tests p-value, but what does that p-value exactly tell me - if my question is whether the condition influences on how big the blood sugar difference is.

sorry... I am definitely not a statistician 🙂
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
StatDave
SAS Super FREQ

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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 16 replies
  • 1176 views
  • 1 like
  • 5 in conversation