# Remove seasonality in R

I have data of total exports of fish from my country in the time period 2010-2020. Since our currency (NOK) has gotten weaker to the currencies we are trading with, we have gotten a lot more value from our exports the last decade.

I have made data who shows how much we have earned from every month the last year. To get precise data for further analysis, I have taken the total value from our exports and divided it by the quantity we have exported.

I want to remove the seasonality of the data. For an example, we will export more every october then january.

This is what I have done:

library(rio)
library(ggplot2)
library(forecast)
library(tseries)
library(tidyverse)
library(zoo)


VM = value/quantity of our exports

data_ma = ts(na.omit(data\$VM), frequency = 12)

decomp = stl(data_ma, "periodic")
deseasonal_cnt <- seasadj(decomp)
plot(decomp)


adf.test(data_ma, alternative = "stationary")


Result shows p-value at 0.04

Acf(data_ma, main = '')


Pacf(VM_ma, main = '')


I now want to remove the seasonality, but the I dont know what to do with the ACF and PACF tests as there is so much lags. Can someone please help?

Data:

https://drive.google.com/file/d/17QEiXrV8Zvx5IrIFjBbQGtpODu6ktT8o/view?usp=sharing

• Could you please complete the Minimal Working Example by providing the data? That helps those users who want to provide solution to your problem with code.
– 1muflon1
Feb 25 at 15:17
• @1muflon1 I have edited the thing now, so you can see the head. Is this what you want or should I share the whole excel-file? If so, how? :) Thanks Feb 25 at 15:33
• often the head is enough as one can simulate data based on the head and give you solution but here you have specific problem that is tied to your data (or at least I understood the question that you want to know answer for this problem not just general discussion of how to remove seasonality- if I misunderstood the question then sorry for that). You can share it by for example putting it on a drop box or google docs or some other online service that allows you to upload data and then posting link here
– 1muflon1
Feb 25 at 15:43
• @1muflon1 thanks for the help. I think I have provided the data now. Feb 25 at 15:51
• There are several issues here. 1) ADF test should not be used on seasonal data. You need to first deseasinalize to apply adf test to check for unit root. 2) p-values for adf test are not easy to get. Often in R p-values for adf test are from the t-distribution which is wrong. urdf from urca is probably the most trust worthy function for adf test. It reports the test statistic and critical values. 3) There are various ways to deseasinalize and it is often not straight forward. The most widely used for official statistics is X13Arima or Tramo-Seats. Both are available in R in package... Feb 27 at 9:50