33
overall20<-read_excel("C:/Users/joesc/Documents/SeniorYear/spring/Senior
Projec/doc3/data/mds.xlsx",
sheet="overall20year")
library(forecast)
ts.totex<-ts(data=overall$TEE, start=1980, freq=1)
ts.totem<-ts(data=overall$TEM, start=1980, freq=1)
ts.renpct<-ts(data=overall$RPT, start=1980, freq=1)
ts.avgrencst<-ts(data=overall$REC, start=1980, freq=1)
ts.avgnoncst<-ts(data=overall$NEC, start=1980, freq=1)
ts.avgretprc<-ts(data=overall$REP, start=1980, freq=1)
ts.totex20<-ts(data=overall20$TEE, start=2000, freq=1)
ts.totem20<-ts(data=overall20$TEM, start=2000, freq=1)
ts.renpct20<-ts(data=overall20$RPT, start=2000, freq=1)
ts.avgrencst20<-ts(data=overall20$REC, start=2010, end=2018, freq=1)
ts.avgnoncst20<-ts(data=overall20$NEC, start=2000, freq=1)
ts.avgretprc20<-ts(data=overall20$REP, start=2000, freq=1)
#View Graphs
ts.plot(ts.totex20, main="Total Expenditures 2000-2018", ylab= "Millions of
US Dollars")
ts.plot(ts.totem20, main="Total Emissions 2000-2018", ylab="Million Metric
Tons of CO2")
ts.plot(ts.renpct20, main="Percent of Energy Produced by Renewable Sources in
the US 2000-2018", ylab="Percent")
ts.plot(ts.avgrencst20, main="Average Renewable Cost 2010-2019",
ylab="Dollars/KWH")
ts.plot(ts.avgnoncst20, main="Average Nonrenewable Cost 2000-2018",
ylab="Dollars/KWH")
ts.plot(ts.avgretprc20, main="Average US Energy Retail Price 2000-2018",
ylab="Dollars/KWH")
#making stationary
stl.totem<-(diff(log(ts.totem)))
stl.renpct<-(diff(log(ts.renpct)))
stl.avgrencst<-(diff(log(ts.avgrencst)))
stl.avgnoncst<-(diff(log(ts.avgnoncst)))
stl.avgretprc<-(diff(log(ts.avgretprc)))
acf(stl.totem, main="Autocorrelation Function Graph for Total
Emissions")
acf(stl.renpct)
acf(stl.avgrencst)
acf(stl.avgnoncst)
acf(stl.avgretprc)
ccf(stl.totem, stl.renpct)
ccf(stl.totem, stl.avgrencst)
ccf(stl.totem, stl.avgnoncst)
ccf(stl.totem, stl.avgretprc)
ccf(stl.renpct, stl.avgrencst)
ccf(stl.renpct, stl.avgnoncst)
ccf(stl.renpct, stl.avgretprc)
ccf(stl.avgrencst, stl.avgnoncst)
ccf(stl.avgrencst, stl.avgretprc)