R/AllClasses-09-Prior-hierarchy.R

setClass("Prior",
         contains = c("VIRTUAL",
                      "SlotsToExtract",
                      "IMethodPrior",
                      "ComponentFlagsMixin",
                      "IsSaturatedMixin",
                      "JMixin"))

setClass("Exch",
         contains = c("VIRTUAL",
                      "Prior",
                      "AllStrucZeroMixin"))

setClass("DLM",
         contains = c("VIRTUAL",
                      "Prior",
                      "AAlphaMixin",
                      "AllStrucZeroMixin",
                      "AlongAllStrucZeroMixin",
                      "AlphaDLMMixin",
                      "IAlongMixin",
                      "IteratorStateMixin",
                      "IteratorVMixin",
                      "KLMixin",
                      "NuAlphaMixin",
                      "OmegaAlphaMixin",
                      "OmegaAlphaMaxMixin",
                      "PhiMixin",
                      "PhiKnownMixin",
                      "PhiMinMaxMixin",
                      "Shape1Shape2PhiMixin"))

setClass("ICAR",
         contains = c("VIRTUAL",
             "Prior",
             "AlphaICARMixin"))

setClass("Known",
         contains = c("VIRTUAL",
                      "Prior",
                      "AllStrucZeroMixin",
                      "AlphaKnownMixin",
                      "AlphaKnownAllMixin",
                      "MetadataAllMixin"),
         validity = function(object) {
             alphaKnown <- object@alphaKnown@.Data
             J <- object@J@.Data
             isSaturated <- object@isSaturated@.Data
             allStrucZero <- object@allStrucZero
             ## 'alphaKnown' has length 'J'
             if (!identical(length(alphaKnown), J))
                 return(gettextf("'%s' does not have length '%s'",
                                 "alphaKnown", "J"))
             ## is not saturated
             if (isSaturated)
                 return(gettextf("prior has class \"%s\" but '%s' is %s",
                                 "Known", "isSaturated", "TRUE"))
             ## 'alphaKnown' is zero if 'allStrucZero' is TRUE
             if (any(allStrucZero & (alphaKnown != 0)))
                 return(gettextf("elements where '%s' is %s but '%s' does not equal %d",
                                 "allStrucZero", "TRUE", "alphaKnown", 0L))
             TRUE
         })

setClass("Mix",
         contains = c("VIRTUAL",
                      "Prior",
                      "AComponentWeightMixMixin",
                      "ALevelComponentWeightMixMixin",
                      "aMixMixin",
                      "AVectorsMixMixin",
                      "AllStrucZeroMixin",
                      "AlphaMixMixin",
                      "CMixMixin",
                      "ComponentWeightMixMixin",
                      "DimBetaMixin",
                      "IAlongMixin",
                      "FoundIndexClassMaxPossibleMixMixin",
                      "IndexClassMaxMixMixin",
                      "IndexClassMaxPossibleMixMixin",
                      "IndexClassMaxUsedMixMixin",
                      "IndexClassMixMixin",
                      "IndexClassProbMixMixin",
                      "IteratorProdVectorMix",
                      "IteratorsDimsMixMixin",
                      "LatentWeightMixMixin",
                      "LatentComponentWeightMixMixin",
                      "LevelComponentWeightMinMaxMixin",
                      "LevelComponentWeightMixMixin",
                      "mMixMixin",
                      "MeanLevelComponentWeightMixMixin",
                      "NuComponentWeightMixMixin",
                      "NuLevelComponentWeightMixMixin",
                      "NuVectorsMixMixin",
                      "OmegaComponentWeightMaxMixMixin",
                      "OmegaComponentWeightMixMixin",
                      "OmegaLevelComponentWeightMaxMixMixin",
                      "OmegaLevelComponentWeightMixMixin",
                      "OmegaVectorsMaxMixMixin",
                      "OmegaVectorsMixMixin",
                      "PhiKnownMixin",
                      "PhiMinMaxMixin",
                      "PhiMixMixin",
                      "PosProdVectorsMixMixin",
                      "PriorMeanLevelComponentWeightMixMixin",
                      "PriorSDLevelComponentWeightMixMixin",
                      "ProdVectorsMixMixin",
                      "RMixMixin",
                      "Shape1Shape2PhiMixin",
                      "SumsWeightsMixMixin",
                      "ToleranceMixin",
                      "VectorsMixMixin",
                      "WeightMixMixin",
                      "YXXXMixMixin"),
         validity = function(object) {
             ## at least 2 dimensions
             TRUE
         })


## TimeInvariant

setClass("TimeInvariant",
         prototype = prototype(iMethodPrior = -1L,
                               slotsToExtract = character(),
                               hasAlphaDLM = methods::new("LogicalFlag", FALSE),
                               hasAlphaICAR = methods::new("LogicalFlag", FALSE),
                               hasAlphaMix = methods:::new("LogicalFlag", FALSE),
                               hasCovariates = methods::new("LogicalFlag", FALSE),
                               hasAlphaKnown = methods::new("LogicalFlag", FALSE),
                               hasMean = methods::new("LogicalFlag", FALSE),
                               hasSeason = methods::new("LogicalFlag", FALSE),
                               isKnownUncertain = methods::new("LogicalFlag", FALSE),
                               isNorm = methods::new("LogicalFlag", FALSE),
                               isRobust = methods::new("LogicalFlag", FALSE),
                               isZeroVar = methods::new("LogicalFlag", TRUE),
                               isSaturated = methods::new("LogicalFlag", FALSE)),
         contains = "Prior",
         validity = function(object) {
             isSaturated <- object@isSaturated@.Data
             ## is not saturated
             if (isSaturated)
                 return(gettextf("prior has class \"%s\" but '%s' is %s",
                                 "TimeInvariant", "isSaturated", "TRUE"))
             TRUE
         })

## ExchFixed

setClass("ExchFixed",
         prototype = prototype(iMethodPrior = 0L,
                               slotsToExtract = character(),
                               hasAlphaDLM = methods::new("LogicalFlag", FALSE),
                               hasAlphaICAR = methods::new("LogicalFlag", FALSE),
                               hasAlphaMix = methods:::new("LogicalFlag", FALSE),
                               hasCovariates = methods::new("LogicalFlag", FALSE),
                               hasAlphaKnown = methods::new("LogicalFlag", FALSE),
                               hasMean = methods::new("LogicalFlag", TRUE),
                               hasSeason = methods::new("LogicalFlag", FALSE),
                               isKnownUncertain = methods::new("LogicalFlag", FALSE),
                               isNorm = methods::new("LogicalFlag", TRUE),
                               isRobust = methods::new("LogicalFlag", FALSE),
                               isZeroVar = methods::new("LogicalFlag", FALSE),
                               J = methods::new("Length", 1L),
                               mean = methods::new("Parameter", 0),
                               tau = methods::new("Scale", 1)),
         contains = c("Prior",
                      "AllStrucZeroMixin",
                      "MeanMixin",
                      "TauMixin"),
         validity = function(object) {
             isSaturated <- object@isSaturated@.Data
             ## is not saturated
             if (isSaturated)
                 return(gettextf("prior has class \"%s\" but '%s' is %s",
                                 "Known", "isSaturated", "TRUE"))
             TRUE
         })


setClassUnion("Exchangeable",
              members = c("Exch", "ExchFixed"))

## Exch

setClass("ExchNormZero",
         prototype = prototype(iMethodPrior = 1L,
                               slotsToExtract = "tau",  
                               hasAlphaDLM = methods::new("LogicalFlag", FALSE),
                               hasAlphaICAR = methods::new("LogicalFlag", FALSE),
                               hasAlphaMix = methods:::new("LogicalFlag", FALSE),
                               hasCovariates = methods::new("LogicalFlag", FALSE),
                               hasAlphaKnown = methods::new("LogicalFlag", FALSE),
                               hasMean = methods::new("LogicalFlag", FALSE),
                               hasSeason = methods::new("LogicalFlag", FALSE),
                               isKnownUncertain = methods::new("LogicalFlag", FALSE),
                               isNorm = methods::new("LogicalFlag", TRUE),
                               isRobust = methods::new("LogicalFlag", FALSE),
                               isZeroVar = methods::new("LogicalFlag", FALSE),
                               tau = methods::new("Scale", 1),
                               ATau = methods::new("Scale", 1),
                               nuTau = methods::new("DegreesFreedom", 7)),
         contains = c("Exch",
                      "NormMixin",
                      "ZeroMixin"))

