gera.pa {bnpa} | R Documentation |
This function receives a BN structure learned, the data set and some parameters and build a PA input model string. Then run the PA model using Structural Equation Model functions and export a PA graph and a PA model summary information.
gera.pa(bn.structure, data.to.work, pa.name, pa.imgname, bn.algorithm, bn.score.test, outcome.var)
bn.structure |
is a BN structure learned from data. |
data.to.work |
is a data frame containing the variables of the BN. |
pa.name |
is a variable to store the name of file to save PA parameters. |
pa.imgname |
is a variable to store the name of file to save PA graph. |
bn.algorithm |
is a list of algorithms to learn the BN structure. |
bn.score.test |
is a list of tests to be used during BN structure learning. |
outcome.var |
is the outcome variable. |
Elias Carvalho
Yves Rosseel (2012). lavaan: An R Package for Structural Equation Modeling. Journal of Statistical Software, 48(2),1-36.
## Not run: # Clean environment closeAllConnections() rm(list=ls()) # Set enviroment # setwd("To your working directory") # Load packages library(bnpa) # Load data sets from package data(dataQualiN) # Show first lines head(dataQualiN) # Learn BN structure bn.structure <- bnlearn::hc(dataQualiN) bnlearn::graphviz.plot(bn.structure) # Set variables pa.name<-"docPAHC" pa.imgname<-"imgPAHC" bn.algorithm<-"hc" bn.score.test<-"aic-g" outcome.var<-"D" # Generates the PA model from bn structure gera.pa(bn.structure, dataQualiN, pa.name, pa.imgname, bn.algorithm, bn.score.test, outcome.var) ## End(Not run)