# First passage times

The package works readily in a setting where its smooth coordinates (coordinates whose volatility coefficients are identically equal to zero) are observed only at first-passage times to some fixed thresholds (these could be counted as first up-crossings or first down-crossings).

If we observe the first-passage time to level $L$ of coordinate $i$ at time $t$, then we need to first pass it as a usual partial observation of coordinate $i$ at time $t$ to take value $L$ and additionally we need to specify in a separate struct that this is the first passage time observation. This latter specification is done by the function set_observations!

BridgeSDEInference.set_observations!Function
set_observations!(setup::DiffusionSetup, Ls, Σs, obs, obs_times,
fpt=fill(nothing, length(obs)-1))

Store observations to setup. The observations follow the scheme V=LX+η, where V are the observations in obs, observed at times given in obs_times, L are the observation operators given in Ls, X is the unobserved, underlying diffusion and η is a Gaussian noise with mean 0 and covariance Σ with the last stored in Σs. fpt provides additional information in case the nature of observations has to do with first-passage times

The last argument (fpt) is supposed to be a vector whose each element corresponds to a separate observation and gives additional information regarding its first-passage time nature. If it is just a partial observation, then this object can take value nothing (this is the default behaviour for all elements), alternatively, we can define an instance of a struct FPTInfo

BridgeSDEInference.FPTInfoType
FPTInfo{S,T}

The struct

struct FPTInfo{S,T}
condCoord::NTuple{N,S}
upCrossing::NTuple{N,Bool}
autoRenewed::NTuple{N,Bool}
reset::NTuple{N,T}
end

serves as a container for the information regarding first passage time observations. condCoord is an NTuple of coordinates that are conditioned on the first passage time nature of the observations. upCrossing indicates whether observations of the corresponding coordinate are up-crossings or down-crossings. autoRenewed indicates whether process starts from the renewed state (i.e. normally the process is unconstrained until it hits level reset for the first time, however autoRenewed process is constrained on the first passage time from the very beginnig). reset level is the level that needs to be reached before the process starts to be conditioned on the first passage time.

which indicates that first-passage times are observed, it says which coordinates are observed, whether it is the up- or down-crossing, and whether the diffusion is conditioned on having reached reset level specified as the fourth parameter since the previous observation time (in which case autoRenewed is set to false and otherwise true).