Compute moment and quantiles of a stream of data I'd like to compute the moments and quantiles of a random variable which is the output of a sensor.
I don't intend to store all the values this sensor outputs (let's say it outputs one value each 15 minutes), but rather keep batches of these values (for example a two weeks' batch) that I'll discard from time to time.
I was considering estimating the probability density function of a batch of outputs with scikit's KernelDensity. I then discard the batch and when I get hold of a new batch of values I update the estimate of the probability density with these new values.
I know that the probability density function that I estimate for each batch separately converges almost surely to the real density but I don't know if this result still holds if I compute the density incrementally as defined in the above paragraph.
Is it the way I should do ?  
 A: As a start, I wanted to refer you to a journal article called A Fast Algorithm for Approximate Quantiles in High Speed Data Streams. This is a paper that I have referenced myself before and used in practice when building software that analyze stream data. Additionally, this method was also discussed and implemented here on Intel's site.
Below is a snapshot of the simplest code snippet used to compute snapshots of quantiles for streaming data taken from the Intel site showing how the algorithm was implemented.
#include "mkl_vsl.h"
#include <stdio.h>
#define DIM 3      /* dimension of the task */
#define N   1000   /* number of observations */
#define M   100    /* number of quantiles to compute */
#define EPS 0.01   /* accuracy of quantile computation */

int main()
{
   int i, status;
   VSLSSTaskPtr task;
   float x[DIM][N];  /* matrix of observations */
   float q_order[M], quants[M];
   float params;
   MKL_INT q_order_n;
   MKL_INT p, n, nparams, xstorage;
   int indices[DIM]={1,0,0}; /* the first vector component is processed */

   /* Parameters of the task and initialization */
   p = DIM;
   n = N;

   q_order_n = M;
   xstorage  = VSL_SS_MATRIX_STORAGE_ROWS;
   params    = EPS;
   nparams   = VSL_SS_SQUANTS_ZW_PARAMS_N;

   /* Calculate percentiles */
   for ( i = 0; i < M; i++ ) q_order[i] = (float)i / (float)M;

   /* Create a task */
   status = vslsSSNewTask( &task, &p, &n, &xstorage, x, 0, indices );

   /* Initialize the task parameters */
   status = vslsSSEditStreamQuantiles( task, &q_order_n, q_order,
                                       quants, &nparams, &params );

   /* Compute the percentiles with accuracy eps */
   status = vslsSSCompute( task, VSL_SS_STREAM_QUANTS,
                                 VSL_SS_METHOD_SQUANTS_ZW );

   /* Deallocate the task resources */
   status = vslSSDeleteTask( &task );

   return 0;
}

As Zhang notes in his paper, "Streaming quantile computation has several constraints. Data streams are transient and can arrive at a high speed. Furthermore, the stream size may not be known apriori. Streaming computations therefore require single pass algorithms with small space requirement and which are able to handle arbitrary sized streams. In order to guarantee the precision of the result, the algorithm should ensure random or deterministic error bound for the quantile computation."
I would start by reading the paper and then going from there. Here is a link to the PDF of the paper. Multiple methods are discussed before their fast algorithm is introduced.
A: I have no background regarding your task. However that reminded me of an idea I have to adapt a classifier (non-Bayesian, but static classifier) to the changes in time (specifically I was trying to adapt a random forest). 
So, my idea is to collect a sample for a period of time: in your case 2 weeks if you can afford that. Than for each new hour (could be any other period of time), add to the sample the new data points, and remove data points from the oldest hour. 
It might have some problems, because it depends a lot on how do you choose those periods. Larger periods means smaller effects for the new input. Smaller periods could mean that new data could perturb the old distribution too much. It depends on what do you really need for.
[Later edit] After few google searches I have found that this is an old procedure known as "sliding window", and there are a lot of papers for "sliding window quantiles".
