Reputation: 1640
I am plotting time series graph with forecasting. I need to take the Y-axis values as in percentage. How to proceed for this. Please specify.
val <- sqlQuery(dbhandle, 'select COUNT(*) from Admission where YEAR(YearOFRegistration)=2006 and YEAR(Admission)=2006);
Ttl <- sqlQuery(dbhandle, 'select COUNT(*) from Admission where YEAR(YearOFRegistration)=2006');
firstyr<-(val/Ttl)*100
Same way I am calculating for each year.
> YrTimeSeries <- c(firstyrs,secyr,thirdyr,forthyr,fifthyr)
tsValue<-ts(YrTimeSeries,frequency=1,start=2006)
library(forecast)
plot(forecast(tsValue,h=5))
Forecast values are
Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
2011 86.9993 72.19680 101.8018 64.36083 109.6378
2012 86.9993 66.06645 107.9321 54.98528 119.0133
2013 86.9993 61.36233 112.6363 47.79094 126.2077
2014 86.9993 57.39653 116.6021 41.72576 132.2728
2015 86.9993 53.90256 120.0960 36.38220 137.6164
I am doing forecasting for next 6 years. I have included 2006 to 2010 years data and calculated in percentages. What I am worried about is I want to take predictive values in percentage of children taken addmision.Please elaborate where I am going wrong.
Upvotes: 0
Views: 167
Reputation: 21
Just redefine your Y-variable
x = sort(rnorm(100))
y = x * 2 + rnorm(100)
plot(x,y, type='b') # plain data
plot(x,y/max(y)*100, type='b') # Y-axis in percentage
Upvotes: 2