Hello R users,
Below is the code and output of what I am trying to do. My goal is to
insert/print all items in the chart function into a pdf document. Only the
acf and pacf charts gets printed.
Again, thanks in advance for any help I can get!
####################################
options (scipen=999, digits=7)
library(lmtest)
library(dyn)
tdata <- ts(read.table("C:/test/data.csv" ,sep = ",",header=TRUE))
print(tdata)
res <- function(dep, indep, fn, env = parent.frame()) {
depnm <- deparse(substitute(dep))
indepnm <- deparse(substitute(indep))
fo <- sprintf("%s ~ lag(%s, -1) + %s", depnm, depnm, indepnm)
fo <- as.formula(fo, env = env)
mod <- do.call(dyn$lm, list(fo))
chart <- function(mod) {
pdf(file="results.pdf")
par(mfrow=c(2,1))
acf(residuals(mod))
pacf(residuals(mod))
summ<- summary(mod)
aic <- AIC(mod)
dev.off() }
output <- return(list(Charts=chart(mod))) }
results <- res(tdata[ ,"Y"], tdata[ ,"X_VARY"]) ; results
############output###############
$Charts
null device
http://www.nabble.com/file/p21888211/results.pdf results.pdf
Hello R users,
I have been trying to output all my results (text, plots, etc) into the same
postscript file as
one document, but have been unable to...Can anyone help me improve my code
below so that I can
accomplish this? Currently I have to output them separately then piece them
back together into
one document..
[[elided Yahoo spam]]
http://www.nabble.com/file/p21888211/data.csv data.csv