pfmc-assessments / VASTWestCoast

VAST for the NWFSC West Coast data
Other
5 stars 1 forks source link

error in stats::loess b/c too few degrees of freedom #42

Open kellijohnson-NOAA opened 2 years ago

kellijohnson-NOAA commented 2 years ago

Got the following error from plot_ss() because there are too few data points for a smoother. Noting this in case we want to fix it in the future.

https://github.com/nwfsc-assess/VASTWestCoast/blob/5fcadd3318c040b2aa4cb81227895ce65d252a8b/R/plot_ss.R#L92-L95

Browse[4]> stats::loess(Estimate_metric_tons ~ Year, dat[ind,],degree=2)
Call:
stats::loess(formula = Estimate_metric_tons ~ Year, data = dat[ind,
    ], degree = 2)

Number of Observations: 5
Equivalent Number of Parameters: 5
Residual Standard Error: Inf
Warning messages:
1: In simpleLoess(y, x, w, span, degree = degree, parametric = parametric,  :
  span too small.   fewer data values than degrees of freedom.
2: In simpleLoess(y, x, w, span, degree = degree, parametric = parametric,  :
  pseudoinverse used at 1998
3: In simpleLoess(y, x, w, span, degree = degree, parametric = parametric,  :
  neighborhood radius 2.02
4: In simpleLoess(y, x, w, span, degree = degree, parametric = parametric,  :
  reciprocal condition number  0
5: In simpleLoess(y, x, w, span, degree = degree, parametric = parametric,  :
  There are other near singularities as well. 4.0804