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("deal-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('deal') Loading required package: dynamicGraph Loading required package: tcltk Loading Tcl/Tk interface ... done > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "autosearch" > > ### * autosearch > > flush(stderr()); flush(stdout()) > > ### Name: autosearch > ### Title: Greedy search > ### Aliases: autosearch heuristic gettable > ### Keywords: models > > ### ** Examples > > data(rats) > fit <- network(rats) > fit.prior <- jointprior(fit,12) Imaginary sample size: 12 > fit <- getnetwork(learn(fit,rats,fit.prior)) > fit <- getnetwork(insert(fit,2,1,rats,fit.prior)) > fit <- getnetwork(insert(fit,1,3,rats,fit.prior)) > hisc <- autosearch(fit,rats,fit.prior,trace=FALSE) [Autosearch (1) -170.0867 [Sex|Drug][Drug][W1|Sex:W2][W2] (2) -166.3658 [Sex|Drug][Drug][W1|Sex:Drug:W2][W2] (3) -163.5749 [Sex|Drug][Drug][W1|Drug:W2][W2] (4) -161.4324 [Sex|Drug][Drug][W1|Drug][W2|W1] (5) -160.2244 [Sex][Drug][W1|Drug][W2|W1] Total 0.65 add 0.34 rem 0.14 turn 0.04 sort 0.02 choose 0.02 rest 0.09 ] > hisc <- autosearch(fit,rats,fit.prior,trace=FALSE,removecycles=TRUE) # slower [Autosearch (1) -170.0867 [Sex|Drug][Drug][W1|Sex:W2][W2] (2) -166.3658 [Sex|Drug][Drug][W1|Sex:Drug:W2][W2] (3) -163.5749 [Sex|Drug][Drug][W1|Drug:W2][W2] (4) -161.4324 [Sex|Drug][Drug][W1|Drug][W2|W1] (5) -160.2244 [Sex][Drug][W1|Drug][W2|W1] Total 0.78 add 0.33 rem 0.14 turn 0.05 sort 0.01 choose 0.13 rest 0.12 ] > plot(getnetwork(hisc)) > > hisc2 <- heuristic(fit,rats,fit.prior,restart=10,trace=FALSE) [Heuristic [Autosearch (1) -170.0867 [Sex|Drug][Drug][W1|Sex:W2][W2] (2) -166.3658 [Sex|Drug][Drug][W1|Sex:Drug:W2][W2] (3) -163.5749 [Sex|Drug][Drug][W1|Drug:W2][W2] (4) -161.4324 [Sex|Drug][Drug][W1|Drug][W2|W1] (5) -160.2244 [Sex][Drug][W1|Drug][W2|W1] Total 0.66 add 0.31 rem 0.21 turn 0.05 sort 0 choose 0.01 rest 0.08 ] [Perturb 0.03 ] [Autosearch (1) -167.7038 [Sex][Drug|Sex][W1|Drug][W2] (2) -161.4324 [Sex][Drug|Sex][W1|Drug][W2|W1] (3) -160.2244 [Sex][Drug][W1|Drug][W2|W1] Total 0.16 add 0.04 rem 0.01 turn 0.02 sort 0 choose 0.03 rest 0.06 ] [Perturb 0.02 ] [Perturb 0.01 ] [Perturb 0.03 ] [Perturb 0.01 ] [Perturb 0.02 ] [Perturb 0.03 ] [Perturb 0.05 ] [Perturb 0 ] [Perturb 0.01 ] [Autosearch (1) -167.1701 [Sex][Drug][W1|Drug][W2|Sex] (2) -160.6097 [Sex][Drug][W1|Drug][W2|Sex:W1] (3) -160.2244 [Sex][Drug][W1|Drug][W2|W1] Total 0.25 add 0.16 rem 0 turn 0.01 sort 0.03 choose 0 rest 0.05 ] Tried 63 out of approx. 144 networks 1.46 ] Perturb: 0.24 ,Autosearch: 1.29 ,Unique: 0 > plot(getnetwork(hisc2)) > print(modelstring(getnetwork(hisc2))) [1] "[Sex][Drug][W1|Drug][W2|W1]" > plot(makenw(gettable(hisc2),fit)) > > > > cleanEx(); ..nameEx <- "drawnetwork" > > ### * drawnetwork > > flush(stderr()); flush(stdout()) > > ### Name: drawnetwork > ### Title: Graphical interface for editing networks > ### Aliases: drawnetwork > ### Keywords: models > > ### ** Examples > > data(rats) > rats.nw <- network(rats) > rats.prior <- jointprior(rats.nw,12) Imaginary sample size: 12 > rats.nw <- getnetwork(learn(rats.nw,rats,rats.prior)) > > ## Not run: newrat <- getnetwork(drawnetwork(rats.nw,rats,rats.prior)) > > > > cleanEx(); ..nameEx <- "genlatex" > > ### * genlatex > > flush(stderr()); flush(stdout()) > > ### Name: genlatex > ### Title: From a network family, generate LaTeX output > ### Aliases: genlatex genpicfile > ### Keywords: iplot > > ### ** Examples > > data(rats) > allrats <- getnetwork(networkfamily(rats,network(rats))) [networkfamily Imaginary sample size: 12 Creating all (144 minus restrictions) networks with 2 discrete and 2 continuous nodes Created 144 networks, 1.1 ] > allrats <- nwfsort(allrats) > > ## Not run: dir.create("c:/temp") > ## Not run: genpicfile(allrats,outdir="c:/temp/pic/") > ## Not run: genlatex(allrats,outdir="c:/temp/pic/",picdir="c:/temp/pic/") > > ## LATEX FILE: > #\documentclass{article} > #\usepackage{array,pictex} > #\begin{document} > #\input{scoretable} > #\input{picnice} > #\end{document} > > > > cleanEx(); ..nameEx <- "insert" > > ### * insert > > flush(stderr()); flush(stdout()) > > ### Name: insert > ### Title: Insert/remove an arrow in network > ### Aliases: insert remover > ### Keywords: iplot > > ### ** Examples > > data(rats) > rats.nw <- network(rats) > rats.nw <- getnetwork(insert(rats.nw,2,1,nocalc=TRUE)) > rats.prior <- jointprior(rats.nw,12) Imaginary sample size: 12 > > rats.nw2 <- network(rats) > rats.nw2 <- getnetwork(learn(rats.nw2,rats,rats.prior)) > rats.nw2 <- getnetwork(insert(rats.nw2,1,2,rats,rats.prior)) > > rats.nw3 <- getnetwork(remover(rats.nw2,1,2,rats,rats.prior)) > > > > cleanEx(); ..nameEx <- "jointprior" > > ### * jointprior > > flush(stderr()); flush(stdout()) > > ### Name: jointprior > ### Title: Calculates the joint prior distribution > ### Aliases: jointprior > ### Keywords: models > > ### ** Examples > > data(rats) > rats.nw <- network(rats) > rats.prior <- jointprior(rats.nw,12) Imaginary sample size: 12 > > ## Not run: savenet(rats.nw,file("rats.net")) > ## Not run: rats.nw <- readnet(file("rats.net")) > ## Not run: rats.nw <- prob(rats.nw,rats) > ## Not run: rats.prior <- jointprior(rats.nw,12) > > > > > cleanEx(); ..nameEx <- "learn" > > ### * learn > > flush(stderr()); flush(stdout()) > > ### Name: learn > ### Title: Estimation of parameters in the local probability distributions > ### Aliases: learn > ### Keywords: iplot > > ### ** Examples > > data(rats) > fit <- network(rats) > fit.prior <- jointprior(fit,12) Imaginary sample size: 12 > fit.learn <- learn(fit,rats,fit.prior,timetrace=TRUE) [Learn.network 0.02 ]> fit.nw <- getnetwork(fit.learn) > fit.learn2<- learn(fit,rats,fit.prior,trylist=gettrylist(fit.learn),timetrace=TRUE) [Learn.network 0 ]> > > > cleanEx(); ..nameEx <- "maketrylist" > > ### * maketrylist > > flush(stderr()); flush(stdout()) > > ### Name: maketrylist > ### Title: Creates the full trylist > ### Aliases: maketrylist > ### Keywords: models > > ### ** Examples > > data(rats) > rats.nw <- network(rats) > rats.pr <- jointprior(rats.nw,12) Imaginary sample size: 12 > rats.nw <- getnetwork(learn(rats.nw,rats,rats.pr)) > rats.tr <- maketrylist(rats.nw,rats,rats.pr) Creating all (144 minus restrictions) networks with 2 discrete and 2 continuous nodes Created 144 networks, > > rats.hi <- getnetwork(heuristic(rats.nw,rats,rats.pr,trylist=rats.tr)) [Heuristic [Autosearch (1) -166.4958 [Sex][Drug][W1|Drug][W2] (2) -160.2244 [Sex][Drug][W1|Drug][W2|W1] Total 0.13 add 0.04 rem 0.01 turn 0.01 sort 0.01 choose 0 rest 0.06 ] [Perturb 0.02 ] [Perturb 0.01 ] [Perturb 0.02 ] [Perturb 0.02 ] [Perturb 0 ] [Perturb 0 ] [Perturb 0 ] [Perturb 0.02 ] [Perturb 0.04 ] [Perturb 0.03 ] Tried 25 out of approx. 144 networks 0.36 ] Perturb: 0.19 ,Autosearch: 0.18 ,Unique: 0 > > > > cleanEx(); ..nameEx <- "network" > > ### * network > > flush(stderr()); flush(stdout()) > > ### Name: network > ### Title: Bayesian network data structure > ### Aliases: network plot.network print.network > ### Keywords: models > > ### ** Examples > > A <- factor(rep(c("A1","A2"),50)) > B <- factor(rep(rep(c("B1","B2"),25),2)) > thisnet <- network( data.frame(A,B) ) > > set.seed(109) > sex <- gl(2,4,label=c("male","female")) > age <- gl(2,2,8) > yield <- rnorm(length(sex)) > weight <- rnorm(length(sex)) > mydata <- data.frame(sex,age,yield,weight) > mynw <- network(mydata) > > # adjust prior probability distribution > localprob(mynw,"sex") <- c(0.4,0.6) > localprob(mynw,"age") <- c(0.6,0.4) > localprob(mynw,"yield") <- c(2,0) > localprob(mynw,"weight")<- c(1,0) > > print(mynw) ## 4 ( 2 discrete+ 2 ) nodes;score= ;relscore= 1 sex discrete(2) 2 age discrete(2) 3 yield continuous() 4 weight continuous() > plot(mynw) > > prior <- jointprior(mynw) Imaginary sample size: 8.333333 > mynw <- getnetwork(learn(mynw,mydata,prior)) > thebest <- getnetwork(autosearch(mynw,mydata,prior)) [Autosearch (1) -35.34196 [sex][age][yield][weight|age] (2) -34.47202 [sex][age][yield][weight|age:yield] (3) -34.19462 [sex][age][yield|sex][weight|age:yield] Total 0.44 add 0.3 rem 0.01 turn 0.02 sort 0.04 choose 0 rest 0.07 ] > > print(mynw,condposterior=TRUE) ## 4 ( 2 discrete+ 2 ) nodes;score= -35.8417032539780 ;relscore= 1 sex discrete(2) ------------------------------------------------------------ Conditional Posterior: sex [[1]] [[1]]$alpha male female 8 8 attr(,"class") [1] "table" [[1]]$nu [1] NA [[1]]$rho [1] NA [[1]]$mu [1] NA [[1]]$phi [1] NA [[1]]$tau [1] NA 2 age discrete(2) ------------------------------------------------------------ Conditional Posterior: age [[1]] [[1]]$alpha 1 2 8 8 attr(,"class") [1] "table" [[1]]$nu [1] NA [[1]]$rho [1] NA [[1]]$mu [1] NA [[1]]$phi [1] NA [[1]]$tau [1] NA 3 yield continuous() ------------------------------------------------------------ Conditional Posterior: yield [[1]] [[1]]$alpha [1] NA [[1]]$nu [1] 8 [[1]]$rho [1] 16 [[1]]$mu [1] 0.0867827 [[1]]$phi [1] 19.08751 [[1]]$tau [1] 16 4 weight continuous() ------------------------------------------------------------ Conditional Posterior: weight [[1]] [[1]]$alpha [1] NA [[1]]$nu [1] 8 [[1]]$rho [1] 16 [[1]]$mu [1] -0.06561016 [[1]]$phi [1] 9.385794 [[1]]$tau [1] 16 > > ## Not run: savenet(mynw,file("yield.net")) > > > > cleanEx(); ..nameEx <- "networkfamily" > > ### * networkfamily > > flush(stderr()); flush(stdout()) > > ### Name: networkfamily > ### Title: Generates and learns all networks for a set of variables. > ### Aliases: networkfamily print.networkfamily plot.networkfamily > ### Keywords: iplot > > ### ** Examples > > data(rats) > allrats <- getnetwork(networkfamily(rats)) [networkfamily Imaginary sample size: 12 Creating all (144 minus restrictions) networks with 2 discrete and 2 continuous nodes Created 144 networks, 1.07 ] > plot(allrats) > print(allrats) Discrete: Sex(2),Drug(3) Continuous:W1,W2 log(Score) |Relscore |Network ------------------------------------------------------------ 1. -160.2244 1 [Sex][Drug][W1|Drug][W2|W1] 2. -160.6097 0.6802642 [Sex][Drug][W1|Drug][W2|SexW1] 3. -161.4324 0.2987972 [Sex|Drug][Drug][W1|Drug][W2|W1] 4. -161.4324 0.2987972 [Sex][Drug|Sex][W1|Drug][W2|W1] 5. -161.8177 0.2032610 [Sex|Drug][Drug][W1|Drug][W2|SexW1] 6. -161.8177 0.2032610 [Sex][Drug|Sex][W1|Drug][W2|SexW1] 7. -162.3077 0.1245122 [Sex][Drug][W1|Drug][W2|DrugW1] 8. -162.3077 0.1245122 [Sex][Drug][W1|DrugW2][W2|Drug] 9. -162.3669 0.1173555 [Sex][Drug][W1|DrugW2][W2] 10. -162.8150 0.07497692 [Sex][Drug][W1|SexDrug][W2|W1] 11. -163.0412 0.05979467 [Sex][Drug][W1|DrugW2][W2|Sex] 12. -163.2002 0.05100412 [Sex][Drug][W1|SexDrug][W2|SexW1] 13. -163.5157 0.03720389 [Sex|Drug][Drug][W1|Drug][W2|DrugW1] 14. -163.5157 0.03720389 [Sex][Drug|Sex][W1|Drug][W2|DrugW1] 15. -163.5157 0.03720389 [Sex|Drug][Drug][W1|DrugW2][W2|Drug] 16. -163.5157 0.03720389 [Sex][Drug|Sex][W1|DrugW2][W2|Drug] 17. -163.5749 0.0350655 [Sex|Drug][Drug][W1|DrugW2][W2] 18. -163.5749 0.0350655 [Sex][Drug|Sex][W1|DrugW2][W2] 19. -163.7908 0.02825631 [Sex][Drug][W1|DrugW2][W2|SexDrug] 20. -163.9911 0.02312842 [Sex][Drug][W1|Drug][W2|SexDrugW1] 21. -164.0230 0.02240289 [Sex|Drug][Drug][W1|SexDrug][W2|W1] 22. -164.0230 0.02240289 [Sex][Drug|Sex][W1|SexDrug][W2|W1] 23. -164.2492 0.01786648 [Sex|Drug][Drug][W1|DrugW2][W2|Sex] 24. -164.2492 0.01786648 [Sex][Drug|Sex][W1|DrugW2][W2|Sex] 25. -164.4082 0.01523989 [Sex|Drug][Drug][W1|SexDrug][W2|SexW1] 26. -164.4082 0.01523989 [Sex][Drug|Sex][W1|SexDrug][W2|SexW1] 27. -164.8983 0.009335542 [Sex][Drug][W1|SexDrug][W2|DrugW1] 28. -164.9988 0.008442904 [Sex|Drug][Drug][W1|DrugW2][W2|SexDrug] 29. -164.9988 0.008442904 [Sex][Drug|Sex][W1|DrugW2][W2|SexDrug] 30. -165.0986 0.00764135 [Sex][Drug][W1|SexDrugW2][W2|Drug] 31. -165.1578 0.007202143 [Sex][Drug][W1|SexDrugW2][W2] 32. -165.1991 0.006910706 [Sex|Drug][Drug][W1|Drug][W2|SexDrugW1] 33. -165.1991 0.006910706 [Sex][Drug|Sex][W1|Drug][W2|SexDrugW1] 34. -165.8321 0.003669616 [Sex][Drug][W1|SexDrugW2][W2|Sex] 35. -166.1063 0.002789433 [Sex|Drug][Drug][W1|SexDrug][W2|DrugW1] 36. -166.1063 0.002789433 [Sex][Drug|Sex][W1|SexDrug][W2|DrugW1] 37. -166.3066 0.002283214 [Sex|Drug][Drug][W1|SexDrugW2][W2|Drug] 38. -166.3066 0.002283214 [Sex][Drug|Sex][W1|SexDrugW2][W2|Drug] 39. -166.3658 0.002151980 [Sex|Drug][Drug][W1|SexDrugW2][W2] 40. -166.3658 0.002151980 [Sex][Drug|Sex][W1|SexDrugW2][W2] 41. -166.4366 0.002004747 [Sex][Drug][W1|Drug][W2|Drug] 42. -166.4958 0.001889518 [Sex][Drug][W1|Drug][W2] 43. -166.5817 0.001734098 [Sex][Drug][W1|SexDrug][W2|SexDrugW1] 44. -166.5817 0.001734098 [Sex][Drug][W1|SexDrugW2][W2|SexDrug] 45. -167.0401 0.001096471 [Sex|Drug][Drug][W1|SexDrugW2][W2|Sex] 46. -167.0401 0.001096471 [Sex][Drug|Sex][W1|SexDrugW2][W2|Sex] 47. -167.1701 0.0009627422 [Sex][Drug][W1|Drug][W2|Sex] 48. -167.6446 0.0005990126 [Sex|Drug][Drug][W1|Drug][W2|Drug] 49. -167.6446 0.0005990126 [Sex][Drug|Sex][W1|Drug][W2|Drug] 50. -167.7038 0.0005645827 [Sex|Drug][Drug][W1|Drug][W2] 51. -167.7038 0.0005645827 [Sex][Drug|Sex][W1|Drug][W2] 52. -167.7897 0.0005181435 [Sex|Drug][Drug][W1|SexDrug][W2|SexDrugW1] 53. -167.7897 0.0005181435 [Sex][Drug|Sex][W1|SexDrug][W2|SexDrugW1] 54. -167.7897 0.0005181435 [Sex|Drug][Drug][W1|SexDrugW2][W2|SexDrug] 55. -167.7897 0.0005181435 [Sex][Drug|Sex][W1|SexDrugW2][W2|SexDrug] 56. -167.9197 0.0004549493 [Sex][Drug][W1|Drug][W2|SexDrug] 57. -168.3781 0.0002876646 [Sex|Drug][Drug][W1|Drug][W2|Sex] 58. -168.3781 0.0002876646 [Sex][Drug|Sex][W1|Drug][W2|Sex] 59. -168.8195 0.0001850109 [Sex][Drug][W1|SexW2][W2|Drug] 60. -168.8787 0.0001743769 [Sex][Drug][W1|SexW2][W2] 61. -168.9201 0.0001672946 [Sex][Drug][W1|W2][W2|Drug] 62. -168.9793 0.0001576789 [Sex][Drug][W1][W2|W1] 63. -168.9793 0.0001576789 [Sex][Drug][W1|W2][W2] 64. -169.0272 0.0001503097 [Sex][Drug][W1|SexDrug][W2|Drug] 65. -169.0864 0.0001416703 [Sex][Drug][W1|SexDrug][W2] 66. -169.1277 0.0001359376 [Sex|Drug][Drug][W1|Drug][W2|SexDrug] 67. -169.1277 0.0001359376 [Sex][Drug|Sex][W1|Drug][W2|SexDrug] 68. -169.1677 0.0001306081 [Sex][Drug][W1|Sex][W2|W1] 69. -169.3646 0.0001072633 [Sex][Drug][W1][W2|SexW1] 70. -169.5530 8.884804e-05 [Sex][Drug][W1|Sex][W2|SexW1] 71. -169.5530 8.884804e-05 [Sex][Drug][W1|SexW2][W2|Sex] 72. -169.6536 8.03401e-05 [Sex][Drug][W1|W2][W2|Sex] 73. -169.7607 7.218345e-05 [Sex][Drug][W1|SexDrug][W2|Sex] 74. -170.0275 5.528073e-05 [Sex|Drug][Drug][W1|SexW2][W2|Drug] 75. -170.0275 5.528073e-05 [Sex][Drug|Sex][W1|SexW2][W2|Drug] 76. -170.0867 5.210332e-05 [Sex|Drug][Drug][W1|SexW2][W2] 77. -170.0867 5.210332e-05 [Sex][Drug|Sex][W1|SexW2][W2] 78. -170.1281 4.998714e-05 [Sex|Drug][Drug][W1|W2][W2|Drug] 79. -170.1281 4.998714e-05 [Sex][Drug|Sex][W1|W2][W2|Drug] 80. -170.1873 4.711399e-05 [Sex|Drug][Drug][W1][W2|W1] 81. -170.1873 4.711399e-05 [Sex][Drug|Sex][W1][W2|W1] 82. -170.1873 4.711399e-05 [Sex|Drug][Drug][W1|W2][W2] 83. -170.1873 4.711399e-05 [Sex][Drug|Sex][W1|W2][W2] 84. -170.2352 4.491212e-05 [Sex|Drug][Drug][W1|SexDrug][W2|Drug] 85. -170.2352 4.491212e-05 [Sex][Drug|Sex][W1|SexDrug][W2|Drug] 86. -170.2944 4.233068e-05 [Sex|Drug][Drug][W1|SexDrug][W2] 87. -170.2944 4.233068e-05 [Sex][Drug|Sex][W1|SexDrug][W2] 88. -170.3026 4.198564e-05 [Sex][Drug][W1|SexW2][W2|SexDrug] 89. -170.3757 3.902534e-05 [Sex|Drug][Drug][W1|Sex][W2|W1] 90. -170.3757 3.902534e-05 [Sex][Drug|Sex][W1|Sex][W2|W1] 91. -170.4032 3.796517e-05 [Sex][Drug][W1|W2][W2|SexDrug] 92. -170.5103 3.41107e-05 [Sex][Drug][W1|SexDrug][W2|SexDrug] 93. -170.5726 3.204997e-05 [Sex|Drug][Drug][W1][W2|SexW1] 94. -170.5726 3.204997e-05 [Sex][Drug|Sex][W1][W2|SexW1] 95. -170.7610 2.654754e-05 [Sex|Drug][Drug][W1|Sex][W2|SexW1] 96. -170.7610 2.654754e-05 [Sex][Drug|Sex][W1|Sex][W2|SexW1] 97. -170.7610 2.654754e-05 [Sex|Drug][Drug][W1|SexW2][W2|Sex] 98. -170.7610 2.654754e-05 [Sex][Drug|Sex][W1|SexW2][W2|Sex] 99. -170.8616 2.400539e-05 [Sex|Drug][Drug][W1|W2][W2|Sex] 100. -170.8616 2.400539e-05 [Sex][Drug|Sex][W1|W2][W2|Sex] 101. -170.9687 2.156821e-05 [Sex|Drug][Drug][W1|SexDrug][W2|Sex] 102. -170.9687 2.156821e-05 [Sex][Drug|Sex][W1|SexDrug][W2|Sex] 103. -171.0627 1.963294e-05 [Sex][Drug][W1][W2|DrugW1] 104. -171.2511 1.626230e-05 [Sex][Drug][W1|Sex][W2|DrugW1] 105. -171.5106 1.254519e-05 [Sex|Drug][Drug][W1|SexW2][W2|SexDrug] 106. -171.5106 1.254519e-05 [Sex][Drug|Sex][W1|SexW2][W2|SexDrug] 107. -171.6112 1.134388e-05 [Sex|Drug][Drug][W1|W2][W2|SexDrug] 108. -171.6112 1.134388e-05 [Sex][Drug|Sex][W1|W2][W2|SexDrug] 109. -171.7183 1.019218e-05 [Sex|Drug][Drug][W1|SexDrug][W2|SexDrug] 110. -171.7183 1.019218e-05 [Sex][Drug|Sex][W1|SexDrug][W2|SexDrug] 111. -172.2707 5.866267e-06 [Sex|Drug][Drug][W1][W2|DrugW1] 112. -172.2707 5.866267e-06 [Sex][Drug|Sex][W1][W2|DrugW1] 113. -172.4590 4.85913e-06 [Sex|Drug][Drug][W1|Sex][W2|DrugW1] 114. -172.4590 4.85913e-06 [Sex][Drug|Sex][W1|Sex][W2|DrugW1] 115. -172.7460 3.646863e-06 [Sex][Drug][W1][W2|SexDrugW1] 116. -172.9344 3.020759e-06 [Sex][Drug][W1|Sex][W2|SexDrugW1] 117. -173.9540 1.089672e-06 [Sex|Drug][Drug][W1][W2|SexDrugW1] 118. -173.9540 1.089672e-06 [Sex][Drug|Sex][W1][W2|SexDrugW1] 119. -174.1424 9.025943e-07 [Sex|Drug][Drug][W1|Sex][W2|SexDrugW1] 120. -174.1424 9.025943e-07 [Sex][Drug|Sex][W1|Sex][W2|SexDrugW1] 121. -175.1916 3.161061e-07 [Sex][Drug][W1][W2|Drug] 122. -175.2508 2.979371e-07 [Sex][Drug][W1][W2] 123. -175.3799 2.618362e-07 [Sex][Drug][W1|Sex][W2|Drug] 124. -175.4391 2.467865e-07 [Sex][Drug][W1|Sex][W2] 125. -175.9251 1.518041e-07 [Sex][Drug][W1][W2|Sex] 126. -176.1134 1.257420e-07 [Sex][Drug][W1|Sex][W2|Sex] 127. -176.3996 9.445162e-08 [Sex|Drug][Drug][W1][W2|Drug] 128. -176.3996 9.445162e-08 [Sex][Drug|Sex][W1][W2|Drug] 129. -176.4588 8.902276e-08 [Sex|Drug][Drug][W1][W2] 130. -176.4588 8.902276e-08 [Sex][Drug|Sex][W1][W2] 131. -176.5879 7.823591e-08 [Sex|Drug][Drug][W1|Sex][W2|Drug] 132. -176.5879 7.823591e-08 [Sex][Drug|Sex][W1|Sex][W2|Drug] 133. -176.6471 7.373909e-08 [Sex|Drug][Drug][W1|Sex][W2] 134. -176.6471 7.373909e-08 [Sex][Drug|Sex][W1|Sex][W2] 135. -176.6747 7.173588e-08 [Sex][Drug][W1][W2|SexDrug] 136. -176.8630 5.942007e-08 [Sex][Drug][W1|Sex][W2|SexDrug] 137. -177.1331 4.535863e-08 [Sex|Drug][Drug][W1][W2|Sex] 138. -177.1331 4.535863e-08 [Sex][Drug|Sex][W1][W2|Sex] 139. -177.3214 3.757134e-08 [Sex|Drug][Drug][W1|Sex][W2|Sex] 140. -177.3214 3.757134e-08 [Sex][Drug|Sex][W1|Sex][W2|Sex] 141. -177.8827 2.143448e-08 [Sex|Drug][Drug][W1][W2|SexDrug] 142. -177.8827 2.143448e-08 [Sex][Drug|Sex][W1][W2|SexDrug] 143. -178.071 1.775455e-08 [Sex|Drug][Drug][W1|Sex][W2|SexDrug] 144. -178.071 1.775455e-08 [Sex][Drug|Sex][W1|Sex][W2|SexDrug] > > > > cleanEx(); ..nameEx <- "numbermixed" > > ### * numbermixed > > flush(stderr()); flush(stdout()) > > ### Name: numbermixed > ### Title: The number of possible networks > ### Aliases: numbermixed > ### Keywords: models > > ### ** Examples > > numbermixed(2,2) [1] 144 > ## Not run: numbermixed(5,10) > > > > cleanEx(); ..nameEx <- "nwfunique" > > ### * nwfunique > > flush(stderr()); flush(stdout()) > > ### Name: unique.networkfamily > ### Title: Makes a network family unique. > ### Aliases: unique.networkfamily > ### Keywords: iplot > > ### ** Examples > > data(rats) > rats.nwf <- networkfamily(rats) [networkfamily Imaginary sample size: 12 Creating all (144 minus restrictions) networks with 2 discrete and 2 continuous nodes Created 144 networks, 1.01 ] > rats.nwf2<- unique(getnetwork(rats.nwf),equi=TRUE) > > > > cleanEx(); ..nameEx <- "perturb" > > ### * perturb > > flush(stderr()); flush(stdout()) > > ### Name: perturb > ### Title: Perturbs a network > ### Aliases: perturb > ### Keywords: iplot > > ### ** Examples > > set.seed(200) > data(rats) > fit <- network(rats) > fit.prior <- jointprior(fit) Imaginary sample size: 12 > fit <- getnetwork(learn(fit,rats,fit.prior)) > fit.new <- getnetwork(perturb(fit,rats,fit.prior,degree=10)) [Perturb 0.08 ] > > data(ksl) > ksl.nw <- network(ksl) > ksl.rand <- getnetwork(perturb(ksl.nw,nocalc=TRUE,degree=10)) [Perturb 0.27 ] > plot(ksl.rand) > > > > cleanEx(); ..nameEx <- "readnet" > > ### * readnet > > flush(stderr()); flush(stdout()) > > ### Name: readnet > ### Title: Reads/saves .net file > ### Aliases: readnet savenet > ### Keywords: iplot > > ### ** Examples > > data(rats) > nw <- network(rats) > ## Not run: savenet(nw,file("default.net")) > ## Not run: nw2 <- readnet(file("default.net")) > ## Not run: nw2 <- prob(nw2,rats) > > > > > cleanEx(); ..nameEx <- "rnetwork" > > ### * rnetwork > > flush(stderr()); flush(stdout()) > > ### Name: rnetwork > ### Title: Simulation of data sets with a given dependency structure > ### Aliases: rnetwork > ### Keywords: models > > ### ** Examples > > A <- factor(NA,levels=paste("A",1:2,sep="")) > B <- factor(NA,levels=paste("B",1:3,sep="")) > c1 <- NA > c2 <- NA > df <- data.frame(A,B,c1,c2) > > nw <- network(df,doprob=FALSE) # doprob must be FALSE > nw <- makesimprob(nw) # create simprob properties > > set.seed(944) > sim <- rnetwork(nw,n=100) # create simulated data frame > > > > ### *