OpenDendro / dplR

This is the dev site for the dplR package in R
37 stars 14 forks source link

use absolute power for power transformation as per Cook and Peters #1

Closed cszang closed 3 years ago

cszang commented 4 years ago

In theory (and as pointed out by Feng Wang), the exponent for power transformation can be (slightly) negative. Cook and Peters (1997) just use the absolute value in this case, even if this is not reflected in the given formula.

sklesse commented 4 years ago

I was just gonna write something similar. Although, I think the choice to use the absolute value is a bit arbitrary. Either way, p has to be constrained to be 0<p<=1. If "p" goes negative then the variability gets sort of inverted. So, if "p" goes negative per the linear fit, one could simply constrain the power transformation to a log-transformation.

X2 <- ifelse(p<=0,log(X),X^p) instead of just X2<-X^p

More on the conceptual side and totally beside the point of constraining p: Why should p vary from tree to tree at a site? Shouldn't the spread vs. level relationship be a "universal" relationship at a given site?

A modification of fit.lm() to contain a mixed-effects model in the form of: ... lmm<-lmer(run.S~run.M+(1ID)+(1|year),df) b <- fixef(lmm)[2] 1 - b ... would be an interesting solution.