Discussion board where members can get started with Qlik Sense.
I have a customer with the sample attached data.Who wants me to display predictive values for next one year.
Can anyone of you, show me or send me the Required R codes required to generate the futuristic data for Next one year based on the sample file:
Activity Period : is my Field for PeriodPassenger Count: is my field for values.
I have downloaded R-studio.
But not understanding the concept of Ts, arima etc.
If someone can explain to me.. that will be very much appreciated . My Skpye id: ashvinzoe
At the end, i want to use the predicted data to display in a graph.
( from qlikview i know we have linear prediction, however Customer wants an ideal forecast graph )
Go to Solution.
Ok guy, i gat it working.
// This is going to generate all the difference between the present and past row of data.
// Remember to send the DAta Measure into that. NEVER THE DATE.
// lag = 1 :: diference between 2 rows immediate
// lag = 1 :: difference bewen Two 2 rows... behind.
dif1 = diff(dfSummarize[] , lag = 1 )
// When plot of you will know whether it is stationary or not.
// UNTIL you get a staiotnay plot... u need to keep on Differentioating...
// remember... you need to Diff the diff ...
// Check these tw0 ONLY WHEN YOU HAEV A STATIONARY SERIES.. u can use these fucntion.
// numbe rof AR terms
pacf(dif1) // from this chart >> locate the PEEK. The highest. VALUE ABOVE THE BLUE LINE. Max line out of the RANGE ( Blue dotted lines)
// numbe rof MA terms
acf(dif1) // from this chart >> locate the PEEK. The highest.
// calculate the Fit
c(6,1,6) = 1 here is the number of Diff we have made. No of times we have differentiate to be stationary.
fit <- arima(x = dfSummarize[] , order = c(6,1,6) )
fit <- arima(x = dfSummarize[] , order = c(12,1,12))
// WHY DONT U reduce the amount of data loaded and then when predict, do the prediction for KNOWN values.
// u will know whether the model is best fit.
// VALIDATION of Forecast data.
// Finally forcast .... H = 12.. depends on what you want to predict.. periods... how many values.
pForecast <- forecast(fit, h = 12)
I went through your dataset. May i understand at what level you would want to predict the data.
For instance the last period was : 200606
And what is required is to predict till 200706.
I have managed to use grouping to get the Period per month.
> csvdata <- read.csv("MonthlyPassengerData_200507_to_201509.csv", header = TRUE)
> xPeriod <- csvdata
> yPax <- csvdata["Passenger.Count"]
> df = data.frame(xPeriod,yPax);
// use library(data.table)
dfSummarize <- aggregate(Passenger.Count ~ Activity.Period, df, sum)
1 200507 3225769
2 200508 3195866
3 200509 2740553
4 200510 2770715
5 200511 2617333
Convert date from YYYYMM to YYYY-MM-DD
// where initialy dfSummarize[] has a list of date in YYYYMM
dfSummarize[] <- as.Date(paste(dfSummarize[],"01", sep = ""), format = "%Y%m%d")
So from here... i need to get next 12 months data...
This link here will give you more information on how to implement ARIMA.
Also, once done with your predictive model , you can plot the data in Qliksense in a line chart as I have done in my project (I made use of random forest time series forecasting).
You can color the line chart the way you need. Please check the image below: the red and the yellow lines are the confidence bands.