Running examples in ‘bfast-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: bfastmonitor
> ### Title: Near Real-Time Disturbance Detection Based on BFAST-Type Models
> ### Aliases: bfastmonitor
> ### Keywords: ts
> 
> ### ** Examples
> 
> NDVIa <- as.ts(zoo::zoo(som$NDVI.a, som$Time))
> plot(NDVIa)
> ## apply the bfast monitor function on the data
> ## start of the monitoring period is c(2010, 13)
> ## and the ROC method is used as a method to automatically identify a stable history
> mona <- bfastmonitor(NDVIa, start = c(2010, 13))
> mona

BFAST monitoring

1. History period
Stable period selected: 2000(4)--2010(12)
Length (in years): 10.347826
Model fit:
  (Intercept)         trend    harmoncos1    harmoncos2    harmoncos3 
 0.3906913721  0.0001376278  0.0034256312  0.0479024139  0.0152613429 
   harmonsin1    harmonsin2    harmonsin3 
-0.0092576950 -0.1071534760 -0.0200069655 
R-squared: 0.520570


2. Monitoring period
Monitoring period assessed: 2010(13)--2011(13)
Length (in years): 1.000000
Break detected at: 2011(3)

> plot(mona)
> ## fitted season-trend model in history period
> summary(mona$model)

Call:
lm(formula = response ~ trend + harmon)

Residuals:
      Min        1Q    Median        3Q       Max 
-0.223962 -0.052668  0.001105  0.050476  0.205938 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept)  3.907e-01  1.107e-02  35.281  < 2e-16 ***
trend        1.376e-04  7.967e-05   1.727   0.0854 .  
harmoncos1   3.426e-03  7.760e-03   0.441   0.6593    
harmoncos2   4.790e-02  7.761e-03   6.172 3.03e-09 ***
harmoncos3   1.526e-02  7.698e-03   1.982   0.0486 *  
harmonsin1  -9.258e-03  7.718e-03  -1.200   0.2316    
harmonsin2  -1.072e-01  7.718e-03 -13.883  < 2e-16 ***
harmonsin3  -2.001e-02  7.776e-03  -2.573   0.0107 *  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.08415 on 229 degrees of freedom
Multiple R-squared:  0.5206,	Adjusted R-squared:  0.5059 
F-statistic: 35.52 on 7 and 229 DF,  p-value: < 2.2e-16

> ## OLS-based MOSUM monitoring process
> plot(mona$mefp, functional = NULL)
> ## the pattern in the running mean of residuals
> ## this illustrates the empirical fluctuation process
> ## and the significance of the detected break.
> 
> NDVIb <- as.ts(zoo(som$NDVI.b, som$Time))
> plot(NDVIb)
> monb <- bfastmonitor(NDVIb, start = c(2010, 13))
> monb

BFAST monitoring

1. History period
Stable period selected: 2007(19)--2010(12)
Length (in years): 2.695652
Model fit:
 (Intercept)        trend   harmoncos1   harmoncos2   harmoncos3   harmonsin1 
 0.403786818  0.000517089 -0.058053468  0.040185053 -0.007416574 -0.062640841 
  harmonsin2   harmonsin3 
-0.048084840  0.002732460 
R-squared: 0.434615


2. Monitoring period
Monitoring period assessed: 2010(13)--2011(13)
Length (in years): 1.000000
Break detected at: 2010(22)

> plot(monb)
> summary(monb$model)

Call:
lm(formula = response ~ trend + harmon)

Residuals:
     Min       1Q   Median       3Q      Max 
-0.21781 -0.04807  0.00368  0.04909  0.19732 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept)  0.4037868  0.1399886   2.884 0.005589 ** 
trend        0.0005171  0.0006705   0.771 0.443904    
harmoncos1  -0.0580535  0.0171895  -3.377 0.001350 ** 
harmoncos2   0.0401851  0.0169844   2.366 0.021533 *  
harmoncos3  -0.0074166  0.0169043  -0.439 0.662569    
harmonsin1  -0.0626408  0.0172487  -3.632 0.000619 ***
harmonsin2  -0.0480848  0.0170196  -2.825 0.006571 ** 
harmonsin3   0.0027325  0.0169939   0.161 0.872848    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.09437 on 55 degrees of freedom
Multiple R-squared:  0.4346,	Adjusted R-squared:  0.3627 
F-statistic:  6.04 on 7 and 55 DF,  p-value: 3.007e-05

