Cpu Response Time
1. **Problem Statement:** We want to find a regression equation that predicts server response time (ms) based on CPU usage percentage.
2. **Data Given:**
CPU usage percentage ($x$): 20, 40, 60, 80, 100
Response time (ms) ($y$): 180, 120, 250, 320, 400
3. **Method:** We will use linear regression to find the best fit line $y = mx + b$ where $m$ is the slope and $b$ is the intercept.
4. **Formulas:**
Slope: $$m = \frac{n\sum xy - \sum x \sum y}{n\sum x^2 - (\sum x)^2}$$
Intercept: $$b = \frac{\sum y - m \sum x}{n}$$
where $n$ is the number of data points.
5. **Calculate sums:**
$\sum x = 20 + 40 + 60 + 80 + 100 = 300$
$\sum y = 180 + 120 + 250 + 320 + 400 = 1270$
$\sum xy = 20\times180 + 40\times120 + 60\times250 + 80\times320 + 100\times400 = 3600 + 4800 + 15000 + 25600 + 40000 = 89000$
$\sum x^2 = 20^2 + 40^2 + 60^2 + 80^2 + 100^2 = 400 + 1600 + 3600 + 6400 + 10000 = 22000$
$n = 5$
6. **Calculate slope $m$:**
$$m = \frac{5 \times 89000 - 300 \times 1270}{5 \times 22000 - 300^2} = \frac{445000 - 381000}{110000 - 90000} = \frac{64000}{20000} = 3.2$$
7. **Calculate intercept $b$:**
$$b = \frac{1270 - 3.2 \times 300}{5} = \frac{1270 - 960}{5} = \frac{310}{5} = 62$$
8. **Regression equation:**
$$y = 3.2x + 62$$
This means for each 1% increase in CPU usage, the response time increases by approximately 3.2 ms, starting from a base of 62 ms when CPU usage is 0%.