**Example 1**: *Random Walk with Fixed Moves*

- Suppose price of a stock move up by 10 paisa with probability 0.5 or move down by 10 paisa with probability 0.5 every seconds.
- If the price of the stock is Re 1/-; then what will be the price of the stock after 21600 seconds
- The model \(P_t=P_{t-1}\pm M_t\), where \(M_t=5~a.s.\)

```
set.seed(321)
n<-21600
P<-rep(NA,n)
P[1]<-100 ## Current price 100 paisa or Re 1/-
for(sec in 2:n){
toss<-sample(c("H","T"),1,replace = TRUE,prob = c(0.5,0.5))
if(toss=="H")P[sec]<-P[sec-1]+5
if(toss=="T")P[sec]<-P[sec-1]-5
}
plot(ts(P))
abline(h=0,lwd=2,col="red")
```

- Notice: Price of the stock is negative
- This model is good candidate to model the stock price movement.
- However, it cannot take care of the
**limited liability**feature of the stock market. **Check what happens price of the stock move up by 10 paisa with probability 0.51 or move down by 10 paisa with probability 0.49 on every seconds!**

**Example 2:** *Random Walk with Random Moves*

- Suppose price of a stock move up or down with probability 0.5 or
- Size of the movement follow \(Poisson(\lambda=5)\)
- If the price of the stock is Re 1/-; then what will be the price of the stock after 21600 seconds
- The model: \[ P_t=P_{t-1}+\pm M_t, \] where \(M_t \sim Poisson(\lambda=5)\)

```
set.seed(321)
n<-21600
P<-M<-rep(NA,n)
P[1]<-100 ## Current price 100 paisa or Re 1/-
for(sec in 2:n){
toss<-sample(c("H","T"),1,replace = TRUE,prob = c(0.5,0.5))
M[sec]<-rpois(1,lambda = 5)
if(toss=="H")P[sec]<-P[sec-1]+ M[sec]
if(toss=="T")P[sec]<-P[sec-1]- M[sec]
}
par(mfrow=c(1,2))
plot(ts(P))
abline(h=0,lwd=2,col="red")
plot(ts(M))
abline(h=0,lwd=2,col="red")
```

**Example 3:** *Random Walk with Random Return*

- Simple return of an asset is nothing but movement of the price with respect to previous price. \[ \begin{eqnarray} R_t&=&\frac{P_t-P_{t-1}}{P_{t-1}}\\ R_t.P_{t-1}&=&P_t-P_{t-1}\\ P_t&=&P_{t-1}(1+R_t) \end{eqnarray} \]
- Suppose \(R_t\sim N(\mu=0,\sigma=0.01)\) on every seconds.
- If the price of the stock is Re 1/-; then what will be the price of the stock after 21600 seconds

```
set.seed(321)
n<-21600
P<-rep(NA,n)
P[1]<-100 ## Current price 100 paisa or Re 1/-
rt<-rnorm(n,mean=0,sd=0.01)
for(sec in 2:n) P[sec]<-P[sec-1]*(1+rt[sec])
par(mfrow=c(1,2))
plot(ts(P))
abline(h=0,lwd=2,col="red")
plot(ts(rt))
abline(h=0,lwd=2,col="red")
```