in calculating Kalman gain, what if state and measurement space have different units? My understanding is that the Kalman gain for a regular multivariate filter is computed as 
$$
K = \bar P H^T S^{-1}
\\
S = H \bar P H^T + R
$$
$K$ being the Kalman gain, $\bar P$ being the prior state covariance, $H$ being the measurement function, $S$ being the innovation covariance, and $R$ being the sensor noise.
The state is updated with this equation:
$$
x = \bar x + Ky
$$
with $x$ being the posterior state, $\bar x$ being the prior state, and $y$ being the residual.
In the text I am reading, the $H^T$ term in $K$ is explained as being responsible for transforming the value of y into state space, which leaves the $\bar P S^{-1}$ term responsible for scaling the residual as it is added to $\bar x$.  
The part that confuses me is that $\bar P$ is obviously in state space, as it is the state covariance.  However, $S$ is in measurement space, as it is clearly the sum of $\bar P$ projected into measurement space plus $R$, which is also in measurement space.  If state space and measurement space happen to be in different units that have completely different scales (maybe a voltage measurement is being used to estimate a state variable of temperature), I feel like the ratio would not make sense, or unfairly weight the units with a smaller scale.
Is my thinking here correct, or do the current set of equations I have not account for a possible difference in units between state and measurement space?
 A: Just to clarify one point to begin -- the components of the state and measurement vectors may themselves be in different units -- there's not a single unit for either the state nor the measurement (observation). Indeed even the dimension of either one could change over time.
Note that:


*

*$\bar{P}$ is not in "units of the state". The units of its components are a product of units from the state (e.g. its $i$th diagonal element is in squared units of the $i$th state component, and the $i,j$ element is in $i$th-component-units by $j$th-component-units).

*Similarly, $S$ is not "in measurement space", but in products of units; (e.g. its $i$th diagonal element is in squared units of the $i$th observation-component, and the $i,j$ element is in $i$th-component-units by $j$th-component-units)

*$K$ will be a matrix of terms in ratios of units; the $i,j$ element will be in units that are the ratio of units of the $i$th component of state to the $j$th component of observation.

*$H$ goes the other direction, converting state to observation (the ratios are the other way up)

*There's no "$\bar{P}S^{-1}$" term. In general they're not even of conforming dimension; that $H$ in there between them matters. You express concern about the ratio (well let's put "ratio" in inverted commas and say we're speaking loosely), but you never take that ratio without the $H$ being there converting between them (as you already stated it did and as your mathematics clearly has it).

*Note that $H\bar{P}H^T$ then converts from products-of-units of the state  to products-of-units of the measurement; both $S$ and $R$ are on that scale.
I see no discrepancy anywhere -- all the units work as they should.
