n <- 3 # number of genes
K <- 4 # number of experiments
T_ <- 4 # number of time points
annot_node <- seq(1, n)
annot <- getEdgeAnnot(n)
# generate random observation matrix
obs <- array(rnorm(n*K*T_), c(n,K,T_))
baseline <- c(0.75, 0, 0)
# define delta
delta <- apply(obs, 1, mean, na.rm=TRUE)
# perturbation vector, entry is 0 if gene is inactivated and 1 otherwise
b <- c(0,1,1, # perturbation exp1: gene 1 perturbed, gene 2,3 unperturbed
1,0,1, # perturbation exp2: gene 2 perturbed, gene 1,3 unperturbed
1,1,0, # perturbation exp3....
1,1,1)
T_nw <- matrix(c(0,1,0,
0,0,1,
0,0,0), nrow=n, ncol=n, byrow=TRUE)
colnames(T_nw) <- rownames(T_nw) <- annot_node
## calculate observation matrix with given parameters for the
# Gaussian distributions for activation and deactivation
active_mu <- 0.95
inactive_mu <- 0.56
active_sd <- inactive_sd <- 0.1
times <- kfold <- 10 # can be increased i.e. to 1000 to produce stable results
mu_type <- "single"
delta_type <- "perGene"
lambda <- 1/10
#### LOOCV
loocv(kfold=NULL, times=times, obs=obs, delta=delta, lambda=lambda, b=b, n=n, K=K, T_=T_, annot=annot,
annot_node=annot_node, active_mu=active_mu, active_sd=active_sd, inactive_mu=inactive_mu,
inactive_sd=inactive_sd, mu_type=mu_type, delta_type=delta_type, prior=NULL, sourceNode=NULL,
sinkNode=NULL, allint=FALSE, allpos=FALSE, flag_time_series=TRUE)
#### K-fold CV
kfoldCV(kfold=kfold, times=times, obs=obs, delta=delta, lambda=lambda, b=b, n=n, K=K, T_=T_, annot=annot,
annot_node=annot_node, active_mu=active_mu, active_sd=active_sd, inactive_mu=inactive_mu,
inactive_sd=inactive_sd, mu_type=mu_type, delta_type=delta_type, prior=NULL, sourceNode=NULL,
sinkNode=NULL, allint=FALSE, allpos=FALSE, flag_time_series=TRUE)
Run the code above in your browser using DataLab