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 Equation - need to take log(x) #34

Closed passeroe closed 6 years ago

passeroe commented 6 years ago

During breakpoint calculations where we use the lm() function to find piecewise regressions, we need to take the log(x). We use log(x) for our upper quantile calculations and plot on a semi-log scale. Since we are assuming this data is logarithmic, we need to transform the x-values to be able to find a meaningful piecewise linear regression.

This is the change I propose making. I've already tested it, and the code works fine. It improved r^2 values and increased breakpoint estimates in the two datasets I was able to look at.

for(n in 1:length(breaks)){ piecewise1 <- lm(y ~ log(x)*(x < breaks[n]) + log(x)*(x >= breaks[n])) mse[n] <- summary(piecewise1)[6] }

jenniferRapp commented 6 years ago

I know the code was updated today. I pulled it and updated my system. For some reason it is not creating the pw-it graphs and storing them locally. It is creating quantreg, ymax, and pw_it_RS.

Question, did you also update pw_it_RS?

passeroe commented 6 years ago

I also updated pw_it_RS.