require(knitr)
require(formatR)
require(dplyr)
options(width=200)
knitr::opts_chunk$set(cache=FALSE,prompt=FALSE,comment=">",message=FALSE,echo=TRUE,warning=FALSE,tidy=TRUE,strip.white=TRUE,size="small", fig.align = "center",fig.show='hold')

Assignments: Iterating 1D Maps

In this assignment you will build two (relatively) simple one-dimensional maps in Excel and look at their behaviour and properties. We start with the Linear Map and then proceed to the slightly more complicated Logistic Map (aka Quadratic map). If your are experienced in R or Matlab you can try to code the models following the instructions at the end of this document.

Before you begin, be sure to check the following settings:


The Linear Map

The ordinary difference equation discussed in the lecture (see lecture notes) is called the Linear Map:

$$ Y_{t+1} = Y_{t=0} + r*Y_t $$

In these excersises you will simulate time series produced by this change process for different parameter settings of the growth-rate parameter $r$ (the control parameter) and the initial conditions $Y_0$. This is different from a statistical analysis in which parameters are estimated from a data set. The goal of the assignments is to get a feeling for what a dynamical model is, and how it is different from a linear statistical regression model like GLM.

Simulate the Linear Map in a Spreadsheet

You have just simulated a time series based on a theoretical change process!

Visualizing the time series

. Select cells A10 to A110 Create a line graph (Insert, 2D-line, Scatter). This will show you the graph. (There are other

ways to do this, by the way, which work just as well.) You can play with the setting to make the best suitable view, like rescaling the axes.

. If you change the values in cells B5 and B6 you will see an immediate change in the graph. To study the model’s behaviour, try the following growth parameters:

+ $a = -1.08$
+ $a = 1,08$
+ $a = 1$
+ $a = -1$

. Change the initial value $Y_0$ in cell B6 to $10$. Subsequently give the growth parameter in cell B5 the following values $0.95$ and $–0.95$.

The Logistic Map

The Logistic Map has the following form:

$$ Y_{t+1} = rY_t(1-Y_t) $$

Simulate the Logistic Map in a Spreadsheet

To get started, copy the spreadsheet from the previous assignment to a new sheet. The parameters are the same as for the Linear Map, there has to be an initial value $Y_{t=0}$ (no longer explicit as a constant in the equation) and the control parameter $r$. What will have to change is

Visualize the time series and explore its behavioour

To study the behavior of the Logistic Map you can start playing around with the values for the parameters and the initial values in cells B5 and B6.

The plot you just produced is a so called return plot, in which you have plotted $Y_{t+1}$ against $Y_t$.

The meaning and use of this plot was discussed in the next session


Using R or Matlab to do the exercises.

The best (and easiest) way to simulate these simple models is to create a function which takes as input the parameters ($Y_0$, $r$) and a variable indicating the length of the time series.

For example for the Linear Map:

# In R
linearMap <- function(Y0 = 0, r = 1, N = 100){

    Y <- c(Y0, rep(NA,N-1))

    for(t in 1:N){

    Y[i+1] <- # Implement the function here

    }

    return(Y)
}


# In Matlab
function linearMap(Y0,r,N)
 # Implement the function here
end

Creating the time series graphs and the return plot should be easy if the function linearMap returns the time series. Both R and Matlab have a plot() function you can call.[^tseries]


[^tseries]: Both R and Matlab have specialized objects to represent timeseries, and functions and packages for timeseries analysis. They are especially convenient for plotting time and date information on the X-axis. See Mathematics of Change 1 - SOLUTIONS



FredHasselman/nlRtsa documentation built on May 6, 2019, 5:07 p.m.