calcPnetLLike {Peanut} | R Documentation |
The function calcPnetLLike
calculates the log likelihood for a
set of data contained in cases
using the current values of the
conditional probability table in a Pnet
. If it is
called after a call to BuildAllTables(net)
this will be
the current value of the parameters.
calcPnetLLike(net, cases)
net |
A |
cases |
An object representing a set of cases. Note the type of object is implementation dependent. It could be either a data frame providing cases or a filename for a case file. |
This function provides the convergence test for the
GEMfit
algorithm. The Pnet
represents a model
(with parameters set to the value used in the current iteration of the
EM algorithm) and cases
a set of data. This function gives the
log likelihood of the data.
This is a generic function shell. It is assumed that either (a) the
native Bayes net implementation provides a way of calculating the log
likelihood of a set of cases, or (b) it provides a way of calculating
the likelihood of a single case, and the log likelihood of the case
set can be calculated though iteration. In either case, the value of
cases
is implementation dependent. In
PNetica-package
the cases
argument
should be a filename of a Netica case file (see
write.CaseFile
).
A numeric scalar giving the log likelihood of the data in the case file.
The function calcPnetLLike
is an abstract generic functions,
and it needs specific implementations. See the
PNetica-package
for an example.
Russell Almond
Almond, R. G. (2015) An IRT-based Parameterization for Conditional Probability Tables. Paper presented at the 2015 Bayesian Application Workshop at the Uncertainty in Artificial Intelligence Conference.
Pnet
, GEMfit
, calcExpTables
,
maxAllTableParams
## Not run: library(PNetica) ## Need a specific implementation sess <- NeticaSession() startSession(sess) irt10.base <- ReadNetworks(paste(library(help="PNetica")$path, "testnets","IRT10.2PL.base.dne", sep=.Platform$file.sep), session=sess) irt10.base <- as.Pnet(irt10.base) ## Flag as Pnet, fields already set. irt10.theta <- PnetFindNode(irt10.base,"theta") irt10.items <- PnetPnodes(irt10.base) ## Flag items as Pnodes for (i in 1:length(irt10.items)) { irt10.items[[i]] <- as.Pnode(irt10.items[[i]]) ## Add node to list of observed nodes PnodeLabels(irt10.items[[1]]) <- union(PnodeLabels(irt10.items[[1]]),"onodes") } PnetCompile(irt10.base) ## Netica requirement casepath <- paste(library(help="PNetica")$path, "testdat","IRT10.2PL.200.items.cas", sep=.Platform$file.sep) llike <- calcPnetLLike(irt10.base,casepath) DeleteNetwork(irt10.base) stopSession(sess) ## End(Not run)