For data at a weekly level, I'm giving frequency as 52 for the auto.arima function. What happens when a year has 53 weeks? How does it affect the forecast?
You need to create a variable to account for the leap year effect.
For example, a common specificacion with monthly data is to define a column vector with zeros for all months except February. In February, the variable takes on the value 0.75 if it belongs to a leap year and -0.25 otherwise. In this way the leap year effect cancels out over a period of four years and does not affect the mean over this interval.
For weekly data, you could collapse weeks 52 and 53 into a single week (e.g. adding up the values for weeks 52 and 53 of leap years) and then define a dummy that could account for the different number of days in the last week of the year. Following the same idea as above, you could define a dummy with zeros for all weeks of the year except for the last one, which can be set to 0.75 if it belongs to a leap year and -0.25 otherwise.
There may be several other possible specifications for this variable. Regardless of whether it is a leap year or not, the last week of the year does not always have the same number of days. A dummy based on the number of days in the last week may be better, as it may capture the potential effect of the length of the last week both in leap and non-leap years.
Once the dummy has been chosen and built, it can be passed to
forecast::auto.arima through the argument
xreg. When forecasting, remember that you need to extend this dummy for the out-of-sample periods.
auto.arima does not seem to pay any attention to leap years. Thus if your data spans more than a few years, the 52-week frequency starts being a problem. You are getting out of sync at a pace of approximately one week every 5-6 years.
As regards seasonality, the first time "week 53" is encountered in your data, it will be treated as week 1 (because your specified frequency is 52), then the subsequent "week 1" will be treated as week 2 etc. The discrepancy will persist and even grow with every new "week 53".
Here is a useful treatment of weekly data by the author of the
forecast package and the
auto.arima function. It might help you solve the underlying problem.