setClass("ExchNormCov",
         prototype = prototype(iMethodPrior = 2L,
                               slotsToExtract = c("eta", "tau"),
                               hasAlphaDLM = methods::new("LogicalFlag", FALSE),
                               hasAlphaICAR = methods::new("LogicalFlag", FALSE),
                               hasAlphaMix = methods:::new("LogicalFlag", FALSE),
                               hasCovariates = methods::new("LogicalFlag", TRUE),
                               hasAlphaKnown = methods::new("LogicalFlag", FALSE),
                               hasMean = methods::new("LogicalFlag", FALSE),
                               hasSeason = methods::new("LogicalFlag", FALSE),
                               isKnownUncertain = methods::new("LogicalFlag", FALSE),
                               isNorm = methods::new("LogicalFlag", TRUE),
                               isRobust = methods::new("LogicalFlag", FALSE),
                               isZeroVar = methods::new("LogicalFlag", FALSE),
                               AEtaIntercept = methods::new("Scale", 10),
                               tau = methods::new("Scale", 1),
                               ATau = methods::new("Scale", 1),
                               nuTau = methods::new("DegreesFreedom", 7)),
         contains = c("Exch",
                      "CovariatesMixin",
                      "NormMixin"))

setClass("ExchRobustZero",
         prototype = prototype(iMethodPrior = 3L,
                               slotsToExtract = "tau",
                               hasAlphaDLM = methods::new("LogicalFlag", FALSE),
                               hasAlphaICAR = methods::new("LogicalFlag", FALSE),
                               hasAlphaMix = methods:::new("LogicalFlag", FALSE),
                               hasCovariates = methods::new("LogicalFlag", FALSE),
                               hasAlphaKnown = methods::new("LogicalFlag", FALSE),
                               hasMean = methods::new("LogicalFlag", FALSE),
                               hasSeason = methods::new("LogicalFlag", FALSE),
                               isKnownUncertain = methods::new("LogicalFlag", FALSE),
                               isNorm = methods::new("LogicalFlag", FALSE),
                               isRobust = methods::new("LogicalFlag", TRUE),
                               isZeroVar = methods::new("LogicalFlag", FALSE),
                               nuBeta = methods::new("DegreesFreedom", 4),
                               tau = methods::new("Scale", 1),
                               ATau = methods::new("Scale", 1),
                               nuTau = methods::new("DegreesFreedom", 7)),
         contains = c("Exch",
                      "RobustMixin",
                      "ZeroMixin"))

setClass("ExchRobustCov",
         prototype = prototype(iMethodPrior = 4L,
                               slotsToExtract = c("eta", "tau"),
                               hasAlphaDLM = methods::new("LogicalFlag", FALSE),
                               hasAlphaICAR = methods::new("LogicalFlag", FALSE),
                               hasAlphaMix = methods:::new("LogicalFlag", FALSE),
                               hasCovariates = methods::new("LogicalFlag", TRUE),
                               hasAlphaKnown = methods::new("LogicalFlag", FALSE),
                               hasMean = methods::new("LogicalFlag", FALSE),
                               hasSeason = methods::new("LogicalFlag", FALSE),
                               isKnownUncertain = methods::new("LogicalFlag", FALSE),
                               isNorm = methods::new("LogicalFlag", FALSE),
                               isRobust = methods::new("LogicalFlag", TRUE),
                               isZeroVar = methods::new("LogicalFlag", FALSE),
                               nuBeta = methods::new("DegreesFreedom", 4),
                               AEtaIntercept = methods::new("Scale", 10),
                               tau = methods::new("Scale", 1),
                               ATau = methods::new("Scale", 1),
                               nuTau = methods::new("DegreesFreedom", 7)),
         contains = c("Exch",
                      "CovariatesMixin",
                      "RobustMixin"))


## DLM, NoTrend

setClass("DLMNoTrendNormZeroNoSeason",
         prototype = prototype(iMethodPrior = 5L,
                               slotsToExtract = c("alphaDLM",
                                                  "omegaAlpha",
                                                  "phi",
                                                  "tau"),  
                               hasAlphaDLM = methods::new("LogicalFlag", TRUE),
                               hasAlphaICAR = methods::new("LogicalFlag", FALSE),
                               hasAlphaMix = methods:::new("LogicalFlag", FALSE),
                               hasCovariates = methods::new("LogicalFlag", FALSE),
                               hasAlphaKnown = methods::new("LogicalFlag", FALSE),
                               hasMean = methods::new("LogicalFlag", FALSE),
                               hasSeason = methods::new("LogicalFlag", FALSE),
                               isKnownUncertain = methods::new("LogicalFlag", FALSE),
                               isNorm = methods::new("LogicalFlag", TRUE),
                               isRobust = methods::new("LogicalFlag", FALSE),
                               isZeroVar = methods::new("LogicalFlag", FALSE),
                               AAlpha = methods::new("Scale", 1),
                               nuAlpha = methods::new("DegreesFreedom", 7),
                               omegaAlpha = methods::new("Scale", 1),
                               phi = 0.89,
                               phiKnown = methods::new("LogicalFlag", FALSE),
                               minPhi = 0.8,
                               maxPhi = 0.98,
                               shape1Phi = methods::new("Scale", 2),
                               shape2Phi = methods::new("Scale", 2),
                               tau = methods::new("Scale", 1),
                               ATau = methods::new("Scale", 1),
                               nuTau = methods::new("DegreesFreedom", 7)),
         contains = c("DLM",
                      "NormMixin",
                      "NoTrendMixin",
                      "ZeroMixin"))

setClass("DLMNoTrendNormZeroWithSeason",
         prototype = prototype(iMethodPrior = 6L,
                               slotsToExtract = c("alphaDLM",
                                                  "omegaAlpha",
                                                  "phi",
                                                  "s",
                                                  "omegaSeason",
                                                  "tau"),
                               hasAlphaDLM = methods::new("LogicalFlag", TRUE),
                               hasAlphaICAR = methods::new("LogicalFlag", FALSE),
                               hasAlphaMix = methods:::new("LogicalFlag", FALSE),
                               hasCovariates = methods::new("LogicalFlag", FALSE),
                               hasAlphaKnown = methods::new("LogicalFlag", FALSE),
                               hasMean = methods::new("LogicalFlag", FALSE),
                               hasSeason = methods::new("LogicalFlag", TRUE),
                               isKnownUncertain = methods::new("LogicalFlag", FALSE),
                               isNorm = methods::new("LogicalFlag", TRUE),
                               isRobust = methods::new("LogicalFlag", FALSE),
                               isZeroVar = methods::new("LogicalFlag", FALSE),
                               AAlpha = methods::new("Scale", 1),
                               nuAlpha = methods::new("DegreesFreedom", 7),
                               omegaAlpha = methods::new("Scale", 1),
                               phi = 0.89,
                               phiKnown = methods::new("LogicalFlag", FALSE),
                               minPhi = 0.8,
                               maxPhi = 0.98,
                               shape1Phi = methods::new("Scale", 2),
                               shape2Phi = methods::new("Scale", 2),
                               tau = methods::new("Scale", 1),
                               ATau = methods::new("Scale", 1),
                               nuTau = methods::new("DegreesFreedom", 7),
                               omegaSeason = methods::new("Scale", 1),
                               ASeason = methods::new("Scale", 1),
                               nuSeason = methods::new("DegreesFreedom", 7)),
         contains = c("DLM",
                      "NormMixin",
                      "NoTrendMixin",
                      "SeasonMixin",
                      "ZeroMixin"))

setClass("DLMNoTrendNormCovNoSeason",
         prototype = prototype(iMethodPrior = 7L,
                               slotsToExtract = c("alphaDLM",
                                                  "omegaAlpha",
                                                  "phi",
                                                  "eta",
                                                  "tau"),
                               hasAlphaDLM = methods::new("LogicalFlag", TRUE),
                               hasAlphaICAR = methods::new("LogicalFlag", FALSE),
                               hasAlphaMix = methods:::new("LogicalFlag", FALSE),
                               hasCovariates = methods::new("LogicalFlag", TRUE),
                               hasAlphaKnown = methods::new("LogicalFlag", FALSE),
                               hasMean = methods::new("LogicalFlag", FALSE),
                               hasSeason = methods::new("LogicalFlag", FALSE),
                               isKnownUncertain = methods::new("LogicalFlag", FALSE),
                               isNorm = methods::new("LogicalFlag", TRUE),
                               isRobust = methods::new("LogicalFlag", FALSE),
                               isZeroVar = methods::new("LogicalFlag", FALSE),
                               nuBeta = methods::new("DegreesFreedom", 4),
                               AEtaIntercept = methods::new("Scale", 10),
                               AAlpha = methods::new("Scale", 1),
                               nuAlpha = methods::new("DegreesFreedom", 7),
                               omegaAlpha = methods::new("Scale", 1),
                               phi = 0.89,
                               phiKnown = methods::new("LogicalFlag", FALSE),
                               minPhi = 0.8,
                               maxPhi = 0.98,
                               shape1Phi = methods::new("Scale", 2),
                               shape2Phi = methods::new("Scale", 2),
                               tau = methods::new("Scale", 1),
                               ATau = methods::new("Scale", 1),
                               nuTau = methods::new("DegreesFreedom", 7)),
         contains = c("DLM",
                      "CovariatesMixin",
                      "NormMixin",
                      "NoTrendMixin"))

