tune | R Documentation |
Prune a probabilistic suffix tree with a series of cut-offs and select the model having the lowest value of the selected information criterion. Available information criterion are Akaike information criterion (AIC), AIC with a correction for finite sample sizes (AICc) and Bayesian information criterion (BIC).
## S4 method for signature 'PSTf'
tune(object, gain="G2", C, criterion = "AIC", output = "PST")
object |
a probabilistic suffix tree, i.e., an object of class |
gain |
character. The gain function used for pruning decisions. See |
C |
numeric. A vector of cutoff values. See |
criterion |
The criterion used to select the model, either AIC, AICc or BIC. AICc should be used when the ratio between the number of observations and the number of estimated parameters is low, which is often the case with VLMC models. Burnham et al 2004 suggest to use AICc instead of AIC when the ratio is lower than 40. |
output |
If |
The tune
function selects among a series of PST pruned with different values of the C
cutoff the model having the lowest AIC
or AIC_{c}
value. The function can return either the selected PST or a data frame containing the statistics for each model. For more details, see Gabadinho 2016.
If output="PST"
a PST that is an object of class PSTf
. If output="stats"
a matrix with the results of the tuning procedure.
The selected model is tagged with ***
, while models with IC < min(IC)+2
are tagged with **
, and models with IC < min(IC)+10
are tagged with **
.
Alexis Gabadinho
Burnham, K. P. & Anderson, D. R. (2004). Multimodel Inference Sociological Methods & Research, 33, pp. 261-304.
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.
prune
## activity calendar for year 2000
## from the Swiss Household Panel
## see ?actcal
data(actcal)
## selecting individuals aged 20 to 59
actcal <- actcal[actcal$age00>=20 & actcal$age00 <60,]
## defining a sequence object
actcal.lab <- c("> 37 hours", "19-36 hours", "1-18 hours", "no work")
actcal.seq <- seqdef(actcal,13:24,labels=actcal.lab)
## building a PST
actcal.pst <- pstree(actcal.seq, nmin=2, ymin=0.001)
## Cut-offs for 5% and 1% (see ?prune)
C95 <- qchisq(0.95,4-1)/2
C99 <- qchisq(0.99,4-1)/2
## selecting the optimal PST using AIC criterion
actcal.pst.opt <- tune(actcal.pst, gain="G2", C=c(C95,C99))
## plotting the tree
plot(actcal.pst.opt)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.