HARPgroup / r-dh-ecohydro

A set of R scripts for generating Ecological Limit Functions (ELF), storing the modeled output with REST in drupal VAHydro (dH), and a set of scripts for querying and analyzing processed ELF data
0 stars 1 forks source link

PWIT using root mean square error (RMSE) not MSE #33

Closed passeroe closed 6 years ago

passeroe commented 6 years ago

Picking through the PWIT script I discovered that the variable we are labeling MSE is in fact the root mean squared error (aka the residual standard error in R). This value was used to determine which piecewise regression had the best fit. Our current scripts only find one RMSE value which represents the entire piecewise function.

I believe we can find the actual MSE by squaring the RMSE. If we think using the RMSE instead of the MSE is still fine, we just need to change the variable name in the scripts and update our documentation.

I've attached an example that shows that we are saving the RMSE not the MSE. for(n in 1:length(breaks)){ piecewise1 <- lm(y ~ x*(x < breaks[n]) + x*(x >= breaks[n])) mse[n] <- summary(piecewise1)[6] }

image