setClass("DLMNoTrendNormCovWithSeason",
         prototype = prototype(iMethodPrior = 8L,
                               slotsToExtract = c("alphaDLM",
                                                  "omegaAlpha",
                                                  "phi",
                                                  "s",
                                                  "omegaSeason",
                                                  "eta",
                                                  "tau"),
                               hasAlphaDLM = methods::new("LogicalFlag", TRUE),
                               hasAlphaICAR = methods::new("LogicalFlag", FALSE),
                               hasAlphaMix = methods:::new("LogicalFlag", FALSE),
                               hasCovariates = methods::new("LogicalFlag", TRUE),
                               hasAlphaKnown = methods::new("LogicalFlag", FALSE),
                               hasMean = methods::new("LogicalFlag", FALSE),
                               hasSeason = methods::new("LogicalFlag", TRUE),
                               isKnownUncertain = methods::new("LogicalFlag", FALSE),
                               isNorm = methods::new("LogicalFlag", TRUE),
                               isRobust = methods::new("LogicalFlag", FALSE),
                               isZeroVar = methods::new("LogicalFlag", FALSE),
                               nuBeta = methods::new("DegreesFreedom", 4),
                               AEtaIntercept = methods::new("Scale", 10),
                               AAlpha = methods::new("Scale", 1),
                               nuAlpha = methods::new("DegreesFreedom", 7),
                               omegaAlpha = methods::new("Scale", 1),
                               phi = 0.89,
                               phiKnown = methods::new("LogicalFlag", FALSE),
                               minPhi = 0.8,
                               maxPhi = 0.98,
                               shape1Phi = methods::new("Scale", 2),
                               shape2Phi = methods::new("Scale", 2),
                               tau = methods::new("Scale", 1),
                               ATau = methods::new("Scale", 1),
                               nuTau = methods::new("DegreesFreedom", 7),
                               omegaSeason = methods::new("Scale", 1),
                               ASeason = methods::new("Scale", 1),
                               nuSeason = methods::new("DegreesFreedom", 7)),
         contains = c("DLM",
                      "CovariatesMixin",
                      "NormMixin",
                      "NoTrendMixin",
                      "SeasonMixin"))
         
setClass("DLMNoTrendRobustZeroNoSeason",
         prototype = prototype(iMethodPrior = 9L,
                               slotsToExtract = c("alphaDLM",
                                                  "omegaAlpha",
                                                  "phi",
                                                  "tau"),
                               hasAlphaDLM = methods::new("LogicalFlag", TRUE),
                               hasAlphaICAR = methods::new("LogicalFlag", FALSE),
                               hasAlphaMix = methods:::new("LogicalFlag", FALSE),
                               hasCovariates = methods::new("LogicalFlag", FALSE),
                               hasAlphaKnown = methods::new("LogicalFlag", FALSE),
                               hasMean = methods::new("LogicalFlag", FALSE),
                               hasSeason = methods::new("LogicalFlag", FALSE),
                               isKnownUncertain = methods::new("LogicalFlag", FALSE),
                               isNorm = methods::new("LogicalFlag", FALSE),
                               isRobust = methods::new("LogicalFlag", TRUE),
                               isZeroVar = methods::new("LogicalFlag", FALSE),
                               nuBeta = methods::new("DegreesFreedom", 4),
                               AAlpha = methods::new("Scale", 1),
                               nuAlpha = methods::new("DegreesFreedom", 7),
                               omegaAlpha = methods::new("Scale", 1),
                               phi = 0.89,
                               phiKnown = methods::new("LogicalFlag", FALSE),
                               minPhi = 0.8,
                               maxPhi = 0.98,
                               shape1Phi = methods::new("Scale", 2),
                               shape2Phi = methods::new("Scale", 2),
                               tau = methods::new("Scale", 1),
                               ATau = methods::new("Scale", 1),
                               nuTau = methods::new("DegreesFreedom", 7)),
         contains = c("DLM",
                      "NoTrendMixin",
                      "RobustMixin",
                      "ZeroMixin"))

setClass("DLMNoTrendRobustZeroWithSeason",
         prototype = prototype(iMethodPrior = 10L,
                               slotsToExtract = c("alphaDLM",
                                                  "omegaAlpha",
                                                  "phi",
                                                  "s",
                                                  "omegaSeason",
                                                  "tau"),
                               hasAlphaDLM = methods::new("LogicalFlag", TRUE),
                               hasAlphaICAR = methods::new("LogicalFlag", FALSE),
                               hasAlphaMix = methods:::new("LogicalFlag", FALSE),
                               hasCovariates = methods::new("LogicalFlag", FALSE),
                               hasAlphaKnown = methods::new("LogicalFlag", FALSE),
                               hasMean = methods::new("LogicalFlag", FALSE),
                               hasSeason = methods::new("LogicalFlag", TRUE),
                               isKnownUncertain = methods::new("LogicalFlag", FALSE),
                               isNorm = methods::new("LogicalFlag", FALSE),
                               isRobust = methods::new("LogicalFlag", TRUE),
                               isZeroVar = methods::new("LogicalFlag", FALSE),
                               nuBeta = methods::new("DegreesFreedom", 4),
                               AAlpha = methods::new("Scale", 1),
                               nuAlpha = methods::new("DegreesFreedom", 7),
                               omegaAlpha = methods::new("Scale", 1),
                               phi = 0.89,
                               phiKnown = methods::new("LogicalFlag", FALSE),
                               minPhi = 0.8,
                               maxPhi = 0.98,
                               shape1Phi = methods::new("Scale", 2),
                               shape2Phi = methods::new("Scale", 2),
                               tau = methods::new("Scale", 1),
                               ATau = methods::new("Scale", 1),
                               nuTau = methods::new("DegreesFreedom", 7),
                               omegaSeason = methods::new("Scale", 1),
                               ASeason = methods::new("Scale", 1),
                               nuSeason = methods::new("DegreesFreedom", 7)),
         contains = c("DLM",
                      "NoTrendMixin",
                      "RobustMixin",
                      "SeasonMixin",
                      "ZeroMixin"))

setClass("DLMNoTrendRobustCovNoSeason",
         prototype = prototype(iMethodPrior = 11L,
                               slotsToExtract = c("alphaDLM",
                                                  "omegaAlpha",
                                                  "phi",
                                                  "eta",
                                                  "tau"),
                               hasAlphaDLM = methods::new("LogicalFlag", TRUE),
                               hasAlphaICAR = methods::new("LogicalFlag", FALSE),
                               hasAlphaMix = methods:::new("LogicalFlag", FALSE),
                               hasCovariates = methods::new("LogicalFlag", TRUE),
                               hasAlphaKnown = methods::new("LogicalFlag", FALSE),
                               hasMean = methods::new("LogicalFlag", FALSE),
                               hasSeason = methods::new("LogicalFlag", FALSE),
                               isKnownUncertain = methods::new("LogicalFlag", FALSE),
                               isNorm = methods::new("LogicalFlag", FALSE),
                               isRobust = methods::new("LogicalFlag", TRUE),
                               isZeroVar = methods::new("LogicalFlag", FALSE),
                               nuBeta = methods::new("DegreesFreedom", 4),
                               AEtaIntercept = methods::new("Scale", 10),
                               AAlpha = methods::new("Scale", 1),
                               nuAlpha = methods::new("DegreesFreedom", 7),
                               omegaAlpha = methods::new("Scale", 1),
                               phi = 0.89,
                               phiKnown = methods::new("LogicalFlag", FALSE),
                               minPhi = 0.8,
                               maxPhi = 0.98,
                               shape1Phi = methods::new("Scale", 2),
                               shape2Phi = methods::new("Scale", 2),
                               tau = methods::new("Scale", 1),
                               ATau = methods::new("Scale", 1),
                               nuTau = methods::new("DegreesFreedom", 7)),
         contains = c("DLM",
                      "CovariatesMixin",
                      "NoTrendMixin",
                      "RobustMixin"))

