The idea of estimating the order of numerical scheme is following. If you have only one discretization parameter, say $dt$, you start with an assumption that the error have the following character $e = C (dt)^p$ where $e$ is your preferred ``global'' error when comparing numerical solution with exact solution e.g. at a fixed time $T$ (i.e. you need different number of time steps with different $dt$). If you expect such behavior of your error then $p$ expresses the order of method.
Consequently
$$
e_1 = C (dt_1)^p \,, \quad e_2 = C (dt_2)^p \,.
$$
Then you make a simplification (an approximation) that $C$ is identical in both cases that is not true in general, but for enough small $dt$ this approximation is reasonable. Doing simple algebraic computations you obtain
$$
\frac{e_2}{e_1} = \left(\frac{dt_2}{dt_1}\right)^p
$$
that you can express as you wrote.
The simplest way to do this is to use $dt_2=dt_1/2$ when for small enough $dt_1$ you can estimate that $p=1$ if $e_2=e_1/2$ or $p=2$ if $e_2=e_1/4$ and so on.
First remark - you typically do not (and do not want to) estimate local truncation error that in many cases is of order $p+1$. Secondly, you mention PDEs, so you typically have also another discretization step, e.g. $dx$ (or you solve one equation in splitting method with analytical methods?). Then your error will be dominated by lower order accuracy, so with no prior knowledge of order it is not easy to estimate it.