[Robkalman-commits] r55 - branches/robKalman_2012/pkg/robKalman/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Feb 8 15:26:33 CET 2013
Author: bspangl
Date: 2013-02-08 15:26:33 +0100 (Fri, 08 Feb 2013)
New Revision: 55
Modified:
branches/robKalman_2012/pkg/robKalman/R/allClass.R
Log:
File 'allClass.R' changed
Modified: branches/robKalman_2012/pkg/robKalman/R/allClass.R
===================================================================
--- branches/robKalman_2012/pkg/robKalman/R/allClass.R 2013-02-05 18:08:12 UTC (rev 54)
+++ branches/robKalman_2012/pkg/robKalman/R/allClass.R 2013-02-08 14:26:33 UTC (rev 55)
@@ -1,8 +1,8 @@
########################################################
##
-## S4 classes for robust filtering
-## author: Bernhard Spangl & Peter Ruckdeschel
-## version: 0.1 (last changed: 2012-04-27, created: 2011-08-19)
+## file: S4 classes for robust filtering
+## author: Bernhard Spangl & Peter Ruckdeschel
+## version: 0.3 (changed: 2013-02-08, created: 2011-08-19)
##
#######################################################
@@ -18,214 +18,322 @@
invisible()
}
-## ClassUnion: OptionalList
+
+### ClassUnion:
setClassUnion("OptionalList",
- c("list","NULL")
- )
+ c("list","NULL")
+ )
setClassUnion("OptionalFunction",
- c("function","NULL")
- )
+ c("function","NULL")
+ )
setClassUnion("OptionalCall",
- c("call","NULL")
- )
+ c("call","NULL")
+ )
setClass("ListOfCalls", contains = "list",
- validity = function (object) all(sapply(object, function (u) is(u)=="call")))
+ validity = function (object) {
+ all(sapply(object, function (u) is(u)=="call"))
+ }
+ )
setClassUnion("OptionalListofCalls",
- c("ListofCalls","NULL")
- )
+ c("ListofCalls","NULL")
+ )
-## Class: FunctionWithControl
+### Class: FunctionWithControl
setClass("FunctionWithControl", contains = "function")
-### in validity method check whether has args dots.propagated and control
+ # in validity method check whether has args dots.propagated and control
setClassUnion("OptionalFunctionWithControl",
- c("FunctionWithControl","NULL")
- )
+ c("FunctionWithControl","NULL")
+ )
setClassUnion("OptionalDistribution",
- c("Distribution","NULL")
- )
+ c("Distribution","NULL")
+ )
### SSM definitions
setClass("SSstateEq",
- representation = representation(Ffct = "FunctionWithControl",
- Qfct = "FunctionWithControl",
- muqfct = "OptionalFunction",
- Exofct = "OptionalFunctionWithControl",
- distrfct = "OptionalFunctionWithControl")
- )
+ representation = representation(Ffct = "FunctionWithControl",
+ Qfct = "FunctionWithControl",
+ muqfct = "OptionalFunction",
+ Exofct = "OptionalFunctionWithControl",
+ distrfct = "OptionalDistribution")
+ )
setClass("SSobsEq",
- representation = representation(Zfct = "FunctionWithControl",
- Vfct = "FunctionWithControl",
- muvfct = "OptionalFunction",
- Exofct = "OptionalFunctionWithControl",
- distrfct = "OptionalFunctionWithControl")
- )
+ representation = representation(Zfct = "FunctionWithControl",
+ Vfct = "FunctionWithControl",
+ muvfct = "OptionalFunction",
+ Exofct = "OptionalFunctionWithControl",
+ distrfct = "OptionalDistribution")
+ )
setClass("SSinitEq",
- representation = representation(a0 = "numeric",
- Sigma0 = "matrix",
- Exofct = "OptionalFunctionWithControl",
- distrfct = "OptionalDistribution")
-
- )
+ representation = representation(a0 = "numeric",
+ Sigma0 = "matrix",
+ Exofct = "OptionalFunctionWithControl",
+ distrfct = "OptionalDistribution")
+ )
setClass("SSM",
- representation = representation(initEq = "SSinitEq",
- statesEq = "SSstateEq",
- obsEq = "SSobsEq",
- pdim = "numeric", qdim = "numeric")
-)
-setClass("SStimes", representation = representation(times = "numeric",
- inX = "logical"))
-
+ representation = representation(initEq = "SSinitEq",
+ statesEq = "SSstateEq",
+ obsEq = "SSobsEq",
+ pdim = "numeric", qdim = "numeric")
+ )
+setClass("SStimes",
+ representation = representation(times = "numeric",
+ inX = "logical")
+ )
setClass("SSObs",
- representation = representation(Y = "matrix", ### soll Matrix bleiben?
- origData = "ANY"),
- prototype = prototype(Y = as.matrix(1),
- origData = 1)
+ representation = representation(Y = "matrix",
+ origData = "ANY"),
+ prototype = prototype(Y = as.matrix(1),
+ origData = 1)
+ )
- )
-
### SSM procedures
-setClass("SSFilter", representation = representation(initStep = "FunctionWithControl",
- prepStep = "OptionalFunctionWithControl",
- predStep = "FunctionWithControl",
- corrStep = "FunctionWithControl"))
-setClass("SSrobFilter", representation = representation(classFilter = "SSFilter",
- robFilter = "SSFilter"))
+setClass("SSFilter",
+ representation = representation(initStep = "FunctionWithControl",
+ prepStep = "OptionalFunctionWithControl",
+ predStep = "FunctionWithControl",
+ corrStep = "FunctionWithControl")
+ )
+setClass("SSrobFilter",
+ representation = representation(classFilter = "SSFilter",
+ robFilter = "SSFilter")
+ )
+setClass("SSSmoother",
+ representation = representation(filt = "SSFilter",
+ smoothStep = "FunctionWithControl",
+ smoothCov = "FunctionWithControl",
+ lagoneCov = "FunctionWithControl")
+ )
+setClass("SSrobSmoother",
+ representation = representation(classSmoother = "SSSmoother",
+ robSmoother = "SSSmoother")
+ )
-setClass("SSSmoother", representation = representation(filt = "SSFilter",
- smoothStep = "FunctionWithControl",
- smoothCov = "FunctionWithControl",
- lagoneCov = "FunctionWithControl"))
-
-setClass("SSrobSmoother", representation = representation(classSmoother = "SSSmoother",
- robSmoother = "SSSmoother"))
-
setClassUnion("SSClassOrRobFilter",
- c("SSFilter","SSrobFilter")
- )
-
+ c("SSFilter", "SSrobFilter")
+ )
setClassUnion("SSClassOrRobSmoother",
- c("SSSmoother","SSrobSmoother")
- )
-setClassUnion("SSClassOrRobSmootherOrFilter",c("SSClassOrRobFilter",
- "SSClassOrRobSmoother"))
+ c("SSSmoother", "SSrobSmoother")
+ )
+setClassUnion("SSClassOrRobFilterOrSmoother",
+ c("SSClassOrRobFilter", "SSClassOrRobSmoother")
+ )
-setClass("SSDiagnostic", contains = c("VIRTUAL"))
-setClass("SSDiagnosticFilter", contains = c("SSDiagnostic","list"))
-setClass("SSDiagnosticretValue", contains = c("SSDiagnostic","list"))
-setClass("SSVariances", contains = "array")
-setClass("SSStateReconstr", contains = "matrix")
+setClass("SSDiagnostic",
+ contains = c("VIRTUAL")
+ )
+setClass("SSDiagnosticFilter",
+ contains = c("SSDiagnostic","list")
+ )
+setClass("SSDiagnosticRetValue",
+ contains = c("SSDiagnostic","list")
+ )
+setClass("SSVariances",
+ contains = "array"
+ )
+setClass("SSStateReconstr",
+ contains = "matrix"
+ )
-
-setClass("SSPredOrFilt", representation = representation(values = "matrix",
- call = "OptionalListOfCalls",
- variances = "array",
- dots.propagated = "list",
- control = "list",
- diagnostics = "SSDiagnosticFilter"),
- contains = "VIRTUAL")
-
-### serve as class of return values for stepfunction initstep, predstep, @Bern: prepstep?,
+### serve as class of return values for stepfunction initstep, predstep,
+### @Bern: prepstep?,
### correction step (in variant as only 1-dim in time)
### and as slot classes (in variant as multi-step in time) for return value
### of recFilter
-setClass("SSInitialized", representation = representation(values = "numeric",
- call = "OptionalCall",
- variance = "matrix",
- dots.propagated = "list",
- control = "list",
- diagnostics = "SSDiagnosticFilter"))
-setClass("SSPredicted", contains = "SSPredOrFilt")
-setClass("SSFiltered", representation = representation(KalmanGain = "array",
- CovObs = "array", DeltaY = "matrix"),
- contains = "SSPredOrFilt")
-setClass("SSSmoothed", representation = representation(lagoneCov = "array"),
- contains = "SSPredOrFilt")
-setClass("SSPrepared", contains = "SSPredOrFilt")
+setClass("SSPredOrFilt",
+ representation = representation(values = "numeric",
+ call = "OptionalCall",
+ variance = "matrix",
+ dots.propagated = "list",
+ control = "list",
+ diagnostics = "SSDiagnosticFilter"),
+ contains = "VIRTUAL"
+ )
+setClass("SSInizialized",
+ contains = "SSPredOrFilt"
+ )
+setClass("SSPrepared",
+ contains = "SSPredOrFilt"
+ )
+setClass("SSPredicted",
+ contains = "SSPredOrFilt"
+ )
+setClass("SSFiltered",
+ representation = representation(KalmanGain = "matrix",
+ CovObs = "matrix",
+ DeltaY = "numeric"),
+ contains = "SSPredOrFilt"
+ )
+setClass("SSSmoothed",
+ representation = representation(lagoneCov = "matrix"),
+ contains = "SSPredOrFilt"
+ )
+
setClassUnion("OptionalSSInitialized",
- c("SSInitialized","NULL")
- )
+ c("SSInitialized","NULL")
+ )
setClassUnion("OptionalSSPrepared",
- c("SSPrepared","NULL")
- )
+ c("SSPrepared","NULL")
+ )
setClassUnion("OptionalSSPredicted",
- c("SSPredicted","NULL")
- )
+ c("SSPredicted","NULL")
+ )
setClassUnion("OptionalSSFiltered",
- c("SSFiltered","NULL")
- )
+ c("SSFiltered","NULL")
+ )
setClassUnion("OptionalSSSmoothed",
- c("SSSmoothed","NULL")
- )
+ c("SSSmoothed","NULL")
+ )
+setClass("SSPredOrFiltRet",
+ representation = representation(values = "matrix",
+ call = "OptionalListOfCalls",
+ variances = "array",
+ dots.propagated = "list",
+ control = "list",
+ diagnostics = "SSDiagnosticFilter"),
+ contains = "VIRTUAL"
+ )
-### User interfaces
-setClass("SSInput", representation = representation(model = "SSM",
- obs = "SSObs",
- times = "SStimes",
- steps = "SSClassOrRobSmootherOrFilter"))
+setClass("SSPreparedRet",
+ contains = "SSPredOrFiltRet"
+ )
+setClass("SSPredictedRet",
+ contains = "SSPredOrFiltRet"
+ )
+setClass("SSFilteredRet",
+ representation = representation(KalmanGain = "array",
+ CovObs = "array",
+ DeltaY = "matrix"),
+ contains = "SSPredOrFiltRet"
+ )
+setClass("SSSmoothedRet",
+ representation = representation(lagoneCov = "array"),
+ contains = "SSPredOrFiltRet"
+ )
-setClass("SSOutput", representation = representation(init.cl = "SSInitialized",
- prep.cl = "OptionalSSPrepared",
- pred.cl = "SSPredicted",
- filt.cl = "SSFiltered",
- smooth.cl = "OptionalSSSmoothed",
- init.rob = "OptionalSSInitialzed",
- pred.rob = "OptionalSSPredicted",
- filt.rob = "OptionalSSFiltered",
- smooth.rob = "OptionalSSSmoothed",
- prep.rob = "OptionalSSPrepared"))
+setClassUnion("OptionalSSPreparedRet",
+ c("SSPreparedRet","NULL")
+ )
+setClassUnion("OptionalSSPredictedRet",
+ c("SSPredictedRet","NULL")
+ )
+setClassUnion("OptionalSSFilteredRet",
+ c("SSFilteredRet","NULL")
+ )
+setClassUnion("OptionalSSSmoothedRet",
+ c("SSSmoothedRet","NULL")
+ )
-setClass("SSrecResult", representation = representation(input="SSInput", output="SSOutput"))
+### User interfaces
+setClass("SSInput",
+ representation = representation(model = "SSM",
+ obs = "SSObs",
+ times = "SStimes",
+ steps = "SSClassOrRobSmootherOrFilter")
+ )
+setClass("SSOutput",
+ representation = representation(init.cl = "SSInitialized",
+ prep.cl = "OptionalSSPreparedRet",
+ pred.cl = "SSPredictedRet",
+ filt.cl = "SSFilteredRet",
+ smooth.cl = "OptionalSSSmoothedRet",
+ init.rob = "OptionalSSInitialzed",
+ pred.rob = "OptionalSSPredictedRet",
+ filt.rob = "OptionalSSFilteredRet",
+ smooth.rob = "OptionalSSSmoothedRet",
+ prep.rob = "OptionalSSPreparedRet")
+ )
-### Simulation
-setClass("SSISimulation", representation = representation(name = "character",
- obs = "array", states = "array"))
-setClass("SSCSimulation", representation = representation(radius = "numeric"),
- contains = "SSISimulation")
+setClass("SSrecResult",
+ representation = representation(input="SSInput",
+ output="SSOutput")
+ )
-setClass("SSSimulation", representation = representation(model = "SSM",
- runs = "numeric", seed = "numeric", times = "SStimes"),
- contains = "SSISimulation")
-setClass("SSSimList", contains = "list") ### Liste von Simulationen Typprüfung nicht
- ## vorgesehen; Erzeugung in Generating Function, sodass alle Anforderungen
- ## "passen"
-setClass("SSContSimulation", representation = representation(SimList = "SSSimList"),
- contains = "SSSimulation")
+### Simulation
+setClass("SSISimulation",
+ representation = representation(name = "character",
+ obs = "array",
+ states = "array")
+ )
+setClass("SSCSimulation",
+ representation = representation(radius = "numeric"),
+ contains = "SSISimulation"
+ )
+setClass("SSSimulation",
+ representation = representation(model = "SSM",
+ runs = "numeric",
+ seed = "numeric",
+ times = "SStimes"),
+ contains = "SSISimulation"
+ )
+setClass("SSSimList",
+ contains = "list"
+ )
+ # Liste von Simulationen Typprüfung nicht
+ # vorgesehen; Erzeugung in Generating Function, sodass alle Anforderungen
+ # "passen"
+setClass("SSContSimulation",
+ representation = representation(SimList = "SSSimList"),
+ contains = "SSSimulation"
+ )
### Itermediate return values
-## ACHTUNG: entgegen Darstellung am 18.09.12 _nicht_ Rückgabetyp
-### von createF createV,... sondern Rückgabetyp der Funktion, die
-## in createF etc zurückgegeben wird
-
-
-
-setClass("SSretValueF", representation = representation(x1 = "numeric",
- Fmat = "matrix", Rmat = "matrix", t = "numeric",
- x0 = "numeric", v = "numeric", u = "numeric",
- control = "OptionalList", dots.propagated = "OptionalList",
- call = "call", diagnostics = "SSDiagnosticretValue"))
-
-setClass("SSretValueZ", representation = representation(y = "numeric",
- Zmat = "matrix", Tmat = "matrix", t = "numeric",
- x1 = "numeric", eps = "numeric", w = "numeric",
- control = "OptionalList", dots.propagated = "OptionalList",
- call = "call", diagnostics = "SSDiagnosticretValue"))
-setClass("SSretValueQ", representation = representation( Q = "matrix",
- t = "numeric", x0 = "numeric", exQ = "ANY",
- control = "OptionalList", dots.propagated = "OptionalList",
- call = "call", diagnostics = "SSDiagnosticretValue"))
-
-setClass("SSretValueV", representation = representation( V = "matrix",
- t = "numeric", x1 = "numeric", exV = "ANY",
- control = "OptionalList", dots.propagated = "OptionalList",
- call = "call", diagnostics = "SSDiagnosticretValue"))
+ # ACHTUNG: entgegen Darstellung am 18.09.12 _nicht_ Rückgabetyp
+ # von createF createV,... sondern Rückgabetyp der Funktion, die
+ # in createF etc zurückgegeben wird
+setClass("SSretValueF",
+ representation = representation(x1 = "numeric",
+ Fmat = "matrix",
+ Rmat = "matrix",
+ t = "numeric",
+ x0 = "numeric",
+ v = "numeric",
+ u = "numeric",
+ control = "OptionalList",
+ dots.propagated = "OptionalList",
+ call = "call",
+ diagnostics = "SSDiagnosticRetValue")
+ )
+setClass("SSretValueZ",
+ representation = representation(y = "numeric",
+ Zmat = "matrix",
+ Tmat = "matrix",
+ t = "numeric",
+ x1 = "numeric",
+ eps = "numeric",
+ w = "numeric",
+ control = "OptionalList",
+ dots.propagated = "OptionalList",
+ call = "call",
+ diagnostics = "SSDiagnosticRetValue")
+ )
+setClass("SSretValueQ",
+ representation = representation(Q = "matrix",
+ t = "numeric",
+ x0 = "numeric",
+ exQ = "ANY",
+ control = "OptionalList",
+ dots.propagated = "OptionalList",
+ call = "call",
+ diagnostics = "SSDiagnosticRetValue")
+ )
+setClass("SSretValueV",
+ representation = representation(V = "matrix",
+ t = "numeric",
+ x1 = "numeric",
+ exV = "ANY",
+ control = "OptionalList",
+ dots.propagated = "OptionalList",
+ call = "call",
+ diagnostics = "SSDiagnosticRetValue")
+ )
More information about the Robkalman-commits
mailing list