[Distr-commits] r833 - branches/distr-2.4/pkg/distrMod/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jan 8 23:13:40 CET 2013


Author: ruckdeschel
Date: 2013-01-08 23:13:39 +0100 (Tue, 08 Jan 2013)
New Revision: 833

Modified:
   branches/distr-2.4/pkg/distrMod/R/modifyModel.R
Log:
distrMod: after change of @<- semantics by J. Chambers moved from
 class(M) <- class(model) 
to 
  slots.from <- slotNames(class(M))
  M1 <- new(class(model))
  for(slot.s in slots.from) slot(M1,slot.s) <- slot(M,slot.s)

Modified: branches/distr-2.4/pkg/distrMod/R/modifyModel.R
===================================================================
--- branches/distr-2.4/pkg/distrMod/R/modifyModel.R	2013-01-08 21:06:35 UTC (rev 832)
+++ branches/distr-2.4/pkg/distrMod/R/modifyModel.R	2013-01-08 22:13:39 UTC (rev 833)
@@ -147,10 +147,12 @@
                 names(cl)[cl.l+1] <- loc.name
              }
              M at fam.call <- cl
-             class(M) <- class(model)
-             M at locscalename <- locscalename(model)
-             M at LogDeriv <- LogDeriv(model)
-             return(M)
+             slots.from <- slotNames(class(M))
+             M1 <- new(class(model))
+             for(slot.s in slots.from) slot(M1,slot.s) <- slot(M,slot.s)
+             M1 at locscalename <- locscalename(model)
+             M1 at LogDeriv <- LogDeriv(model)
+             return(M1)
           })
 
 setMethod("modifyModel", signature(model = "L2ScaleFamily",
@@ -189,10 +191,12 @@
                 names(cl)[cl.l] <- scale.name
              }
              M at fam.call <- cl
-             class(M) <- class(model)
-             M at locscalename <- locscalename(model)
-             M at LogDeriv <- LogDeriv(model)
-             return(M)
+             slots.from <- slotNames(class(M))
+             M1 <- new(class(model))
+             for(slot.s in slots.from) slot(M1,slot.s) <- slot(M,slot.s)
+             M1 at locscalename <- locscalename(model)
+             M1 at LogDeriv <- LogDeriv(model)
+             return(M1)
           })
 
 setMethod("modifyModel", signature(model = "L2LocationScaleFamily",
@@ -249,10 +253,12 @@
                 names(cl)[cl.l] <- scale.name
              }
              M at fam.call <- cl
-             class(M) <- class(model)
-             M at locscalename <- locscalename(model)
-             M at LogDeriv <- LogDeriv(model)
-             return(M)
+             slots.from <- slotNames(class(M))
+             M1 <- new(class(model))
+             for(slot.s in slots.from) slot(M1,slot.s) <- slot(M,slot.s)
+             M1 at locscalename <- locscalename(model)
+             M1 at LogDeriv <- LogDeriv(model)
+             return(M1)
           })
 
 setMethod("modifyModel", signature(model = "GammaFamily",
@@ -260,11 +266,13 @@
           function(model, param, ...){
              M <- modifyModel(as(model, "L2ParamFamily"), param = param,
                               .withCall = FALSE)
-             M at L2derivSymm <- FunSymmList(OddSymmetric(SymmCenter = 
+             slots.from <- slotNames(class(M))
+             M1 <- new(class(model))
+             for(slot.s in slots.from) slot(M1,slot.s) <- slot(M,slot.s)
+             M1 at L2derivSymm <- FunSymmList(OddSymmetric(SymmCenter =
                                                        prod(main(param))),
                                           NonSymmetric())
-             class(M) <- class(model)
-             return(M)
+             return(M1)
           })
 setMethod("modifyModel", signature(model = "ExpScaleFamily",
            param = "ParamFamParameter"),
@@ -272,10 +280,12 @@
              M <- modifyModel(as(model, "L2ParamFamily"), param = param,
                               .withCall = FALSE)
              scale <- main(param)
-             M at L2derivDistr <- UnivarDistrList((Exp(rate = 1)-1)/scale)
-             M at L2derivSymm <- FunSymmList(OddSymmetric(SymmCenter = main(param)))
-             class(M) <- class(model)
-             M at locscalename <- locscalename(model)
-             M at LogDeriv <- LogDeriv(model)
-             return(M)
+             slots.from <- slotNames(class(M))
+             M1 <- new(class(model))
+             for(slot.s in slots.from) slot(M1,slot.s) <- slot(M,slot.s)
+             M1 at L2derivDistr <- UnivarDistrList((Exp(rate = 1)-1)/scale)
+             M1 at L2derivSymm <- FunSymmList(OddSymmetric(SymmCenter = main(param)))
+             M1 at locscalename <- locscalename(model)
+             M1 at LogDeriv <- LogDeriv(model)
+             return(M1)
           })



More information about the Distr-commits mailing list