Learn R Programming

biometrics (version 1.0.1)

valesta: 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 aggregated difference (\(AD\)), the root mean square differences (\(RMSD\)), and the aggregated of the absolute value differences (\(AAD\)). All of them area based on $$r_i = y_i - \hat{y}_i$$ where \(y_i\) and \(\hat{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)

Value

The main output 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.

Arguments

y.obs

observed values of the variable of interest

y.pred

predicted values of the variable of interest

Author

Christian Salas-Eljatib.

Details

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

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. 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. tools:::Rd_expr_doi("10.4067/S0717-92002002000200009").

Examples

Run this code

#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))

Run the code above in your browser using DataLab