What is the minimum sample size required for time series forecasting with quarterly frequency? - size

I'm having a quarterly time series with 2-3 years of data (totally 8-12 data points - varies from case to case basis). I would like to understand the minimum sample size required to perform time series forecasting on quarterly interval series.
I have tried with 2 - 3 years of quarterly data and forecasted but I would like to know the recommended sample size for quarterly frequency.

Related

profit forecast using sql?

I have a set of profit for the year data in a csv file and I would like to create a simple forecast for the upcoming year. I've seen some using Simple moving averages? but from what I see is that its just calculating an average so how does that forecast anything?

Calculating the no. of days for the selected date period using MDX

I am trying to create a calculated column on a SSAS cube to work out the following:
Net Net X Rate = [Net Net Revenue] / [X]
where X = no of days
I need an output for X (using MDX), Something like the no. of days for the date period selected
For example upon the selection of
30 days for the chosen month of April 2021
X = 30
rate for 30 days
14 days for the chosen month of December 2020
X=14
rate for 14 days
I don't have access to SSAS at this point, but maybe somthing like
Net Net X Rate = [Net Net Revenue] / COUNT( EXISTING [Date].[Calendar].[Day].Members )
Answered here maybe: Count children members in MDX
Maybe this could help: DateDiffDays or .
I had something like this in mind: DateDiffDays([Measures].[From_Date], Now()). It will count the days difference between some day in the past and now. DateDiffWorkdays will get you a number of working days between two dates.
Alternatively, you could pre-calculate this value in a view and then pull the number into a cube.
Assuming your Date dimension is on day granularity, a very efficient way from query performance point of view to get what you want would be to add a column to your date dimension table. This could either be done in a view in the relational data model, or in the DVS as a calculated column. Name it e. g. number of days or just X, and make it be the value 1 on each row, i. e. the column expression is just 1. Then you create a new measure group based on this table, with the only measure being X, which would just sum this column. Then, whatever your query context would be, the X measure would just be the number of days. If you want, you can then make the measure invisible.

How to set up the cross_validation() function from Prophet?

I'm using Prophet (Python) to predict and analysis time series in bulk. that means that my time series share the same properties, but they are not exactly the same. They all run from 2016-01-01 to 2020-Jul-01.
I would like to cross validate my results using the first 3 years of data, and my forecast goal is 15 days only.
What is the best configuration to test my fit using the first 3 years, aiming for a 15 days forecast?
My naive try is the one below:
df_cv = cross_validation(mts, initial="1095 days", period='31 days', horizon = '15 days')
I'm not sure what to add in the 'period' and in the 'horizon' parameters.
As mentioned in Prophet's documentation:
We specify the forecast horizon (horizon), and then optionally the size of the initial training period (initial) and the spacing between cutoff dates (period).
Thus, a forecast is made for every observed point between cutoff and cutoff + horizon.
So, you can specify any combination of the 'period' and in the 'horizon' parameters as long as their sum is equal to the period for which you want to forecast (15 days).

Dynamic way to calculate the past 6 months Average

The excel user will export the data from an online website to excel (12 months data), so the date will be all the time different.
I create a pivot table, and I have the months and total Average and Frequency. However, I need the 6 months as well, and I am not sure how to get it which time the data changes.
My question: is there any VBA code that will dynamically calculate the past 6 months Average?
One can do this with Formula.
To get the average of the past 6 months:
=AVERAGEIFS('12 Months'!F:F,'12 Months'!A:A,">="&EDATE(TODAY(),-6),'12 Months'!A:A,"<" &TODAY()+1)
To get the frequency:
=COUNTIFS('12 Months'!A:A,">="&EDATE(TODAY(),-6),'12 Months'!A:A,"<"&TODAY()+1)
If one wants the last 12 months, change the -6 to -12 in both formula.

Single SQL Server query to get the total score by hourly, daily, weekly, monthly, and annual

I have the following requirement :
single SQL Server query to get the total score by hourly, daily, weekly, monthly, and annual data.
this is how the result should be:
thisperiodtotalscore previousperiodtotalscore sumtotalscore periodType
which meets the following criteria:
where score comes from the table data, totalscore has to be summed up for the different members of different teams,
where period can be hourly, daily, weekly, monthly, and annual and hourly is determined by the working hour definition, say it can be any number of selected hours (example: 1st working hour, 2nd working hour, and so on..)
and weekly determined by working days definition, say it can be wednesday to wednesday,..)
and likewise for monthy and annual
If the period has empty data, say if it is a holiday/leave that particular period should not be skipped in the count.
Note:
thisperiodtotalscore (this period total score can be for any of the periods (hourly, daily, weekly, monthly, annual) for the user date input) - say the corresponding week score of the user input, the corresponding month score of the user date input, .. likewise
previousperiodtotalscore (previous period total score can be for any of the periods (hourly, daily, weekly, monthly, annual) for the user date input) - say previous week score of the user date input, previous month score of the user date input,.. likewise
sumtotalscore - total of the thisperiodtotalscore and previousperiodtotalscore
periodType - hourly, daily, weekly, monthly, annual, based on the period request type
and which meets the following criteria:
where score comes from the table data, totalscore has to be summed up for the different members of different teams,
where period can be hourly, daily, weekly, monthly, and annual
and hourly is determined by the working hour definition, say it can be any number of selected hours (example: 1st working hour, 2nd working hour, and so on..)
and weekly determined by working days definition, say it can be wednesday to wednesday,..)
and likewise for monthly and annual
If the period has empty data, say if it is a holiday/leave that particular period should not be skipped in the count.
This is the requirement, also Welcome for other possible cases if missed in such kind of scenarios.
Thanks in advance,
GravityPush
For start, take a look at DimDate in AdventureWorksDW sample. You can have a similar table in your database and write some join queries. I suggest use queries which are dynamically grouped by different columns of DimDate.