setClass("DLMNoTrendRobustCovWithSeason",
         prototype = prototype(iMethodPrior = 12L,
                               slotsToExtract = c("alphaDLM",
                                                  "omegaAlpha",
                                                  "phi",
                                                  "s",
                                                  "omegaSeason",
                                                  "eta",
                                                  "tau"),
                               hasAlphaDLM = methods::new("LogicalFlag", TRUE),
                               hasAlphaICAR = methods::new("LogicalFlag", FALSE),
                               hasAlphaMix = methods:::new("LogicalFlag", FALSE),
                               hasCovariates = methods::new("LogicalFlag", TRUE),
                               hasAlphaKnown = methods::new("LogicalFlag", FALSE),
                               hasMean = methods::new("LogicalFlag", FALSE),
                               hasSeason = methods::new("LogicalFlag", TRUE),
                               isKnownUncertain = methods::new("LogicalFlag", FALSE),
                               isNorm = methods::new("LogicalFlag", FALSE),
                               isRobust = methods::new("LogicalFlag", TRUE),
                               isZeroVar = methods::new("LogicalFlag", FALSE),
                               nuBeta = methods::new("DegreesFreedom", 4),
                               AEtaIntercept = methods::new("Scale", 10),
                               AAlpha = methods::new("Scale", 1),
                               nuAlpha = methods::new("DegreesFreedom", 7),
                               omegaAlpha = methods::new("Scale", 1),
                               phi = 0.89,
                               phiKnown = methods::new("LogicalFlag", FALSE),
                               minPhi = 0.8,
                               maxPhi = 0.98,
                               shape1Phi = methods::new("Scale", 2),
                               shape2Phi = methods::new("Scale", 2),
                               tau = methods::new("Scale", 1),
                               ATau = methods::new("Scale", 1),
                               nuTau = methods::new("DegreesFreedom", 7),
                               omegaSeason = methods::new("Scale", 1),
                               ASeason = methods::new("Scale", 1),
                               nuSeason = methods::new("DegreesFreedom", 7)),
         contains = c("DLM",
                      "CovariatesMixin",
                      "NoTrendMixin",
                      "RobustMixin",
                      "SeasonMixin"))
         
## DLM, WithTrend

setClass("DLMWithTrendNormZeroNoSeason",
         prototype = prototype(iMethodPrior = 13L,
                               slotsToExtract = c("alphaDLM",
                                                  "omegaAlpha",
                                                  "deltaDLM",
                                                  "omegaDelta",
                                                  "phi",
                                                  "tau"),
                               hasAlphaDLM = methods::new("LogicalFlag", TRUE),
                               hasAlphaICAR = methods::new("LogicalFlag", FALSE),
                               hasAlphaMix = methods:::new("LogicalFlag", FALSE),
                               hasCovariates = methods::new("LogicalFlag", FALSE),
                               hasAlphaKnown = methods::new("LogicalFlag", FALSE),
                               hasMean = methods::new("LogicalFlag", FALSE),
                               hasSeason = methods::new("LogicalFlag", FALSE),
                               isKnownUncertain = methods::new("LogicalFlag", FALSE),
                               isNorm = methods::new("LogicalFlag", TRUE),
                               isRobust = methods::new("LogicalFlag", FALSE),
                               isZeroVar = methods::new("LogicalFlag", FALSE),
                               AAlpha = methods::new("Scale", 1),
                               nuAlpha = methods::new("DegreesFreedom", 7),
                               omegaAlpha = methods::new("Scale", 1),
                               ADelta = methods::new("Scale", 1),
                               ADelta0 = methods::new("Scale", 1),
                               meanDelta = methods::new("Parameter", 0),
                               nuDelta = methods::new("DegreesFreedom", 7),
                               omegaDelta = methods::new("Scale", 1),
                               phi = 0.89,
                               phiKnown = methods::new("LogicalFlag", FALSE),
                               minPhi = 0.8,
                               maxPhi = 0.98,
                               shape1Phi = methods::new("Scale", 2),
                               shape2Phi = methods::new("Scale", 2),
                               tau = methods::new("Scale", 1),
                               ATau = methods::new("Scale", 1),
                               nuTau = methods::new("DegreesFreedom", 7),
                               GWithTrend = methods::new("NumericMatrixSquare",
                                                         matrix(c(1, 0, 1, 0.89),
                                                                nrow = 2L,
                                                                ncol = 2L)),
                               WSqrt = methods::new("NumericMatrixSquare", diag(2L)),
                               WSqrtInvG = methods::new("NumericMatrixSquare",
                                                        matrix(c(1, 0, 1, 0.89),
                                                               nrow = 2L,
                                                               ncol = 2L))),
         contains = c("DLM",
                      "NormMixin",
                      "WithTrendMixin",
                      "ZeroMixin"))

setClass("DLMWithTrendNormZeroWithSeason",
         prototype = prototype(iMethodPrior = 14L,
                               slotsToExtract = c("alphaDLM",
                                                  "omegaAlpha",
                                                  "deltaDLM",
                                                  "omegaDelta",
                                                  "phi",
                                                  "s",
                                                  "omegaSeason",
                                                  "tau"),  
                               hasAlphaDLM = methods::new("LogicalFlag", TRUE),
                               hasAlphaICAR = methods::new("LogicalFlag", FALSE),
                               hasAlphaMix = methods:::new("LogicalFlag", FALSE),
                               hasCovariates = methods::new("LogicalFlag", FALSE),
                               hasAlphaKnown = methods::new("LogicalFlag", FALSE),
                               hasMean = methods::new("LogicalFlag", FALSE),
                               hasSeason = methods::new("LogicalFlag", TRUE),
                               isKnownUncertain = methods::new("LogicalFlag", FALSE),
                               isNorm = methods::new("LogicalFlag", TRUE),
                               isRobust = methods::new("LogicalFlag", FALSE),
                               isZeroVar = methods::new("LogicalFlag", FALSE),
                               AAlpha = methods::new("Scale", 1),
                               nuAlpha = methods::new("DegreesFreedom", 7),
                               omegaAlpha = methods::new("Scale", 1),
                               ADelta = methods::new("Scale", 1),
                               ADelta0 = methods::new("Scale", 1),
                               meanDelta = methods::new("Parameter", 0),
                               nuDelta = methods::new("DegreesFreedom", 7),
                               omegaDelta = methods::new("Scale", 1),
                               phi = 0.89,
                               phiKnown = methods::new("LogicalFlag", FALSE),
                               minPhi = 0.8,
                               maxPhi = 0.98,
                               shape1Phi = methods::new("Scale", 2),
                               shape2Phi = methods::new("Scale", 2),
                               tau = methods::new("Scale", 1),
                               ATau = methods::new("Scale", 1),
                               nuTau = methods::new("DegreesFreedom", 7),
                               omegaSeason = methods::new("Scale", 1),
                               ASeason = methods::new("Scale", 1),
                               nuSeason = methods::new("DegreesFreedom", 7),
                               GWithTrend = methods::new("NumericMatrixSquare",
                                                         matrix(c(1, 0, 1, 0.89), nrow = 2L, ncol = 2L)),
                               WSqrt = methods::new("NumericMatrixSquare", diag(2L)),
                               WSqrtInvG = methods::new("NumericMatrixSquare",
                                                        matrix(c(1, 0, 1, 0.89), nrow = 2L, ncol = 2L))),
         contains = c("DLM",
                      "NormMixin",
                      "SeasonMixin",
                      "WithTrendMixin", 
                      "ZeroMixin"))

