search for: ssfit

Displaying 3 results from an estimated 3 matches for "ssfit".

Did you mean: lsfit
2017 Jul 30
4
Kalman filter for a time series
...provider="yahoo", compression="d", quiet=T) prices.ts = ts(prices) return( prices.ts ) } kalmanFilter = function( x ) { t = x if (class(t) != "ts") { t = ts(t) } ssModel = structSSM( y = t, distribution="Gaussian") ssFit = fitSSM(inits=c(0.5*log(var(t)), 0.5*log(var(t))), model = ssModel ) kfs = KFS( ssFit$model, smoothing="state", nsim=length(t)) vals = kfs$a lastVal = vals[ length(vals)] return(lastVal) } Start = "2011-01-01" End = "2012-12-31" SandP = "^GSPC" w...
2017 Jul 30
0
Kalman filter for a time series
...ession="d", quiet=T) > > prices.ts = ts(prices) > return( prices.ts ) > } > > kalmanFilter = function( x ) > { > t = x > if (class(t) != "ts") { > t = ts(t) > } > ssModel = structSSM( y = t, distribution="Gaussian") > ssFit = fitSSM(inits=c(0.5*log(var(t)), 0.5*log(var(t))), model = ssModel ) > kfs = KFS( ssFit$model, smoothing="state", nsim=length(t)) > vals = kfs$a > lastVal = vals[ length(vals)] > return(lastVal) > } > > Start = "2011-01-01" > End = "2012-12-3...
2017 Jul 30
0
Kalman filter for a time series
...", quiet=T) > > prices.ts = ts(prices) > return( prices.ts ) > } > > kalmanFilter = function( x ) > { > t = x > if (class(t) != "ts") { > t = ts(t) > } > ssModel = structSSM( y = t, distribution="Gaussian") > ssFit = fitSSM(inits=c(0.5*log(var(t)), 0.5*log(var(t))), model = ssModel ) > kfs = KFS( ssFit$model, smoothing="state", nsim=length(t)) > vals = kfs$a > lastVal = vals[ length(vals)] > return(lastVal) > } > > Start = "2011-01-01" > End = "20...