0

I have forest cover (in %) data for a period of 16 years. I am trying to do a time series trend analysis in R so that I could see when the forest cover declined or increased. I generated random numbers and below is a small portion of how the data looks like.

2000 98 98  98  99  99  99  99  99  99  99  99
2001 98 98  98  98  98  98  98  98  98  99  99
2002 93 94  95  95  95  95  96  95  95  95  95
2003 96 96  96  96  96  95  95  96  96  96  96
2004 55 54  55  55  53  49  46  45  52  59  65
2005 53 51  49  52  52  50  50  52  61  70  74
2006 32 33  46  59  72  77  77  0   12  25  38
2007 27 37  39  51  58  56  57  49  69  67  80
2008 0  0   0   0   0   0   0   0   0   0   0
2009 40 37  36  39  48  50  48  46  45  47  46
2010 93 92  91  91  92  91  91  91  93  94  93
2011 29 26  28  33  33  22  13  12  13  9   9
2012 0  11  13  15  15  0   1   1   1   12  22
2013 97 96  95  96  97  97  96  96  97  98  98
2014 75 81  88  94  96  95  96  96  97  95  95
2015 93 93  93  93  93  94  94  94  93  92  91

I am trying to use bfast to generate the trend analysis like below.

t <- ts(test, frequency = 1, start = 2000, end = 2016, class= "ts")
fit <- bfast(t, season = "none", max.iter = 1)
plot(fit)

The error is Warning message:

In process[-(1:nh)] - process[1:(n - nh + 1)] :
  longer object length is not a multiple of shorter object length

Can anyone help me what I am doing wrong? Also, using random points is just a preliminary test. I need to do the trend analysis for the whole raster in multiple years. What could be the easiest way to do that?

Stefan Crain
  • 2,010
  • 3
  • 21
  • 22
user65127
  • 117
  • 5
  • Where are there multiple observations per year? Are those months (there are only 11) or pixel values? It would help if you wrote `dput(test)` so that we can try to run your code. – Amadou Kone Apr 05 '18 at 00:14
  • These are single observations per year. Instead of all pixel values, here are the 11 out of 1000 random points that I generated. – user65127 Apr 05 '18 at 15:59

0 Answers0