setClass("DLMWithTrendNormCovNoSeason",
         prototype = prototype(iMethodPrior = 15L,
                               slotsToExtract = c("alphaDLM",
                                                  "omegaAlpha",
                                                  "deltaDLM",
                                                  "omegaDelta",
                                                  "phi",
                                                  "eta",
                                                  "tau"),
                               hasAlphaDLM = methods::new("LogicalFlag", TRUE),
                               hasAlphaICAR = methods::new("LogicalFlag", FALSE),
                               hasAlphaMix = methods:::new("LogicalFlag", FALSE),
                               hasCovariates = methods::new("LogicalFlag", TRUE),
                               hasAlphaKnown = methods::new("LogicalFlag", FALSE),
                               hasMean = methods::new("LogicalFlag", FALSE),
                               hasSeason = methods::new("LogicalFlag", FALSE),
                               isKnownUncertain = methods::new("LogicalFlag", FALSE),
                               isNorm = methods::new("LogicalFlag", TRUE),
                               isRobust = methods::new("LogicalFlag", FALSE),
                               isZeroVar = methods::new("LogicalFlag", FALSE),
                               AEtaIntercept = methods::new("Scale", 10),
                               AAlpha = methods::new("Scale", 1),
                               nuAlpha = methods::new("DegreesFreedom", 7),
                               omegaAlpha = methods::new("Scale", 1),
                               ADelta = methods::new("Scale", 1),
                               ADelta0 = methods::new("Scale", 1),
                               meanDelta = methods::new("Parameter", 0),
                               nuDelta = methods::new("DegreesFreedom", 7),
                               omegaDelta = methods::new("Scale", 1),
                               phi = 0.89,
                               phiKnown = methods::new("LogicalFlag", FALSE),
                               minPhi = 0.8,
                               maxPhi = 0.98,
                               shape1Phi = methods::new("Scale", 2),
                               shape2Phi = methods::new("Scale", 2),
                               tau = methods::new("Scale", 1),
                               ATau = methods::new("Scale", 1),
                               nuTau = methods::new("DegreesFreedom", 7),
                               GWithTrend = methods::new("NumericMatrixSquare",
                                                         matrix(c(1, 0, 1, 0.89), nrow = 2L, ncol = 2L)),
                               WSqrt = methods::new("NumericMatrixSquare", diag(2L)),
                               WSqrtInvG = methods::new("NumericMatrixSquare",
                                                        matrix(c(1, 0, 1, 0.89), nrow = 2L, ncol = 2L))),
         contains = c("DLM",
                      "CovariatesMixin",
                      "NormMixin",
                      "WithTrendMixin"))

setClass("DLMWithTrendNormCovWithSeason",
         prototype = prototype(iMethodPrior = 16L,
                               slotsToExtract = c("alphaDLM",
                                                  "omegaAlpha",
                                                  "deltaDLM",
                                                  "omegaDelta",
                                                  "phi",
                                                  "s",
                                                  "omegaSeason",
                                                  "eta",
                                                  "tau"),
                               hasAlphaDLM = methods::new("LogicalFlag", TRUE),
                               hasAlphaICAR = methods::new("LogicalFlag", FALSE),
                               hasAlphaMix = methods:::new("LogicalFlag", FALSE),
                               hasCovariates = methods::new("LogicalFlag", TRUE),
                               hasAlphaKnown = methods::new("LogicalFlag", FALSE),
                               hasMean = methods::new("LogicalFlag", FALSE),
                               hasSeason = methods::new("LogicalFlag", TRUE),
                               isKnownUncertain = methods::new("LogicalFlag", FALSE),
                               isNorm = methods::new("LogicalFlag", TRUE),
                               isRobust = methods::new("LogicalFlag", FALSE),
                               isZeroVar = methods::new("LogicalFlag", FALSE),
                               AEtaIntercept = methods::new("Scale", 10),
                               AAlpha = methods::new("Scale", 1),
                               nuAlpha = methods::new("DegreesFreedom", 7),
                               omegaAlpha = methods::new("Scale", 1),
                               ADelta = methods::new("Scale", 1),
                               ADelta0 = methods::new("Scale", 1),
                               meanDelta = methods::new("Parameter", 0),
                               nuDelta = methods::new("DegreesFreedom", 7),
                               omegaDelta = methods::new("Scale", 1),
                               phi = 0.89,
                               phiKnown = methods::new("LogicalFlag", FALSE),
                               minPhi = 0.8,
                               maxPhi = 0.98,
                               shape1Phi = methods::new("Scale", 2),
                               shape2Phi = methods::new("Scale", 2),
                               tau = methods::new("Scale", 1),
                               ATau = methods::new("Scale", 1),
                               nuTau = methods::new("DegreesFreedom", 7),
                               omegaSeason = methods::new("Scale", 1),
                               ASeason = methods::new("Scale", 1),
                               nuSeason = methods::new("DegreesFreedom", 7),
                               GWithTrend = methods::new("NumericMatrixSquare",
                                                         matrix(c(1, 0, 1, 0.89), nrow = 2L, ncol = 2L)),
                               WSqrt = methods::new("NumericMatrixSquare", diag(2L)),
                               WSqrtInvG = methods::new("NumericMatrixSquare",
                                                        matrix(c(1, 0, 1, 0.89), nrow = 2L, ncol = 2L))),
         contains = c("DLM",
                      "CovariatesMixin",
                      "NormMixin", 
                      "SeasonMixin",
                      "WithTrendMixin"))

setClass("DLMWithTrendRobustZeroNoSeason",
         prototype = prototype(iMethodPrior = 17L,
                               slotsToExtract = c("alphaDLM",
                                                  "omegaAlpha",
                                                  "deltaDLM",
                                                  "omegaDelta",
                                                  "phi",
                                                  "tau"),
                               hasAlphaDLM = methods::new("LogicalFlag", TRUE),
                               hasAlphaICAR = methods::new("LogicalFlag", FALSE),
                               hasAlphaMix = methods:::new("LogicalFlag", FALSE),
                               hasCovariates = methods::new("LogicalFlag", FALSE),
                               hasAlphaKnown = methods::new("LogicalFlag", FALSE),
                               hasMean = methods::new("LogicalFlag", FALSE),
                               hasSeason = methods::new("LogicalFlag", FALSE),
                               isKnownUncertain = methods::new("LogicalFlag", FALSE),
                               isNorm = methods::new("LogicalFlag", FALSE),
                               isRobust = methods::new("LogicalFlag", TRUE),
                               isZeroVar = methods::new("LogicalFlag", FALSE),
                               nuBeta = methods::new("DegreesFreedom", 4),
                               AAlpha = methods::new("Scale", 1),
                               nuAlpha = methods::new("DegreesFreedom", 7),
                               omegaAlpha = methods::new("Scale", 1),
                               ADelta = methods::new("Scale", 1),
                               ADelta0 = methods::new("Scale", 1),
                               meanDelta = methods::new("Parameter", 0),
                               nuDelta = methods::new("DegreesFreedom", 7),
                               omegaDelta = methods::new("Scale", 1),
                               phi = 0.89,
                               phiKnown = methods::new("LogicalFlag", FALSE),
                               minPhi = 0.8,
                               maxPhi = 0.98,
                               shape1Phi = methods::new("Scale", 2),
                               shape2Phi = methods::new("Scale", 2),
                               tau = methods::new("Scale", 1),
                               ATau = methods::new("Scale", 1),
                               nuTau = methods::new("DegreesFreedom", 7),
                               GWithTrend = methods::new("NumericMatrixSquare",
                                                         matrix(c(1, 0, 1, 0.89), nrow = 2L, ncol = 2L)),
                               WSqrt = methods::new("NumericMatrixSquare", diag(2L)),
                               WSqrtInvG = methods::new("NumericMatrixSquare",
                                                        matrix(c(1, 0, 1, 0.89), nrow = 2L, ncol = 2L))),
         contains = c("DLM",
                      "RobustMixin",
                      "WithTrendMixin",
                      "ZeroMixin"))

setClass("DLMWithTrendRobustZeroWithSeason",
         prototype = prototype(iMethodPrior = 18L,
                               slotsToExtract = c("alphaDLM",
                                                  "omegaAlpha",
                                                  "deltaDLM",
                                                  "omegaDelta",
                                                  "phi",
                                                  "s",
                                                  "omegaSeason",
                                                  "tau"),
                               hasAlphaDLM = methods::new("LogicalFlag", TRUE),
                               hasAlphaICAR = methods::new("LogicalFlag", FALSE),
                               hasAlphaMix = methods:::new("LogicalFlag", FALSE),
                               hasCovariates = methods::new("LogicalFlag", FALSE),
                               hasAlphaKnown = methods::new("LogicalFlag", FALSE),
                               hasMean = methods::new("LogicalFlag", FALSE),
                               hasSeason = methods::new("LogicalFlag", TRUE),
                               isKnownUncertain = methods::new("LogicalFlag", FALSE),
                               isNorm = methods::new("LogicalFlag", FALSE),
                               isRobust = methods::new("LogicalFlag", TRUE),
                               isZeroVar = methods::new("LogicalFlag", FALSE),
                               nuBeta = methods::new("DegreesFreedom", 4),
                               AAlpha = methods::new("Scale", 1),
                               nuAlpha = methods::new("DegreesFreedom", 7),
                               omegaAlpha = methods::new("Scale", 1),
                               ADelta = methods::new("Scale", 1),
                               ADelta0 = methods::new("Scale", 1),
                               meanDelta = methods::new("Parameter", 0),
                               nuDelta = methods::new("DegreesFreedom", 7),
                               omegaDelta = methods::new("Scale", 1),
                               phi = 0.89,
                               phiKnown = methods::new("LogicalFlag", FALSE),
                               minPhi = 0.8,
                               maxPhi = 0.98,
                               shape1Phi = methods::new("Scale", 2),
                               shape2Phi = methods::new("Scale", 2),
                               tau = methods::new("Scale", 1),
                               ATau = methods::new("Scale", 1),
                               nuTau = methods::new("DegreesFreedom", 7),
                               omegaSeason = methods::new("Scale", 1),
                               ASeason = methods::new("Scale", 1),
                               nuSeason = methods::new("DegreesFreedom", 7),
                               GWithTrend = methods::new("NumericMatrixSquare",
                                                         matrix(c(1, 0, 1, 0.89), nrow = 2L, ncol = 2L)),
                               WSqrt = methods::new("NumericMatrixSquare", diag(2L)),
                               WSqrtInvG = methods::new("NumericMatrixSquare",
                                                        matrix(c(1, 0, 1, 0.89), nrow = 2L, ncol = 2L))),
         contains = c("DLM",
                      "RobustMixin",
                      "SeasonMixin",
                      "WithTrendMixin",
                      "ZeroMixin"))

