optimization - Why "lines()" doesn't draw anything on the plot in R? -


I have the following code, but line () attracts nothing at plot I I've been created by plot.ts (nhtemp). I do not want to use the HaltWinter function.

  Data (required) data (nhtemp) str (nhtemp) mona.function & lt; - Function (beta, y = nhtemp) {y.hat = numerical (length (y) y.hat [1] = y [1] y.hat [2] = y [2] (i in 3: Length (y) {y.hat [i] = beta * Y [i-1] + (1-beta) * y.hat [i-1]} sq.sum = 0 (i in 2: length )} {sq.sum = sq.sum + (y [i] -y.hat [i]) ^ 2} plot.ts (nhtemp) line (y.hat, col = "red") returns (sq.sum)   

This is a result I have: Enter image details here

And this is the plot I hope to get: Here are some Enter the details of

you

  line (ts ( Y.hat, start = start (nhtemp) [1], end = end (nhtemp) [1]), col = "red")   

In this way, Construct that starts in the same way and ends with nhtemp .

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -