Reputation: 11
I am trying to complete an autoregression on my dataset, examining the relationship between winter temperatures and deer populations. I ran an Augmented Dickey Fuller Test and realized that I need to de-trend my data before completing an autoregression.
Does anyone know how to de-trend a time series without losing the years?
Here is a subset of the data, if that helps.
I've tried to de-trended my deer population data set before, but was unable to preserve year.
print(deer_pop)
year population
1 1976 184729
2 1977 181017
3 1978 163250
4 1979 160169
5 1980 214924
6 1981 198624
7 1982 166286
8 1983 169222
9 1984 175300
10 1985 204395
11 1986 206772
12 1987 198760
13 1988 229226
14 1989 226091
15 1990 198285
16 1991 220106
17 1992 215492
18 1993 216814
19 1994 207537
20 1995 233524
21 1996 255604
22 1997 254299
23 1998 292072
24 1999 331435
25 2000 291474
Upvotes: 1
Views: 46
Reputation: 2364
This is a question that you should rather ask at Cross Validated. A simple method for detrending data is to take the first difference, i.e., to substract the population at time t - 1
from the population at time t
. Use:
diff(deer_pop$population)
You will loose one observation by doing so. You may need to take higher order differences, in order to get rid of the trend. This means you will loose more observations.
Upvotes: 1