calcDSllike | 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.
This function is largely superceeded by the likelihood calculation internal
to mapDPC
. In particular, if probs
is the result of the
call to calcDPCTable
, and postTable
is the expected
contingency table (e.g., the output of expTable
). Then the
log likelihood is
-2*sum(as.vector(postTable)*as.vector(log(probs)))
.
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(system.file("testFiles", "randomPinned100.csv",
package="CPTtools"),
header=TRUE, as.is=TRUE)
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.