Skip to contents

Analyze results of a parameter scan

Usage

analyze_parameter_scan(
  parameter_scan_results,
  datafile = "",
  smooth_interval = 28
)

Arguments

parameter_scan_results

String or List. If a string, it is interpreted as the name of a rds file that contains the results of a parameter scan which is then loaded using readRDS(). Otherwise, it should be the output of run_parameter_scan() directly.

datafile

Name or path to a file containing measured data. The model results in parameter_scan_results are compared to the data therein. If empty, the site is inferred from the ModvegeSite objects in parameter_scan_results and a corresponding data file is searched for in `getOption("growR.data_dir", default = "data").

smooth_interval

Int. Number of days over which the variable dBM is smoothened. Should be set to make experimental data and simulated data to be as comparable as possible.

Value

analyzed A list with five keys: dBM, cBM, cBM_end, metrics and params.

dBM

A data.frame with 1 + n_params + n_metrics columns where each row represents a different parameter combination. The first column (n) gives the row number and is used to identify a parameter combination. The subsequent n_params columns give the values of the parameters used in this combination. The final n_metrics columns give the resulting performance score of the model run with these parameters for each metric applied to model variable dBM.

cBM

A data.frame of same format as for the key dBM. The first n_params + 1 columns are identical to the data.frame in dBM. The difference is that the final n_metrics columns give performance scores with respect to the model variable cBM.

cBM_end

A data.frame analogous to dBM and cBM, only this time the last n_metrics columns give performance scores with respect to the variable cBM_end, which is the final value of cBM, i.e. the cumulative grown biomass at the end of the year.

params

A vector containing the names of the scanned parameters. These are also the column names of columns 2:(n_params+1) in results.

metrics

A vector containing the names of the employed performance metrics. These are also the column names of the last n_metrics columns in results.

Examples

# There needs to be data available with which the model is to be compared.
# For this example, use data provided by the package.
path = system.file("extdata", package = "growR")
datafile = file.path(path, "posieux1.csv")

# We also use example parameter scan data provided by the package.
# In the real world, you would generally create your own data using 
# `run_parameter_scan()`.
analyze_parameter_scan(parameter_scan_example, datafile = datafile)
#> $metrics
#> [1] "bias" "MAE"  "RMSE"
#> 
#> $params
#> [1] "w_FGA" "w_FGB" "w_FGC" "w_FGD" "NI"   
#> 
#> $dBM
#>     n w_FGA w_FGB w_FGC w_FGD   NI        bias       MAE      RMSE
#> 1   1  0.25  0.50  0.25     0 0.75 -0.16419980 0.4121337 0.5509299
#> 2   2  0.25  0.50  0.25     0 1.00  0.37751388 0.5616504 0.7263866
#> 3   3  0.25  0.75  0.00     0 0.75  0.01932302 0.4459105 0.6276639
#> 4   4  0.25  0.75  0.00     0 1.00  0.66012890 0.7781165 1.0460631
#> 5   5  0.50  0.25  0.25     0 0.75 -0.11642138 0.3867247 0.5155541
#> 6   6  0.50  0.25  0.25     0 1.00  0.45122258 0.5778548 0.7362369
#> 7   7  0.50  0.50  0.00     0 0.75  0.07664023 0.4441456 0.6178312
#> 8   8  0.50  0.50  0.00     0 1.00  0.75151179 0.8490970 1.0913082
#> 9   9  0.75  0.25  0.00     0 0.75  0.12918741 0.4492931 0.6126609
#> 10 10  0.75  0.25  0.00     0 1.00  0.83592409 0.9173581 1.1348994
#> 
#> $cBM
#>     n w_FGA w_FGB w_FGC w_FGD   NI        bias        MAE       RMSE
#> 1   1  0.25  0.50  0.25     0 0.75 -0.13008035 0.13186180 0.15652216
#> 2   2  0.25  0.50  0.25     0 1.00  0.38746620 0.38746620 0.42660768
#> 3   3  0.25  0.75  0.00     0 0.75  0.03281790 0.06620229 0.07540092
#> 4   4  0.25  0.75  0.00     0 1.00  0.64515615 0.64515615 0.72225753
#> 5   5  0.50  0.25  0.25     0 0.75 -0.08854830 0.09152647 0.11209344
#> 6   6  0.50  0.25  0.25     0 1.00  0.44361801 0.44361801 0.48903023
#> 7   7  0.50  0.50  0.00     0 0.75  0.08346587 0.10527472 0.11363656
#> 8   8  0.50  0.50  0.00     0 1.00  0.72353157 0.72353157 0.80873053
#> 9   9  0.75  0.25  0.00     0 0.75  0.12863606 0.14195089 0.15724209
#> 10 10  0.75  0.25  0.00     0 1.00  0.79117326 0.79117326 0.88505112
#> 
#> $cBM_end
#>     n w_FGA w_FGB w_FGC w_FGD   NI       bias       MAE      RMSE
#> 1   1  0.25  0.50  0.25     0 0.75 -0.9204985 0.9204985 0.9204985
#> 2   2  0.25  0.50  0.25     0 1.00 -0.8683340 0.8683340 0.8683340
#> 3   3  0.25  0.75  0.00     0 0.75 -0.9029277 0.9029277 0.9029277
#> 4   4  0.25  0.75  0.00     0 1.00 -0.8416330 0.8416330 0.8416330
#> 5   5  0.50  0.25  0.25     0 0.75 -0.9157582 0.9157582 0.9157582
#> 6   6  0.50  0.25  0.25     0 1.00 -0.8610272 0.8610272 0.8610272
#> 7   7  0.50  0.50  0.00     0 0.75 -0.8972664 0.8972664 0.8972664
#> 8   8  0.50  0.50  0.00     0 1.00 -0.8325599 0.8325599 0.8325599
#> 9   9  0.75  0.25  0.00     0 0.75 -0.8920878 0.8920878 0.8920878
#> 10 10  0.75  0.25  0.00     0 1.00 -0.8242270 0.8242270 0.8242270
#>