# How to do linear regression for multiple subjects

#### Davidk

##### New Member
Hello,

super - basic question, thanks in advance:

I'm trying to analyze the impact of group session meetings on sleep quality of (preliminary 7, but around 28 subjects eventually) 7 different patients.

Each morning they have assigned the time they slept (in minutets for instance) for a period of 28 days. Meaning I have 7 observations per day, for 28 days.
how would you present the data? what analysis would you recommend?

a simple option I came up with is calculating the mean of each day and then to run a lin reg on the means but it swipes the fact I have 7 observations for each day and maybe weakens the power(?)

#### Karabiner

##### TS Contributor
You observed 7 subjects over 28 days. Where is the intervention?
calculating the mean of each day and then to run a lin reg on the means
With what research question? With what predictor variable(s)?

With kind regards

Karabiner

Last edited:

#### Davidk

##### New Member
Hey Karabiner, thank you for responding.

The intervention is CBT session. There are 4 of those during the month I followed the patients but for now I'm not interested in checking how they interfered independently but more on did the process had an impact.

The question is - my H0 is that along the period (28 days) the variable sleep time in minutes (more precisely - delta sleep time - the time they were in bed minus the time they were asleep) did not change. The H1 is that there is an improvement in this measure (delta sleep time in minutes).

In other words - I have a continuous dependent variable sleep time in minutes (or delta sleep time in minutes) and an ordinal discrete independent variable (days).

As for observations I have 7 different observations (7 patients) for each night, along 28 nights.

#### Karabiner

##### TS Contributor
The intervention is CBT session. There are 4 of those during the month I followed the patients but for now I'm not interested in checking how they interfered independently but more on did the process had an impact.
But you cannot determine the impact of the process, since you have no control group?
Any changes over time could be do to regression effects, natural course, placebo effects or something like that.
But, of course you can try to determine whether there was any change over time at all.
You could perform a repeated-measures analysis of variance with the repeated-measures factor "day" (28 levels),
and include an appropriate linear contrast fpr comparison between the 28 levels.
Or, you could calculate the 7 individual correlations between "day" and "sleep time" and display them graphically (boxplots)
and by using appropriate desciptive statistics (e.g. min, max, median.)
Or, you regress "sleep time" on "day" in the context of a multilevel model, where these measurements are nested within subjects.

HTH

Karabiner

Last edited:

#### Davidk

##### New Member
It's correct. I would not be able determine if the change is due to the process or time. I'm looking for change over time. I'll try to preform a repeated measure analysis and to read a little bit (I'm not sure I understand the linear contrast issue)

Thank you