[Depmix-commits] r683 - in pkg/depmixS4: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jan 15 16:24:49 CET 2020


Author: ingmarvisser
Date: 2020-01-15 16:24:48 +0100 (Wed, 15 Jan 2020)
New Revision: 683

Modified:
   pkg/depmixS4/DESCRIPTION
   pkg/depmixS4/NEWS
   pkg/depmixS4/R/depmixfit.R
   pkg/depmixS4/R/hessian2vcov.R
   pkg/depmixS4/R/makeResponseModels.R
   pkg/depmixS4/R/multistart.R
   pkg/depmixS4/R/setpars.R
   pkg/depmixS4/R/vcov.R
Log:
=updates to conform with devvelopment version of R

Modified: pkg/depmixS4/DESCRIPTION
===================================================================
--- pkg/depmixS4/DESCRIPTION	2019-11-13 11:51:18 UTC (rev 682)
+++ pkg/depmixS4/DESCRIPTION	2020-01-15 15:24:48 UTC (rev 683)
@@ -1,6 +1,6 @@
 Package: depmixS4
-Version: 1.5-0
-Date: 2019-07-18
+Version: 1.4-1
+Date: 2020-01-09
 Title: Dependent Mixture Models - Hidden Markov Models of GLMs and Other Distributions in S4
 Author: Ingmar Visser <i.visser at uva.nl>, Maarten Speekenbrink <m.speekenbrink at ucl.ac.uk>
 Maintainer: Ingmar Visser <i.visser at uva.nl>

Modified: pkg/depmixS4/NEWS
===================================================================
--- pkg/depmixS4/NEWS	2019-11-13 11:51:18 UTC (rev 682)
+++ pkg/depmixS4/NEWS	2020-01-15 15:24:48 UTC (rev 683)
@@ -1,8 +1,8 @@
-Changes in depmixS4 version 1.5-0
+Changes in depmixS4 version 1.4-1
 
 Major changes
+  o Replaced errorprone calls using class(x)=="y", now using is(x,"y"). 
 
-
 Minor changes
 
   o Added function multistart to fit models using multiple sets of random starting

Modified: pkg/depmixS4/R/depmixfit.R
===================================================================
--- pkg/depmixS4/R/depmixfit.R	2019-11-13 11:51:18 UTC (rev 682)
+++ pkg/depmixS4/R/depmixfit.R	2020-01-15 15:24:48 UTC (rev 683)
@@ -147,8 +147,8 @@
 		    ...
 		)
 		
-		if(class(object)=="depmix") object <- as(object,"depmix.fitted") # class(object) <- "depmix.fitted"
-		if(class(object)=="mix") object <- as(object,"mix.fitted") #  class(object) <- "mix.fitted"
+		if(is(object,"depmix")) object <- as(object,"depmix.fitted") # class(object) <- "depmix.fitted"
+#		if(is(object,"mix")) object <- as(object,"mix.fitted") #  class(object) <- "mix.fitted"
 		
 		# convergence info
 		object at message <- result$message
@@ -210,8 +210,8 @@
 		    ...
 		)
 		
-		if(class(object)=="depmix")  object <- as(object,"depmix.fitted") #  class(object) <- "depmix.fitted"
-		if(class(object)=="mix") object <- as(object,"mix.fitted") #  class(object) <- "mix.fitted"
+		if(is(object, "depmix"))  object <- as(object,"depmix.fitted") #  class(object) <- "depmix.fitted"
+#		if(is(object, "mix")) object <- as(object,"mix.fitted") #  class(object) <- "mix.fitted"
 		
 		object at message <- c(res$convergence," (0 is good in Rsolnp, check manual for other values)")
 		

Modified: pkg/depmixS4/R/hessian2vcov.R
===================================================================
--- pkg/depmixS4/R/hessian2vcov.R	2019-11-13 11:51:18 UTC (rev 682)
+++ pkg/depmixS4/R/hessian2vcov.R	2020-01-15 15:24:48 UTC (rev 683)
@@ -16,17 +16,17 @@
 			A <- lincon
 			d <- hessian+t(lincon)%*%lincon
 			di <- try(solve(d),silent=TRUE)
-			if(class(di)=="try-error") {
+			if(is(di,"try-error")) {
 				warning("Hessian singular, ses could not be computed.") 
 				vcov <- 0 
 			} else {
 				ada <- A%*%di%*%t(A)
 				adai <- try(solve(ada),silent=TRUE)
-				if(class(adai)=="try-error") {
+				if(is(adai, "try-error")) {
 					warning("Near-singular hessian, ses may be bad.\n")
 					diag(ada) <- diag(ada)*1.000001
 					adai <- try(solve(ada))
-					if(class(adai)=="try-error") {
+					if(is(adai,"try-error")) {
 						warning("Corrected hessian also singular, ses computed without contraints.\n")
 					} else {
 						vcov <- di-di%*%t(A)%*%adai%*%A%*%di

Modified: pkg/depmixS4/R/makeResponseModels.R
===================================================================
--- pkg/depmixS4/R/makeResponseModels.R	2019-11-13 11:51:18 UTC (rev 682)
+++ pkg/depmixS4/R/makeResponseModels.R	2020-01-15 15:24:48 UTC (rev 683)
@@ -6,7 +6,7 @@
 	nresppars <- 0
 		
 	# univariate response data
-	if(class(resp)=="formula") {
+	if(is(resp,"formula")) {
 		resp <- list(resp)
 		family <- list(family)
 	}

Modified: pkg/depmixS4/R/multistart.R
===================================================================
--- pkg/depmixS4/R/multistart.R	2019-11-13 11:51:18 UTC (rev 682)
+++ pkg/depmixS4/R/multistart.R	2020-01-15 15:24:48 UTC (rev 683)
@@ -22,7 +22,7 @@
 				"out of",
 				nstart, 
 				"attempts failed; result is based on ", 
-				nr-nfailed, 
+				nstart-nfailed, 
 				"starting values.\n"
 				)
 		}

Modified: pkg/depmixS4/R/setpars.R
===================================================================
--- pkg/depmixS4/R/setpars.R	2019-11-13 11:51:18 UTC (rev 682)
+++ pkg/depmixS4/R/setpars.R	2020-01-15 15:24:48 UTC (rev 683)
@@ -19,7 +19,7 @@
 		  bp <- bp+1
 		  values <- values[bp:npar(object)]
 		}
-		if(class(object)=="depmix"|class(object)=="depmix.fitted") {
+		if(is(object,"depmix")|is(object,"depmix.fitted")) {
 			for(i in 1:object at nstates) {
 				bp <- npar(object at transition[[i]])
 				if(bp > 0) {

Modified: pkg/depmixS4/R/vcov.R
===================================================================
--- pkg/depmixS4/R/vcov.R	2019-11-13 11:51:18 UTC (rev 682)
+++ pkg/depmixS4/R/vcov.R	2020-01-15 15:24:48 UTC (rev 683)
@@ -68,7 +68,7 @@
 	par.u <- constraints$par.u
 	par.l <- constraints$par.l
 	
-	if(class(object)=="depmix.fitted"|class(object)=="mix.fitted") {
+	if(is(object,"depmix.fitted")|is(object,"mix.fitted")) {
 		lincon <- object at conMat
 		lin.u <- object at lin.upper
 		lin.l <- object at lin.lower



More information about the depmix-commits mailing list