Back to Multiple platform build/check report for BioC 3.12
ABCDEFGHIJKLM[N]OPQRSTUVWXYZ

CHECK report for netresponse on tokay1

This page was generated on 2021-05-06 12:32:28 -0400 (Thu, 06 May 2021).

To the developers/maintainers of the netresponse package:
Please make sure to use the following settings in order to reproduce any error or warning you see on this page.
Package 1221/1974HostnameOS / ArchINSTALLBUILDCHECKBUILD BIN
netresponse 1.50.0  (landing page)
Leo Lahti
Snapshot Date: 2021-05-05 14:51:38 -0400 (Wed, 05 May 2021)
URL: https://git.bioconductor.org/packages/netresponse
Branch: RELEASE_3_12
Last Commit: 3309644
Last Changed Date: 2020-10-27 10:39:14 -0400 (Tue, 27 Oct 2020)
malbec1Linux (Ubuntu 18.04.5 LTS) / x86_64  OK    OK    OK  UNNEEDED, same version exists in internal repository
tokay1Windows Server 2012 R2 Standard / x64  OK    OK    OK    OK  UNNEEDED, same version exists in internal repository
merida1macOS 10.14.6 Mojave / x86_64  OK    OK    OK    OK  UNNEEDED, same version exists in internal repository

Summary

Package: netresponse
Version: 1.50.0
Command: C:\Users\biocbuild\bbs-3.12-bioc\R\bin\R.exe CMD check --force-multiarch --install=check:netresponse.install-out.txt --library=C:\Users\biocbuild\bbs-3.12-bioc\R\library --no-vignettes --timings netresponse_1.50.0.tar.gz
StartedAt: 2021-05-06 05:05:07 -0400 (Thu, 06 May 2021)
EndedAt: 2021-05-06 05:09:25 -0400 (Thu, 06 May 2021)
EllapsedTime: 257.9 seconds
RetCode: 0
Status:   OK   
CheckDir: netresponse.Rcheck
Warnings: 0

Command output

##############################################################################
##############################################################################
###
### Running command:
###
###   C:\Users\biocbuild\bbs-3.12-bioc\R\bin\R.exe CMD check --force-multiarch --install=check:netresponse.install-out.txt --library=C:\Users\biocbuild\bbs-3.12-bioc\R\library --no-vignettes --timings netresponse_1.50.0.tar.gz
###
##############################################################################
##############################################################################


* using log directory 'C:/Users/biocbuild/bbs-3.12-bioc/meat/netresponse.Rcheck'
* using R version 4.0.5 (2021-03-31)
* using platform: x86_64-w64-mingw32 (64-bit)
* using session charset: ISO8859-1
* using option '--no-vignettes'
* checking for file 'netresponse/DESCRIPTION' ... OK
* checking extension type ... Package
* this is package 'netresponse' version '1.50.0'
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking whether package 'netresponse' can be installed ... OK
* checking installed package size ... OK
* checking package directory ... OK
* checking 'build' directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* loading checks for arch 'i386'
** checking whether the package can be loaded ... OK
** checking whether the package can be loaded with stated dependencies ... OK
** checking whether the package can be unloaded cleanly ... OK
** checking whether the namespace can be loaded with stated dependencies ... OK
** checking whether the namespace can be unloaded cleanly ... OK
* loading checks for arch 'x64'
** checking whether the package can be loaded ... OK
** checking whether the package can be loaded with stated dependencies ... OK
** checking whether the package can be unloaded cleanly ... OK
** checking whether the namespace can be loaded with stated dependencies ... OK
** checking whether the namespace can be unloaded cleanly ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... NOTE
plotPCA: no visible binding for global variable 'npoints'
Undefined global functions or variables:
  npoints
* checking Rd files ... OK
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking contents of 'data' directory ... OK
* checking data for non-ASCII characters ... OK
* checking data for ASCII and uncompressed saves ... OK
* checking line endings in C/C++/Fortran sources/headers ... OK
* checking line endings in Makefiles ... OK
* checking compilation flags in Makevars ... OK
* checking for GNU extensions in Makefiles ... OK
* checking for portable use of $(BLAS_LIBS) and $(LAPACK_LIBS) ... OK
* checking use of PKG_*FLAGS in Makefiles ... OK
* checking compiled code ... NOTE
Note: information on .o files for i386 is not available
Note: information on .o files for x64 is not available
File 'C:/Users/biocbuild/bbs-3.12-bioc/R/library/netresponse/libs/i386/netresponse.dll':
  Found 'abort', possibly from 'abort' (C), 'runtime' (Fortran)
File 'C:/Users/biocbuild/bbs-3.12-bioc/R/library/netresponse/libs/x64/netresponse.dll':
  Found 'abort', possibly from 'abort' (C), 'runtime' (Fortran)

Compiled code should not call entry points which might terminate R nor
write to stdout/stderr instead of to the console, nor use Fortran I/O
nor system RNGs. The detected symbols are linked into the code but
might come from libraries and not actually be called.

See 'Writing portable packages' in the 'Writing R Extensions' manual.
* checking files in 'vignettes' ... OK
* checking examples ...
** running examples for arch 'i386' ... OK
Examples with CPU (user + system) or elapsed time > 5s
                user system elapsed
sample2response 5.83      0    5.83
** running examples for arch 'x64' ... OK
* checking for unstated dependencies in 'tests' ... OK
* checking tests ...
** running tests for arch 'i386' ...
  Running 'bicmixture.R'
  Running 'mixture.model.test.R'
  Running 'mixture.model.test.multimodal.R'
  Running 'mixture.model.test.singlemode.R'
  Running 'timing.R'
  Running 'toydata2.R'
  Running 'validate.netresponse.R'
  Running 'validate.pca.basis.R'
  Running 'vdpmixture.R'
 OK
** running tests for arch 'x64' ...
  Running 'bicmixture.R'
  Running 'mixture.model.test.R'
  Running 'mixture.model.test.multimodal.R'
  Running 'mixture.model.test.singlemode.R'
  Running 'timing.R'
  Running 'toydata2.R'
  Running 'validate.netresponse.R'
  Running 'validate.pca.basis.R'
  Running 'vdpmixture.R'
 OK
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes in 'inst/doc' ... OK
* checking running R code from vignettes ... SKIPPED
* checking re-building of vignette outputs ... SKIPPED
* checking PDF version of manual ... OK
* DONE

Status: 2 NOTEs
See
  'C:/Users/biocbuild/bbs-3.12-bioc/meat/netresponse.Rcheck/00check.log'
for details.



Installation output

netresponse.Rcheck/00install.out

##############################################################################
##############################################################################
###
### Running command:
###
###   C:\cygwin\bin\curl.exe -O http://172.29.0.3/BBS/3.12/bioc/src/contrib/netresponse_1.50.0.tar.gz && rm -rf netresponse.buildbin-libdir && mkdir netresponse.buildbin-libdir && C:\Users\biocbuild\bbs-3.12-bioc\R\bin\R.exe CMD INSTALL --merge-multiarch --build --library=netresponse.buildbin-libdir netresponse_1.50.0.tar.gz && C:\Users\biocbuild\bbs-3.12-bioc\R\bin\R.exe CMD INSTALL netresponse_1.50.0.zip && rm netresponse_1.50.0.tar.gz netresponse_1.50.0.zip
###
##############################################################################
##############################################################################


  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  800k  100  800k    0     0  12.8M      0 --:--:-- --:--:-- --:--:-- 13.0M

install for i386

