Given the following simple linear regression model:
$$y = ax + \epsilon$$
where the variance is normally distributed, I'd like to learn the maximum likelihood estimates for $a$ (which is a scalar) and $\sigma^2$. I'm confident in my estimate for $\sigma^2$ but not $a$.
First I derived the log likelihood. I obtained:
$$\frac{-N}2log(2\pi) - \frac{-N}2log(\sigma^2) - \frac{1}{2\sigma^2}\sum_{i=1}^n (y_i-ax_i)^2$$
After calculating the derivative of the log likelihood with respect to $a$, I obtain:
$$\frac{1}{\sigma^2}\sum_{i=1}^n (y_i-ax_i)x_i = 0$$
Assuming this is right (it's been a long time since I took calc) then wouldn't the estimate for $a$ be the following?
$$\frac{\sum_{i=1}^n y_i}{\sum_{i=1}^n x_i}$$
But this doesn't seem to match any of the other solutions I've seen on CV or elsewhere for this estimate (i.e. http://www.stat.cmu.edu/~cshalizi/mreg/15/lectures/05/lecture-05.pdf)
I apologize if I've made a stupid math error here. Any tips would be much appreciated. Thanks!