buildFactorTab {CPTtools} | R Documentation |
Looks for margin statistics in scored Bayes net output, and puts them into tables with rows representing variables and columns representing variable states.
The marginTab
function does this for a single individual. The
buildMarginTab
uses the grand mean across all individuals and
the buildFactorTab
breaks down groups according to a factor
variable. The function build2FactorTab
builds a three-way table.
buildFactorTab(data, fact, stateNames, skillNames, reverse = TRUE, stem="margin", sep=".") build2FactorTab(data, fact1, fact2, stateNames, skillNames, reverse = TRUE, stem="margin",sep=".") buildMarginTab(data, stateNames, skillNames, reverse = TRUE, stem="margin",sep=".") marginTab(datarow, stateNames, skillNames, reverse = TRUE, stem="margin",sep=".")
data |
A data sets of StatShop statistics for many individuals. |
datarow |
One row of such a data set. |
fact |
A factor variable according to which to split the
data. Length should be the same as the length of |
fact1 |
A factor variable according to which to split the data. |
fact2 |
A factor variable according to which to split the data. |
stateNames |
Names of the variable states. |
skillNames |
Names of the proficiency variable(s) to be used. |
reverse |
Reverse the order of the states for display (i.e., convert from StatShop order of highest first to more natural order of lowest first. |
stem |
A character string giving a prefix used to indicate variable names. |
sep |
A character string giving a separator used to separate prefix from variable names. |
This looks for columns marked “<stem><sep><skillName>” in the
data frame, and builds them into a matrix. It is assumed that all
variables have the same number of states and that they are in the same
order, and the order is the same as given in stateNames
.
The functions buildFactorTab
and build2FactorTab
really
expect their skillNames
argument to be a single variable name.
However, they should work with multiple variables if suitable values
are chosen for the state names.
For marginTab
a matrix with columns corresponding to
skillNames
and rows corresponding to stateNames
giving
the probabilities for a single individual.
For buildMarginTab
a matrix with columns corresponding to
skillNames
and rows corresponding to stateNames
giving
the average probabilities for the entire data set.
For buildFactorTab
a matrix with columns corresponding to
the unique values of fact
and rows corresponding to
stateNames
entries give the average probabilities across the
groups.
For build2FactorTab
a 3 dimensional array with the first
dimension corresponding to the unique values of fact1
, the
second dimension corresponding to the unique values of fact2
and the last dimension corresponding to stateNames
entries give
the average probabilities across the groups.
Russell Almond
data(ACED) marginTab(ACED.scores[1,], c("H","M","L"), ACED.skillNames, reverse = TRUE, stem="p",sep="") buildMarginTab(ACED.scores, c("H","M","L"), ACED.skillNames[1:4], reverse = TRUE, stem="p",sep="") buildFactorTab(ACED.scores, ACED.scores$Cond, c("H","M","L"), "sgp", reverse = TRUE, stem="p", sep="") build2FactorTab(ACED.scores, ACED.scores$Seq, ACED.scores$FB, c("H","M","L"), "sgp", reverse = TRUE, stem="p",sep="")