[Depmix-commits] r651 - in pkg/depmix: . R src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Feb 12 08:50:29 CET 2016


Author: ingmarvisser
Date: 2016-02-12 08:50:29 +0100 (Fri, 12 Feb 2016)
New Revision: 651

Modified:
   pkg/depmix/DESCRIPTION
   pkg/depmix/NAMESPACE
   pkg/depmix/R/depmix.R
   pkg/depmix/src/derdist.h
   pkg/depmix/src/hessdist.h
   pkg/depmix/src/logl.h
   pkg/depmix/src/matrix.h
   pkg/depmix/src/mdmm.h
   pkg/depmix/src/mgdmm.h
   pkg/depmix/src/mmts.h
   pkg/depmix/src/mts.h
   pkg/depmix/src/npsolfit.h
Log:
=test stuff from development version

Modified: pkg/depmix/DESCRIPTION
===================================================================
--- pkg/depmix/DESCRIPTION	2016-02-12 07:50:14 UTC (rev 650)
+++ pkg/depmix/DESCRIPTION	2016-02-12 07:50:29 UTC (rev 651)
@@ -1,11 +1,11 @@
 Package: depmix
-Version: 0.9.13
-Date: 2014-12-21
+Version: 0.9.14
+Date: 2016-02-11
 Title: Dependent Mixture Models
 Author: Ingmar Visser <i.visser at uva.nl>
 Maintainer: Ingmar Visser <i.visser at uva.nl>
 Depends: R (>= 3.1.2), MASS
 Suggests: Rdonlp2
 Additional_repositories: http://R-Forge.R-project.org
-Description: Fit (multigroup) mixtures of latent Markov models on mixed categorical and continuous (timeseries) data. The Rdonlp2 package can optionally be used for optimization of the log-likelihood and is available from R-forge: https://r-forge.r-project.org/R/?group_id=156
+Description: Fits (multigroup) mixtures of latent or hidden Markov models on mixed categorical and continuous (timeseries) data. The Rdonlp2 package can optionally be used for optimization of the log-likelihood and is available from R-forge. 
 License: GPL-3
\ No newline at end of file

Modified: pkg/depmix/NAMESPACE
===================================================================
--- pkg/depmix/NAMESPACE	2016-02-12 07:50:14 UTC (rev 650)
+++ pkg/depmix/NAMESPACE	2016-02-12 07:50:29 UTC (rev 651)
@@ -2,6 +2,10 @@
 
 import(MASS)
 
+importFrom("graphics", "layout.show")
+importFrom("stats", "kmeans", "na.omit", "nlm", "optim", "plot.ts",
+	"rmultinom", "rnorm", "runif", "sd", "ts")
+
 export(dmm,mgdmm,fitdmm,mixdmm,loglike,oneliner,bootstrap,posterior,
 	generate,lca,ntimes,itemtypes,dname,replicates,ncov,inames,
 	nitems,ind,markovdata)

Modified: pkg/depmix/R/depmix.R
===================================================================
--- pkg/depmix/R/depmix.R	2016-02-12 07:50:14 UTC (rev 650)
+++ pkg/depmix/R/depmix.R	2016-02-12 07:50:29 UTC (rev 651)
@@ -14,7 +14,7 @@
 #                                 #
 ###################################
 
