Title: | MultiGroup Method and Simulation Data Analysis |
---|---|
Description: | Two method new of multigroup and simulation of data. The first technique called multigroup PCA (mgPCA) this multivariate exploration approach that has the idea of considering the structure of groups and / or different types of variables. On the other hand, the second multivariate technique called Multigroup Dimensionality Reduction (MDR) it is another multivariate exploration method that is based on projections. In addition, a method called Single Dimension Exploration (SDE) was incorporated for to analyze the exploration of the data. It could help us in a better way to observe the behavior of the multigroup data with certain variables of interest. |
Authors: | Carolina Millap/'an [aut, cre], Esteban Vegas [aut] , Ferran Reverter [aut] , Josep M Oller [aut] , Joel Mu/~noz [aut] |
Maintainer: | Carolina Millap/'an <[email protected]> |
License: | GPL-3 |
Version: | 0.4.0 |
Built: | 2024-11-05 03:13:21 UTC |
Source: | https://github.com/cran/MultiGroupO |
biplot methods
BIplot( variates, loadings, prop_expl_var, comp = c(1, 2), group = NULL, rownamevar = T, rownameload = T )
BIplot( variates, loadings, prop_expl_var, comp = c(1, 2), group = NULL, rownamevar = T, rownameload = T )
variates |
is the size of groups |
loadings |
is a vector of classes |
prop_expl_var |
data set |
comp |
component numeric |
group |
is a vector of groups |
rownamevar |
is a logical vector where TRUE is the label of the observations, if is FALSE, is index. |
rownameload |
is a logical vector where TRUE is the label of the vectors of loadings, if is FALSE, is index. |
return an grafics .
library(datasets) obj<-pca(datos=iris[,-5],grupos=iris[,5],Plot=FALSE,center=TRUE,scale=TRUE) BIplot(variates=obj$variates,loadings=obj$loadings, prop_expl_var=obj$prop_expl_var,comp=c(1,2), group=factor(as.numeric(iris[,5])),rownamevar=FALSE,rownameload=TRUE)
library(datasets) obj<-pca(datos=iris[,-5],grupos=iris[,5],Plot=FALSE,center=TRUE,scale=TRUE) BIplot(variates=obj$variates,loadings=obj$loadings, prop_expl_var=obj$prop_expl_var,comp=c(1,2), group=factor(as.numeric(iris[,5])),rownamevar=FALSE,rownameload=TRUE)
Simulation function of quantitative multigroup data under a multivariate normal distribution
fun.sim(g, mean1, d, n.var, sds2, corr)
fun.sim(g, mean1, d, n.var, sds2, corr)
g |
An vector of the size of each group |
mean1 |
An vector of the population means structure |
d |
distance d for the structure of population means |
n.var |
2x1 dimension vector whose first component is the number of random variables to simulate and the second component number of noise variables to simulate |
sds2 |
An vector of the variances to simulate for each group noise variables |
corr |
An vector of the correlation to simulate for each group and noise variables |
return an grafics
fun.sim(g=c(20,20),mean1=2,d=0,sds2=c(1,1,1),corr=c(0.5,0.5,0),n.var=c(50,1))
fun.sim(g=c(20,20),mean1=2,d=0,sds2=c(1,1,1),corr=c(0.5,0.5,0),n.var=c(50,1))
Performs a Multigroup Dimensionality Reduction (MDR) analysis in the given multigroup data matrix. Show MDR graphical output.
mdr(group, data.x, c, Plot = T)
mdr(group, data.x, c, Plot = T)
group |
is a vector of classes |
data.x |
quantitative data set |
c |
component numeric |
Plot |
grafics output of MDR |
return an grafics .
sim.list<-fun.sim(g=c(50,50,50),mean1=2,d=0,sds2=c(1,1,1,1), corr=c(0.5,0.5,0.5,0),n.var=c(30,30)) mdr(group=as.factor(sim.list$grp), data.x=sim.list$`lisx`,c=2)
sim.list<-fun.sim(g=c(50,50,50),mean1=2,d=0,sds2=c(1,1,1,1), corr=c(0.5,0.5,0.5,0),n.var=c(30,30)) mdr(group=as.factor(sim.list$grp), data.x=sim.list$`lisx`,c=2)
Performs a Multigroup PCA analysis in the given multigroup data matrix. Show mgpca graphical output.
mgpca( mat.to.diag, mat.x, cls, Plot = TRUE, ncomp = 2, center = TRUE, scale = TRUE )
mgpca( mat.to.diag, mat.x, cls, Plot = TRUE, ncomp = 2, center = TRUE, scale = TRUE )
mat.to.diag |
is a matrix with the data |
mat.x |
is a vector of classes |
cls |
group |
Plot |
grafics output of mgpca |
ncomp |
number of component |
center |
is a logical vector where TRUE is center (whether the variables should be shifted to be zero centered), if is FALSE, is original data. |
scale |
is a logical vector where TRUE is scale (indicating whether the variables should be scaled), if is FALSE, is original data. |
If simplify == TRUE class values.
If simplify == FALSE, the result is a list of length
nsim
data.tables.
library(plsgenomics) data(SRBCT) mydata<-SRBCT$X mydata<-mydata[1:50,1:5] groups<-as.factor(SRBCT$Y)[1:50] mat.to.diag1<-new.cov(x=mydata,cls=groups,A=diag(ncol(mydata))) mgpca(mat.to.diag=mat.to.diag1,mat.x=as.matrix(mydata), cls=groups,Plot=TRUE,ncomp=2,center = TRUE,scale = TRUE)
library(plsgenomics) data(SRBCT) mydata<-SRBCT$X mydata<-mydata[1:50,1:5] groups<-as.factor(SRBCT$Y)[1:50] mat.to.diag1<-new.cov(x=mydata,cls=groups,A=diag(ncol(mydata))) mgpca(mat.to.diag=mat.to.diag1,mat.x=as.matrix(mydata), cls=groups,Plot=TRUE,ncomp=2,center = TRUE,scale = TRUE)
Generates covariance matrix...
new.cov(x, cls, A)
new.cov(x, cls, A)
x |
is a matrix with the data |
cls |
is a vector of classes |
A |
is a symmetric and positive definite matrix associated to inner product respect to the base of its vectorial space. |
return an grafics.
library(plsgenomics) data(SRBCT) mydata<-SRBCT$X mydata<-mydata[1:50,1:20] groups<-as.factor(SRBCT$Y)[1:50] new.cov(x=mydata,cls=groups,A=diag(ncol(mydata)))
library(plsgenomics) data(SRBCT) mydata<-SRBCT$X mydata<-mydata[1:50,1:20] groups<-as.factor(SRBCT$Y)[1:50] new.cov(x=mydata,cls=groups,A=diag(ncol(mydata)))
Performs a principal components analysis in the given data matrix. Show PCA graphical output.
pca(datos, grupos, Plot = TRUE, center = TRUE, scale = TRUE)
pca(datos, grupos, Plot = TRUE, center = TRUE, scale = TRUE)
datos |
is a matrix with the data |
grupos |
is a vector of classes |
Plot |
vector logic for grafic |
center |
data set center by columns |
scale |
data set scaled by columns |
return an grafics.
library(plsgenomics) data(SRBCT) mydata<-SRBCT$X mydata<-mydata[1:30,1:20] groups<-as.factor(SRBCT$Y)[1:30] pca(datos=mydata,grupos=groups,Plot=TRUE,center=TRUE,scale=TRUE)
library(plsgenomics) data(SRBCT) mydata<-SRBCT$X mydata<-mydata[1:30,1:20] groups<-as.factor(SRBCT$Y)[1:30] pca(datos=mydata,grupos=groups,Plot=TRUE,center=TRUE,scale=TRUE)
Performs a Single Dimension Exploration (SDE) analysis in the given multigroup data matrix. Show SDE graphical output.
sde.method(mydata, groups, plt = FALSE)
sde.method(mydata, groups, plt = FALSE)
mydata |
data set |
groups |
is a vector of classes |
plt |
grafics |
return an grafics .
sim.list2<-fun.sim(g=c(20,50,10),mean1=0.5,d=0,sds2=c(1,1,1,1),corr=c(0.1,0.5,0.5,0), n.var=c(20,20)) datos2 <- as.data.frame(sim.list2$x) datos2<-subset(datos2,select=-grp) grupos <- sim.list2$grp grupos<-factor(grupos,labels=c(1,2,3)) sde.method(mydata=datos2,groups=grupos,plt=FALSE)
sim.list2<-fun.sim(g=c(20,50,10),mean1=0.5,d=0,sds2=c(1,1,1,1),corr=c(0.1,0.5,0.5,0), n.var=c(20,20)) datos2 <- as.data.frame(sim.list2$x) datos2<-subset(datos2,select=-grp) grupos <- sim.list2$grp grupos<-factor(grupos,labels=c(1,2,3)) sde.method(mydata=datos2,groups=grupos,plt=FALSE)