# Weighted variance of the weighted variance in frequency transition matrix?

Assume I have a $m\times n$ Transition Matrix $A$ with $m$ different observations and $n$ represents a discrete state space. Each column counts the frequency that state $j\in [1...n]$ was visited from state $i\in [1,...,m]$. In reality the "states" are no integer numbers, but a discretized real valued variable. I need to know the mean and the variance of the "next" variable, i.e. of the "columns". For example I want to "encode" the speed $v\in \{0,10,20,30\}$ m/s then is $n=4$ and $A(i,2)=10$ m/s and so on.

For that I use the weighted mean + variance from http://en.wikipedia.org/wiki/Weighted_arithmetic_mean:

$\bar{v_i}=\frac{\sum_{j=1}^m w_j{v}_j}{\sum_{j=1}w_j}$, where $x_i$ are the single values from the featurespace, represented by the i-th row and $w_j$ the frequency. That seems to work.

For the covariance I use $\sigma^2=\frac{\sum_{j=1}^m w_j({v}_j-\bar{v_i})^2}{\sum_{j=1}w_j}$.

So I have $i$ different values for the mean and covariance that I use to fit a distribution via moment matching. Now the problem is, that there are rows with only a few columns $\ne 0$. That can result in a very small covariance, which might be misleading:

The last "hat" at $v=70$ was generated from only $\sum_j=24$ samples and the one before from $\sum_j =3100$, but is even lower.

If I assume, that more data means more safety, can I weight the covariance again? Or can I introduce a "uncertainty" of the variance (that does not make sense does it?)

Thank you very much!

As whuber suggested here is a little background:

The whole thing is a Markov chain like procedure. As whuber said, I want to know "How can I estimate transition probabilities for a continuous Markov process based on binned? observed frequencies?" Thats correct. I thought these information was not neccessary, sorry. There is one different PDF for each possible velocity. If I assume that the process is memoryless and stationary then I shouldn't care about the time anymore or? The PDF shall be the distribution at the next timestep k+1, but only depending on the current timestep k. So k are the rows, k+1 the columns. I'm searching the distribution of all velocities at all times, I think. I counted all the transitions from velocity i to j. But over the whole timeseries. It's like a 1st order markov chain, but with cont. pdfs instead of discrete ones. The goal is not to have a giant Markov transition Matrix, but only $m\times 2$ Matrix, containing the PDF parameters. This might not be appropriate way, whuber mentioned.

Thank you

• If you simply want to estimate means and variances of columns of frequencies, weighting seems pointless. Exactly what random variables are you defining? What do you mean by the "'next' variable"? – whuber Sep 24 '14 at 17:10
• Sorry for being not clear. Assume the rows are my velocity at the timestep k and the columns the velocity at timestep k+1. The latter one is the "next" variable. I would like to estimate the pdf of the next velocity in time for discretized velocities. Thank you! – Jan Sep 24 '14 at 17:27
• That would be one potentially different PDF for each time $k$ and each possible velocity. You don't have the data to do that. Exactly what is this PDF intended to represent? If it's the distribution of velocities at time $k+1$, it will depend on the distribution at time $k$. If it's the distribution of all velocities at all times then it will depend on the initial velocity distribution and the duration. Therefore you need to be clearer about what you are looking for and you will need to supply additional data or assumptions to get an answer. – whuber Sep 24 '14 at 17:31
• Okay thank you. One different PDF for each possible velocity yes. If I assume that the process is memoryless and stationary then I shouldn't care about the time anymore or? The PDF shall be the distribution at the timestep k+1, but only depending on the timestep k. I thought k would be in the rows, k+1 in the columns. I'm not really sure how to answer your question. It's the distribution of the all velocities at all times, I think. I counted all the transitions from velocity $i$ to $j$. But over the whole timeseries. It's like a 1st order markov chain, but with cont. pdfs instead of discrete – Jan Sep 24 '14 at 18:39
• That explanation is so helpful you should consider editing the question to include the information in it. It now sounds like your question is something like "How can I estimate transition probabilities for a continuous Markov process based on (binned?) observed frequencies?" Phrasing it somewhat like this would help elicit responses that address what you really need to know, whereas the present form seems likely to collect responses that merely critically evaluate the procedure you have in mind (which might not be optimal or even appropriate). – whuber Sep 24 '14 at 19:08