calcDSllike {CPTtools} | R Documentation |
These functions take data
which represent draws from a
categorical data with the given DiBello–Samejima distribution and
returns the log-likelihood of the given data.
calcDSllike(data, parents, skillLevels, child, obsLevels, lnAlphas, beta, dinc = 0, rule = "Compensatory") calcDNllike(data, parents, skillLevels, child, obsLevels, lnAlphas, beta, std, rule = "Compensatory")
data |
A data frame whose columns contain variables corresponding
to |
parents |
A vector of names for the columns in |
child |
The name of the child variable, should refer to a column
in |
skillLevels |
A list of character vectors giving names of levels for each of the condition variables. |
obsLevels |
A character vector giving names of levels for the output variables from highest to lowest. |
lnAlphas |
A vector of log slope parameters. Its length should
be either 1 or the length of |
beta |
A vector of difficulty (-intercept) parameters. Its length
should be either 1 or the length of |
dinc |
Vector of difficulty increment parameters (see
|
rule |
Function for computing effective theta (see
|
std |
The log of the residual standard deviation (see Details). |
This function assumes that the observed data are independent draws
from a Bayesian network. This function calculates the log-likelihood
of a single conditional probability table. First, it calculates a
table of counts corresponding states of the parent and child variables
using the function dataTable
. Next it calculates the
conditional probability for each cell using the function
calcDSTable
or calcDNTable
.
It then calculates the log-likelihood as the sum of count(cell)*log(Pr(cell)) where this value is set to zero if count(cell) is zero (this allows cells with zero probability as long as the count is also zero).
A real giving the log-likelihood of the observed data.
This function is primarily about testing the log likelihood calculations used internally in StatShop.
Russell Almond
http://comet.research.ets.org/~ralmond/StatShop
dataTable
, calcDSTable
,
Compensatory
,OffsetConjunctive
,
eThetaFrame
, calcDNTable
skill1l <- c("High","Medium","Low") skill3l <- c("High","Better","Medium","Worse","Low") correctL <- c("Correct","Incorrect") x <- read.csv(paste(library(help="CPTtools")$path,"testFiles", "randomPinned100.csv", sep=.Platform$file.sep), header=FALSE, as.is=TRUE, col.names = c("Skill1", "Skill2", "Skill3", "Comp.Correct", "Comp.Grade", "Conj.Correct", "Conj.Grade", "Cor.Correct", "Cor.Grade", "Dis.Correct", "Dis.Grade", "Inhib.Correct", "Inhib.Grade" )) x[,"Skill1"] <- ordered(x[,"Skill1"],skill1l) x[,"Skill3"] <- ordered(x[,"Skill3"],skill3l) x[,"Comp.Correct"] <- ordered(x[,"Comp.Correct"],correctL) like <- calcDSllike(x,c("Skill1","Skill3"), list(Skill1=skill1l, Skill3=skill3l), "Comp.Correct", correctL, log(c(0.45,-0.4)),-1.9,rule="Compensatory")