R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0 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 a HTML browser interface to help. Type 'q()' to quit R. > ### *
> ### > attach(NULL, name = "CheckExEnv") > assign(".CheckExEnv", as.environment(2), pos = length(search())) # base > ## add some hooks to label plot pages for base and grid graphics > setHook("plot.new", ".newplot.hook") > setHook("persp", ".newplot.hook") > setHook("grid.newpage", ".gridplot.hook") > > assign("cleanEx", + function(env = .GlobalEnv) { + rm(list = ls(envir = env, all.names = TRUE), envir = env) + RNGkind("default", "default") + set.seed(1) + options(warn = 1) + delayedAssign("T", stop("T used instead of TRUE"), + assign.env = .CheckExEnv) + delayedAssign("F", stop("F used instead of FALSE"), + assign.env = .CheckExEnv) + sch <- search() + newitems <- sch[! sch %in% .oldSearch] + for(item in rev(newitems)) + eval(substitute(detach(item), list(item=item))) + missitems <- .oldSearch[! .oldSearch %in% sch] + if(length(missitems)) + warning("items ", paste(missitems, collapse=", "), + " have been removed from the search path") + }, + env = .CheckExEnv) > assign("..nameEx", "__{must remake R-ex/*.R}__", env = .CheckExEnv) # for now > assign("ptime", proc.time(), env = .CheckExEnv) > grDevices::postscript("concor-Examples.ps") > assign("par.postscript", graphics::par(no.readonly = TRUE), env = .CheckExEnv) > options(contrasts = c(unordered = "contr.treatment", ordered = "contr.poly")) > options(warn = 1) > library('concor') > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "concor" > > ### * concor > > flush(stderr()); flush(stdout()) > > ### Name: concor > ### Title: Relative links of several subsets of variables > ### Aliases: concor > > > ### ** Examples > > # To make some "GPA" : so, by posing the compromise X = Y, > # "procrustes" rotations to the "compromise X" then are : > # Yj*(vj*u'). > > x<-matrix(runif(50),10,5);y<-matrix(runif(90),10,9) > x<-scale(x);y<-scale(y) > co<-concor(x,y,c(3,2,4),2) > ((t(x%*%co$u[,1])%*%y[,1:3]%*%co$v[1:3,1])/10)^2;co$cov2[1,1] [,1] [1,] 0.5212125 [1] 0.5212125 > t(x%*%co$u)%*%y%*%co$V [,1] [,2] [1,] 1.136708e+01 7.039088e-16 [2,] 5.934967e-16 8.596593e+00 > > > > cleanEx(); ..nameEx <- "concorcano" > > ### * concorcano > > flush(stderr()); flush(stdout()) > > ### Name: concorcano > ### Title: Canonical analysis of several sets with another set > ### Aliases: concorcano > > > ### ** Examples > > x<-matrix(runif(50),10,5);y<-matrix(runif(90),10,9) > x<-scale(x);y<-scale(y) > ca<-concorcano(x,y,c(3,2,4),2) > diag(t(ca$cx)%*%ca$cy[1:10,]/10)^2 [1] 0.7658546 0.1462615 > ca$rho2[1,] [1] 0.7658546 0.1462615 > > > > cleanEx(); ..nameEx <- "concoreg" > > ### * concoreg > > flush(stderr()); flush(stdout()) > > ### Name: concoreg > ### Title: Redundancy of sets yj by one set x > ### Aliases: concoreg > > > ### ** Examples > > x<-matrix(runif(50),10,5);y<-matrix(runif(90),10,9) > x<-scale(x);y<-scale(y) > co<-concoreg(x,y,c(3,2,4),2) > ((t(co$cx[,1])%*%y[,1:3]%*%co$v[1:3,1])/10)^2;co$varexp[1,1] [,1] [1,] 0.3828301 [1] 0.3828301 > t(co$cx)%*%co$cx /10 [,1] [,2] [1,] 1.000000e+00 -6.803793e-16 [2,] -6.803793e-16 1.000000e+00 > diag(t(co$cx)%*%y%*%co$V/10)^2 [1] 1.8739663 0.8619997 > sum(co$varexp[,1]);sum(co$varexp[,2]) [1] 1.873966 [1] 0.8619997 > > > > cleanEx(); ..nameEx <- "concorgm" > > ### * concorgm > > flush(stderr()); flush(stdout()) > > ### Name: concorgm > ### Title: Analyzing a set of partial links between Xi and Yj > ### Aliases: concorgm > > > ### ** Examples > > x<-matrix(runif(50),10,5);y<-matrix(runif(90),10,9) > x<-scale(x);y<-scale(y) > cg<-concorgm(x,c(2,3),y,c(3,2,4),2) > diag(t(x[,1:2]%*%cg$u[1:2,])%*%y[,1:3]%*%cg$v[1:3,]/10)^2 [1] 0.09388086 0.36212069 > cg$cov2[1,1,] [1] 0.09388086 0.36212069 > > > > cleanEx(); ..nameEx <- "concorgmcano" > > ### * concorgmcano > > flush(stderr()); flush(stdout()) > > ### Name: concorgmcano > ### Title: Canonical analysis of subsets Yj with subsets Xi > ### Aliases: concorgmcano > > > ### ** Examples > > x<-matrix(runif(50),10,5);y<-matrix(runif(90),10,9) > x<-scale(x);y<-scale(y) > cc<-concorgmcano(x,c(2,3),y,c(3,2,4),2) > diag(t(cc$cx[1:10,])%*%cc$cy[1:10,]/10)^2 [1] 0.1903244 0.4146075 > cc$rho2[1,1,] [1] 0.1903244 0.4146075 > > > > cleanEx(); ..nameEx <- "concorgmreg" > > ### * concorgmreg > > flush(stderr()); flush(stdout()) > > ### Name: concorgmreg > ### Title: Regression of subsets Yj by subsets Xi > ### Aliases: concorgmreg > > > ### ** Examples > > x<-matrix(runif(50),10,5);y<-matrix(runif(90),10,9) > x<-scale(x);y<-scale(y) > cr<-concorgmreg(x,c(2,3),y,c(3,2,4),2) > diag(t(cr$cx[1:10,])%*%y[,1:3]%*%cr$v[1:3,]/10)^2 [1] 0.1046304 0.3743149 > cr$varexp[1,1,] [1] 0.1046304 0.3743149 > > > > cleanEx(); ..nameEx <- "concors" > > ### * concors > > flush(stderr()); flush(stdout()) > > ### Name: concors > ### Title: "simultaneous concorgm" > ### Aliases: concors > > > ### ** Examples > > x<-matrix(runif(50),10,5);y<-matrix(runif(90),10,9) > x<-scale(x);y<-scale(y) > cs<-concors(x,c(2,3),y,c(3,2,4),2) > diag(t(x[,1:2]%*%cs$u[1:2,])%*%y[,1:3]%*%cs$v[1:3,]/10)^2 [1] 0.08311143 0.40914900 > cs$cov2[1,1,] [1] 0.08311143 0.40914900 > > > > cleanEx(); ..nameEx <- "concorscano" > > ### * concorscano > > flush(stderr()); flush(stdout()) > > ### Name: concorscano > ### Title: "simultaneous concorgmcano" > ### Aliases: concorscano > > > ### ** Examples > > x<-matrix(runif(50),10,5);y<-matrix(runif(90),10,9) > x<-scale(x);y<-scale(y) > cca<-concorscano(x,c(2,3),y,c(3,2,4),2) > diag(t(cca$cx[1:10,])%*%cca$cy[1:10,]/10)^2 [1] 0.09551706 0.53879906 > cca$rho2[1,1,] [1] 0.09551706 0.53879906 > > > > cleanEx(); ..nameEx <- "concorsreg" > > ### * concorsreg > > flush(stderr()); flush(stdout()) > > ### Name: concorsreg > ### Title: "simultaneous concorgmreg" > ### Aliases: concorsreg > > > ### ** Examples > > x<-matrix(runif(50),10,5);y<-matrix(runif(90),10,9) > x<-scale(x);y<-scale(y) > crs<-concorsreg(x,c(2,3),y,c(3,2,4),2) > diag(t(crs$cx[1:10,])%*%y[,1:3]%*%crs$v[1:3,]/10)^2 [1] 0.09208706 0.45370752 > crs$varexp[1,1,] [1] 0.09208706 0.45370752 > > > > cleanEx(); ..nameEx <- "svdbip" > > ### * svdbip > > flush(stderr()); flush(stdout()) > > ### Name: svdbip > ### Title: SVD for one bipartitioned matrix x > ### Aliases: svdbip > > > ### ** Examples > > x<-matrix(runif(200),10,20) > s<-svdbip(x,c(3,4,3),c(5,15),3) > zu<-cbind(x[1:3,1:5]%*%s$v[1:5,1],x[1:3,6:20]%*%s$v[6:20,1]) > czu<-svd(zu); > czu$u[,1]%*%s$u[1:3,2:3] [,1] [,2] [1,] 1.276912e-16 9.09504e-18 > czu$u[,1] # is a compromise between the vectors xj*vj[,1], [1] -0.6330866 -0.5494441 -0.5452637 > # orthogonal to the partial vectors uk[,k] relative to the > # following solutions (k>1); (in a same way, the singular > # vectors ui and vj of an usual SVD of x verifies ui'*(x*vj)=0, > #when i is not equal to j) > > > > cleanEx(); ..nameEx <- "svdbip2" > > ### * svdbip2 > > flush(stderr()); flush(stdout()) > > ### Name: svdbip2 > ### Title: SVD for bipartitioned matrix x > ### Aliases: svdbip2 > > > ### ** Examples > > x<-matrix(runif(200),10,20) > s2<-svdbip2(x,c(3,4,3),c(5,5,10),3);s2$s2 , , 1 [,1] [,2] [,3] [1,] 4.121405 3.433959 8.116402 [2,] 5.668206 5.271511 10.175459 [3,] 4.537545 4.358561 9.491261 , , 2 [,1] [,2] [,3] [1,] 0.09952137 0.1535515 0.3146026 [2,] 0.18465944 0.1518462 0.3523056 [3,] 0.40171204 0.4133174 0.6992409 , , 3 [,1] [,2] [,3] [1,] 0.01440136 0.485436378 0.04872644 [2,] 0.37730664 0.191593674 0.80319746 [3,] 0.16978449 0.006509385 0.06206466 > s1<-svdbip(x,c(3,4,3),c(5,5,10),3);s1$s2 , , 1 [,1] [,2] [,3] [1,] 4.121404 3.433959 8.116403 [2,] 5.668208 5.271511 10.175459 [3,] 4.537544 4.358561 9.491261 , , 2 [,1] [,2] [,3] [1,] 0.09950465 0.1535372 0.3147517 [2,] 0.18476071 0.1518692 0.3523503 [3,] 0.40163798 0.4132831 0.6990623 , , 3 [,1] [,2] [,3] [1,] 0.01440256 0.485466178 0.04870044 [2,] 0.37741525 0.191531291 0.80302493 [3,] 0.16983301 0.006508503 0.06207789 > > > > cleanEx(); ..nameEx <- "svdbips" > > ### * svdbips > > flush(stderr()); flush(stdout()) > > ### Name: svdbips > ### Title: SVD for bipartitioned matrix x > ### Aliases: svdbips > > > ### ** Examples > > x<-matrix(runif(200),10,20) > s1<-svdbip(x,c(3,4,3),c(5,5,10),2);sum(sum(sum(s1$s2))) [1] 57.94507 > ss<-svdbips(x,c(3,4,3),c(5,5,10),2);sum(sum(sum(ss$s2))) [1] 57.95949 > > > > cleanEx(); ..nameEx <- "svdcp" > > ### * svdcp > > flush(stderr()); flush(stdout()) > > ### Name: svdcp > ### Title: SVD for a Column Partitioned matrix x > ### Aliases: svdcp > > > ### ** Examples > > x<-matrix(runif(200),10,20) > s<-svdcp(x,c(5,5,10),1) > ss<-svd(x);ss$d[1]^2 [1] 55.15345 > sum(s$s2) [1] 55.15345 > > > > ### *