setClass("DLMWithTrendRobustCovNoSeason",
         prototype = prototype(iMethodPrior = 19L,
                               slotsToExtract = c("alphaDLM",
                                                  "omegaAlpha",
                                                  "deltaDLM",
                                                  "omegaDelta",
                                                  "phi",
                                                  "eta",
                                                  "tau"),
                               hasAlphaDLM = methods::new("LogicalFlag", TRUE),
                               hasAlphaICAR = methods::new("LogicalFlag", FALSE),
                               hasAlphaMix = methods:::new("LogicalFlag", FALSE),
                               hasCovariates = methods::new("LogicalFlag", TRUE),
                               hasAlphaKnown = methods::new("LogicalFlag", FALSE),
                               hasMean = methods::new("LogicalFlag", FALSE),
                               hasSeason = methods::new("LogicalFlag", FALSE),
                               isKnownUncertain = methods::new("LogicalFlag", FALSE),
                               isNorm = methods::new("LogicalFlag", FALSE),
                               isRobust = methods::new("LogicalFlag", TRUE),
                               isZeroVar = methods::new("LogicalFlag", FALSE),
                               nuBeta = methods::new("DegreesFreedom", 4),
                               AEtaIntercept = methods::new("Scale", 10),
                               meanDelta = methods::new("Parameter", 0),
                               AAlpha = methods::new("Scale", 1),
                               nuAlpha = methods::new("DegreesFreedom", 7),
                               omegaAlpha = methods::new("Scale", 1),
                               ADelta = methods::new("Scale", 1),
                               ADelta0 = methods::new("Scale", 1),
                               nuDelta = methods::new("DegreesFreedom", 7),
                               omegaDelta = methods::new("Scale", 1),
                               phi = 0.89,
                               phiKnown = methods::new("LogicalFlag", FALSE),
                               minPhi = 0.8,
                               maxPhi = 0.98,
                               shape1Phi = methods::new("Scale", 2),
                               shape2Phi = methods::new("Scale", 2),
                               tau = methods::new("Scale", 1),
                               ATau = methods::new("Scale", 1),
                               nuTau = methods::new("DegreesFreedom", 7),
                               GWithTrend = methods::new("NumericMatrixSquare",
                                                         matrix(c(1, 0, 1, 0.89), nrow = 2L, ncol = 2L)),
                               WSqrt = methods::new("NumericMatrixSquare", diag(2L)),
                               WSqrtInvG = methods::new("NumericMatrixSquare",
                                                        matrix(c(1, 0, 1, 0.89), nrow = 2L, ncol = 2L))),
         contains = c("DLM",
                      "CovariatesMixin",
                      "RobustMixin",
                      "WithTrendMixin"))

setClass("DLMWithTrendRobustCovWithSeason",
         prototype = prototype(iMethodPrior = 20L,
                               slotsToExtract = c("alphaDLM",
                                                  "omegaAlpha",
                                                  "deltaDLM",
                                                  "omegaDelta",
                                                  "phi",
                                                  "s",
                                                  "omegaSeason",
                                                  "eta",
                                                  "tau"),
                               hasAlphaDLM = methods::new("LogicalFlag", TRUE),
                               hasAlphaICAR = methods::new("LogicalFlag", FALSE),
                               hasAlphaMix = methods:::new("LogicalFlag", FALSE),
                               hasCovariates = methods::new("LogicalFlag", TRUE),
                               hasAlphaKnown = methods::new("LogicalFlag", FALSE),
                               hasMean = methods::new("LogicalFlag", FALSE),
                               hasSeason = methods::new("LogicalFlag", TRUE),
                               isKnownUncertain = methods::new("LogicalFlag", FALSE),
                               isNorm = methods::new("LogicalFlag", FALSE),
                               isRobust = methods::new("LogicalFlag", TRUE),
                               isZeroVar = methods::new("LogicalFlag", FALSE),
                               nuBeta = methods::new("DegreesFreedom", 4),
                               AEtaIntercept = methods::new("Scale", 10),
                               AAlpha = methods::new("Scale", 1),
                               meanDelta = methods::new("Parameter", 0),
                               nuAlpha = methods::new("DegreesFreedom", 7),
                               omegaAlpha = methods::new("Scale", 1),
                               ADelta = methods::new("Scale", 1),
                               ADelta0 = methods::new("Scale", 1),
                               meanDelta = methods::new("Parameter", 0),
                               nuDelta = methods::new("DegreesFreedom", 7),
                               omegaDelta = methods::new("Scale", 1),
                               phi = 0.89,
                               phiKnown = methods::new("LogicalFlag", FALSE),
                               minPhi = 0.8,
                               maxPhi = 0.98,
                               shape1Phi = methods::new("Scale", 2),
                               shape2Phi = methods::new("Scale", 2),
                               tau = methods::new("Scale", 1),
                               ATau = methods::new("Scale", 1),
                               nuTau = methods::new("DegreesFreedom", 7),
                               omegaSeason = methods::new("Scale", 1),
                               ASeason = methods::new("Scale", 1),
                               nuSeason = methods::new("DegreesFreedom", 7),
                               GWithTrend = methods::new("NumericMatrixSquare",
                                                         matrix(c(1, 0, 1, 0.89), nrow = 2L, ncol = 2L)),
                               WSqrt = methods::new("NumericMatrixSquare", diag(2L)),
                               WSqrtInvG = methods::new("NumericMatrixSquare",
                                                        matrix(c(1, 0, 1, 0.89), nrow = 2L, ncol = 2L))),
         contains = c("DLM",
                      "CovariatesMixin",
                      "RobustMixin",
                      "SeasonMixin",
                      "WithTrendMixin"))


## ICAR

setClass("ICARNormZero",
         prototype = prototype(iMethodPrior = 21L,
                               slotsToExtract = c("alphaICAR",
                                                  "omegaAlpha",
                                                  "tau"),
                               hasAlphaDLM = methods::new("LogicalFlag", FALSE),
                               hasAlphaICAR = methods::new("LogicalFlag", TRUE),
                               hasAlphaMix = methods:::new("LogicalFlag", FALSE),
                               hasCovariates = methods::new("LogicalFlag", FALSE),
                               hasAlphaKnown = methods::new("LogicalFlag", FALSE),
                               hasMean = methods::new("LogicalFlag", FALSE),
                               hasSeason = methods::new("LogicalFlag", FALSE),
                               isKnownUncertain = methods::new("LogicalFlag", FALSE),
                               isNorm = methods::new("LogicalFlag", TRUE),
                               isRobust = methods::new("LogicalFlag", FALSE),
                               isZeroVar = methods::new("LogicalFlag", FALSE),
                               tau = methods::new("Scale", 1),
                               ATau = methods::new("Scale", 1),
                               nuTau = methods::new("DegreesFreedom", 7)),
         contains = c("ICAR",
                      "NormMixin",
                      "ZeroMixin"))

