Correlation between sleep hours and brain activity Say I am tracking my sleep for 1 week and these are the number of hours I sleep each night:

(5, 6, 9, 4, 8, 9, 6)

everyday that I track my sleep I am also taking a test that measures how well my brain is working these were my scores:

(45, 23, 33, 48, 68, 19, 26)

The higher the score the better.
Given these numbers, I would like to find out the optimal number of hours I would have to sleep to score the highest on this test. For example, the answer could be X amount of hours would give me the best chance of scoring highest on this test. I would like to know how to find X.
Any help that points me in the right direction would be incredibly appreciated!
 A: Now, I am assuming you just pulled those numbers out of a hat, because when I plotted them, I saw absolutely NO relationship between them. 
Theoretically, you will first need to have an idea of the underlying model, or a reasonably accurate approximation. For example, a quadratic model for the mean test score might be useful since it can accommodate linear (no limits to the benefit of sleep) and non-linear (diminishing or negative effects of too much sleep).
Then you will need to determine the form of the variability. I doubt normality will hold, so you may want to examine the residuals for a least squares fit to give you some ideas, then use a generalized linear model with the proper mean-variance relationship and a strictly positive range.
The alternative is to use a non-parametric regression...which is a vast field of techniques.
A: There is no correlation between the numbers.
Even if there were, it is such a small data set that even if there were a strong correlation between the two numbers, drawing a conclusion based on just 7 data points would be unwise.
Sleep is an important factor when taking an exam, but a) many factors other than sleep contribute to how well you do in a test, and (b) Sleep happens in cycles of 3-4 hours. When you "slept" for 9 hours, you probably: Slept for 3.5 hours, woke up for 2 hours then went back to sleep for 3.5 hours, or something. So "sleeping for 8 hours" may bring the same results as "sleeping for 9 hours" (it may not, but this sort of thing should be taken into consideration), c) Your data points is not independent of other data points: a poor night's sleep the day before may make you more tired and therefore more likely to have a better night's sleep the day after, or something like that.
Basically, to expect to draw a relationship conclusion from only 7 data points is ridiculous because the functioning of peoples' brains is very complicated and is affected by tonnes of factors, not just sleep the night before. Also, the number of hours of sleep does not by itself predict the quality of brain function. If you really wanted to see when you perform better on tests, you would have to control for all other factors - e.g. only compare days where the last 2 or 3 night's sleep were similar and you'd had no alcohol but had 2 cups of coffee, done the same amount of exercise etc (as these all affect deep sleep).
