# Safety stock calculation

I am trying to calculate a optimal safety stock based on time-series analysis of the sales and the previous lead times of the suppliers.

For that purpose, I am using the classical formula which is:

That is based on the average and standard deviation of the two components, which are the forecasted demand and the lead time.

The forecasting is made using the auto.arima function of the forecast package in R.

The problem I am facing, is that I have the sales per day, and the lead times are also days, but if I try to input that directly to the auto.arima, the forecast is bad because there are a lot of days where sales are 0, and also doesn't get the yearly seasionality right.

So what I do is aggregate the sales monthly and forecast monthly, that gives good forecasts, but then to estimate the standard deviation everything has to be in the same time unit right?

So I split the monthly forecast equally amongst its days, which gives for example 20 units a day, then compare to the actual data to get the forecast error, and that is for example many days at 0 and one day 100, which as a result means high standard deviation of the error, and this leads to high safety stock values.

I think I am doing something wrong here when I forecast monthly and then compare the error on a daily basis. It feels statiscally incorrect, however I am not sure it is.

The other option I was thinking is converting lead times to months and use the formula with all the quantities in a monthly basis (I think forecast error in months will be relatively smaller), do you think it is a better choice?

Any other options I am missing?