# plotLLE: plotLLE In tsiR: An Implementation of the TSIR Model

## Description

Function to plot the Local Lyapunov Exponents. The output is of class ggplot2 so you can add standard ggplot2 options to it if desired.

## Usage

 `1` ```plotLLE(LLE) ```

## Arguments

 `LLE` The output from TSIR_LLE

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65``` ```## Not run: require(kernlab) require(ggplot2) require(kernlab) London <- twentymeas\$London ## just analyze the biennial portion of the data London <- subset(London, time > 1950) ## define the interval to be 2 weeks IP <- 2 ## first estimate paramters from the London data parms <- estpars(data=London, IP=2, regtype='gaussian',family='poisson',link='log') ## look at beta and alpha estimate plotbeta(parms) ## simulate the fitted parameters sim <- simulatetsir(data=London,parms=parms,IP=2,method='deterministic',nsim=2) ## now lets predict forward 200 years using the mean birth rate, ## starting from rough initial conditions times <- seq(1965,2165, by = 1/ (52/IP)) births <- rep(mean(London\$births),length(times)) S0 <- parms\$sbar I0 <- 1e-5*mean(London\$pop) pred <- predicttsir(times=times,births=births, beta=parms\$contact\$beta,alpha=parms\$alpha, S0=S0,I0=I0, nsim=50,stochastic=T) ## take the last 10 years pred <- lapply(pred, function(x) tail(x, 52/IP * 20) ) ## now compute the Lyapunov Exponent for the simulate and predicted model simLE <- TSIR_LE( time=sim\$res\$time, S=sim\$simS\$mean, I=sim\$res\$mean, alpha=sim\$alpha, beta=sim\$contact\$beta, IP=IP ) predLE <- TSIR_LE( time=pred\$I\$time, S=pred\$S\$X3, I=pred\$I\$X3, alpha=parms\$alpha, beta=parms\$contact\$beta, IP=IP ) simLE\$LE predLE\$LE simLLE <- TSIR_LLE(simLE) predLLE <- TSIR_LLE(predLE) plotLLE(simLLE) plotLLE(predLLE) ## End(Not run) ```

tsiR documentation built on Jan. 21, 2021, 1:06 a.m.