-if(getRversion() >= "2.15.1")  utils::globalVariables(c("donlp2", "donlp2Control"))
+# if(getRversion() >= "2.15.1")  utils::globalVariables(c("donlp2", "donlp2Control"))
 
 fitdmm <- function(dat,dmm,printlevel=1,poster=TRUE,tdcov=0,ses=TRUE,method="optim",vfactor=15,der=1,iterlim=100,kmst=!dmm$st,kmrep=5,postst=FALSE) { 
 	mod=dmm #keep copy of the original model
@@ -259,7 +259,7 @@
  	##  call npmain to optimize the model (non-linear constraints not implemented yet)
  	if(method=="donlp") {
  		
- 		require("Rdonlp2")
+ 		requireNamespace("Rdonlp2")
  		
  		bu=bu[which(fixed==1)]
  		bl=bl[which(fixed==1)]
@@ -293,14 +293,14 @@
  		}
  		
  		timeUsed <- system.time(
- 			res <- donlp2(optpars, logl,
+ 			res <- Rdonlp2::donlp2(optpars, logl,
  				par.upper=bu,
  				par.lower=bl,
  				A = A,
  				lin.upper=bulin,
  				lin.lower=bllin,
  				nlin = list(),
- 				control=donlp2Control(),
+ 				control=Rdonlp2::donlp2Control(),
  				env=.GlobalEnv, name="Rdonlp2")
  		)
  		

Modified: pkg/depmix/src/derdist.h
===================================================================
--- pkg/depmix/src/derdist.h	2016-02-12 07:50:14 UTC (rev 650)
+++ pkg/depmix/src/derdist.h	2016-02-12 07:50:29 UTC (rev 651)
@@ -9,7 +9,6 @@
 *                                  *
 ***********************************/
 
-
 #ifndef DERDIST
 #define DERDIST 1
 
@@ -27,6 +26,8 @@
   * will be returned
   */
 
+/* extern "C" { */
+
 double dernorm(double x, double mu, double sig, int ms, int logsc);
 
 /* 
@@ -40,5 +41,15 @@
  *  and others .....
  */
 
+/* double squared(double x); */
+
+// the second and third to last integer arguments determine for which 
+// combination of parameters the hessian is returned, ie 1 for mu and 
+//2 for sigma, if logsc=1 the log will be returned (not functional)
+
+double hessnorm(double x, double mu, double sig, int ms1, int ms2, int logsc);
+
+/* } // end extern "C" */
+
 #endif
 

Modified: pkg/depmix/src/hessdist.h
===================================================================
--- pkg/depmix/src/hessdist.h	2016-02-12 07:50:14 UTC (rev 650)
+++ pkg/depmix/src/hessdist.h	2016-02-12 07:50:29 UTC (rev 651)
@@ -12,13 +12,15 @@
 
 #ifndef HESSDIST
 #define HESSDIST 1
-
+   
 #include <stdio.h>
 #include <stdlib.h>
 
 #include <R.h>
 #include <Rmath.h>
 
+/* extern "C" { */
+
 //constant M_PI=3.141592653589793238462643383280 from Rmath.h
 
 double squared(double x);
@@ -30,7 +32,7 @@
 double hessnorm(double x, double mu, double sig, int ms1, int ms2, int logsc);
 
 //this puts the return value in x (for use directly from R)
-void Rhessnorm(double *x, double *mu, double *sig, int *ms1, int *ms2, int *logsc, double *value);
+/* void Rhessnorm(double *x, double *mu, double *sig, int *ms1, int *ms2, int *logsc, double *value); */
 
 // to be implemented:
 
@@ -39,4 +41,7 @@
 // double hessweibull(double x, double sh, double sc, int shsc1, int shsc2, int logsc);
 // double hessgamma(double x, double sh, double sc, int shsc1, int shsc2, int logsc);
 
+/* } */
+
+
 #endif
\ No newline at end of file

Modified: pkg/depmix/src/logl.h
===================================================================
--- pkg/depmix/src/logl.h	2016-02-12 07:50:14 UTC (rev 650)
+++ pkg/depmix/src/logl.h	2016-02-12 07:50:29 UTC (rev 651)
@@ -13,11 +13,11 @@
 
 #include "matrix.h"
 
-extern "C" {
-
 #include <R.h>	
 #include <Rmath.h>
 
+extern "C" {
+
 //these routines set up the model and set up the data in formats that are readable by loglikelihood
 void mixModelSetUp(int *ngroups, int *nrcomp, int *nstates, int *nitems, int *itemtypes, double *pars, int *xm, int *print);
 void covSetUp(int *ngroups, int *nrcomp, int *nstates, int *nitems, int *itemtypes, double *pars, int *xm, int *print);

Modified: pkg/depmix/src/matrix.h
===================================================================
--- pkg/depmix/src/matrix.h	2016-02-12 07:50:14 UTC (rev 650)
+++ pkg/depmix/src/matrix.h	2016-02-12 07:50:29 UTC (rev 651)
@@ -5,10 +5,10 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-extern "C" {
-	#include <R.h>
+/* extern "C" { */
+#include <R.h>
 /* 	static int matrixConst;  */
-}
+/* } */
 
 #define MATRIXBOUNDS 1
 

Modified: pkg/depmix/src/mdmm.h
===================================================================
--- pkg/depmix/src/mdmm.h	2016-02-12 07:50:14 UTC (rev 650)
+++ pkg/depmix/src/mdmm.h	2016-02-12 07:50:29 UTC (rev 651)
@@ -19,15 +19,15 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-extern "C" {
-	#include <R.h>
-	#include <Rmath.h>
-	#include "derdist.h"
-	#include "hessdist.h"
-}
+#include <R.h>
+#include <Rmath.h>
 
 #include "matrix.h"
 
+extern "C" { 
+#include "derdist.h"	
+}
+
 #define MDMMBOUNDS 1
 
 class mdmm {

Modified: pkg/depmix/src/mgdmm.h
===================================================================
--- pkg/depmix/src/mgdmm.h	2016-02-12 07:50:14 UTC (rev 650)
+++ pkg/depmix/src/mgdmm.h	2016-02-12 07:50:29 UTC (rev 651)
@@ -18,10 +18,10 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-extern "C" {
-	#include <R.h>
-	#include <Rmath.h>
-}
+/* extern "C" { */
+#include <R.h>
+#include <Rmath.h>
+/* } */
 
 #include "matrix.h"
 #include "mdmm.h"

Modified: pkg/depmix/src/mmts.h
===================================================================
--- pkg/depmix/src/mmts.h	2016-02-12 07:50:14 UTC (rev 650)
+++ pkg/depmix/src/mmts.h	2016-02-12 07:50:29 UTC (rev 651)
@@ -20,9 +20,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-extern "C" {
-	#include <R.h>
-}
+/* extern "C" { */
+#include <R.h>
+/* } */
 
 #include "matrix.h"
 #include "mts.h"

Modified: pkg/depmix/src/mts.h
===================================================================
--- pkg/depmix/src/mts.h	2016-02-12 07:50:14 UTC (rev 650)
+++ pkg/depmix/src/mts.h	2016-02-12 07:50:29 UTC (rev 651)
@@ -24,9 +24,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-extern "C" {
-	#include <R.h>
-}
+/* extern "C" { */
+#include <R.h>
+/* } */
 
 #include "matrix.h"
 

Modified: pkg/depmix/src/npsolfit.h
===================================================================
--- pkg/depmix/src/npsolfit.h	2016-02-12 07:50:14 UTC (rev 650)
+++ pkg/depmix/src/npsolfit.h	2016-02-12 07:50:29 UTC (rev 651)
@@ -6,6 +6,9 @@
 #include <stdlib.h>
 /* #include <fstream.h> */
 
+#include <R.h>
+#include <Rmath.h>
+
 extern "C" {
 
 //globals needed in npsolc and funobj	
@@ -15,8 +18,6 @@
 double *fixedvalues;
 int npars;
 
-#include <R.h>	
-#include <Rmath.h>
 
 /************************************************************/
 /*															*/



More information about the depmix-commits mailing list