valesta: Function to compute prediction statistics based on observed...

View source: R/valesta.r

valestaR Documentation

Function to compute prediction statistics based on observed values

Description

Computes three prediction statistics as a way to compare observed versus predicted values of a response variable of interest. The statistics are: the root mean square differences (RMSD), the aggregated difference (AD), and the absolute aggregated differences (AAD). All of them are based on

r_i = y_i - \widehat{y}_i

where y_i and \widehat{y}_i are the observed and the predicted value of the response variable y for the i-th observation, respectively. Both the observed and predicted values must be expressed in the same units.

Usage

valesta(y.obs = y.obs, y.pred = y.pred, want.percent = TRUE)

Arguments

y.obs

observed values of the variable of interest

y.pred

predicted values of the variable of interest

want.percent

A logic option for requesting to also computed the prediction statistics as a percentage of the sample mean of y.obs. By default is set to TRUE.

Details

The function computes the three aforementioned statistics expressed in both (a) the units of the response variable and (b) the percentage. Notice that to represent each statistic in percentual terms, we divided them by the mean observed value of the response variable.

Value

The main output depends on the want.percent; if TRUE, then it has the following six prediction statistics as a vector: (rmsd, rmsd.p,ad, ad.p, aad, aad.p); where rmsd.p stands for RMSD expressed as a percentage, and the same applies to AD.p and AAD.p. Meanwhile, if want.percent=FALSE, then it has the following three prediction statistics as a vector: (rmsd,ad,aad)

Author(s)

Christian Salas-Eljatib.

References

  • Salas C, Ene L, Gregoire TG, Nasset E, Gobakken T. 2010. Modelling tree diameter from airborne laser scanning derived variables: a comparison of spatial statistical models. Remote Sensing of Environment 114(6):1277-1285. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.rse.2010.01.020")}

  • Salas C. 2002. Ajuste y validación de ecuaciones de volumen para un relicto del bosque de roble-laurel-lingue. Bosque 23(2):81–92. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.4067/S0717-92002002000200009")}.

Examples


#Creates a fake dataframe
set.seed(1234)
df <- as.data.frame(cbind(Y=rnorm(30, 30,9), X=rnorm(30, 450,133)))
#fitting a candidate model
mod1 <- lm(Y~X, data=df)
#Using the valesta function
valesta(y.obs=df$Y,y.pred=fitted(mod1))

datana documentation built on Aug. 18, 2025, 5:18 p.m.