setClass("ICARNormCov",
         prototype = prototype(iMethodPrior = 22L,
                               slotsToExtract = c("alphaICAR",
                                                  "omegaAlpha",
                                                  "eta",
                                                  "tau"),
                               hasAlphaDLM = methods::new("LogicalFlag", FALSE),
                               hasAlphaICAR = methods::new("LogicalFlag", TRUE),
                               hasAlphaMix = methods:::new("LogicalFlag", FALSE),
                               hasCovariates = methods::new("LogicalFlag", TRUE),
                               hasAlphaKnown = methods::new("LogicalFlag", FALSE),
                               hasMean = methods::new("LogicalFlag", FALSE),
                               hasSeason = methods::new("LogicalFlag", FALSE),
                               isKnownUncertain = methods::new("LogicalFlag", FALSE),
                               isNorm = methods::new("LogicalFlag", TRUE),
                               isRobust = methods::new("LogicalFlag", FALSE),
                               isZeroVar = methods::new("LogicalFlag", FALSE),
                               AEtaIntercept = methods::new("Scale", 10),
                               tau = methods::new("Scale", 1),
                               ATau = methods::new("Scale", 1),
                               nuTau = methods::new("DegreesFreedom", 7)),
         contains = c("ICAR",
                      "CovariatesMixin",
                      "NormMixin"))

setClass("ICARRobustZero",
         prototype = prototype(iMethodPrior = 23L,
                               slotsToExtract = c("alphaICAR",
                                                  "omegaAlpha",
                                                  "tau"),
                               hasAlphaDLM = methods::new("LogicalFlag", FALSE),
                               hasAlphaICAR = methods::new("LogicalFlag", TRUE),
                               hasAlphaMix = methods:::new("LogicalFlag", FALSE),
                               hasCovariates = methods::new("LogicalFlag", FALSE),
                               hasAlphaKnown = methods::new("LogicalFlag", FALSE),
                               hasMean = methods::new("LogicalFlag", FALSE),
                               hasSeason = methods::new("LogicalFlag", FALSE),
                               isKnownUncertain = methods::new("LogicalFlag", FALSE),
                               isNorm = methods::new("LogicalFlag", FALSE),
                               isRobust = methods::new("LogicalFlag", TRUE),
                               isZeroVar = methods::new("LogicalFlag", FALSE),
                               nuBeta = methods::new("DegreesFreedom", 4),
                               tau = methods::new("Scale", 1),
                               ATau = methods::new("Scale", 1),
                               nuTau = methods::new("DegreesFreedom", 7)),
         contains = c("ICAR",
                      "RobustMixin",
                      "ZeroMixin"))

setClass("ICARRobustCov",
         prototype = prototype(iMethodPrior = 24L,
                               slotsToExtract = c("alphaICAR",
                                                  "omegaAlpha",
                                                  "eta",
                                                  "tau"),
                               hasAlphaDLM = methods::new("LogicalFlag", FALSE),
                               hasAlphaICAR = methods::new("LogicalFlag", TRUE),
                               hasAlphaMix = methods:::new("LogicalFlag", FALSE),
                               hasCovariates = methods::new("LogicalFlag", TRUE),
                               hasAlphaKnown = methods::new("LogicalFlag", FALSE),
                               hasMean = methods::new("LogicalFlag", FALSE),
                               hasSeason = methods::new("LogicalFlag", FALSE),
                               isKnownUncertain = methods::new("LogicalFlag", FALSE),
                               isNorm = methods::new("LogicalFlag", FALSE),
                               isRobust = methods::new("LogicalFlag", TRUE),
                               isZeroVar = methods::new("LogicalFlag", FALSE),
                               nuBeta = methods::new("DegreesFreedom", 4),
                               AEtaIntercept = methods::new("Scale", 10),
                               tau = methods::new("Scale", 1),
                               ATau = methods::new("Scale", 1),
                               nuTau = methods::new("DegreesFreedom", 7)),
         contains = c("ICAR",
                      "CovariatesMixin",
                      "RobustMixin"))

## Known

setClass("KnownCertain",
         prototype = prototype(iMethodPrior = 29L,
                               slotsToExtract = character(),
                               hasAlphaDLM = methods::new("LogicalFlag", FALSE),
                               hasAlphaICAR = methods::new("LogicalFlag", FALSE),
                               hasAlphaMix = methods:::new("LogicalFlag", FALSE),
                               hasCovariates = methods::new("LogicalFlag", FALSE),
                               hasAlphaKnown = methods::new("LogicalFlag", TRUE),
                               hasMean = methods::new("LogicalFlag", FALSE),
                               hasSeason = methods::new("LogicalFlag", FALSE),
                               isKnownUncertain = methods::new("LogicalFlag", FALSE),
                               isNorm = methods::new("LogicalFlag", FALSE),
                               isRobust = methods::new("LogicalFlag", FALSE),
                               isZeroVar = methods::new("LogicalFlag", TRUE)),
         contains = "Known")

setClass("KnownUncertain",
         prototype = prototype(iMethodPrior = 30L,
                               slotsToExtract = character(),
                               hasAlphaDLM = methods::new("LogicalFlag", FALSE),
                               hasAlphaICAR = methods::new("LogicalFlag", FALSE),
                               hasAlphaMix = methods:::new("LogicalFlag", FALSE),
                               hasCovariates = methods::new("LogicalFlag", FALSE),
                               hasAlphaKnown = methods::new("LogicalFlag", TRUE),
                               hasMean = methods::new("LogicalFlag", FALSE),
                               hasSeason = methods::new("LogicalFlag", FALSE),
                               isKnownUncertain = methods::new("LogicalFlag", TRUE),
                               isNorm = methods::new("LogicalFlag", FALSE),
                               isRobust = methods::new("LogicalFlag", FALSE),
                               isZeroVar = methods::new("LogicalFlag", FALSE)),
         contains = c("Known",
                      "AKnownVecMixin",
                      "AKnownAllVecMixin"),
         validity = function(object) {
             AKnownVec <- object@AKnownVec
             J <- object@J@.Data
             allStrucZero <- object@allStrucZero
             ## 'AKnownVec' has length 'J'
             if (!identical(length(AKnownVec), J))
                 return(gettextf("'%s' does not have length '%s'",
                                 "AKnownVec", "J"))
             ## 'AKnownVec' is zero if 'allStrucZero' is TRUE
             if (any(allStrucZero & (AKnownVec != 0)))
                 return(gettextf("elements where '%s' is %s but '%s' does not equal %d",
                                 "allStrucZero", "TRUE", "AKnownVec", 0L))
             TRUE
         })

## Mix

setClass("MixNormZero",
         prototype = prototype(iMethodPrior = 31L,
                               slotsToExtract = c("prodVectorsMix",
                                                  "omegaVectorsMix",
                                                  "weightMix",
                                                  "componentWeightMix",
                                                  "omegaComponentWeightMix",
                                                  "levelComponentWeightMix",
                                                  "meanLevelComponentWeightMix",
                                                  "phiMix",
                                                  "omegaLevelComponentWeightMix",
                                                  "tau"),
                               hasAlphaDLM = methods::new("LogicalFlag", FALSE),
                               hasAlphaICAR = methods::new("LogicalFlag", FALSE),
                               hasAlphaMix = methods:::new("LogicalFlag", TRUE),
                               hasCovariates = methods::new("LogicalFlag", FALSE),
                               hasAlphaKnown = methods::new("LogicalFlag", FALSE),
                               hasMean = methods::new("LogicalFlag", FALSE),
                               hasSeason = methods::new("LogicalFlag", FALSE),
                               isKnownUncertain = methods::new("LogicalFlag", FALSE),
                               isNorm = methods::new("LogicalFlag", TRUE),
                               isRobust = methods::new("LogicalFlag", FALSE),
                               isZeroVar = methods::new("LogicalFlag", FALSE),
                               tau = methods::new("Scale", 1),
                               ATau = methods::new("Scale", 1),
                               nuTau = methods::new("DegreesFreedom", 7)),
         contains = c("Mix",
                      "NormMixin",
                      "ZeroMixin"))

setClass("MixNormCov",
         prototype = prototype(iMethodPrior = 32L,
                               slotsToExtract = c("eta", "tau"),
                               hasAlphaDLM = methods::new("LogicalFlag", FALSE),
                               hasAlphaICAR = methods::new("LogicalFlag", FALSE),
                               hasAlphaMix = methods:::new("LogicalFlag", TRUE),
                               hasCovariates = methods::new("LogicalFlag", TRUE),
                               hasAlphaKnown = methods::new("LogicalFlag", FALSE),
                               hasMean = methods::new("LogicalFlag", FALSE),
                               hasSeason = methods::new("LogicalFlag", FALSE),
                               isKnownUncertain = methods::new("LogicalFlag", FALSE),
                               isNorm = methods::new("LogicalFlag", TRUE),
                               isRobust = methods::new("LogicalFlag", FALSE),
                               isZeroVar = methods::new("LogicalFlag", FALSE),
                               AEtaIntercept = methods::new("Scale", 10),
                               tau = methods::new("Scale", 1),
                               ATau = methods::new("Scale", 1),
                               nuTau = methods::new("DegreesFreedom", 7)),
         contains = c("Mix",
                      "CovariatesMixin",
                      "NormMixin"))

