\name{distribution} \alias{distribution} \title{ Constructor for Distribution } \usage{ distribution(conditions=character(0), consequences=character(0), type = character(0), table = NULL, parameterSet=NULL, parameterTable = NULL) } \arguments{ \item{conditions}{Names of the parent variable objects} \item{consequences}{Name of the child variable object} \item{type}{String giving the name of the type. This should correspond to one of the known StatShop distributions types} \item{table}{Object giving the probability table for this distribution.} \item{parameterSet}{The parameter set for DiBello--Samejima type distributions.} \item{parameterTable}{The parameter table for hyper-Dirichlet type distributions.} } \description{ Creates an object of class distribution, usually built up from the XML parsing of a graphical model file. } \author{Russell Almond} \seealso{ \code{\link{parseDist}},\code{\link{parameterVector}} } \examples{ ## Build the Parameter Set ## Need to get names correct for everything to work. pnames <- c("Task Difficulty", "Relative Importance(Reading)", "Level Difficulty Increment(Outcome_R,Good)") pvalue <- c(1,0,0.5) names(pvalue) <- pnames pcov <- matrix(0,nrow=length(pnames),ncol=length(pnames), dimnames=list(pnames,pnames)) diag(pcov) <- c(0.3164,0.0207, 0.01) ps1 <- parameterVector(pvalue,"SkillRead1.Outcome_R",pcov) table1 <- matrix(c(0.79894674, 0.06863273, 0.1324205, 0.22270014, 0.09812116, 0.6791787, 0.02023846, 0.01269671, 0.9670648),nrow=3,byrow=3) ## These come from running calcDSTable with the above parameters. colnames(table1) <- c("Good","Okay","Poor") dtable1 <- data.frame(Reading=c("Advanced","Basic","Novice"),table1) ## DiBello--Samejima style dist1 <- distribution(c("Reading"),"Outcome_R", "Compensatory Distribution", table=dtable1, parameterSet = ps1) table2 <- matrix(c(0.7, 0.2, 0.1, 0.3, 0.4, 0.3, 0.1, 0.2, 0.7), nrow=3,byrow=3) ## These come from running calcDSTable with the above parameters. colnames(table2) <- c("Good","Okay","Poor") dtable2 <- data.frame(Reading=c("Advanced","Basic","Novice"),table2) ptable2 <- data.frame(Reading=c("Advanced","Basic","Novice"),table2,Scale=1,Sum=10) ## HyperDirichlet style dist2 <- distribution(c("Reading"),"Outcome_R", "HyperDirichlet Distribution", table=dtable2, parameterTable = ptable2) } \keyword{interface}