nobs | R Documentation |
The number of observations to which a VLMC model is fitted is notably used for computing the Bayesian information criterion BIC
or the Akaike information criterion with correction for finite sample sizes AICc
.
## S4 method for signature 'PSTf'
nobs(object)
object |
A PST, that is an object of class |
This is the method for the generic nobs
function provided by the stats4
package. The number of observations to which a VLMC model is fitted is the total number of symbols in the learning sample. If the learning sample contains missing values and the model is learned without including missing values (see pstree
), the total number of symbols is the number of non-missing states in the sequence(s). This information is used to compute the Bayesian information criterion of a fitted VLMC model. The BIC
generic function calls the logLik
and nobs
methods for class PSTf
. For more details, see Gabadinho 2016.
An integer containing the number of symbols in the learning sample.
Alexis Gabadinho
Gabadinho, A. & Ritschard, G. (2016). Analyzing State Sequences with Probabilistic Suffix Trees: The PST R Package. Journal of Statistical Software, 72(3), pp. 1-39.
BIC
data(s1)
s1.seq <- seqdef(s1)
S1 <- pstree(s1.seq, L=3)
nobs(S1)
## Self rated health sequences
## Loading the 'SRH' data frame and 'SRH.seq' sequence object
data(SRH)
## model without considering missing states
## model with max. order 2 to reduce computing time
## nobs is the same whatever L and nmin
m1 <- pstree(SRH.seq, L=2, nmin=30, ymin=0.001)
nobs(m1)
## considering missing states, hence nobs is higher
m2 <- pstree(SRH.seq, L=2, nmin=30, ymin=0.001, with.missing=TRUE)
nobs(m2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.