Skip to content
Permalink
339bb5649d
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
41 lines (36 sloc) 1.11 KB
#' Function to compute DPM
#'
#' @param data is a matrix containing samples in rows, variables in columns
#'
#' @return a nvar*nvar matrix containing reg.DPM scores for all links (edges) where nvar is the number of variables
#'
#' @import corpcor
#'
#' @examples
#' Example1:
#' ## Generate non-linear data with 100 samples (from the network discussed in the paper) where the gaussian noise with standard deviation of sigma=0.2 is added to the generated data
#' data <- nldata(nsamp=100,sigma=0.2)$data
#'
#'## run regularized DPM
#' res <-reg.dpm(data)
#' head(res)
#'
#' Example2:
#' ##load DREAM4 data (insilico_size10_1_knockouts)
#' data(dream4)
#'
#'## Run regularized DPM
#' res <- reg.dpm(dream4)
#' head(res)
#'
#' @export
###############################
### Function to compute DPM ###
###############################
dpm <- function(data) {
# compute the double-centred vectors of each variable and concatenate them into the columns of matrix d
d <- apply(as.matrix(data), 2, Dcenter)
# compute the precision matrix of d (cor2pcor is a function from corpcor Library)
res <- corpcor::cor2pcor(cov(d))
return(res)
}