2.2.1.26. sdepy.process.tdiff¶
-
process.
tdiff
(dt_exp=0, fwd=True)[source]¶ Process increments along the timeline, optionally weighted by time increments.
Parameters: - dt_exp : int or float, optional
Exponent applied to time increment weights. If 0, returns process increments. If 1, approximates a time derivative. If 0.5, approximates realized volatility.
- fwd : bool, optional
If True, the differences are forward-looking
Returns: - q : process
If
p
is a process shaped(N,) + p.vshape + (p.paths,)
, with timelinet
,p.tdiff(dt_exp, fwd)
returns a processq
, shaped(N-1,) + p.vshape + (p.paths,)
with valuesq[i] = (p[i+1] - p[i])/(t[i+1] - t[i])**dt_exp
If
fwd
evaluates toTrue
,q[i]
is assigned to time pointt[i]
(q
stores att[i]
the increments ofp
looking forwards) or tot[i+1]
otherwise (increments looking backwards).
Notes
if
p
is a process instance realizing a solution of the SDEdp(t) = sigma(t)*dw(t)
across several paths, thenp.tdiff(dt_exp=0.5).pstd()
is a 1-path process that estimates
sigma(t)
.