I have an equation $\Delta{y_t} = py_{t-1} +\epsilon_t$. I want to know what is the p value estimated using OLS. I have drawn the below calculations based on my bounded knowledge on OLS estimation with simple formulas.
Calculations:
$\Delta{y_t} = py_{t-1} +\epsilon_t$ => $y_t-y_{t-1} = py_{t-1} +\epsilon_t $
$\therefore y_t = y_{t-1}(p+1) +\epsilon_t$
We know,
$S = \sum[y_t - (y_{t-1}(p+1) + \epsilon_t)]^2$ [based on OLS]
Take differentiation w.r.t to p unknown variable
$\frac{\partial s }{\partial p} = \frac {\partial }{\partial p}(\sum[{y_t} - (y_{t-1}(p+1)+\epsilon_t)]^2$
$= 2 * \sum[{y_t} - [y_{t-1}(p+1) + \epsilon_t]]*[0 - \frac {\partial y_{t-1} (p+1)} {\partial p} + \frac{\partial \epsilon_t}{\partial p}]$
$=2*\sum[y_t - [y_{t-1}(p+1) + \epsilon_t] * y_{t-1}$
Equating to 0
$0 = \sum y_t y_{t-1} - \sum(y_{t-1})^2(p+1)- \sum \epsilon_ty_{t-1}$
$(p+1) \sum (y_{t-1})^2 +\epsilon_t \sum y_{t-1} = \sum y_t y_{t-1}$
$p+1 = \frac{\sum y_t y_{t-1} - \epsilon_t \sum y_{t-1}}{\sum (y_{t-1})^2}$
$\therefore$
$p = \frac{\sum y_t y_{t-1} - \epsilon_t \sum y_{t-1}} {\sum (y_{t-1})^2} - 1$
I am obtaining the p value as above. Can someone say whether the calculations done are in the right manner or not? Thanx for any guidance.
Ditching the ε terms in the estimator (you can read about the derivation at many places on the web).
For the equation
$ y_t = y_{t-1}(p+1) +\epsilon_t$
The OLS estimator is $p = \frac{\sum y_t y_{t-1} }{\sum (y_{t-1})^2} - 1$
Is this what you are implementing for your Dickey Fuller problem?