object FactorSv
Model a large covariance matrix using a factor structure
- Alphabetic
- By Inheritance
- FactorSv
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
case class
State(params: FsvParameters, factors: Vector[(Double, Option[DenseVector[Double]])], volatility: Vector[SamplingState]) extends Product with Serializable
The state of the Gibbs Sampler
The state of the Gibbs Sampler
- factors
the current sample of the time series of factors k x n dimensional
- volatility
the current sample of the time series of variances, k x n dimensional
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
buildBeta(p: Int, k: Int, prior: ⇒ Double): DenseMatrix[Double]
Build a beta matrix from a prior distribution
Build a beta matrix from a prior distribution
- p
the dimension of the rows of beta
- k
the dimension of the columns of beta
- prior
a lazily evaluated prior distribution
- returns
a beta matrix with ones on the leading diagonal, zeros above and draws from the prior distribution elsewhere
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
- def combineStates(s: Vector[Vector[SampleState]]): Vector[SamplingState]
-
def
encodePartiallyMissing(obs: Vector[Data]): Vector[(Double, Option[DenseVector[Double]])]
Encode partially missing data as totally missing in order to sample the factors
Encode partially missing data as totally missing in order to sample the factors
- obs
a vector of observations
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
extractFactors(fs: Vector[(Double, Option[DenseVector[Double]])], i: Int): Vector[(Double, Option[Double])]
Extract the ith factor from a multivariate vector of factors
-
def
extractState(vs: Vector[SamplingState], i: Int): Vector[SampleState]
Extract a single state from a vector of states
Extract a single state from a vector of states
- vs
the combined state
- i
the position of the state to extract
- returns
the extracted state
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
getithObs(y: Vector[Data], i: Int): Vector[Option[Double]]
Select the ith observation from a vector of data representing a multivariate time series
Select the ith observation from a vector of data representing a multivariate time series
- y
a vector of data
- i
the index of the observation to select
- returns
a vector containing the ith observation of a multivariate time series
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
initialiseFactors(beta: DenseMatrix[Double], observations: Vector[Data], sigmaY: DenseMatrix[Double]): Rand[Vector[(Double, Option[DenseVector[Double]])]]
Initialise the factors
Initialise the factors
- beta
the factor loading matrix
- observations
a vector containing observations of the process
- sigmaY
The observation error variance
- returns
the factors sampled from a multivariate normal distribution
-
def
initialiseStateAr(initP: FsvParameters, observations: Vector[Data], k: Int): State
Initialise the state for the Factor SV model with AR(1) latent state
-
def
initialiseStateOu(initP: FsvParameters, observations: Vector[Data], k: Int): State
Initialise the state for the Factor SV model with OU latent state
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
makeBeta(p: Int, k: Int): DenseMatrix[Double]
Make an empty beta matrix Make a p x k matrix with 1s on the diagonal and zeros elsewhere
Make an empty beta matrix Make a p x k matrix with 1s on the diagonal and zeros elsewhere
- p
the rows of the matrix corresponding to the number of time series to model
- k
the number of factors
- returns
a p x k matrix with 1s on leading diagonal
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
rnorm(mean: DenseVector[Double], prec: DenseMatrix[Double]): Rand[DenseVector[Double]]
Generate a random draw from the multivariate normal distribution Using the precision matrix
-
def
sampleAr(priorBeta: Gaussian, priorSigmaEta: InverseGamma, priorMu: Gaussian, priorPhi: Gaussian, priorSigma: InverseGamma, observations: Vector[Data], initP: FsvParameters): Process[State]
Gibbs sampling for the factor stochastic volatility model with AR(1) latent-state
Gibbs sampling for the factor stochastic volatility model with AR(1) latent-state
- priorBeta
the prior for the non-zero elements of the factor loading matrix
- priorSigmaEta
the prior for the state evolution noise
- priorPhi
the prior for the mean reverting factor phi
- priorSigma
the prior for the variance of the measurement noise
- observations
a vector of time series results
- initP
the parameters of the Factor model
- returns
a markov chain
-
def
sampleBeta(prior: Gaussian, ys: Vector[Data], p: Int, k: Int, fs: Vector[(Double, Option[DenseVector[Double]])], v: DenseMatrix[Double]): DenseMatrix[Double]
Sample a value of beta using the function sampleBetaRow
Sample a value of beta using the function sampleBetaRow
- prior
the prior distribution to be used for each element of beta
- p
the dimension of a single observation vector
- k
the dimension of the latent-volatilities
-
def
sampleBetaRow(prior: Gaussian, factors: Vector[(Double, Option[DenseVector[Double]])], observations: Vector[Data], sigma: Double, i: Int, k: Int): DenseVector[Double]
The rows, i = 1,...,p of a k-factor model of Beta can be updated with Gibbs step The prior specification is b_ij ~ N(0, C0) i > j, b_ii = 1, b_ij = 0 for j > i This is a helper function for sampleBeta
The rows, i = 1,...,p of a k-factor model of Beta can be updated with Gibbs step The prior specification is b_ij ~ N(0, C0) i > j, b_ii = 1, b_ij = 0 for j > i This is a helper function for sampleBeta
- prior
a multivariate normal prior distribution for each column
- factors
the current value of latent factors
- sigma
the variance of the measurement error
- i
the row number
- k
the total number of factors in the model
- returns
the full conditional distribution of the
-
def
sampleFactors(observations: Vector[Data], p: FsvParameters, volatility: Vector[SamplingState]): Rand[Vector[(Double, Option[DenseVector[Double]])]]
Sample the factors from a multivariate gaussian
Sample the factors from a multivariate gaussian
- observations
the observations of the time series
- volatility
the current value of the volatility
- def sampleOu(priorBeta: Gaussian, priorSigmaEta: InverseGamma, priorMu: Gaussian, priorPhi: Beta, priorSigma: InverseGamma, observations: Vector[Data], initP: FsvParameters): Process[State]
-
def
sampleSigmaUni(prior: InverseGamma, ys: Vector[Data], params: FsvParameters, fs: Vector[(Double, Option[DenseVector[Double]])]): Rand[DenseMatrix[Double]]
Update the value of the variance in the observation model, a diagonal matrix filled with identical values
Update the value of the variance in the observation model, a diagonal matrix filled with identical values
- prior
an inverse gamma
- ys
the observations
- returns
the sampled value of sigma
-
def
sampleStep(priorBeta: Gaussian, priorSigmaEta: InverseGamma, priorMu: Gaussian, priorPhi: Gaussian, priorSigma: InverseGamma, observations: Vector[Data], p: Int, k: Int)(s: State): Rand[State]
Gibbs step for the factor stochastic volatility model
-
def
sampleVolatilityAr(p: Int, params: FsvParameters, factors: Vector[(Double, Option[DenseVector[Double]])], volatility: Vector[SamplingState]): Rand[Vector[SamplingState]]
Sample the log-volatility of a factor model
-
def
sampleVolatilityOu(p: Int, params: FsvParameters, factors: Vector[(Double, Option[DenseVector[Double]])], volatility: Vector[SamplingState]): Vector[SamplingState]
Sample the log-volatility of a factor model
-
def
sampleVolatilityParamsAr(priorPhi: Gaussian, priorMu: Gaussian, priorSigmaEta: InverseGamma, p: Int)(s: State): Rand[State]
Sample each of the factor states and parameters in turn
Sample each of the factor states and parameters in turn
- priorMu
a Normal prior for the mean of the AR(1) process
- priorSigmaEta
an inverse Gamma prior for the variance of the AR(1) process
- p
an integer specifying the dimension of the observations
- s
the current state of the MCMC algorithm
-
def
sampleVolatilityParamsOu(priorMu: Gaussian, priorSigmaEta: InverseGamma, priorPhi: Beta, p: Int)(s: State): Rand[State]
Sample each of the factor states and parameters in turn
Sample each of the factor states and parameters in turn
- priorMu
a Normal prior for the mean of the OU
- priorSigmaEta
an inverse Gamma prior for the variance of the OU process
- priorPhi
a Beta prior on the mean reversion parameter phi
- p
an integer specifying the dimension of the observations
- s
the current state of the MCMC algorithm
-
def
simStep(t: Double, params: FsvParameters)(a: Vector[Double]): Rand[(Data, Vector[Double], Vector[Double])]
A single step for simulating a factor stochastic volatility model
A single step for simulating a factor stochastic volatility model
- t
the current time of the realisation
- params
the parameters of the stochastic volatility model
- a
the current log volatilities of the factors
- def simulate(p: FsvParameters): Process[(Data, Vector[Double], Vector[Double])]
- def stepOu(priorBeta: Gaussian, priorSigmaEta: InverseGamma, priorMu: Gaussian, priorPhi: Beta, priorSigma: InverseGamma, observations: Vector[Data], p: Int, k: Int): (State) ⇒ Rand[State]
- def sumFactors(factors: Vector[(Double, Option[DenseVector[Double]])]): DenseMatrix[Double]
-
def
sumFactorsObservations(facs: Vector[(Double, Option[DenseVector[Double]])], obs: Vector[Option[Double]]): DenseVector[Double]
Sum the product of f and y
Sum the product of f and y
- facs
the latent factors
- obs
the observations of the ith time series
- returns
the squared sum of the product of factors and observations
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )