7

tslistmissingvalues = {{1, 1}, {3, 2}, {5, 3}, {6, 4}, {11, 5}, {14, 6}, {16, 7}, {18, 8}}; TimeSeriesResample[tslistmissingvalues, ResamplingMethod -> {"Interpolation", InterpolationOrder -> 0}] (* output: {{1, 1}, {2, 1}, {3, 2}, {4, 2}, {5, 3}, {6, 4}, {7, 4}, {8, 4}, {9, 4}, {10, 4}, {11, 5}, {12, 5}, {13, 5}, {14, 6}, {15, 6}, {16, 7}...


7

You can use TimeSeriesResample as follows: ts2 = TimeSeries[{0.0, 0.0, 0.0, 0.0, 15.0, 0.0, 0.0, 0.0}, {1}]; pks = FindPeaks[ts2]; ts3 = TimeSeriesResample[ts2, { Complement[ts2["Times"], pks["Times"]]}] Normal@ts3 {{1, 0.}, {2, 0.}, {3, 0.}, {4, 0.}, {6, 0.}, {7, 0.}, {8, 0.}}


7

The problem is that your time samples are not regularly sampled. When time intervals are unequal, Accumulate resamples to make a regularly sample series. See the "Possible Issues" section of Time Series documentation for an example similar to your data. You can make Accumulate assume regular sampling with the TemporalRegularity option. Values[Accumulate[...


6

DateListPlot[Tooltip[#, {DateString[First @ #, { "MonthNameShort", " ", "Day", " / ", "Year"}], Last @ #}] & /@ ts["Path"], Joined -> False, Filling -> Axis]


5

You might want to consider kernel regression. (It would be great if Mathematica would offer a function to do so. And it's likely that someone has already produced a package for this.) Kernel regression is similar to using a "moving mean" but with weighting where each data point's influence decreases with distance from that data point. Below is a ...


5

This is as designed. If we set ts = randomTimeSeries[RandomInteger[{10^6, 10^7}]] then RegularlySampledQ[ts] is False which means that calling Accumulate on it will first trigger TimeSeriesResample on ts with respect to the minimal time step: In[3]:= ts["MinimumTimeIncrement"] Out[3]= {0.00926208} which is very small compared to the other time ...


4

The time series that FinancialData creates has the option TemporalRegularity -> Automatic. With this option, this series does not interpolate values. data = FinancialData["SBUX", "Close", {{2013, 1, 1}, {2013, 8, 1}, "Week"}, "Value"]; Time series that aren't regularly sampled can interpolate values with the ...


4

Complete automation I think what you are actually looking for is DeleteAnomalies. Define these data: ts=TimeSeries[{1,2,3,15,3,2,1},{1}] Now compare old and new: DateListPlot[ {ts,TimeSeries[DeleteAnomalies[ts["Path"]]]}, PlotMarkers->Automatic,PlotRange->All] Surgery Now if you want to play surgeon, you can define a function: deleteTS[ts_,...


4

lst = {2, 3, 4}; Apply[Inactive[Times]]@# == Times @@ # &@lst 2*3*4==24 Or, for purposes of display, Inactive[Set][Apply[Inactive[Times]]@#, Times @@ #] & @ lst 2*3*4=24 and Row[{Inactive[Times] @@ #, Times @@ #}, "="] & @ lst 2*3*4=24


4

ClearAll["Global`*"] sampleRate = 1000.; duration = 2.5; dt = 1/sampleRate; data = Table[Sin[7*Sin[140*t]], {t, 0, duration, dt}]; fdata = Abs[Fourier[data]]; todecibels[pwr_] := 10 Log10[pwr] peaks = {#[[1]]/duration, todecibels[#[[2]]^2]} & /@ FindPeaks[fdata]; Periodogram[data, SampleRate -> sampleRate, PlotRange -> {{0, 600}, Full}, ...


4

I don't know if you can do this with TimeSeries, but you can do it yourself with GroupBy like this: data = SortBy[First] @ Table[{RandomInteger[{0, 10}], RandomReal[]}, 20]; ts = TimeSeries[GroupBy[data, First -> Last, Total]]


3

A Sinc interpolation can be done along the same same idea as a Lagrange interpolation: Assuming we have equally spaced data points, we seek a function ipol that is 1 at x==0 and zero at every other data argument. The sum of ipol[x-x[[i]]] dat[[i]] over i gives then an interpolation function. By this the highest frequency is given by half the sample rate. To ...


3

Update Plot data for several regions provinces = {"lombardia", "sicilia"}; dataByProvince = covid19Italy /@ provinces; dataByProvince // Map[(KeyTake[#, {"date", "total infected"}] &), #, {2}] & // Values // Flatten[#, 1] & // DateListPlot[#, ScalingFunctions -> "Log", PlotLegends -> Capitalize@provinces, PlotMarkers -&...


2

You may use Accumulateand TimeSeriesThread. With s = TimeSeries[{a, b, c}]; then t = TimeSeriesThread[Apply[Divide], {Accumulate[s], Range@s["PathLength"]}]; t["Values"] { a , (a+b)/2 , (a+b+c)/3 } Hope this helps.


2

Use TimeSeriesShift to adjust your time series first. I have not handled that aspect of the question below, but rather the way to get the time out of a video stream and use it for live plotting, which is kind of non-trivial and worth answering here: This video stream player is straight out of the documentation: stream = VideoStream["ExampleData/...


2

If we want to use FFT to get an expansion in circular functions we can proceed as follows: FFT can be look at as a base change with the new base functions: Exp[2Pi I x f]. This is not too simple, because the FFT returns the coefficients like: First DC component, then coefficients of functions with increasing frequencies and pos. exponents. Up to the highest ...


2

Assuming there is no change expected over the weekends or holidays: dataFC = Table[{ DatePlus[Last[data][[1]], {n, "BusinessDay"}], TimeSeriesForecast[dataFit, n] }, {n, 1, 30}];


1

You may forgo the bulk of your manipulations by using TimeSeriesWindow. With example 2 path time series data data = TemporalData /@ { FinancialData["GOOGL", {"High", "Low"}, {"2 Jan 2019", "10 Dec 2019"}] , FinancialData["GE", {"High", "Low"}, {"4 Jan 2019", &...


1

Using meanwdata, first, we need to remove stations that have no observations. Let's define beginning- and end-dates so we can find the largest number of observations that a station might have. Use a short list of stations for demonstration; otherwise use weatherstations instead of sampleStations. (*Note: 2011-1-1 to 2020-12-31 is 10 years of daily ...


1

data = FinancialData["SBUX", "Close", {{2013, 1, 1}, {2013, 8, 1}, "Week"}, "Value"] data["Properties"] {"DatePath", "Dates", "FinancialProperty", "FirstDate", "FirstTime", "FirstValue", "LastDate", "LastTime", "LastValue&...


1

Ummm, I'm not sure what do you want. Likely, just use Normal:


1

I think you should be able to slice the different output dimensions with TimeSeriesMap. For example, to get the first component: TimeSeriesMap[#[[1]]&, simData] Similarly for the other two components.


1

This is what I had in mind when I mentioned Quantile Regression in comments:


Only top voted, non community-wiki answers of a minimum length are eligible