# load the imset.R suite of functions source("imset.R") # the file with the data set fileName="asia-long-names.dat" data=read.table(fileName,header=TRUE,colClasses="factor",sep=",") # variables of the model - in the alphabetic order vars=names(data) o1=order(vars) vars=vars[o1] # coordinates for the nodes in the graph dataCoor=c(71.55299, 68.20930, 59.32657, 38.38371, 40.83020, 70.40697, 11.51814, 39.16860, 57.75908, 91.44186, 11.20465, 71.34883, 24.37156, 57.06395, 11.04790, 90.34302) # names of the coordinates dnames=list(vars,c("x","y")) # matrix of coordinates coor=matrix(dataCoor,nrow=8,ncol=2,byrow=TRUE,dimnames=dnames) # The learning algorithm uses our coordinates (otherwise it would place all variables in a cricle) # and prints the imset for each step of the algorithm (default is no prints). # The output is a best essential graph for the criteria (default is BIC) print("learning the model from data",quote=FALSE) eg=bestModel(data,coordinates=coor,printImsets=TRUE)