Commit fc1d9997 authored by Monnet Jean-Matthieu's avatar Monnet Jean-Matthieu
Browse files

Updated with ABAmodel main parameters

No related merge requests found
Showing with 46 additions and 46 deletions
+46 -46
...@@ -131,9 +131,9 @@ subsample <- 1:nrow(plots) ...@@ -131,9 +131,9 @@ subsample <- 1:nrow(plots)
# model calibration # model calibration
model.ABA <- lidaRtRee::ABAmodel(plots[subsample,variable], metrics[subsample,], transform="boxcox", nmax=4, xy = plots[subsample, c("X", "Y")]) model.ABA <- lidaRtRee::ABAmodel(plots[subsample,variable], metrics[subsample,], transform="boxcox", nmax=4, xy = plots[subsample, c("X", "Y")])
# renames outputs with variable name # renames outputs with variable name
row.names(model.ABA$stats) <- names(model.ABA$model) <- variable row.names(model.ABA$stats) <- variable
# display selected linear regression model # display selected linear regression model
model.ABA$model[[variable]] model.ABA$model
# display calibration and validation statistics # display calibration and validation statistics
model.ABA$stats model.ABA$stats
``` ```
...@@ -149,7 +149,7 @@ round(cor(cbind(model.ABA$values$residual, plots[subsample, c("G.m2.ha","N.ha"," ...@@ -149,7 +149,7 @@ round(cor(cbind(model.ABA$values$residual, plots[subsample, c("G.m2.ha","N.ha","
cor.test(model.ABA$values$residual, plots[subsample, variable]) cor.test(model.ABA$values$residual, plots[subsample, variable])
# plot predicted VS field values # plot predicted VS field values
par(mfrow=c(1,2)) par(mfrow=c(1,2))
lidaRtRee::ABAmodelPlot(model.ABA, variable) lidaRtRee::ABAmodelPlot(model.ABA, main = variable)
plot(plots[subsample, c("G.m2.ha")], model.ABA$values$residual, ylab = "Prediction errors", xlab = "Field values") plot(plots[subsample, c("G.m2.ha")], model.ABA$values$residual, ylab = "Prediction errors", xlab = "Field values")
abline(h = 0, lty = 2) abline(h = 0, lty = 2)
``` ```
...@@ -164,7 +164,7 @@ model.ABA.point.metrics$stats ...@@ -164,7 +164,7 @@ model.ABA.point.metrics$stats
# cor.test(model.ABA.point.metrics$values$residual, plots[subsample, variable]) # cor.test(model.ABA.point.metrics$values$residual, plots[subsample, variable])
par(mfrow=c(1,2)) par(mfrow=c(1,2))
# plot predicted VS field values # plot predicted VS field values
lidaRtRee::ABAmodelPlot(model.ABA.point.metrics, variable, lidaRtRee::ABAmodelPlot(model.ABA.point.metrics, main = variable,
col = ifelse(plots$stratum == "public", "green", "blue")) col = ifelse(plots$stratum == "public", "green", "blue"))
legend("topleft", c("public", "private"), col = c("green", "blue"), pch = 1) legend("topleft", c("public", "private"), col = c("green", "blue"), pch = 1)
plot(plots[subsample, c("G.m2.ha")], plot(plots[subsample, c("G.m2.ha")],
...@@ -207,7 +207,7 @@ knitr::kable(table.output) ...@@ -207,7 +207,7 @@ knitr::kable(table.output)
par(mfrow = c(1,3)) par(mfrow = c(1,3))
for (i in names(models.ABA)) for (i in names(models.ABA))
{ {
lidaRtRee::ABAmodelPlot(models.ABA[[i]], i) lidaRtRee::ABAmodelPlot(models.ABA[[i]], main = i)
} }
rm(models.ABA, model.stats) rm(models.ABA, model.stats)
``` ```
...@@ -241,7 +241,7 @@ for (i in levels(plots[, strat])) ...@@ -241,7 +241,7 @@ for (i in levels(plots[, strat]))
# backup list of models for later use # backup list of models for later use
model.ABA.stratified.boxcox <- model.ABA.stratified model.ABA.stratified.boxcox <- model.ABA.stratified
# combine list of models into single object # combine list of models into single object
model.ABA.stratified <- lidaRtRee::ABAmodelCombineStrata(model.ABA.stratified, plots$plotID) model.ABA.stratified <- lidaRtRee::ABAmodelCombineStrata(model.ABA.stratified, plots$plotId)
# model.ABA.stratified$stats # model.ABA.stratified$stats
``` ```
...@@ -256,8 +256,8 @@ table.output <- cbind(model.stats[, c("n", "formula")], ...@@ -256,8 +256,8 @@ table.output <- cbind(model.stats[, c("n", "formula")],
names(table.output) <- c("n", "metrics", "adj-R2.%", "CV-R2.%", "CV-RMSE.%", "CV-RMSE") names(table.output) <- c("n", "metrics", "adj-R2.%", "CV-R2.%", "CV-RMSE.%", "CV-RMSE")
knitr::kable(table.output) knitr::kable(table.output)
par(mfrow=c(1,2)) par(mfrow=c(1,2))
lidaRtRee::ABAmodelPlot(model.ABA, paste0(variable, ", not stratified")) lidaRtRee::ABAmodelPlot(model.ABA, main = paste0(variable, ", not stratified"))
lidaRtRee::ABAmodelPlot(model.ABA.stratified, paste0(variable, ", stratified")) lidaRtRee::ABAmodelPlot(model.ABA.stratified, main = paste0(variable, ", stratified"))
``` ```
## Stratified models with stratum-specific variable tranformations ## Stratified models with stratum-specific variable tranformations
...@@ -267,7 +267,7 @@ In case one wants to apply different variable transformations, or use different ...@@ -267,7 +267,7 @@ In case one wants to apply different variable transformations, or use different
* public ownership, all metrics, Box-Cox transformation of basal area values (calibrated in the previous paragraph), * public ownership, all metrics, Box-Cox transformation of basal area values (calibrated in the previous paragraph),
+ private ownership, only point cloud metrics, no data transformation. + private ownership, only point cloud metrics, no data transformation.
```{r stratifiedmodelCalibrationTransforation, include=TRUE, warning = FALSE} ```{r stratifiedmodelCalibrationTransformation, include=TRUE, warning = FALSE}
# create list of models for no transformation # create list of models for no transformation
model.ABA.stratified.none <- list() model.ABA.stratified.none <- list()
# calibrate each stratum model # calibrate each stratum model
...@@ -295,8 +295,8 @@ names(table.output) <- c("n", "metrics", "transform", "adj-R2.%", "CV-R2.%", "CV ...@@ -295,8 +295,8 @@ names(table.output) <- c("n", "metrics", "transform", "adj-R2.%", "CV-R2.%", "CV
knitr::kable(table.output) knitr::kable(table.output)
# graphics # graphics
par(mfrow=c(1,2)) par(mfrow=c(1,2))
lidaRtRee::ABAmodelPlot(model.ABA, paste0(variable, ", not stratified")) lidaRtRee::ABAmodelPlot(model.ABA, main = paste0(variable, ", not stratified"))
lidaRtRee::ABAmodelPlot(model.ABA.stratified.mixed, paste0(variable, ", stratified")) lidaRtRee::ABAmodelPlot(model.ABA.stratified.mixed, main = paste0(variable, ", stratified"))
``` ```
# Save data before next tutorial # Save data before next tutorial
......
This source diff could not be displayed because it is too large. You can view the blob instead.
No preview for this file type
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment