title: Use arima.sim to simulate ARIMA 1,1,1 with drift in R
body: <p>I am trying to use ARIMA sim package to simulate an ARIMA simulation with a drift. My problem is that I cannot seem to get it to work.</p>
  <p>I need to get something like this:</p>
  <p><a href="https://i.stack.imgur.com/c5Yp3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/c5Yp3.png" alt="enter image description here" /></a><a href="https://i.stack.imgur.com/9z0VB.png" rel="nofollow noreferrer"></a></p>
  <p>My code  is producing this though:</p>
  <pre><code>&gt; mean(datatime)
  [1] 15881.56
  &gt; sd(datatime)
  [1] 8726.893
  &gt; length(datatime)
  [1] 123
  
  </code></pre>
  <pre><code># The mean and variance from the original series
  
  originalseriesmean = 15881.56
  originalseriesvariance = 8726.893*8726.893
  originalseriesn=123
  
  # Simulation using arima.sim
  
  
  
  ts.sim &lt;- arima.sim(model=list(c(1,1,1)), n = 123, mean=190,sd=69.2863)
  
  ts.plot(ts.sim)
  
  
  </code></pre>
  <p><a href="https://i.stack.imgur.com/c0DzJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/c0DzJ.png" alt="[" /></a>
  How do I add a drft term to this function to make it look like the simulation before?</p>