setClass("MixRobustZero",
         prototype = prototype(iMethodPrior = 33L,
                               slotsToExtract = "tau",
                               hasAlphaDLM = methods::new("LogicalFlag", FALSE),
                               hasAlphaICAR = methods::new("LogicalFlag", FALSE),
                               hasAlphaMix = methods:::new("LogicalFlag", TRUE),
                               hasCovariates = methods::new("LogicalFlag", FALSE),
                               hasAlphaKnown = methods::new("LogicalFlag", FALSE),
                               hasMean = methods::new("LogicalFlag", FALSE),
                               hasSeason = methods::new("LogicalFlag", FALSE),
                               isKnownUncertain = methods::new("LogicalFlag", FALSE),
                               isNorm = methods::new("LogicalFlag", FALSE),
                               isRobust = methods::new("LogicalFlag", TRUE),
                               isZeroVar = methods::new("LogicalFlag", FALSE),
                               nuBeta = methods::new("DegreesFreedom", 4),
                               tau = methods::new("Scale", 1),
                               ATau = methods::new("Scale", 1),
                               nuTau = methods::new("DegreesFreedom", 7)),
         contains = c("Mix",
                      "RobustMixin",
                      "ZeroMixin"))

setClass("MixRobustCov",
         prototype = prototype(iMethodPrior = 34L,
                               slotsToExtract = c("eta", "tau"),
                               hasAlphaDLM = methods::new("LogicalFlag", FALSE),
                               hasAlphaICAR = methods::new("LogicalFlag", FALSE),
                               hasAlphaMix = methods:::new("LogicalFlag", TRUE),
                               hasCovariates = methods::new("LogicalFlag", TRUE),
                               hasAlphaKnown = methods::new("LogicalFlag", FALSE),
                               hasMean = methods::new("LogicalFlag", FALSE),
                               hasSeason = methods::new("LogicalFlag", FALSE),
                               isKnownUncertain = methods::new("LogicalFlag", FALSE),
                               isNorm = methods::new("LogicalFlag", FALSE),
                               isRobust = methods::new("LogicalFlag", TRUE),
                               isZeroVar = methods::new("LogicalFlag", FALSE),
                               nuBeta = methods::new("DegreesFreedom", 4),
                               AEtaIntercept = methods::new("Scale", 10),
                               tau = methods::new("Scale", 1),
                               ATau = methods::new("Scale", 1),
                               nuTau = methods::new("DegreesFreedom", 7)),
         contains = c("Mix",
                      "CovariatesMixin",
                      "RobustMixin"))


## Zero

setClass("Zero",
         prototype = prototype(iMethodPrior = 40L,
                               slotsToExtract = character(),
                               hasAlphaDLM = methods::new("LogicalFlag", FALSE),
                               hasAlphaICAR = methods::new("LogicalFlag", FALSE),
                               hasAlphaMix = methods:::new("LogicalFlag", FALSE),
                               hasCovariates = methods::new("LogicalFlag", FALSE),
                               hasAlphaKnown = methods::new("LogicalFlag", FALSE),
                               hasMean = methods::new("LogicalFlag", FALSE),
                               hasSeason = methods::new("LogicalFlag", FALSE),
                               isKnownUncertain = methods::new("LogicalFlag", FALSE),
                               isNorm = methods::new("LogicalFlag", FALSE),
                               isRobust = methods::new("LogicalFlag", FALSE),
                               isZeroVar = methods::new("LogicalFlag", TRUE)),
         contains = c("Prior",
                      "AllStrucZeroMixin"),
         validity = function(object) {
             isSaturated <- object@isSaturated@.Data
             ## is not saturated
             if (isSaturated)
                 return(gettextf("prior has class \"%s\" but '%s' is %s",
                                 "Zero", "isSaturated", "TRUE"))
             TRUE
         })


## DLMPredict, NoTrend

setClass("DLMNoTrendNormZeroNoSeasonPredict",
         prototype = prototype(iMethodPrior = 105L),
         contains = c("DLMNoTrendNormZeroNoSeason",
             "DLMPredictMixin"))

setClass("DLMNoTrendNormZeroWithSeasonPredict",
         prototype = prototype(iMethodPrior = 106L),
         contains = c("DLMNoTrendNormZeroWithSeason",
             "DLMPredictMixin"))

setClass("DLMNoTrendNormCovNoSeasonPredict",
         prototype = prototype(iMethodPrior = 107L),
         contains = c("DLMNoTrendNormCovNoSeason",
             "DLMPredictMixin"))

setClass("DLMNoTrendNormCovWithSeasonPredict",
         prototype = prototype(iMethodPrior = 108L),
         contains = c("DLMNoTrendNormCovWithSeason",
             "DLMPredictMixin"))
         
setClass("DLMNoTrendRobustZeroNoSeasonPredict",
         prototype = prototype(iMethodPrior = 109L),
         contains = c("DLMNoTrendRobustZeroNoSeason",
             "DLMPredictMixin"))

setClass("DLMNoTrendRobustZeroWithSeasonPredict",
         prototype = prototype(iMethodPrior = 110L),
         contains = c("DLMNoTrendRobustZeroWithSeason",
             "DLMPredictMixin"))

setClass("DLMNoTrendRobustCovNoSeasonPredict",
         prototype = prototype(iMethodPrior = 111L),
         contains = c("DLMNoTrendRobustCovNoSeason",
             "DLMPredictMixin"))

setClass("DLMNoTrendRobustCovWithSeasonPredict",
         prototype = prototype(iMethodPrior = 112L),
         contains = c("DLMNoTrendRobustCovWithSeason",
             "DLMPredictMixin"))
         
## DLM, WithTrend

setClass("DLMWithTrendNormZeroNoSeasonPredict",
         prototype = prototype(iMethodPrior = 113L),
         contains = c("DLMWithTrendNormZeroNoSeason",
             "DLMPredictMixin"))

setClass("DLMWithTrendNormZeroWithSeasonPredict",
         prototype = prototype(iMethodPrior = 114L),
         contains = c("DLMWithTrendNormZeroWithSeason",
             "DLMPredictMixin"))

setClass("DLMWithTrendNormCovNoSeasonPredict",
         prototype = prototype(iMethodPrior = 115L),
         contains = c("DLMWithTrendNormCovNoSeason",
             "DLMPredictMixin"))

setClass("DLMWithTrendNormCovWithSeasonPredict",
         prototype = prototype(iMethodPrior = 116L),
         contains = c("DLMWithTrendNormCovWithSeason",
             "DLMPredictMixin"))

setClass("DLMWithTrendRobustZeroNoSeasonPredict",
         prototype = prototype(iMethodPrior = 117L),
         contains = c("DLMWithTrendRobustZeroNoSeason",
             "DLMPredictMixin"))

setClass("DLMWithTrendRobustZeroWithSeasonPredict",
         prototype = prototype(iMethodPrior = 118L),
         contains = c("DLMWithTrendRobustZeroWithSeason",
             "DLMPredictMixin"))

setClass("DLMWithTrendRobustCovNoSeasonPredict",
         prototype = prototype(iMethodPrior = 119L),
         contains = c("DLMWithTrendRobustCovNoSeason",
             "DLMPredictMixin"))

setClass("DLMWithTrendRobustCovWithSeasonPredict",
         prototype = prototype(iMethodPrior = 120L),
         contains = c("DLMWithTrendRobustCovWithSeason",
             "DLMPredictMixin"))


## MixPredict

setClass("MixNormZeroPredict",
         prototype = prototype(iMethodPrior = 131L),
         contains = c("MixNormZero",
                      "MixPredictMixin"))

setClass("MixNormCovPredict",
         prototype = prototype(iMethodPrior = 132L),
         contains = c("MixNormCov",
                      "MixPredictMixin"))

setClass("MixRobustZeroPredict",
         prototype = prototype(iMethodPrior = 133L),
         contains = c("MixRobustZero",
                      "MixPredictMixin"))

setClass("MixRobustCovPredict",
         prototype = prototype(iMethodPrior = 134L),
         contains = c("MixRobustCov",
                      "MixPredictMixin"))
StatisticsNZ/demest documentation built on Nov. 2, 2023, 7:56 p.m.