R Under development (unstable) (2024-08-17 r87027 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(VLMC) > > set.seed(21001) > c0 <- proc.time() > > f1 <- c(1,0,0,0) > f2 <- rep(1:0,2) > (dt2 <- rep(c(f1,f1,f2,f1,f2,f2,f1),2)) [1] 1 0 0 0 1 0 0 0 1 0 1 0 1 0 0 0 1 0 1 0 1 0 1 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 [39] 1 0 1 0 0 0 1 0 1 0 1 0 1 0 1 0 0 0 > dt3 <- c(unlist(sapply(1:5, function(k) c(rep(0,k),1))), + rep(1,6))# patterns NOI in dt2 > > (vlmc.dt2c15 <- vlmc(dt2, cutoff = 1.5)) 'vlmc' a Variable Length Markov Chain; alphabet '01', |alphabet| = 2, n = 56. Call: vlmc(dts = dt2, cutoff.prune = 1.5); cutoff =1.5 -> extensions (= $size ) : ord.MC context nr.leaves total 6 8 4 46 AIC = 36.65 > draw(vlmc.dt2c15) [x]-( 36 19| 55)-F +--[0]-( 16 19| 35) <2.84>-F | +--[0]-( 8 7| 15) <0.17>-F | | +--[0]-( 0 7| 7) <5.33>-T | | '--[1]-( 8 0| 8) <5.03>-T | '--[1]-( 8 12| 20) <0.13> | '--[0]-( 7 12| 19) <0.04> | '--[1]-( 4 8| 12) <0.03> | '--[0]-( 4 8| 12) <0.00> | '--[0]-( 0 4| 4) <1.62>-T '--[1]-( 20 0| 20) <8.48>-T > ## Predict "myself" (in sample) > noquote(cbind(fit = predict(vlmc.dt2c15, type = "response"), + probs = pr <- predict(vlmc.dt2c15), + lev = predict(vlmc.dt2c15, type = "depth"), + ID = (pid <- predict(vlmc.dt2c15, type = "id")), + flags = {ff <- attr(pr,"flags"); ff[ff == "0"] <- ""; ff}, + context= id2ctxt(pid, m=2, alpha=TRUE) + )) fit 0 1 lev ID context 1 NA 0 0 1 0 1 3 1 0 0 1 0 2 5 01 0 0 1 0 3 9 001 1 1 0 1 3 8 000 0 0 1 0 1 3 1 0 1 0.428571428571429 0.571428571428571 3 10 010 0 0 1 0 3 9 001 1 1 0 1 3 8 000 0 0 1 0 1 3 1 1 1 0.428571428571429 0.571428571428571 3 10 010 0 0 1 0 1 3 1 1 1 0 1 6 84 010100 0 0 1 0 1 3 1 0 0 0.5 0.5 5 42 01010 0 0 1 0 3 9 001 1 1 0 1 3 8 000 0 0 1 0 1 3 1 1 1 0.428571428571429 0.571428571428571 3 10 010 0 0 1 0 1 3 1 1 1 0 1 6 84 010100 0 0 1 0 1 3 1 1 0 0.5 0.5 5 42 01010 0 0 1 0 1 3 1 1 0 0.5 0.5 5 42 01010 0 0 1 0 1 3 1 0 0 0.5 0.5 5 42 01010 0 0 1 0 3 9 001 1 1 0 1 3 8 000 0 0 1 0 1 3 1 0 1 0.428571428571429 0.571428571428571 3 10 010 0 0 1 0 3 9 001 1 1 0 1 3 8 000 0 0 1 0 1 3 1 0 1 0.428571428571429 0.571428571428571 3 10 010 0 0 1 0 3 9 001 1 1 0 1 3 8 000 0 0 1 0 1 3 1 1 1 0.428571428571429 0.571428571428571 3 10 010 0 0 1 0 1 3 1 1 1 0 1 6 84 010100 0 0 1 0 1 3 1 0 0 0.5 0.5 5 42 01010 0 0 1 0 3 9 001 1 1 0 1 3 8 000 0 0 1 0 1 3 1 1 1 0.428571428571429 0.571428571428571 3 10 010 0 0 1 0 1 3 1 1 1 0 1 6 84 010100 0 0 1 0 1 3 1 1 0 0.5 0.5 5 42 01010 0 0 1 0 1 3 1 1 0 0.5 0.5 5 42 01010 0 0 1 0 1 3 1 0 0 0.5 0.5 5 42 01010 0 0 1 0 3 9 001 > > (vlmc.dt2c.1 <- vlmc(dt2, cutoff = .1)) 'vlmc' a Variable Length Markov Chain; alphabet '01', |alphabet| = 2, n = 56. Call: vlmc(dts = dt2, cutoff.prune = 0.1); cutoff =0.1 -> extensions (= $size ) : ord.MC context nr.leaves total 12 27 10 146 AIC = 56.77 > (vlmc.dt2c0 <- vlmc(dt2, cutoff = 0, thresh = 1))# need thresh=1 for "perfect fit" 'vlmc' a Variable Length Markov Chain; alphabet '01', |alphabet| = 2, n = 56. Call: vlmc(dts = dt2, cutoff.prune = 0, threshold.gen = 1); cutoff =0 -> extensions (= $size ) : ord.MC context nr.leaves total 12 28 12 158 AIC = 56 > > draw(vlmc.dt2c.1) [x]-( 36 19| 55)-F +--[0]-( 16 19| 35) <2.84>-F | +--[0]-( 8 7| 15) <0.17>-F | | +--[0]-( 0 7| 7) <5.33>-T | | '--[1]-( 8 0| 8) <5.03>-T | '--[1]-( 8 12| 20) <0.13> | '--[0]-( 7 12| 19) <0.04>-F | +--[0]-( 3 4| 7) <0.05> | | '--[0]-( 3 4| 7) <0.00> | | '--[1]-( 3 4| 7) <0.00> | | '--[0]-( 2 4| 6) <0.11>-F | | +--[0]-( 1 2| 3) <0.00> | | | '--[0]-( 1 2| 3) <0.00> | | | '--[1]-( 1 2| 3) <0.00> | | | '--[0]-( 1 1| 2) <0.12>-T | | '--[1]-( 1 2| 3) <0.00> | | '--[0]-( 1 2| 3) <0.00> | | '--[1]-( 1 2| 3) <0.00> | | '--[0]-( 1 2| 3) <0.00> | | '--[0]-( 0 2| 2) <0.81>-T | '--[1]-( 4 8| 12) <0.03> | '--[0]-( 4 8| 12) <0.00>-F | +--[0]-( 0 4| 4) <1.62>-T | '--[1]-( 4 4| 8) <0.47> | '--[0]-( 4 4| 8) <0.00>-F | +--[0]-( 2 2| 4) <0.00> | | '--[0]-( 2 2| 4) <0.00> | | '--[1]-( 2 2| 4) <0.00> | | '--[0]-( 2 2| 4) <0.00>-F | | +--[0]-( 2 0| 2) <1.39>-T | | '--[1]-( 0 2| 2) <1.39>-T | '--[1]-( 2 2| 4) <0.00> | '--[0]-( 2 2| 4) <0.00>-F | +--[0]-( 0 2| 2) <1.39>-T | '--[1]-( 2 0| 2) <1.39>-T '--[1]-( 20 0| 20) <8.48>-T > > ## Predict "myself" (in sample) > pp.1 <- predict(vlmc.dt2c.1)# pred.prob > p.1 <- predict(vlmc.dt2c.1, type="response") > pid.1 <- predict(vlmc.dt2c.1, type="id.node") ## now give "-" for initial ones! > (pl.1 <- predict(vlmc.dt2c.1, type="depth")) [1] NA 1 2 3 3 1 6 3 3 1 10 1 6 1 12 3 3 1 12 1 6 1 12 1 10 [26] 1 10 3 3 1 11 3 3 1 11 3 3 1 11 1 6 1 12 3 3 1 12 1 6 1 [51] 12 1 10 1 10 3 > > noquote(cbind(pp.1,fit=p.1, "="=c("<>","")[1+(dt2==p.1)], lev= pl.1, + id= pid.1, flags = attr(p.1,"flags"), + context = id2ctxt(pid.1, m=2, alpha=TRUE) + )) 0 1 fit = lev id context 1 NA 0 1 0 0 1 3 1 0 1 0 0 2 5 01 0 1 0 0 3 9 001 1 0 1 1 3 8 000 0 1 0 0 1 3 1 0 1 0 0 6 81 010001 0 1 0 0 3 9 001 1 0 1 1 3 8 000 0 1 0 0 1 3 1 1 0 1 1 10 1297 0100010001 0 1 0 0 1 3 1 1 0 1 1 6 84 010100 0 1 0 0 1 3 1 0 1 0 0 12 5444 010101000100 0 1 0 0 3 9 001 1 0 1 1 3 8 000 0 1 0 0 1 3 1 1 0 1 1 12 5204 010001010100 0 1 0 0 1 3 1 1 0 1 1 6 84 010100 0 1 0 0 1 3 1 1 0 1 1 12 5445 010101000101 0 1 0 0 1 3 1 1 0 1 1 10 1364 0101010100 0 1 0 0 1 3 1 0 1 0 0 10 1365 0101010101 0 1 0 0 3 9 001 1 0 1 1 3 8 000 0 1 0 0 1 3 1 0 1 0 0 11 2602 01000101010 0 1 0 0 3 9 001 1 0 1 1 3 8 000 0 1 0 0 1 3 1 0 0.5 0.5 0 11 2594 01000100010 0 1 0 0 3 9 001 1 0 1 1 3 8 000 0 1 0 0 1 3 1 1 0.5 0.5 0 <> 11 2594 01000100010 0 1 0 0 1 3 1 1 0 1 1 6 84 010100 0 1 0 0 1 3 1 0 1 0 0 12 5444 010101000100 0 1 0 0 3 9 001 1 0 1 1 3 8 000 0 1 0 0 1 3 1 1 0 1 1 12 5204 010001010100 0 1 0 0 1 3 1 1 0 1 1 6 84 010100 0 1 0 0 1 3 1 1 0 1 1 12 5445 010101000101 0 1 0 0 1 3 1 1 0 1 1 10 1364 0101010100 0 1 0 0 1 3 1 0 1 0 0 10 1365 0101010101 0 1 0 0 3 9 001 > ## Almost the same : > predict(vlmc.dt2c.1, type = "ALL") fit Pr[X= 0 ] Pr[X= 1 ] id flags ctxt 1 0 NA 0 0 1 0 3 55 1 0 0 1 0 5 55 01 0 0 1 0 9 55 001 1 1 0 1 8 0 000 0 0 1 0 3 0 1 0 0 1 0 81 55 010001 0 0 1 0 9 0 001 1 1 0 1 8 0 000 0 0 1 0 3 0 1 1 1 0 1 1297 55 0100010001 0 0 1 0 3 0 1 1 1 0 1 84 0 010100 0 0 1 0 3 0 1 0 0 1 0 5444 0 010101000100 0 0 1 0 9 0 001 1 1 0 1 8 0 000 0 0 1 0 3 0 1 1 1 0 1 5204 0 010001010100 0 0 1 0 3 0 1 1 1 0 1 84 0 010100 0 0 1 0 3 0 1 1 1 0 1 5445 0 010101000101 0 0 1 0 3 0 1 1 1 0 1 1364 0 0101010100 0 0 1 0 3 0 1 0 0 1 0 1365 0 0101010101 0 0 1 0 9 0 001 1 1 0 1 8 0 000 0 0 1 0 3 0 1 0 0 1 0 2602 0 01000101010 0 0 1 0 9 0 001 1 1 0 1 8 0 000 0 0 1 0 3 0 1 0 0 1/2 1/2 2594 0 01000100010 0 0 1 0 9 0 001 1 1 0 1 8 0 000 0 0 1 0 3 0 1 1 0 1/2 1/2 2594 0 01000100010 0 0 1 0 3 0 1 1 1 0 1 84 0 010100 0 0 1 0 3 0 1 0 0 1 0 5444 0 010101000100 0 0 1 0 9 0 001 1 1 0 1 8 0 000 0 0 1 0 3 0 1 1 1 0 1 5204 0 010001010100 0 0 1 0 3 0 1 1 1 0 1 84 0 010100 0 0 1 0 3 0 1 1 1 0 1 5445 0 010101000101 0 0 1 0 3 0 1 1 1 0 1 1364 0 0101010100 0 0 1 0 3 0 1 0 0 1 0 1365 0 0101010101 0 0 1 0 9 0 001 > > > draw(vlmc.dt2c0) [x]-( 36 19| 55)-F +--[0]-( 16 19| 35) <2.84>-F | +--[0]-( 8 7| 15) <0.17>-F | | +--[0]-( 0 7| 7) <5.33>-T | | '--[1]-( 8 0| 8) <5.03>-T | '--[1]-( 8 12| 20) <0.13> | '--[0]-( 7 12| 19) <0.04>-F | +--[0]-( 3 4| 7) <0.05> | | '--[0]-( 3 4| 7) <0.00> | | '--[1]-( 3 4| 7) <0.00> | | '--[0]-( 2 4| 6) <0.11>-F | | +--[0]-( 1 2| 3) <0.00> | | | '--[0]-( 1 2| 3) <0.00> | | | '--[1]-( 1 2| 3) <0.00> | | | '--[0]-( 1 1| 2) <0.12>-F | | | +--[0]-( 0 1| 1) <0.69>-T | | | '--[1]-( 1 0| 1) <0.69>-T | | '--[1]-( 1 2| 3) <0.00> | | '--[0]-( 1 2| 3) <0.00> | | '--[1]-( 1 2| 3) <0.00> | | '--[0]-( 1 2| 3) <0.00>-F | | +--[0]-( 0 2| 2) <0.81>-T | | '--[1]-( 1 0| 1) <1.10>-T | '--[1]-( 4 8| 12) <0.03> | '--[0]-( 4 8| 12) <0.00>-F | +--[0]-( 0 4| 4) <1.62>-T | '--[1]-( 4 4| 8) <0.47> | '--[0]-( 4 4| 8) <0.00>-F | +--[0]-( 2 2| 4) <0.00> | | '--[0]-( 2 2| 4) <0.00> | | '--[1]-( 2 2| 4) <0.00> | | '--[0]-( 2 2| 4) <0.00>-F | | +--[0]-( 2 0| 2) <1.39>-T | | '--[1]-( 0 2| 2) <1.39>-T | '--[1]-( 2 2| 4) <0.00> | '--[0]-( 2 2| 4) <0.00>-F | +--[0]-( 0 2| 2) <1.39>-T | '--[1]-( 2 0| 2) <1.39>-T '--[1]-( 20 0| 20) <8.48>-T > draw(vlmc.dt2c0, cumulative = FALSE) [x]-( 0 0| 0)-F +--[0]-( 0 0| 0)-F | +--[0]-( 0 0| 0)-F | | +--[0]-( 0 7| 7)-T | | '--[1]-( 8 0| 8)-T | '--[1]-( 1 0| 1) | '--[0]-( 0 0| 0)-F | +--[0]-( 0 0| 0) | | '--[0]-( 0 0| 0) | | '--[1]-( 1 0| 1) | | '--[0]-( 0 0| 0)-F | | +--[0]-( 0 0| 0) | | | '--[0]-( 0 0| 0) | | | '--[1]-( 0 1| 1) | | | '--[0]-( 0 0| 0)-F | | | +--[0]-( 0 1| 1)-T | | | '--[1]-( 1 0| 1)-T | | '--[1]-( 0 0| 0) | | '--[0]-( 0 0| 0) | | '--[1]-( 0 0| 0) | | '--[0]-( 0 0| 0)-F | | +--[0]-( 0 2| 2)-T | | '--[1]-( 1 0| 1)-T | '--[1]-( 0 0| 0) | '--[0]-( 0 0| 0)-F | +--[0]-( 0 4| 4)-T | '--[1]-( 0 0| 0) | '--[0]-( 0 0| 0)-F | +--[0]-( 0 0| 0) | | '--[0]-( 0 0| 0) | | '--[1]-( 0 0| 0) | | '--[0]-( 0 0| 0)-F | | +--[0]-( 2 0| 2)-T | | '--[1]-( 0 2| 2)-T | '--[1]-( 0 0| 0) | '--[0]-( 0 0| 0)-F | +--[0]-( 0 2| 2)-T | '--[1]-( 2 0| 2)-T '--[1]-( 20 0| 20)-T > > ## Predict "myself" (in sample) > (p0 <- predict(vlmc.dt2c0, type="response")) [1] NA 0 0 0 1 0 0 0 1 0 1 0 1 0 0 0 1 0 1 0 1 0 1 0 1 [26] 0 0 0 1 0 0 0 1 0 0 0 1 0 1 0 1 0 0 0 1 0 1 0 1 0 [51] 1 0 1 0 0 0 > all(dt2[-1] == abs(p0[-1])) # TRUE ! [1] TRUE > pp <- predict(vlmc.dt2c0)# pred.prob > !any(is.na(match(pp[-1,],0:1)))#> TRUE [1] TRUE > ## since all pred.probabilties are 0 or 1 ! > > p.id <- predict(vlmc.dt2c0, type="id.node") > p.lev <- predict(vlmc.dt2c0, type="depth") > noquote(cbind(pp, flags = attr(p.id,"flags"), + ID= p.id, lev = p.lev, ctxt = id2ctxt(p.id,m=2, a=TRUE))) 0 1 ID lev ctxt 1 NA 0 1 0 3 1 1 0 1 0 5 2 01 0 1 0 9 3 001 1 0 1 8 3 000 0 1 0 3 1 1 0 1 0 81 6 010001 0 1 0 9 3 001 1 0 1 8 3 000 0 1 0 3 1 1 1 0 1 1297 10 0100010001 0 1 0 3 1 1 1 0 1 84 6 010100 0 1 0 3 1 1 0 1 0 5444 12 010101000100 0 1 0 9 3 001 1 0 1 8 3 000 0 1 0 3 1 1 1 0 1 5204 12 010001010100 0 1 0 3 1 1 1 0 1 84 6 010100 0 1 0 3 1 1 1 0 1 5445 12 010101000101 0 1 0 3 1 1 1 0 1 1364 10 0101010100 0 1 0 3 1 1 0 1 0 1365 10 0101010101 0 1 0 9 3 001 1 0 1 8 3 000 0 1 0 3 1 1 0 1 0 5205 12 010001010101 0 1 0 9 3 001 1 0 1 8 3 000 0 1 0 3 1 1 0 1 0 5189 12 010001000101 0 1 0 9 3 001 1 0 1 8 3 000 0 1 0 3 1 1 1 0 1 5188 12 010001000100 0 1 0 3 1 1 1 0 1 84 6 010100 0 1 0 3 1 1 0 1 0 5444 12 010101000100 0 1 0 9 3 001 1 0 1 8 3 000 0 1 0 3 1 1 1 0 1 5204 12 010001010100 0 1 0 3 1 1 1 0 1 84 6 010100 0 1 0 3 1 1 1 0 1 5445 12 010101000101 0 1 0 3 1 1 1 0 1 1364 10 0101010100 0 1 0 3 1 1 0 1 0 1365 10 0101010101 0 1 0 9 3 001 > ## or almost the same: > predict(vlmc.dt2c0, type="ALL") fit Pr[X= 0 ] Pr[X= 1 ] id flags ctxt 1 0 NA 0 0 1 0 3 55 1 0 0 1 0 5 55 01 0 0 1 0 9 55 001 1 1 0 1 8 0 000 0 0 1 0 3 0 1 0 0 1 0 81 55 010001 0 0 1 0 9 0 001 1 1 0 1 8 0 000 0 0 1 0 3 0 1 1 1 0 1 1297 55 0100010001 0 0 1 0 3 0 1 1 1 0 1 84 0 010100 0 0 1 0 3 0 1 0 0 1 0 5444 0 010101000100 0 0 1 0 9 0 001 1 1 0 1 8 0 000 0 0 1 0 3 0 1 1 1 0 1 5204 0 010001010100 0 0 1 0 3 0 1 1 1 0 1 84 0 010100 0 0 1 0 3 0 1 1 1 0 1 5445 0 010101000101 0 0 1 0 3 0 1 1 1 0 1 1364 0 0101010100 0 0 1 0 3 0 1 0 0 1 0 1365 0 0101010101 0 0 1 0 9 0 001 1 1 0 1 8 0 000 0 0 1 0 3 0 1 0 0 1 0 5205 0 010001010101 0 0 1 0 9 0 001 1 1 0 1 8 0 000 0 0 1 0 3 0 1 0 0 1 0 5189 0 010001000101 0 0 1 0 9 0 001 1 1 0 1 8 0 000 0 0 1 0 3 0 1 1 1 0 1 5188 0 010001000100 0 0 1 0 3 0 1 1 1 0 1 84 0 010100 0 0 1 0 3 0 1 0 0 1 0 5444 0 010101000100 0 0 1 0 9 0 001 1 1 0 1 8 0 000 0 0 1 0 3 0 1 1 1 0 1 5204 0 010001010100 0 0 1 0 3 0 1 1 1 0 1 84 0 010100 0 0 1 0 3 0 1 1 1 0 1 5445 0 010101000101 0 0 1 0 3 0 1 1 1 0 1 1364 0 0101010100 0 0 1 0 3 0 1 0 0 1 0 1365 0 0101010101 0 0 1 0 9 0 001 > > ## This once gave a seg.fault! > p.dt2c0dt3 <- predict(vlmc.dt2c0, dt3) ## quite many NA (but not at end!) > ## which(is.na(p.dt2c0dt3[,1])) > which(is.na(unname(p.dt2c0dt3[-1,1]))) integer(0) > ## 1 3 6 10 15 ---- SAME as ../VLMC/dt2_c0.dt3.pred !! > ## NONE! > > predict(vlmc.dt2c0, dt3, type = "ALL") fit Pr[X= 0 ] Pr[X= 1 ] id flags ctxt 0 0 NA 1 1 16/35 19/35 2 65 0 0 0 1 0 3 0 1 0 1 7/19 12/19 10 65 010 1 0 1 0 9 0 001 0 0 1 0 3 0 1 0 1 3/7 4/7 20 10 0100 0 0 1 0 9 0 001 1 1 0 1 8 0 000 0 0 1 0 3 0 1 0 1 1/3 2/3 324 10 01000100 0 0 1 0 9 0 001 0 1 0 1 8 0 000 1 1 0 1 8 0 000 0 0 1 0 3 0 1 0 1 3/7 4/7 40 10 01000 0 0 1 0 9 0 001 0 1 0 1 8 0 000 0 1 0 1 8 0 000 1 1 0 1 8 0 000 1 0 1 0 3 0 1 1 0 1 0 3 0 1 1 0 1 0 3 0 1 1 0 1 0 3 0 1 1 0 1 0 3 0 1 1 0 1 0 3 0 1 > > ## NA NA's : > prm <- cbind(fit = predict(vlmc.dt2c0, dt3, type = "response"), + probs = (pr <- predict(vlmc.dt2c0, dt3)), + lev = predict(vlmc.dt2c0, dt3, type = "depth"), + ID = (pid <- predict(vlmc.dt2c0, dt3, type = "id")), + flags = attr(pr,"flags")) > noquote(cbind(prm, context = id2ctxt(pid, m=2, alpha=TRUE))) fit 0 1 lev ID context 0 NA 1 1 0.457142857142857 0.542857142857143 1 2 0 0 0 1 0 1 3 1 0 1 0.368421052631579 0.631578947368421 3 10 010 1 0 1 0 3 9 001 0 0 1 0 1 3 1 0 1 0.428571428571429 0.571428571428571 4 20 0100 0 0 1 0 3 9 001 1 1 0 1 3 8 000 0 0 1 0 1 3 1 0 1 0.333333333333333 0.666666666666667 8 324 01000100 0 0 1 0 3 9 001 0 1 0 1 3 8 000 1 1 0 1 3 8 000 0 0 1 0 1 3 1 0 1 0.428571428571429 0.571428571428571 5 40 01000 0 0 1 0 3 9 001 0 1 0 1 3 8 000 0 1 0 1 3 8 000 1 1 0 1 3 8 000 1 0 1 0 1 3 1 1 0 1 0 1 3 1 1 0 1 0 1 3 1 1 0 1 0 1 3 1 1 0 1 0 1 3 1 1 0 1 0 1 3 1 > > ## Constant data prediction: |alphabet| = 1 (!!) > mod <- vlmc(rep(1, 99)) > pr <- predict(mod, c(1, 0, 1)) # crash did occur here (in C code) > stopifnot(pr[-1] == 1) > > > cat("Time elapsed:", format(proc.time() - c0),"\n") Time elapsed: 0.08 0.00 0.08 NA NA > > proc.time() user system elapsed 0.26 0.10 0.31