View source: R/plot.arfimaMLM.R
plot.arfimaMLM | R Documentation |
Function for plotting time-varying coefficients generated by Arfima-MLM package
## S3 method for class 'arfimaMLM' plot( x, ..., CoefName, TimeVar, loess = NULL, title = NULL, xaxis = NULL, yaxis = NULL )
x |
Object of class ArfimaMLM |
... |
Other arguments passed down, currently not implemented. |
CoefName |
Name of time varying coefficient you wish to plot. |
TimeVar |
Variable specifying unit of time. |
loess |
TRUE sets loess smoother on. FALSE disables features. Defaults to TRUE. |
title |
Character string to pass on to ggtitle. |
xaxis |
Character string to pass on to ggplot2. Defaults to "Date" if left blank. |
yaxis |
Character string to pass on to ggplot2. Defaults to coefficient name if left blank. |
David L Stack, stackd85@gmail.com
require(fracdiff) t = 100 # number of time points n = 500 # number of observations within time point N = t*n # total number of observations ### generate fractional ARIMA Time Series for y_t, x1_t, z1_t, z2_t set.seed(123) y_t <- fracdiff.sim(t, d=0.4, mu=10)$series x1_t <- fracdiff.sim(t, d=0.3, mu=5)$series z1_t <- fracdiff.sim(t, d=0.1, mu=2)$series z2_t <- fracdiff.sim(t, d=0.25, mu=3)$series ### simulate data data <- NULL; data$time <- rep(seq(1:t),each=n) data <- data.frame(data) data$x1 <- rnorm(N,rep(x1_t,each=n),2) data$x2 <- rnorm(N,0,40) data$z1 <- rnorm(N,rep(z1_t,each=n),3) data$z2 <- rep(z2_t,each=n) b1 <- 0.2+rep(rnorm(t,0,0.1),each=n) data$y <- (b1*data$x1-0.05*data$x2+0.3*rep(z1_t,each=n) +0*data$z2+rnorm(N,rep(y_t,each=n),1)) m1 <- arfimaMLM(y.ydif ~ x1.xdif + x2 + z1.fd + z2.fd + (1 + x1.xdif|time) , data = data, timevar = "time") plot(x = m1, CoefName = "x1.xdif", TimeVar = "time")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.