# Sample used in calculating the sample regression function

Does the OLS (ordinary least squares) method of regression consider only one sample value in calculating the sample regression function (SRF)? If not, then how is the SRF created when there is more than one observation per $X_{i}$?

• Then according to you , if there are more than one values of Yi at a given Xi, then OLS can't be used to find SRF – akshit arora Feb 17 '18 at 12:52
• I am not sure what does SRF mean in this context. Can you clarify? – Tom Apr 17 '18 at 2:11
• Can you provide a little more context? – Dave Harris Apr 17 '18 at 2:59
• My question is supposed a table of data is given in which for each x there are more than y , then how to regess y on x – akshit arora Apr 17 '18 at 3:45
• Are the multiple y's due to ties or is it multi-valued? For example, do you have two men who are the same height, but with different weight? Or do you believe it is a relation and not a function as in $y=\pm\sqrt{x}$? If it is the former, then the ties do not matter. If it is the latter then you cannot use regression at all. – Dave Harris Apr 17 '18 at 5:19

It is not very clear what you're asking, but if the model is of the form

$$y_i = \beta_0 + \beta_1 x_i + \epsilon_i \tag{1}$$

Then the sample regression function (SRF)

$$\hat{y}_i = \beta_0 + \beta_1 x_i \tag{2}$$

indeed only considers one value of $x_i$ at the time. If you have a situation in which several observations $y$ are associated with the same value $x_i$, then a linear model is perhaps not appropriate for describing your data

• Then according to you ,if there are more than one values of Yi at a given Xi, then OLS can't be used to find SRF? – akshit arora Feb 18 '18 at 20:02
• @akshitarora That's not what I said. Eqn (2) an still be used to find the prediction $\hat{y}_i$. What I said is that if you have a bunch of values of possible $y$s for a given $x$ then perhaps a linear model with a single feature is not the best model for your system – caverac Feb 18 '18 at 20:05

OLS considers all values. The method doesn't care if some samples have the same X value as long as not all of them do.

In many cases there is no controversy in having multiple samples with the same Xi but different Yi.

For example, if you plot company turnover (Y) versus number of employees (X) for a sample of companies there can be companies that happen to have the exact same number of employees.

Suppose you use OLS to estimate the model:

$$Y_i = \beta_1 + \beta_2X_i + \varepsilon_i$$

Note that what $i$ indexes is not values of $X$ but units (eg individuals, countries) within the population of interest.

Given sample data for units $i=1,...,N$, OLS will find the values of $\beta_1$ and $\beta_2$ that minimize $\Sigma(Y_i - \beta_1 - \beta_2X_i)^2$. It does not matter at all if some of the $X_i$'s have the same value. The sum to be minimised is calculated over all the sample units.