> plot(monb$mefp, functional = NULL)
> 
> ## set the stable history period manually and use a 4th order harmonic model
> bfastmonitor(NDVIb, start = c(2010, 13),
+   history = c(2008, 7), order = 4, plot = TRUE)

BFAST monitoring

1. History period
Stable period selected: 2008(7)--2010(12)
Length (in years): 2.217391
Model fit:
  (Intercept)         trend    harmoncos1    harmoncos2    harmoncos3 
 5.364374e-01 -8.166557e-05 -5.189379e-02  3.907679e-02 -1.265991e-02 
   harmoncos4    harmonsin1    harmonsin2    harmonsin3    harmonsin4 
-1.986360e-02 -6.043991e-02 -4.517956e-02  6.520623e-03  1.800916e-02 
R-squared: 0.389227


2. Monitoring period
Monitoring period assessed: 2010(13)--2011(13)
Length (in years): 1.000000
Break detected at: 2010(22)

> 
> ## just use a 6th order harmonic model without trend
> mon <- bfastmonitor(NDVIb, formula = response ~ harmon,
+     start = c(2010, 13), order = 6, plot = TRUE)
> summary(mon$model)

Call:
lm(formula = response ~ harmon)

Residuals:
      Min        1Q    Median        3Q       Max 
-0.308946 -0.058140 -0.000453  0.062612  0.284683 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)    
(Intercept)  0.502356   0.006032  83.276  < 2e-16 ***
harmoncos1  -0.003780   0.008542  -0.443 0.658529    
harmoncos2   0.065239   0.008557   7.624 6.83e-13 ***
harmoncos3  -0.001834   0.008502  -0.216 0.829434    
harmoncos4  -0.036234   0.008540  -4.243 3.23e-05 ***
harmoncos5  -0.018776   0.008519  -2.204 0.028534 *  
harmoncos6   0.018059   0.008547   2.113 0.035714 *  
harmonsin1  -0.033660   0.008520  -3.951 0.000104 ***
harmonsin2  -0.068213   0.008505  -8.021 5.74e-14 ***
harmonsin3  -0.016358   0.008559  -1.911 0.057255 .  
harmonsin4   0.008842   0.008521   1.038 0.300537    
harmonsin5  -0.001411   0.008542  -0.165 0.868980    
harmonsin6   0.008917   0.008505   1.048 0.295542    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.09294 on 225 degrees of freedom
Multiple R-squared:  0.4342,	Adjusted R-squared:  0.404 
F-statistic: 14.39 on 12 and 225 DF,  p-value: < 2.2e-16

> AIC(mon$model)
[1] -440.8433
> 
> ## use a custom number of seasonal dummies (11/yr) instead of harmonics
> mon <- bfastmonitor(NDVIb, formula = response ~ season,
+     start = c(2010, 13), sbins = 11, plot = TRUE)
> summary(mon$model)

Call:
lm(formula = response ~ season)

Residuals:
      Min        1Q    Median        3Q       Max 
-0.294758 -0.061462 -0.003898  0.063313  0.260542 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)    
(Intercept)  0.502875   0.006245  80.531  < 2e-16 ***
season.L     0.131014   0.020339   6.442 6.98e-10 ***
season.Q     0.023991   0.020192   1.188   0.2360    
season.C     0.047918   0.020405   2.348   0.0197 *  
season^4     0.137652   0.020636   6.670 1.92e-10 ***
season^5    -0.111478   0.020753  -5.372 1.93e-07 ***
season^6    -0.086809   0.020889  -4.156 4.60e-05 ***
season^7    -0.012671   0.021018  -0.603   0.5472    
season^8    -0.061810   0.021009  -2.942   0.0036 ** 
season^9     0.018892   0.020945   0.902   0.3680    
season^10   -0.040136   0.020901  -1.920   0.0561 .  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.09568 on 227 degrees of freedom
Multiple R-squared:  0.395,	Adjusted R-squared:  0.3684 
F-statistic: 14.82 on 10 and 227 DF,  p-value: < 2.2e-16

> AIC(mon$model)
[1] -428.9029
> 
> ## Example for processing raster bricks (satellite image time series of 16-day NDVI images)
> f <- system.file("extdata/modisraster.grd", package = "bfast")
> library("raster")
Error in library("raster") : there is no package called ‘raster’
Execution halted