Trying to use the AIC on e.g. one of the fit `fit_splinemodel`

-s gives me an error message:

```
AIC(fit_splinemodel[[3]] )
Error in UseMethod("logLik") :
no applicable method for 'logLik' applied to an object of class "c('smooth.spline_fit', 'growthrates_fit')"
```

Personally I prefer to use the `map`

functions of the `purrr`

package instead of ` lapply`

.

In the code below I extract the `deviance`

value from the first six model results.

Do not know if that makes any sense to you.

`?`rsquared,growthrates_fit-method`

` shows which results can be accessed

```
library(growthrates)
#> Loading required package: lattice
#> Loading required package: deSolve
data("bactgrowth")
split_df <- split(bactgrowth,~strain+replicate+conc)
timeseries <- lapply(split_df, function(x) x$value)
df <- cbind(data.frame(time = 1:31),
as.data.frame(timeseries))
library(purrr)
# fit_easymodel <- lapply(2:length(colnames(df)), function(x) fit_easylinear(df$time, df[] ))
fit_easymodel <- purrr::map(2:length(colnames(df)), function(x) fit_easylinear(df$time, df[,x] ))
#> Warning in summary.lm(m): essentially perfect fit: summary may be unreliable
#> Warning in summary.lm(m): essentially perfect fit: summary may be unreliable
### other warnings manually removed
head(purrr::map_dbl(fit_easymodel,function(x) deviance(x )))
#> [1] 0.012487437 0.020573997 0.006437104 0.038155104 0.022007107 0.003899535
# fit_splinemodel <- lapply(2:length(colnames(df)), function(x) fit_spline(df$time, df[],spar=0.5))
fit_splinemodel <- purrr::map(2:length(colnames(df)), function(x) fit_spline(df$time, df[,x],spar=0.5))
head(purrr::map_dbl(fit_splinemodel,function(x) deviance(x)))
#> [1] 0.02368248 0.03203602 0.03861812 0.13365795 0.03155168 0.02578376
Created on 2022-10-21 with reprex v2.0.2
```