Description Usage Arguments Value Examples
This is a standard implementation where log likelihood is multiplied by -2 and penalty term is added in the form of number of parameters times log of number of observations. See Schwarz (1978) for details.
1 | BIC(logLikelihood, noPar, noObs)
|
logLikelihood |
Either a natural logarithm of the maximum likelihood of the model, or a vector of logged probabilities for each trial. Note that it should not be a negative of the log likelihood. |
noPar |
Number of free parameters in the model. |
noObs |
Number of observations used to obtain the maximum likelihood of the model. |
The BIC value of the model in a form of a scalar.
1 2 3 4 5 6 7 8 9 10 | # 100 artificial trials with probability for each trial
set.seed(1234)
maxLikelihood <- runif(100)
# you can use either a final log of the maximum likelihood
logLikelihood1 <- sum(log(maxLikelihood))
# or logged probabilites of each trial
logLikelihood2 <- log(maxLikelihood)
# computing the BIC value, both give the same value
BIC(logLikelihood1, 3, 100)
BIC(logLikelihood2, 3, length(logLikelihood2))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.