R: Plotting Bayesian Network Discovery using a Standard MCMC...
plot.Networks.STD
R Documentation
Plotting Bayesian Network Discovery using a Standard MCMC Algorithm
Description
plot method for class "Networks.STD"
Usage
## S3 method for class 'Networks.STD'
plot(x, ...)
Arguments
x
An object of class "Networks.STD" resulting of a call to Networks.STD.
...
other arguments
See Also
Networks.STD.
Examples
library(igraph)
###Creating the network of 10X10 image
g <- graph.lattice(length=10,dim=2)
net=as(get.adjacency(g,attr=NULL),"matrix")##this is the input of argument 'net'
##Assign the signal elements with signal intention
##as normal distribution N(1,0.2). While noise is set as N(0,0.2)
newz=rep(0,100)
for (i in 3:7)
{
newz[(i*10+3):(i*10+7)]=1
}
testcov<-0
for(i in 1:100){
if(newz[i]==0){
testcov[i]<-rnorm(1,mean=0,sd=0.2)
}else{
testcov[i]<-rnorm(1,mean=1,sd=0.2)
}
}
##The profile of the image
image(matrix(testcov,10,10),col=gray(seq(0,1,length=255)))
##Transform the signals into pvalue form and begin identification
pvalue=pnorm(-testcov)
total=Networks.STD(pvalue,net,iter=3,nburns=1,
piall=c(0.8, 0.85, 0.9, 0.95),rhoall=c(0.5,1,5,10,15))
######plot the object of class "Networks.STD"
plot(total)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (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(BANFF)
Loading required package: foreach
Loading required package: doParallel
Loading required package: iterators
Loading required package: parallel
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/BANFF/plot.Networks.STD.Rd_%03d_medium.png", width=480, height=480)
> ### Name: plot.Networks.STD
> ### Title: Plotting Bayesian Network Discovery using a Standard MCMC
> ### Algorithm
> ### Aliases: plot.Networks.STD
>
> ### ** Examples
>
> library(igraph)
Attaching package: 'igraph'
The following objects are masked from 'package:stats':
decompose, spectrum
The following object is masked from 'package:base':
union
> ###Creating the network of 10X10 image
> g <- graph.lattice(length=10,dim=2)
> net=as(get.adjacency(g,attr=NULL),"matrix")##this is the input of argument 'net'
> ##Assign the signal elements with signal intention
> ##as normal distribution N(1,0.2). While noise is set as N(0,0.2)
> newz=rep(0,100)
> for (i in 3:7)
+ {
+ newz[(i*10+3):(i*10+7)]=1
+ }
> testcov<-0
> for(i in 1:100){
+ if(newz[i]==0){
+ testcov[i]<-rnorm(1,mean=0,sd=0.2)
+
+ }else{
+ testcov[i]<-rnorm(1,mean=1,sd=0.2)
+
+ }
+ }
> ##The profile of the image
> image(matrix(testcov,10,10),col=gray(seq(0,1,length=255)))
> ##Transform the signals into pvalue form and begin identification
> pvalue=pnorm(-testcov)
> total=Networks.STD(pvalue,net,iter=3,nburns=1,
+ piall=c(0.8, 0.85, 0.9, 0.95),rhoall=c(0.5,1,5,10,15))
iteration: 1
iteration: 2
iteration: 3
>
> ######plot the object of class "Networks.STD"
> plot(total)
>
>
>
>
>
> dev.off()
null device
1
>