* installing *source* package 'netresponse' ...
** using staged installation
** libs
"C:/rtools40/mingw32/bin/"gcc  -I"C:/Users/BIOCBU~1/BBS-3~1.12-/R/include" -DNDEBUG     -I"C:/extsoft/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c netresponse.c -o netresponse.o
netresponse.c: In function 'mHPpost':
netresponse.c:264:15: warning: unused variable 'prior_fields' [-Wunused-variable]
   const char *prior_fields[]={"Mumu","S2mu",
               ^~~~~~~~~~~~
netresponse.c: In function 'mLogLambda':
netresponse.c:713:3: warning: 'U_p' may be used uninitialized in this function [-Wmaybe-uninitialized]
   vdp_mk_log_lambda(Mumu, S2mu, Mubar, Mutilde,
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       AlphaKsi, BetaKsi, KsiAlpha, KsiBeta,
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       post_gamma, log_lambda, prior_alpha,
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       U_p, U_hat,
       ~~~~~~~~~~~
       datalen, dim1, dim2, data1, data2,
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       Ns, ncentroids, implicitnoisevar);
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
netresponse.c:713:3: warning: 'KsiBeta' may be used uninitialized in this function [-Wmaybe-uninitialized]
netresponse.c:713:3: warning: 'KsiAlpha' may be used uninitialized in this function [-Wmaybe-uninitialized]
netresponse.c:713:3: warning: 'BetaKsi' may be used uninitialized in this function [-Wmaybe-uninitialized]
netresponse.c:713:3: warning: 'AlphaKsi' may be used uninitialized in this function [-Wmaybe-uninitialized]
netresponse.c:713:3: warning: 'Mutilde' may be used uninitialized in this function [-Wmaybe-uninitialized]
netresponse.c:713:3: warning: 'Mubar' may be used uninitialized in this function [-Wmaybe-uninitialized]
netresponse.c:713:3: warning: 'S2mu' may be used uninitialized in this function [-Wmaybe-uninitialized]
netresponse.c:713:3: warning: 'Mumu' may be used uninitialized in this function [-Wmaybe-uninitialized]
C:/rtools40/mingw32/bin/gcc -shared -s -static-libgcc -o netresponse.dll tmp.def netresponse.o -LC:/extsoft/lib/i386 -LC:/extsoft/lib -LC:/Users/BIOCBU~1/BBS-3~1.12-/R/bin/i386 -lR
installing to C:/Users/biocbuild/bbs-3.12-bioc/meat/netresponse.buildbin-libdir/00LOCK-netresponse/00new/netresponse/libs/i386
** R
** data
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
  converting help for package 'netresponse'
    finding HTML links ... done
    NetResponseModel-class                  html  
    P.S                                     html  
    P.Sr                                    html  
    P.r.s                                   html  
    P.rS                                    html  
    P.rs.joint                              html  
    P.rs.joint.individual                   html  
    P.s.individual                          html  
    P.s.r                                   html  
    PlotMixture                             html  
    PlotMixtureBivariate                    html  
    PlotMixtureMultivariate                 html  
    PlotMixtureUnivariate                   html  
    add.ellipse                             html  
    bic.mixture                             html  
    bic.mixture.multivariate                html  
    bic.mixture.univariate                  html  
    bic.select.best.mode                    html  
    centerData                              html  
    check.matrix                            html  
    check.network                           html  
    continuous.responses                    html  
    detect.responses                        html  
    dna                                     html  
    enrichment.list.factor                  html  
    enrichment.list.factor.minimal          html  
    factor.responses                        html  
    factor.responses.minimal                html  
    filter.netw                             html  
    filter.network                          html  
    find.similar.features                   html  
    generate.toydata                        html  
    get.dat-NetResponseModel-method         html  
    get.mis                                 html  
    get.model.parameters                    html  
    get.subnets-NetResponseModel-method     html  
    getqofz-NetResponseModel-method         html  
    independent.models                      html  
    list.responses.continuous.multi         html  
    list.responses.continuous.single        html  
    list.responses.factor                   html  
    list.responses.factor.minimal           html  
    list.significant.responses              html  
    listify.groupings                       html  
    mixture.model                           html  
    model.stats                             html  
    netresponse-package                     html  
    order.responses                         html  
    osmo                                    html  
    pick.model.pairs                        html  
    pick.model.parameters                   html  
    plotPCA                                 html  
    plot_associations                       html  
    plot_data                               html  
    plot_expression                         html  
    plot_matrix                             html  
    plot_response                           html  
    plot_responses                          html  
    plot_scale                              html  
    plot_subnet                             html  
    read.sif                                html  
    remove.negative.edges                   html  
    response.enrichment                     html  
    response2sample                         html  
    sample2response                         html  
    set.breaks                              html  
    split.qofz                              html  
    toydata                                 html  
    update.model.pair                       html  
    vdp.mixt                                html  
    vectorize.groupings                     html  
    write.netresponse.results               html  
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path

install for x64

* installing *source* package 'netresponse' ...
** libs
"C:/rtools40/mingw64/bin/"gcc  -I"C:/Users/BIOCBU~1/BBS-3~1.12-/R/include" -DNDEBUG     -I"C:/extsoft/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c netresponse.c -o netresponse.o
netresponse.c: In function 'mHPpost':
netresponse.c:264:15: warning: unused variable 'prior_fields' [-Wunused-variable]
   const char *prior_fields[]={"Mumu","S2mu",
               ^~~~~~~~~~~~
netresponse.c: In function 'mLogLambda':
netresponse.c:713:3: warning: 'U_p' may be used uninitialized in this function [-Wmaybe-uninitialized]
   vdp_mk_log_lambda(Mumu, S2mu, Mubar, Mutilde,
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       AlphaKsi, BetaKsi, KsiAlpha, KsiBeta,
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       post_gamma, log_lambda, prior_alpha,
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       U_p, U_hat,
       ~~~~~~~~~~~
       datalen, dim1, dim2, data1, data2,
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       Ns, ncentroids, implicitnoisevar);
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
netresponse.c:713:3: warning: 'KsiBeta' may be used uninitialized in this function [-Wmaybe-uninitialized]
netresponse.c:713:3: warning: 'KsiAlpha' may be used uninitialized in this function [-Wmaybe-uninitialized]
netresponse.c:713:3: warning: 'BetaKsi' may be used uninitialized in this function [-Wmaybe-uninitialized]
netresponse.c:713:3: warning: 'AlphaKsi' may be used uninitialized in this function [-Wmaybe-uninitialized]
netresponse.c:713:3: warning: 'Mutilde' may be used uninitialized in this function [-Wmaybe-uninitialized]
netresponse.c:713:3: warning: 'Mubar' may be used uninitialized in this function [-Wmaybe-uninitialized]
netresponse.c:713:3: warning: 'S2mu' may be used uninitialized in this function [-Wmaybe-uninitialized]
netresponse.c:713:3: warning: 'Mumu' may be used uninitialized in this function [-Wmaybe-uninitialized]
C:/rtools40/mingw64/bin/gcc -shared -s -static-libgcc -o netresponse.dll tmp.def netresponse.o -LC:/extsoft/lib/x64 -LC:/extsoft/lib -LC:/Users/BIOCBU~1/BBS-3~1.12-/R/bin/x64 -lR
installing to C:/Users/biocbuild/bbs-3.12-bioc/meat/netresponse.buildbin-libdir/netresponse/libs/x64
** testing if installed package can be loaded
* MD5 sums
packaged installation of 'netresponse' as netresponse_1.50.0.zip
* DONE (netresponse)
* installing to library 'C:/Users/biocbuild/bbs-3.12-bioc/R/library'
package 'netresponse' successfully unpacked and MD5 sums checked

Tests output

netresponse.Rcheck/tests_i386/bicmixture.Rout


R version 4.0.5 (2021-03-31) -- "Shake and Throw"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> # 1. vdp.mixt: moodien loytyminen eri dimensiolla, naytemaarilla ja komponenteilla
> #   -> ainakin nopea check
> 
> #######################################################################
> 
> # Generate random data from five Gaussians. 
> # Detect modes with vdp-gm. 
> # Plot data points and detected clusters with variance ellipses
> 
> #######################################################################
> 
> library(netresponse)
Loading required package: Rgraphviz
Loading required package: graph
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, basename, cbind, colnames, dirname, do.call,
    duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
    lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin,
    pmin.int, rank, rbind, rownames, sapply, setdiff, sort, table,
    tapply, union, unique, unsplit, which.max, which.min

Loading required package: grid
Loading required package: minet
Loading required package: mclust
Package 'mclust' version 5.4.7
Type 'citation("mclust")' for citing this R package in publications.
Loading required package: reshape2

netresponse (C) 2008-2020 Leo Lahti et al.

https://github.com/antagomir/netresponse
> #source("~/Rpackages/netresponse/netresponse/R/detect.responses.R")
> #source("~/Rpackages/netresponse/netresponse/R/internals.R")
> #source("~/Rpackages/netresponse/netresponse/R/vdp.mixt.R")
> #dyn.load("/home/tuli/Rpackages/netresponse/netresponse/src/netresponse.so")
> 
> #########  Generate DATA #############################################
> 
> # Generate Nc components from normal-inverseGamma prior
> 
> set.seed(12346)
> 
> dd <- 3   # Dimensionality of data
> Nc <- 5   # Number of components
> Ns <- 200 # Number of data points
> sd0 <- 3  # component spread
> rgam.shape = 2 # parameters for Gamma distribution 
> rgam.scale = 2 # parameters for Gamma distribution to define precisions
> 
> 
> # Generate means and variances (covariance diagonals) for the components 
> component.means <- matrix(rnorm(Nc*dd, mean = 0, sd = sd0), nrow = Nc, ncol = dd)
> component.vars <- matrix(1/rgamma(Nc*dd, shape = rgam.shape, scale = rgam.scale), 
+ 	                 nrow = Nc, ncol = dd)
> component.sds <- sqrt(component.vars)
> 
> 
> # Size for each component -> sample randomly for each data point from uniform distr.
> # i.e. cluster assignments
> sample2comp <- sample.int(Nc, Ns, replace = TRUE)
> 
> D <- array(NA, dim = c(Ns, dd))
> for (i in 1:Ns)  {
+     # component identity of this sample
+     ci <- sample2comp[[i]]
+     cm <- component.means[ci,]
+     csd <- component.sds[ci,]
+     D[i,] <- rnorm(dd, mean = cm, sd = csd)
+ }
> 
> 
> ######################################################################
> 
> # Fit mixture model
> out <- mixture.model(D, mixture.method = "bic")
> 
> # FIXME rowmeans(qofz) is constant but not 1
> #qofz <- P.r.s(t(D), list(mu = out$mu, sd = out$sd, w = out$w), log = FALSE)
> 
> ############################################################
> 
> # Compare input data and results
> 
> ord.out <- order(out$mu[,1])
> ord.in <- order(component.means[,1])
> 
> means.out <- out$mu[ord.out,]
> means.in <- component.means[ord.in,]
> 
> # Cluster stds and variances
> sds.out <- out$sd[ord.out,]
> sds.in  <- sqrt(component.vars[ord.in,])
> 
> # -----------------------------------------------------------
> 
> vars.out <- sds.out^2
> vars.in <- sds.in^2
> 
> # Check correspondence between input and output
> if (length(means.in) == length(means.out)) {
+    cm <- cor(as.vector(means.in), as.vector(means.out))
+    csd <- cor(as.vector(sds.in), as.vector(sds.out))
+ }
> 
> # Plot results (assuming 2D)
> 
> ran <- range(c(as.vector(means.in - 2*vars.in), 
+                as.vector(means.in + 2*vars.in), 
+ 	       as.vector(means.out + 2*vars.out), 
+ 	       as.vector(means.out - 2*vars.out)))
> 
> plot(D, pch = 20, main = paste("Cor.means:", round(cm,3), "/ Cor.sds:", round(csd,3)), xlim = ran, ylim = ran) 
> #for (ci in 1:nrow(means.out))  { add.ellipse(centroid = means.out[ci,], covmat = diag(vars.out[ci,]), col = "red") }
> #for (ci in 1:nrow(means.in))  { add.ellipse(centroid = means.in[ci,], covmat = diag(vars.in[ci,]), col = "blue") }
> 
> ######################################################
> 
> #for (ci in 1:nrow(means.out))  {
> #    points(means.out[ci,1], means.out[ci,2], col = "red", pch = 19)
> #    el <- ellipse(matrix(c(vars.out[ci,1],0,0,vars.out[ci,2]),2), centre = means.out[ci,])
> #    lines(el, col = "red") 						  
> #}
> 
> #for (ci in 1:nrow(means.in))  {
> #    points(means.in[ci,1], means.in[ci,2], col = "blue", pch = 19)
> #    el <- ellipse(matrix(c(vars.in[ci,1],0,0,vars.in[ci,2]),2), centre = means.in[ci,])
> #    lines(el, col = "blue") 						  
> #}
> 
> 
> 
> 
> 
> 
> proc.time()
   user  system elapsed 
   4.45    0.40    4.84 

netresponse.Rcheck/tests_x64/bicmixture.Rout


R version 4.0.5 (2021-03-31) -- "Shake and Throw"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> # 1. vdp.mixt: moodien loytyminen eri dimensiolla, naytemaarilla ja komponenteilla
> #   -> ainakin nopea check
> 
> #######################################################################
> 
> # Generate random data from five Gaussians. 
> # Detect modes with vdp-gm. 
> # Plot data points and detected clusters with variance ellipses
> 
> #######################################################################
> 
> library(netresponse)
Loading required package: Rgraphviz
Loading required package: graph
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, basename, cbind, colnames, dirname, do.call,
    duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
    lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin,
    pmin.int, rank, rbind, rownames, sapply, setdiff, sort, table,
    tapply, union, unique, unsplit, which.max, which.min

Loading required package: grid
Loading required package: minet
Loading required package: mclust
Package 'mclust' version 5.4.7
Type 'citation("mclust")' for citing this R package in publications.
Loading required package: reshape2

netresponse (C) 2008-2020 Leo Lahti et al.

https://github.com/antagomir/netresponse
> #source("~/Rpackages/netresponse/netresponse/R/detect.responses.R")
> #source("~/Rpackages/netresponse/netresponse/R/internals.R")
> #source("~/Rpackages/netresponse/netresponse/R/vdp.mixt.R")
> #dyn.load("/home/tuli/Rpackages/netresponse/netresponse/src/netresponse.so")
> 
> #########  Generate DATA #############################################
> 
> # Generate Nc components from normal-inverseGamma prior
> 
> set.seed(12346)
> 
> dd <- 3   # Dimensionality of data
> Nc <- 5   # Number of components
> Ns <- 200 # Number of data points
> sd0 <- 3  # component spread
> rgam.shape = 2 # parameters for Gamma distribution 
> rgam.scale = 2 # parameters for Gamma distribution to define precisions
> 
> 
> # Generate means and variances (covariance diagonals) for the components 
> component.means <- matrix(rnorm(Nc*dd, mean = 0, sd = sd0), nrow = Nc, ncol = dd)
> component.vars <- matrix(1/rgamma(Nc*dd, shape = rgam.shape, scale = rgam.scale), 
+ 	                 nrow = Nc, ncol = dd)
> component.sds <- sqrt(component.vars)
> 
> 
> # Size for each component -> sample randomly for each data point from uniform distr.
> # i.e. cluster assignments
> sample2comp <- sample.int(Nc, Ns, replace = TRUE)
> 
> D <- array(NA, dim = c(Ns, dd))
> for (i in 1:Ns)  {
+     # component identity of this sample
+     ci <- sample2comp[[i]]
+     cm <- component.means[ci,]
+     csd <- component.sds[ci,]
+     D[i,] <- rnorm(dd, mean = cm, sd = csd)
+ }
> 
> 
> ######################################################################
> 
> # Fit mixture model
> out <- mixture.model(D, mixture.method = "bic")
> 
> # FIXME rowmeans(qofz) is constant but not 1
> #qofz <- P.r.s(t(D), list(mu = out$mu, sd = out$sd, w = out$w), log = FALSE)
> 
> ############################################################
> 
> # Compare input data and results
> 
> ord.out <- order(out$mu[,1])
> ord.in <- order(component.means[,1])
> 
> means.out <- out$mu[ord.out,]
> means.in <- component.means[ord.in,]
> 
> # Cluster stds and variances
> sds.out <- out$sd[ord.out,]
> sds.in  <- sqrt(component.vars[ord.in,])
> 
> # -----------------------------------------------------------
> 
> vars.out <- sds.out^2
> vars.in <- sds.in^2
> 
> # Check correspondence between input and output
> if (length(means.in) == length(means.out)) {
+    cm <- cor(as.vector(means.in), as.vector(means.out))
+    csd <- cor(as.vector(sds.in), as.vector(sds.out))
+ }
> 
> # Plot results (assuming 2D)
> 
> ran <- range(c(as.vector(means.in - 2*vars.in), 
+                as.vector(means.in + 2*vars.in), 
+ 	       as.vector(means.out + 2*vars.out), 
+ 	       as.vector(means.out - 2*vars.out)))
> 
> plot(D, pch = 20, main = paste("Cor.means:", round(cm,3), "/ Cor.sds:", round(csd,3)), xlim = ran, ylim = ran) 
> #for (ci in 1:nrow(means.out))  { add.ellipse(centroid = means.out[ci,], covmat = diag(vars.out[ci,]), col = "red") }
> #for (ci in 1:nrow(means.in))  { add.ellipse(centroid = means.in[ci,], covmat = diag(vars.in[ci,]), col = "blue") }
> 
> ######################################################
> 
> #for (ci in 1:nrow(means.out))  {
> #    points(means.out[ci,1], means.out[ci,2], col = "red", pch = 19)
> #    el <- ellipse(matrix(c(vars.out[ci,1],0,0,vars.out[ci,2]),2), centre = means.out[ci,])
> #    lines(el, col = "red") 						  
> #}
> 
> #for (ci in 1:nrow(means.in))  {
> #    points(means.in[ci,1], means.in[ci,2], col = "blue", pch = 19)
> #    el <- ellipse(matrix(c(vars.in[ci,1],0,0,vars.in[ci,2]),2), centre = means.in[ci,])
> #    lines(el, col = "blue") 						  
> #}
> 
> 
> 
> 
> 
> 
> proc.time()
   user  system elapsed 
   3.46    0.18    3.64 

netresponse.Rcheck/tests_i386/mixture.model.test.Rout


R version 4.0.5 (2021-03-31) -- "Shake and Throw"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> # Validate mixture models
> 
> # Generate random data from five Gaussians. 
> # Detect modes 
> # Plot data points and detected clusters 
> 
> library(netresponse)
Loading required package: Rgraphviz
Loading required package: graph
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, basename, cbind, colnames, dirname, do.call,
    duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
    lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin,
    pmin.int, rank, rbind, rownames, sapply, setdiff, sort, table,
    tapply, union, unique, unsplit, which.max, which.min

Loading required package: grid
Loading required package: minet
Loading required package: mclust
Package 'mclust' version 5.4.7
Type 'citation("mclust")' for citing this R package in publications.
Loading required package: reshape2

netresponse (C) 2008-2020 Leo Lahti et al.

https://github.com/antagomir/netresponse
> 
> #fs <- list.files("~/Rpackages/netresponse/netresponse/R/", full.names = TRUE); for (f in fs) {source(f)}; dyn.load("/home/tuli/Rpackages/netresponse/netresponse/src/netresponse.so")
> 
> #########  Generate DATA #######################
> 
> res <- generate.toydata()
> D <- res$data
> component.means <- res$means
> component.sds   <- res$sds
> sample2comp     <- res$sample2comp
> 
> ######################################################################
> 
> par(mfrow = c(2,1))
> 
> for (mm in c("vdp", "bic")) {
+ 
+   # Fit nonparametric Gaussian mixture model
+   #source("~/Rpackages/netresponse/netresponse/R/vdp.mixt.R")
+   out <- mixture.model(D, mixture.method = mm, max.responses = 10, pca.basis = FALSE)
+ 
+   ############################################################
+ 
+   # Compare input data and results
+ 
+   ord.out <- order(out$mu[,1])
+   ord.in <- order(component.means[,1])
+ 
+   means.out <- out$mu[ord.out,]
+   means.in <- component.means[ord.in,]
+ 
+   # Cluster stds and variances
+   sds.out <- out$sd[ord.out,]
+   vars.out <- sds.out^2
+ 
+   sds.in  <- component.sds[ord.in,]
+   vars.in <- sds.in^2
+ 
+   # Check correspondence between input and output
+   if (length(means.in) == length(means.out)) {
+     cm <- cor(as.vector(means.in), as.vector(means.out))
+     csd <- cor(as.vector(sds.in), as.vector(sds.out))
+   }
+ 
+   # Plot results (assuming 2D)
+   ran <- range(c(as.vector(means.in - 2*vars.in), 
+                as.vector(means.in + 2*vars.in), 
+ 	       as.vector(means.out + 2*vars.out), 
+ 	       as.vector(means.out - 2*vars.out)))
+ 
+   real.modes <- sample2comp
+   obs.modes <- apply(out$qofz, 1, which.max)
+ 
+   # plot(D, pch = 20, main = paste(mm, "/ cor.means:", round(cm,6), "/ Cor.sds:", round(csd,6)), xlim = ran, ylim = ran)
+   
+   # plot(D, pch = real.modes, col = obs.modes, main = paste(mm, "/ cor.means:", round(cm,6), "/ Cor.sds:", round(csd,6)), xlim = ran, ylim = ran)
+   
+   # for (ci in 1:nrow(means.out))  { add.ellipse(centroid = means.out[ci,], covmat = diag(vars.out[ci,]), col = "red") }
+   # for (ci in 1:nrow(means.in))  { add.ellipse(centroid = means.in[ci,], covmat = diag(vars.in[ci,]), col = "blue") }
+ 
+ }
> 
> 
> proc.time()
   user  system elapsed 
   4.79    0.29    5.07 

netresponse.Rcheck/tests_x64/mixture.model.test.Rout


R version 4.0.5 (2021-03-31) -- "Shake and Throw"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> # Validate mixture models
> 
> # Generate random data from five Gaussians. 
> # Detect modes 
> # Plot data points and detected clusters 
> 
> library(netresponse)
Loading required package: Rgraphviz
Loading required package: graph
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, basename, cbind, colnames, dirname, do.call,
    duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
    lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin,
    pmin.int, rank, rbind, rownames, sapply, setdiff, sort, table,
    tapply, union, unique, unsplit, which.max, which.min

Loading required package: grid
Loading required package: minet
Loading required package: mclust
Package 'mclust' version 5.4.7
Type 'citation("mclust")' for citing this R package in publications.
Loading required package: reshape2

netresponse (C) 2008-2020 Leo Lahti et al.

https://github.com/antagomir/netresponse
> 
> #fs <- list.files("~/Rpackages/netresponse/netresponse/R/", full.names = TRUE); for (f in fs) {source(f)}; dyn.load("/home/tuli/Rpackages/netresponse/netresponse/src/netresponse.so")
> 
> #########  Generate DATA #######################
> 
> res <- generate.toydata()
> D <- res$data
> component.means <- res$means
> component.sds   <- res$sds
> sample2comp     <- res$sample2comp
> 
> ######################################################################
> 
> par(mfrow = c(2,1))
> 
> for (mm in c("vdp", "bic")) {
+ 
+   # Fit nonparametric Gaussian mixture model
+   #source("~/Rpackages/netresponse/netresponse/R/vdp.mixt.R")
+   out <- mixture.model(D, mixture.method = mm, max.responses = 10, pca.basis = FALSE)
+ 
+   ############################################################
+ 
+   # Compare input data and results
+ 
+   ord.out <- order(out$mu[,1])
+   ord.in <- order(component.means[,1])
+ 
+   means.out <- out$mu[ord.out,]
+   means.in <- component.means[ord.in,]
+ 
+   # Cluster stds and variances
+   sds.out <- out$sd[ord.out,]
+   vars.out <- sds.out^2
+ 
+   sds.in  <- component.sds[ord.in,]
+   vars.in <- sds.in^2
+ 
+   # Check correspondence between input and output
+   if (length(means.in) == length(means.out)) {
+     cm <- cor(as.vector(means.in), as.vector(means.out))
+     csd <- cor(as.vector(sds.in), as.vector(sds.out))
+   }
+ 
+   # Plot results (assuming 2D)
+   ran <- range(c(as.vector(means.in - 2*vars.in), 
+                as.vector(means.in + 2*vars.in), 
+ 	       as.vector(means.out + 2*vars.out), 
+ 	       as.vector(means.out - 2*vars.out)))
+ 
+   real.modes <- sample2comp
+   obs.modes <- apply(out$qofz, 1, which.max)
+ 
+   # plot(D, pch = 20, main = paste(mm, "/ cor.means:", round(cm,6), "/ Cor.sds:", round(csd,6)), xlim = ran, ylim = ran)
+   
+   # plot(D, pch = real.modes, col = obs.modes, main = paste(mm, "/ cor.means:", round(cm,6), "/ Cor.sds:", round(csd,6)), xlim = ran, ylim = ran)
+   
+   # for (ci in 1:nrow(means.out))  { add.ellipse(centroid = means.out[ci,], covmat = diag(vars.out[ci,]), col = "red") }
+   # for (ci in 1:nrow(means.in))  { add.ellipse(centroid = means.in[ci,], covmat = diag(vars.in[ci,]), col = "blue") }
+ 
+ }
> 
> 
> proc.time()
   user  system elapsed 
   4.54    0.20    4.73 

netresponse.Rcheck/tests_i386/mixture.model.test.multimodal.Rout


R version 4.0.5 (2021-03-31) -- "Shake and Throw"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(netresponse)
Loading required package: Rgraphviz
Loading required package: graph
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, basename, cbind, colnames, dirname, do.call,
    duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
    lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin,
    pmin.int, rank, rbind, rownames, sapply, setdiff, sort, table,
    tapply, union, unique, unsplit, which.max, which.min

Loading required package: grid
Loading required package: minet
Loading required package: mclust
Package 'mclust' version 5.4.7
Type 'citation("mclust")' for citing this R package in publications.
Loading required package: reshape2

netresponse (C) 2008-2020 Leo Lahti et al.

https://github.com/antagomir/netresponse
> 
> # Three MODES
> 
> # set.seed(34884)
> set.seed(3488400)
> 
> Ns <- 200
> Nd <- 2
> 
> D3 <- rbind(matrix(rnorm(Ns*Nd, mean = 0), ncol = Nd), 
+       	    matrix(rnorm(Ns*Nd, mean = 3), ncol = Nd),
+       	    cbind(rnorm(Ns, mean = -3), rnorm(Ns, mean = 3))
+ 	    )
> 
> #X11()
> par(mfrow = c(2,2))
> for (mm in c("vdp", "bic")) {
+   for (pp in c(FALSE, TRUE)) {
+ 
+     # Fit nonparametric Gaussian mixture model
+     out <- mixture.model(D3, mixture.method = mm, pca.basis = pp)
+     plot(D3, col = apply(out$qofz, 1, which.max), main = paste(mm, "/ pca:",  pp)) 
+ 
+   }
+ }
> 
> # VDP is less sensitive than BIC in detecting Gaussian modes (more
> # separation between the clusters needed)
> 
> # pca.basis option is less important for sensitive detection but
> # it will help to avoid overfitting to unimodal features that
> # are not parallel to the axes (unimodal distribution often becomes
> # splitted in two or more clusters in these cases)
> 
> 
> proc.time()
   user  system elapsed 
   8.00    0.25    8.45 

netresponse.Rcheck/tests_x64/mixture.model.test.multimodal.Rout


R version 4.0.5 (2021-03-31) -- "Shake and Throw"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(netresponse)
Loading required package: Rgraphviz
Loading required package: graph
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, basename, cbind, colnames, dirname, do.call,
    duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
    lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin,
    pmin.int, rank, rbind, rownames, sapply, setdiff, sort, table,
    tapply, union, unique, unsplit, which.max, which.min

Loading required package: grid
Loading required package: minet
Loading required package: mclust
Package 'mclust' version 5.4.7
Type 'citation("mclust")' for citing this R package in publications.
Loading required package: reshape2

netresponse (C) 2008-2020 Leo Lahti et al.

https://github.com/antagomir/netresponse
> 
> # Three MODES
> 
> # set.seed(34884)
> set.seed(3488400)
> 
> Ns <- 200
> Nd <- 2
> 
> D3 <- rbind(matrix(rnorm(Ns*Nd, mean = 0), ncol = Nd), 
+       	    matrix(rnorm(Ns*Nd, mean = 3), ncol = Nd),
+       	    cbind(rnorm(Ns, mean = -3), rnorm(Ns, mean = 3))
+ 	    )
> 
> #X11()
> par(mfrow = c(2,2))
> for (mm in c("vdp", "bic")) {
+   for (pp in c(FALSE, TRUE)) {
+ 
+     # Fit nonparametric Gaussian mixture model
+     out <- mixture.model(D3, mixture.method = mm, pca.basis = pp)
+     plot(D3, col = apply(out$qofz, 1, which.max), main = paste(mm, "/ pca:",  pp)) 
+ 
+   }
+ }
> 
> # VDP is less sensitive than BIC in detecting Gaussian modes (more
> # separation between the clusters needed)
> 
> # pca.basis option is less important for sensitive detection but
> # it will help to avoid overfitting to unimodal features that
> # are not parallel to the axes (unimodal distribution often becomes
> # splitted in two or more clusters in these cases)
> 
> 
> proc.time()
   user  system elapsed 
   6.23    0.23    6.45 

netresponse.Rcheck/tests_i386/mixture.model.test.singlemode.Rout


R version 4.0.5 (2021-03-31) -- "Shake and Throw"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> 
> skip <- FALSE
> 
> if (!skip) {
+ 
+ library(netresponse)
+ 
+ # SINGLE MODE
+ 
+ # Produce test data that has full covariance
+ # It is expected that
+ # pca.basis = FALSE splits Gaussian with full covariance into two modes
+ # pca.basis = TRUE should detect just a single mode
+ 
+ Ns <- 200
+ Nd <- 2
+ k <- 1.5
+ 
+ D2 <- matrix(rnorm(Ns*Nd), ncol = Nd) %*% rbind(c(1,k), c(k,1))
+ 
+ par(mfrow = c(2,2))
+ for (mm in c("vdp", "bic")) {
+   for (pp in c(FALSE, TRUE)) {
+ 
+     # Fit nonparametric Gaussian mixture model
+     out <- mixture.model(D2, mixture.method = mm, pca.basis = pp)
+     plot(D2, col = apply(out$qofz, 1, which.max), main = paste("mm:" , mm, "/ pp:",  pp)) 
+ 
+   }
+ }
+ 
+ }
Loading required package: Rgraphviz
Loading required package: graph
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, basename, cbind, colnames, dirname, do.call,
    duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
    lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin,
    pmin.int, rank, rbind, rownames, sapply, setdiff, sort, table,
    tapply, union, unique, unsplit, which.max, which.min

Loading required package: grid
Loading required package: minet
Loading required package: mclust
Package 'mclust' version 5.4.7
Type 'citation("mclust")' for citing this R package in publications.
Loading required package: reshape2

netresponse (C) 2008-2020 Leo Lahti et al.

https://github.com/antagomir/netresponse
> 
> proc.time()
   user  system elapsed 
   5.09    0.35    5.53 

netresponse.Rcheck/tests_x64/mixture.model.test.singlemode.Rout


R version 4.0.5 (2021-03-31) -- "Shake and Throw"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> 
> skip <- FALSE
> 
> if (!skip) {
+ 
+ library(netresponse)
+ 
+ # SINGLE MODE
+ 
+ # Produce test data that has full covariance
+ # It is expected that
+ # pca.basis = FALSE splits Gaussian with full covariance into two modes
+ # pca.basis = TRUE should detect just a single mode
+ 
+ Ns <- 200
+ Nd <- 2
+ k <- 1.5
+ 
+ D2 <- matrix(rnorm(Ns*Nd), ncol = Nd) %*% rbind(c(1,k), c(k,1))
+ 
+ par(mfrow = c(2,2))
+ for (mm in c("vdp", "bic")) {
+   for (pp in c(FALSE, TRUE)) {
+ 
+     # Fit nonparametric Gaussian mixture model
+     out <- mixture.model(D2, mixture.method = mm, pca.basis = pp)
+     plot(D2, col = apply(out$qofz, 1, which.max), main = paste("mm:" , mm, "/ pp:",  pp)) 
+ 
+   }
+ }
+ 
+ }
Loading required package: Rgraphviz
Loading required package: graph
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, basename, cbind, colnames, dirname, do.call,
    duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
    lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin,
    pmin.int, rank, rbind, rownames, sapply, setdiff, sort, table,
    tapply, union, unique, unsplit, which.max, which.min

Loading required package: grid
Loading required package: minet
Loading required package: mclust
Package 'mclust' version 5.4.7
Type 'citation("mclust")' for citing this R package in publications.
Loading required package: reshape2

netresponse (C) 2008-2020 Leo Lahti et al.

https://github.com/antagomir/netresponse
> 
> proc.time()
   user  system elapsed 
   5.45    0.26    5.70 

netresponse.Rcheck/tests_i386/timing.Rout


R version 4.0.5 (2021-03-31) -- "Shake and Throw"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> 
> # Play with different options and check their effect on  running times for bic and vdp 
> 
> skip <- TRUE
> 
> if (!skip) {
+ 
+   Ns <- 100
+   Nd <- 2
+ 
+   set.seed(3488400)
+ 
+   D <- cbind(
+ 
+      	rbind(matrix(rnorm(Ns*Nd, mean = 0), ncol = Nd), 
+        	      matrix(rnorm(Ns*Nd, mean = 2), ncol = Nd),
+       	      cbind(rnorm(Ns, mean = -1), rnorm(Ns, mean = 3))
+  	    ), 
+ 
+      	rbind(matrix(rnorm(Ns*Nd, mean = 0), ncol = Nd), 
+        	      matrix(rnorm(Ns*Nd, mean = 2), ncol = Nd),
+       	      cbind(rnorm(Ns, mean = -1), rnorm(Ns, mean = 3))
+  	    )
+ 	    )
+ 
+   rownames(D) <- paste("R", 1:nrow(D), sep = "-")
+   colnames(D) <- paste("C", 1:ncol(D), sep = "-")
+ 
+   ts <- c()
+   for (mm in c("bic", "vdp")) {
+ 
+ 
+     # NOTE: no PCA basis needed with mixture.method = "bic"
+     tt <- system.time(detect.responses(D, verbose = TRUE, max.responses = 5, 
+ 	   		       mixture.method = mm, information.criterion = "BIC", 
+ 			       merging.threshold = 0, bic.threshold = 0, pca.basis = TRUE))
+ 
+     print(paste(mm, ":", round(tt[["elapsed"]], 3)))
+     ts[[mm]] <- tt[["elapsed"]]
+   }
+ 
+    print(paste(names(ts)[[1]], "/", names(ts)[[2]], ": ", round(ts[[1]]/ts[[2]], 3)))
+ 
+ }
> 
> # -> VDP is much faster when sample sizes increase 
> # 1000 samples -> 25-fold speedup with VDP
> 
> 
> 
> proc.time()
   user  system elapsed 
   0.25    0.03    0.26 

netresponse.Rcheck/tests_x64/timing.Rout


R version 4.0.5 (2021-03-31) -- "Shake and Throw"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> 
> # Play with different options and check their effect on  running times for bic and vdp 
> 
> skip <- TRUE
> 
> if (!skip) {
+ 
+   Ns <- 100
+   Nd <- 2
+ 
+   set.seed(3488400)
+ 
+   D <- cbind(
+ 
+      	rbind(matrix(rnorm(Ns*Nd, mean = 0), ncol = Nd), 
+        	      matrix(rnorm(Ns*Nd, mean = 2), ncol = Nd),
+       	      cbind(rnorm(Ns, mean = -1), rnorm(Ns, mean = 3))
+  	    ), 
+ 
+      	rbind(matrix(rnorm(Ns*Nd, mean = 0), ncol = Nd), 
+        	      matrix(rnorm(Ns*Nd, mean = 2), ncol = Nd),
+       	      cbind(rnorm(Ns, mean = -1), rnorm(Ns, mean = 3))
+  	    )
+ 	    )
+ 
+   rownames(D) <- paste("R", 1:nrow(D), sep = "-")
+   colnames(D) <- paste("C", 1:ncol(D), sep = "-")
+ 
+   ts <- c()
+   for (mm in c("bic", "vdp")) {
+ 
+ 
+     # NOTE: no PCA basis needed with mixture.method = "bic"
+     tt <- system.time(detect.responses(D, verbose = TRUE, max.responses = 5, 
+ 	   		       mixture.method = mm, information.criterion = "BIC", 
+ 			       merging.threshold = 0, bic.threshold = 0, pca.basis = TRUE))
+ 
+     print(paste(mm, ":", round(tt[["elapsed"]], 3)))
+     ts[[mm]] <- tt[["elapsed"]]
+   }
+ 
+    print(paste(names(ts)[[1]], "/", names(ts)[[2]], ": ", round(ts[[1]]/ts[[2]], 3)))
+ 
+ }
> 
> # -> VDP is much faster when sample sizes increase 
> # 1000 samples -> 25-fold speedup with VDP
> 
> 
> 
> proc.time()
   user  system elapsed 
   0.14    0.04    0.18 

netresponse.Rcheck/tests_i386/toydata2.Rout


R version 4.0.5 (2021-03-31) -- "Shake and Throw"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> # Generate Nc components from normal-inverseGamma prior
> 
> set.seed(12346)
> 
> Ns <- 300
> Nd <- 2
> 
> # Isotropic cloud
> D1 <- matrix(rnorm(Ns*Nd), ncol = Nd) 
> 
> # Single diagonal mode
> D2 <- matrix(rnorm(Ns*Nd), ncol = Nd) %*% rbind(c(1,2), c(2,1)) 
> 
> # Two isotropic modes
> D3 <- rbind(matrix(rnorm(Ns/2*Nd), ncol = Nd), matrix(rnorm(Ns/2*Nd, mean = 3), ncol = Nd))
> D <- cbind(D1, D2, D3)
> 
> colnames(D) <- paste("Feature-",  1:ncol(D), sep = "")
> rownames(D) <- paste("Sample-", 1:nrow(D), sep = "")
> 
> 
> proc.time()
   user  system elapsed 
   0.20    0.04    0.23 

netresponse.Rcheck/tests_x64/toydata2.Rout


R version 4.0.5 (2021-03-31) -- "Shake and Throw"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> # Generate Nc components from normal-inverseGamma prior
> 
> set.seed(12346)
> 
> Ns <- 300
> Nd <- 2
> 
> # Isotropic cloud
> D1 <- matrix(rnorm(Ns*Nd), ncol = Nd) 
> 
> # Single diagonal mode
> D2 <- matrix(rnorm(Ns*Nd), ncol = Nd) %*% rbind(c(1,2), c(2,1)) 
> 
> # Two isotropic modes
> D3 <- rbind(matrix(rnorm(Ns/2*Nd), ncol = Nd), matrix(rnorm(Ns/2*Nd, mean = 3), ncol = Nd))
> D <- cbind(D1, D2, D3)
> 
> colnames(D) <- paste("Feature-",  1:ncol(D), sep = "")
> rownames(D) <- paste("Sample-", 1:nrow(D), sep = "")
> 
> 
> proc.time()
   user  system elapsed 
   0.25    0.03    0.26 

netresponse.Rcheck/tests_i386/validate.netresponse.Rout


R version 4.0.5 (2021-03-31) -- "Shake and Throw"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> 
> skip <- TRUE
> 
> if (!skip) {
+ 
+ # 2. netresponse test
+ # test later with varying parameters
+ 
+ # Load the package
+ library(netresponse)
+ #load("../data/toydata.rda")
+ fs <- list.files("../R/", full.names = TRUE); for (f in fs) {source(f)};
+ 
+ data(toydata)
+ 
+ D <- toydata$emat
+ netw <- toydata$netw
+ 
+ # The toy data is random data with 10 features (genes). 
+ # The features 
+ rf <- c(4, 5, 6)
+ #form a subnetwork with coherent responses
+ # with means 
+ r1 <- c(0, 3, 0)
+ r2 <- c(-5, 0, 2)
+ r3 <- c(5, -3, -3)
+ mu.real <- rbind(r1, r2, r3)
+ # real weights
+ w.real <- c(70, 70, 60)/200
+ # and unit variances
+ rv <- 1
+ 
+ # Fit the model
+ #res <- detect.responses(D, netw, verbose = TRUE, mc.cores = 2)
+ #res <- detect.responses(D, netw, verbose = TRUE, max.responses = 4)
+ 
+ res <- detect.responses(D, netw, verbose = TRUE, max.responses = 3, mixture.method = "bic", information.criterion = "BIC", merging.threshold = 1, bic.threshold = 10, pca.basis = FALSE)
+ 
+ print("OK")
+ 
+ # Subnets (each is a list of nodes)
+ subnets <- get.subnets(res)
+ 
+ # the correct subnet is retrieved in subnet number 2:
+ #> subnet[[2]]
+ #[1] "feat4" "feat5" "feat6"
+ 
+ # how about responses
+ # Retrieve model for the subnetwork with lowest cost function value
+ # means, standard devations and weights for the components
+ if (!is.null(subnets)) {
+ m <- get.model.parameters(res, subnet.id = "Subnet-2")
+ 
+ # order retrieved and real response means by the first feature 
+ # (to ensure responses are listed in the same order)
+ # and compare deviation from correct solution
+ ord.obs <- order(m$mu[,1])
+ ord.real <- order(mu.real[,1])
+ 
+ print(paste("Correlation between real and observed responses:", cor(as.vector(m$mu[ord.obs,]), as.vector(mu.real[ord.real,]))))
+ 
+ # all real variances are 1, compare to observed ones
+ print(paste("Maximum deviation from real variances: ", max(abs(rv - range(m$sd))/rv)))
+ 
+ # weights deviate somewhat, this is likely due to relatively small sample size
+ #print("Maximum deviation from real weights: ")
+ #print( (w.real[ord.real] - m$w[ord.obs])/w.real[ord.real])
+ 
+ print("estimated and real mean matrices")
+ print(m$mu[ord.obs,])
+ print(mu.real[ord.real,])
+ 
+ }
+ 
+ }
> 
> proc.time()
   user  system elapsed 
   0.25    0.04    0.28 

netresponse.Rcheck/tests_x64/validate.netresponse.Rout


R version 4.0.5 (2021-03-31) -- "Shake and Throw"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> 
> skip <- TRUE
> 
> if (!skip) {
+ 
+ # 2. netresponse test
+ # test later with varying parameters
+ 
+ # Load the package
+ library(netresponse)
+ #load("../data/toydata.rda")
+ fs <- list.files("../R/", full.names = TRUE); for (f in fs) {source(f)};
+ 
+ data(toydata)
+ 
+ D <- toydata$emat
+ netw <- toydata$netw
+ 
+ # The toy data is random data with 10 features (genes). 
+ # The features 
+ rf <- c(4, 5, 6)
+ #form a subnetwork with coherent responses
+ # with means 
+ r1 <- c(0, 3, 0)
+ r2 <- c(-5, 0, 2)
+ r3 <- c(5, -3, -3)
+ mu.real <- rbind(r1, r2, r3)
+ # real weights
+ w.real <- c(70, 70, 60)/200
+ # and unit variances
+ rv <- 1
+ 
+ # Fit the model
+ #res <- detect.responses(D, netw, verbose = TRUE, mc.cores = 2)
+ #res <- detect.responses(D, netw, verbose = TRUE, max.responses = 4)
+ 
+ res <- detect.responses(D, netw, verbose = TRUE, max.responses = 3, mixture.method = "bic", information.criterion = "BIC", merging.threshold = 1, bic.threshold = 10, pca.basis = FALSE)
+ 
+ print("OK")
+ 
+ # Subnets (each is a list of nodes)
+ subnets <- get.subnets(res)
+ 
+ # the correct subnet is retrieved in subnet number 2:
+ #> subnet[[2]]
+ #[1] "feat4" "feat5" "feat6"
+ 
+ # how about responses
+ # Retrieve model for the subnetwork with lowest cost function value
+ # means, standard devations and weights for the components
+ if (!is.null(subnets)) {
+ m <- get.model.parameters(res, subnet.id = "Subnet-2")
+ 
+ # order retrieved and real response means by the first feature 
+ # (to ensure responses are listed in the same order)
+ # and compare deviation from correct solution
+ ord.obs <- order(m$mu[,1])
+ ord.real <- order(mu.real[,1])
+ 
+ print(paste("Correlation between real and observed responses:", cor(as.vector(m$mu[ord.obs,]), as.vector(mu.real[ord.real,]))))
+ 
+ # all real variances are 1, compare to observed ones
+ print(paste("Maximum deviation from real variances: ", max(abs(rv - range(m$sd))/rv)))
+ 
+ # weights deviate somewhat, this is likely due to relatively small sample size
+ #print("Maximum deviation from real weights: ")
+ #print( (w.real[ord.real] - m$w[ord.obs])/w.real[ord.real])
+ 
+ print("estimated and real mean matrices")
+ print(m$mu[ord.obs,])
+ print(mu.real[ord.real,])
+ 
+ }
+ 
+ }
> 
> proc.time()
   user  system elapsed 
   0.26    0.06    0.31 

netresponse.Rcheck/tests_i386/validate.pca.basis.Rout


R version 4.0.5 (2021-03-31) -- "Shake and Throw"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> 
> skip <- FALSE
> 
> if (!skip) {
+ # Visualization
+ 
+ library(netresponse)
+ 
+ #fs <- list.files("~/Rpackages/netresponse/netresponse/R/", full.names = T); for (f in fs) {source(f)}
+ 
+ source("toydata2.R")
+ 
+ # --------------------------------------------------------------------
+ 
+ set.seed(4243)
+ mixture.method <- "bic"
+ 
+ # --------------------------------------------------------------------
+ 
+ res <- detect.responses(D, verbose = TRUE, max.responses = 10, 
+ 	   		       mixture.method = mixture.method, information.criterion = "BIC", 
+ 			       merging.threshold = 1, bic.threshold = 10, pca.basis = FALSE)
+ 
+ res.pca <- detect.responses(D, verbose = TRUE, max.responses = 10, mixture.method = mixture.method, information.criterion = "BIC", merging.threshold = 1, bic.threshold = 10, pca.basis = TRUE)
+ 
+ # --------------------------------------------------------------------
+ 
+ k <- 1
+ 
+ # Incorrect VDP: two modes detected
+ # Correct BIC: single mode detected
+ subnet.id <- names(get.subnets(res))[[k]]
+ 
+ # Correct: single mode detected (VDP & BIC)
+ subnet.id.pca <- names(get.subnets(res.pca))[[k]]
+ 
+ # --------------------------------------------------------------------------------------------------
+ 
+ vis1 <- plot_responses(res, subnet.id, plot_mode = "pca", main = paste("NoPCA; NoDM"))
+ vis2 <- plot_responses(res, subnet.id, plot_mode = "pca", datamatrix = D, main = "NoPCA, DM")
+ vis3 <- plot_responses(res.pca, subnet.id.pca, plot_mode = "pca", main = "PCA, NoDM")
+ vis4 <- plot_responses(res.pca, subnet.id.pca, plot_mode = "pca", datamatrix = D, main = "PCA, DM")
+ 
+ # With original data: VDP overlearns; BIC works; with full covariance data 
+ # With PCA basis: modes detected ok with both VDP and BIC.
+ 
+ # ------------------------------------------------------------------------
+ 
+ # TODO
+ # pca.plot(res, subnet.id)
+ # plot_subnet(res, subnet.id) 
+ }
Loading required package: Rgraphviz
Loading required package: graph
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, basename, cbind, colnames, dirname, do.call,
    duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
    lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin,
    pmin.int, rank, rbind, rownames, sapply, setdiff, sort, table,
    tapply, union, unique, unsplit, which.max, which.min

Loading required package: grid
Loading required package: minet
Loading required package: mclust
Package 'mclust' version 5.4.7
Type 'citation("mclust")' for citing this R package in publications.
Loading required package: reshape2

netresponse (C) 2008-2020 Leo Lahti et al.

https://github.com/antagomir/netresponse
No network provided in function call: assuming fully connected nodes.
convert the network into edge matrix
removing self-links
matching the features between network and datamatrix
Filter the network to only keep the edges with highest mutual information
1 / 5
2 / 5
3 / 5
4 / 5
5 / 5
Compute cost for each variable
Computing model for node 1 / 6
Computing model for node 2 / 6
Computing model for node 3 / 6
Computing model for node 4 / 6
Computing model for node 5 / 6
Computing model for node 6 / 6
independent models done
Computing delta values for edge  1 / 15 

Computing delta values for edge  2 / 15 

Computing delta values for edge  3 / 15 

Computing delta values for edge  4 / 15 

Computing delta values for edge  5 / 15 

Computing delta values for edge  6 / 15 

Computing delta values for edge  7 / 15 

Computing delta values for edge  8 / 15 

Computing delta values for edge  9 / 15 

Computing delta values for edge  10 / 15 

Computing delta values for edge  11 / 15 

Computing delta values for edge  12 / 15 

Computing delta values for edge  13 / 15 

Computing delta values for edge  14 / 15 

Computing delta values for edge  15 / 15 

Combining groups,  6  group(s) left...

Combining groups,  5  group(s) left...

Combining groups,  4  group(s) left...

Combining groups,  3  group(s) left...

No network provided in function call: assuming fully connected nodes.
convert the network into edge matrix
removing self-links
matching the features between network and datamatrix
Filter the network to only keep the edges with highest mutual information
1 / 5
2 / 5
3 / 5
4 / 5
5 / 5
Compute cost for each variable
Computing model for node 1 / 6
Computing model for node 2 / 6
Computing model for node 3 / 6
Computing model for node 4 / 6
Computing model for node 5 / 6
Computing model for node 6 / 6
independent models done
Computing delta values for edge  1 / 15 

Computing delta values for edge  2 / 15 

Computing delta values for edge  3 / 15 

Computing delta values for edge  4 / 15 

Computing delta values for edge  5 / 15 

Computing delta values for edge  6 / 15 

Computing delta values for edge  7 / 15 

Computing delta values for edge  8 / 15 

Computing delta values for edge  9 / 15 

Computing delta values for edge  10 / 15 

Computing delta values for edge  11 / 15 

Computing delta values for edge  12 / 15 

Computing delta values for edge  13 / 15 

Computing delta values for edge  14 / 15 

Computing delta values for edge  15 / 15 

Combining groups,  6  group(s) left...

Combining groups,  5  group(s) left...

Combining groups,  4  group(s) left...

Combining groups,  3  group(s) left...

> 
> proc.time()
   user  system elapsed 
  26.20    0.32   26.51 

netresponse.Rcheck/tests_x64/validate.pca.basis.Rout


R version 4.0.5 (2021-03-31) -- "Shake and Throw"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> 
> skip <- FALSE
> 
> if (!skip) {
+ # Visualization
+ 
+ library(netresponse)
+ 
+ #fs <- list.files("~/Rpackages/netresponse/netresponse/R/", full.names = T); for (f in fs) {source(f)}
+ 
+ source("toydata2.R")
+ 
+ # --------------------------------------------------------------------
+ 
+ set.seed(4243)
+ mixture.method <- "bic"
+ 
+ # --------------------------------------------------------------------
+ 
+ res <- detect.responses(D, verbose = TRUE, max.responses = 10, 
+ 	   		       mixture.method = mixture.method, information.criterion = "BIC", 
+ 			       merging.threshold = 1, bic.threshold = 10, pca.basis = FALSE)
+ 
+ res.pca <- detect.responses(D, verbose = TRUE, max.responses = 10, mixture.method = mixture.method, information.criterion = "BIC", merging.threshold = 1, bic.threshold = 10, pca.basis = TRUE)
+ 
+ # --------------------------------------------------------------------
+ 
+ k <- 1
+ 
+ # Incorrect VDP: two modes detected
+ # Correct BIC: single mode detected
+ subnet.id <- names(get.subnets(res))[[k]]
+ 
+ # Correct: single mode detected (VDP & BIC)
+ subnet.id.pca <- names(get.subnets(res.pca))[[k]]
+ 
+ # --------------------------------------------------------------------------------------------------
+ 
+ vis1 <- plot_responses(res, subnet.id, plot_mode = "pca", main = paste("NoPCA; NoDM"))
+ vis2 <- plot_responses(res, subnet.id, plot_mode = "pca", datamatrix = D, main = "NoPCA, DM")
+ vis3 <- plot_responses(res.pca, subnet.id.pca, plot_mode = "pca", main = "PCA, NoDM")
+ vis4 <- plot_responses(res.pca, subnet.id.pca, plot_mode = "pca", datamatrix = D, main = "PCA, DM")
+ 
+ # With original data: VDP overlearns; BIC works; with full covariance data 
+ # With PCA basis: modes detected ok with both VDP and BIC.
+ 
+ # ------------------------------------------------------------------------
+ 
+ # TODO
+ # pca.plot(res, subnet.id)
+ # plot_subnet(res, subnet.id) 
+ }
Loading required package: Rgraphviz
Loading required package: graph
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, basename, cbind, colnames, dirname, do.call,
    duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
    lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin,
    pmin.int, rank, rbind, rownames, sapply, setdiff, sort, table,
    tapply, union, unique, unsplit, which.max, which.min

Loading required package: grid
Loading required package: minet
Loading required package: mclust
Package 'mclust' version 5.4.7
Type 'citation("mclust")' for citing this R package in publications.
Loading required package: reshape2

netresponse (C) 2008-2020 Leo Lahti et al.

https://github.com/antagomir/netresponse
No network provided in function call: assuming fully connected nodes.
convert the network into edge matrix
removing self-links
matching the features between network and datamatrix
Filter the network to only keep the edges with highest mutual information
1 / 5
2 / 5
3 / 5
4 / 5
5 / 5
Compute cost for each variable
Computing model for node 1 / 6
Computing model for node 2 / 6
Computing model for node 3 / 6
Computing model for node 4 / 6
Computing model for node 5 / 6
Computing model for node 6 / 6
independent models done
Computing delta values for edge  1 / 15 

Computing delta values for edge  2 / 15 

Computing delta values for edge  3 / 15 

Computing delta values for edge  4 / 15 

Computing delta values for edge  5 / 15 

Computing delta values for edge  6 / 15 

Computing delta values for edge  7 / 15 

Computing delta values for edge  8 / 15 

Computing delta values for edge  9 / 15 

Computing delta values for edge  10 / 15 

Computing delta values for edge  11 / 15 

Computing delta values for edge  12 / 15 

Computing delta values for edge  13 / 15 

Computing delta values for edge  14 / 15 

Computing delta values for edge  15 / 15 

Combining groups,  6  group(s) left...

Combining groups,  5  group(s) left...

Combining groups,  4  group(s) left...

Combining groups,  3  group(s) left...

No network provided in function call: assuming fully connected nodes.
convert the network into edge matrix
removing self-links
matching the features between network and datamatrix
Filter the network to only keep the edges with highest mutual information
1 / 5
2 / 5
3 / 5
4 / 5
5 / 5
Compute cost for each variable
Computing model for node 1 / 6
Computing model for node 2 / 6
Computing model for node 3 / 6
Computing model for node 4 / 6
Computing model for node 5 / 6
Computing model for node 6 / 6
independent models done
Computing delta values for edge  1 / 15 

Computing delta values for edge  2 / 15 

Computing delta values for edge  3 / 15 

Computing delta values for edge  4 / 15 

Computing delta values for edge  5 / 15 

Computing delta values for edge  6 / 15 

Computing delta values for edge  7 / 15 

Computing delta values for edge  8 / 15 

Computing delta values for edge  9 / 15 

Computing delta values for edge  10 / 15 

Computing delta values for edge  11 / 15 

Computing delta values for edge  12 / 15 

Computing delta values for edge  13 / 15 

Computing delta values for edge  14 / 15 

Computing delta values for edge  15 / 15 

Combining groups,  6  group(s) left...

Combining groups,  5  group(s) left...

Combining groups,  4  group(s) left...

Combining groups,  3  group(s) left...

> 
> proc.time()
   user  system elapsed 
  30.71    0.25   30.96 

netresponse.Rcheck/tests_i386/vdpmixture.Rout


R version 4.0.5 (2021-03-31) -- "Shake and Throw"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: i386-w64-mingw32/i386 (32-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> 
> # 1. vdp.mixt: moodien loytyminen eri dimensiolla, naytemaarilla ja komponenteilla
> #   -> ainakin nopea check
> 
> #######################################################################
> 
> # Generate random data from five Gaussians. 
> # Detect modes with vdp-gm. 
> # Plot data points and detected clusters with variance ellipses
> 
> #######################################################################
> 
> library(netresponse)
Loading required package: Rgraphviz
Loading required package: graph
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, basename, cbind, colnames, dirname, do.call,
    duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
    lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin,
    pmin.int, rank, rbind, rownames, sapply, setdiff, sort, table,
    tapply, union, unique, unsplit, which.max, which.min

Loading required package: grid
Loading required package: minet
Loading required package: mclust
Package 'mclust' version 5.4.7
Type 'citation("mclust")' for citing this R package in publications.
Loading required package: reshape2

netresponse (C) 2008-2020 Leo Lahti et al.

https://github.com/antagomir/netresponse
> #source("~/Rpackages/netresponse/netresponse/R/detect.responses.R")
> #source("~/Rpackages/netresponse/netresponse/R/internals.R")
> #source("~/Rpackages/netresponse/netresponse/R/vdp.mixt.R")
> #dyn.load("/home/tuli/Rpackages/netresponse/netresponse/src/netresponse.so")
> 
> 
> #########  Generate DATA #############################################
> 
> res <- generate.toydata()
> D <- res$data
> component.means <- res$means
> component.sds   <- res$sds
> sample2comp     <- res$sample2comp
> 
> ######################################################################
> 
> # Fit nonparametric Gaussian mixture model
> out <- vdp.mixt(D)
> # out <- vdp.mixt(D, c.max = 3) # try with limited number of components -> OK
> 
> ############################################################
> 
> # Compare input data and results
> 
> ord.out <- order(out$posterior$centroids[,1])
> ord.in <- order(component.means[,1])
> 
> means.out <- out$posterior$centroids[ord.out,]
> means.in <- component.means[ord.in,]
> 
> # Cluster stds and variances
> sds.out <- out$posterior$sds[ord.out,]
> sds.in  <- component.sds[ord.in,]
> vars.out <- sds.out^2
> vars.in <- sds.in^2
> 
> # Check correspondence between input and output
> if (length(means.in) == length(means.out)) {
+    cm <- cor(as.vector(means.in), as.vector(means.out))
+    csd <- cor(as.vector(sds.in), as.vector(sds.out))
+ }
> 
> # Plot results (assuming 2D)
> 
> ran <- range(c(as.vector(means.in - 2*vars.in), 
+                as.vector(means.in + 2*vars.in), 
+ 	       as.vector(means.out + 2*vars.out), 
+ 	       as.vector(means.out - 2*vars.out)))
> 
> #plot(D, pch = 20, main = paste("Cor.means:", round(cm,3), "/ Cor.sds:", round(csd,3)), xlim = ran, ylim = ran) 
> #for (ci in 1:nrow(means.out))  { add.ellipse(centroid = means.out[ci,], covmat = diag(vars.out[ci,]), col = "red") }
> #for (ci in 1:nrow(means.in))  { add.ellipse(centroid = means.in[ci,], covmat = diag(vars.in[ci,]), col = "blue") }
> 
> 
> 
> proc.time()
   user  system elapsed 
   3.64    0.31    3.93 

netresponse.Rcheck/tests_x64/vdpmixture.Rout


R version 4.0.5 (2021-03-31) -- "Shake and Throw"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> 
> # 1. vdp.mixt: moodien loytyminen eri dimensiolla, naytemaarilla ja komponenteilla
> #   -> ainakin nopea check
> 
> #######################################################################
> 
> # Generate random data from five Gaussians. 
> # Detect modes with vdp-gm. 
> # Plot data points and detected clusters with variance ellipses
> 
> #######################################################################
> 
> library(netresponse)
Loading required package: Rgraphviz
Loading required package: graph
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, basename, cbind, colnames, dirname, do.call,
    duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
    lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin,
    pmin.int, rank, rbind, rownames, sapply, setdiff, sort, table,
    tapply, union, unique, unsplit, which.max, which.min

Loading required package: grid
Loading required package: minet
Loading required package: mclust
Package 'mclust' version 5.4.7
Type 'citation("mclust")' for citing this R package in publications.
Loading required package: reshape2

netresponse (C) 2008-2020 Leo Lahti et al.

https://github.com/antagomir/netresponse
> #source("~/Rpackages/netresponse/netresponse/R/detect.responses.R")
> #source("~/Rpackages/netresponse/netresponse/R/internals.R")
> #source("~/Rpackages/netresponse/netresponse/R/vdp.mixt.R")
> #dyn.load("/home/tuli/Rpackages/netresponse/netresponse/src/netresponse.so")
> 
> 
> #########  Generate DATA #############################################
> 
> res <- generate.toydata()
> D <- res$data
> component.means <- res$means
> component.sds   <- res$sds
> sample2comp     <- res$sample2comp
> 
> ######################################################################
> 
> # Fit nonparametric Gaussian mixture model
> out <- vdp.mixt(D)
> # out <- vdp.mixt(D, c.max = 3) # try with limited number of components -> OK
> 
> ############################################################
> 
> # Compare input data and results
> 
> ord.out <- order(out$posterior$centroids[,1])
> ord.in <- order(component.means[,1])
> 
> means.out <- out$posterior$centroids[ord.out,]
> means.in <- component.means[ord.in,]
> 
> # Cluster stds and variances
> sds.out <- out$posterior$sds[ord.out,]
> sds.in  <- component.sds[ord.in,]
> vars.out <- sds.out^2
> vars.in <- sds.in^2
> 
> # Check correspondence between input and output
> if (length(means.in) == length(means.out)) {
+    cm <- cor(as.vector(means.in), as.vector(means.out))
+    csd <- cor(as.vector(sds.in), as.vector(sds.out))
+ }
> 
> # Plot results (assuming 2D)
> 
> ran <- range(c(as.vector(means.in - 2*vars.in), 
+                as.vector(means.in + 2*vars.in), 
+ 	       as.vector(means.out + 2*vars.out), 
+ 	       as.vector(means.out - 2*vars.out)))
> 
> #plot(D, pch = 20, main = paste("Cor.means:", round(cm,3), "/ Cor.sds:", round(csd,3)), xlim = ran, ylim = ran) 
> #for (ci in 1:nrow(means.out))  { add.ellipse(centroid = means.out[ci,], covmat = diag(vars.out[ci,]), col = "red") }
> #for (ci in 1:nrow(means.in))  { add.ellipse(centroid = means.in[ci,], covmat = diag(vars.in[ci,]), col = "blue") }
> 
> 
> 
> proc.time()
   user  system elapsed 
   3.23    0.29    3.50 

Example timings

netresponse.Rcheck/examples_i386/netresponse-Ex.timings

nameusersystemelapsed
NetResponseModel-class000
PlotMixture000
PlotMixtureBivariate000
PlotMixtureMultivariate000
PlotMixtureUnivariate000
centerData0.010.000.01
check.matrix000
check.network000
continuous.responses000
detect.responses0.000.020.02
dna0.050.000.04
enrichment.list.factor000
enrichment.list.factor.minimal000
factor.responses000
factor.responses.minimal000
filter.network000
find.similar.features0.000.020.02
generate.toydata000
get.dat-NetResponseModel-method000
get.model.parameters0.020.000.02
get.subnets-NetResponseModel-method000
getqofz-NetResponseModel-method000
independent.models000
list.responses.continuous.multi000
list.responses.continuous.single000
list.significant.responses000
listify.groupings000
mixture.model000
model.stats0.020.000.02
netresponse-package4.030.124.17
order.responses000
osmo0.050.020.06
pick.model.pairs000
pick.model.parameters000
plotPCA000
plot_associations000
plot_data000
plot_expression000
plot_matrix000
plot_response000
plot_responses000
plot_scale000
plot_subnet000
read.sif000
remove.negative.edges000
response.enrichment000
response2sample000
sample2response5.830.005.83
set.breaks000
toydata0.000.010.02
update.model.pair000
vdp.mixt0.060.000.06
vectorize.groupings000

netresponse.Rcheck/examples_x64/netresponse-Ex.timings

nameusersystemelapsed
NetResponseModel-class000
PlotMixture000
PlotMixtureBivariate000
PlotMixtureMultivariate000
PlotMixtureUnivariate000
centerData000
check.matrix000
check.network000
continuous.responses000
detect.responses000
dna0.010.000.01
enrichment.list.factor000
enrichment.list.factor.minimal000
factor.responses000
factor.responses.minimal000
filter.network000
find.similar.features000
generate.toydata000
get.dat-NetResponseModel-method000
get.model.parameters0.000.020.01
get.subnets-NetResponseModel-method000
getqofz-NetResponseModel-method000
independent.models000
list.responses.continuous.multi000
list.responses.continuous.single000
list.significant.responses000
listify.groupings000
mixture.model000
model.stats0.000.020.02
netresponse-package3.040.043.09
order.responses000
osmo0.050.000.05
pick.model.pairs000
pick.model.parameters000
plotPCA000
plot_associations000
plot_data000
plot_expression000
plot_matrix000
plot_response000
plot_responses000
plot_scale000
plot_subnet000
read.sif000
remove.negative.edges000
response.enrichment000
response2sample000
sample2response404
set.breaks000
toydata000
update.model.pair000
vdp.mixt0.040.000.05
vectorize.groupings000