Suppose that we have the simple linear regression model for the form:
$$Y_i = \beta X_i +\varepsilon_i$$
With the following set of 'classical assumptions' holding:
$E(\varepsilon_i)=0$
$Var(\varepsilon_i) = {E}(\varepsilon_i^2)-{E}(\varepsilon_i)^2= {E}(\varepsilon_i^2) = \sigma^2$
$Cov(\varepsilon_i, \varepsilon_j)=0$ for all $i\neq j$
$\varepsilon_i$ is normal
$X_i$ are constants, rather than random variables.
I want to find the maximum liklihood estimator for $\sigma^2$ assuming it is unknown, and the maximum liklihood estimator for $\beta$ assuming that $\sigma^2$ is unknown.
As background, assuming that $\sigma^2$ is known, I have the following showing the OLS estimator is the MLE estimator.
From this, we can see that the OLS estimator for $\beta$ is given by solving the following:
$$ \text{minimize s.t.} \beta: f(\beta) =\sum (\hat{\varepsilon_i}^2) = \sum (Y_i - \beta X_i)^2$$
We can easily see that as $\frac{df}{d\beta} = \sum (-2Y_iX_i + \beta^2 X_i^2)$ and $\frac{d^2f}{d\beta^2} = 2X_i^2 \geq 0$ then the OLS estimator for $\beta$ is given by:
$$\hat{\beta} = \dfrac{\sum X_iY_i}{\sum X_i^2}$$
We can easily show that this is also the maximum liklihood estimator. We start by looking at the liklihood function, defined as the joint probability density function of the $Y_i's$, and recalling that the assumption that $\varepsilon_i$ is normal implies that the $Y_i$ are normal. We have:
$$L(\beta) = \prod \frac{1}{\sqrt{2\pi\sigma^2}}\exp(\frac{-1}{2\sigma^2}(Y_i - \beta X_i)^2)$$
$$ \therefore L(\beta) \frac{1}{(2\pi \sigma^2)^{\frac{N}{2}}} \exp (\frac{-1}{2\sigma^2}\sum (Y_i - \beta X_i)^2$$
If we then consider the log-liklihood function, we get:
$$l(\beta) = \text{ln} \left [ \frac{1}{(2\pi \sigma^2)^{\frac{N}{2}}} \right ]\frac{-1}{2\sigma^2}\sum (Y_i - \beta X_i)^2$$
This is once again a fairly straightforward problem to maximise $l(\beta)$ which once again shows that $$\hat{\beta} = \frac{\sum Y_iX_i}{\sum X_i^2}$$
This is where I get a little confused. Am I to take the maximum liklihood function as: $$L(\beta,\sigma^2) = \prod \frac{1}{\sqrt{2\pi\sigma^2}}\exp(\frac{-1}{2\sigma^2}(Y_i - \beta X_i)^2)$$
and then find the maximum for this in terms of both $\sigma^2$ and $\beta$. Moreover, it's not clear to me where I actually used the assumption that $\sigma^2$ is known? This is obviously relevant when considering confidence intervals, hypothesis test etc. but it is not clear to me how $\sigma^2$ being known or unknow impacts the derivations above.
Thanks for any help,
Hmmm16