# Running transformed data with a Generalized Linear Model in SPSS

I am running a generalized linear model in SPSS on data highly skewed to the right with a bunch of zeroes (average # caterpillars per tree species branch sampled) so I decided to use the Tweedie distribution.

In the model I ran both untransformed data (with link=log) as well as $\log(x+1)$ transformed data (with link=identity). The latter model had a much smaller (more negative) AICc value than the untransformed data with link=log.

Is it valid to run the GLM with $\log(x+1)$ transformed data if link=identity? Or am I violating some kind of assumption about the model?

First, your AICs aren't comparable across models with different target variables, in your case, $x$ and $\log(x+1)$. These target variables have different density functions - Tweedie and something that might be called "log(x+1) - Tweedie" - so the deviance calculation will result in different numbers.

To see a concrete example of this, in R unfortunately (given that you're using SPSS), I generate 1,000 standard normal variates $x$, then calculate $-2\log \text{Likelihood}$ for them and for $\exp\{x\}$, using in the former case the standard Normal distribution and the latter the standard Lognormal distribution:

> z <- rnorm(1000)
> -2*sum(dnorm(z,log=TRUE))
[1] 2902.033
> -2*sum(dlnorm(exp(z),log=TRUE))
[1] 2824.019


However, $z$ really is distributed according to a standard Normal, and $\exp\{z\}$ really is distributed according to a standard lognormal. Both models are correct, but obviously they will generate different AICs given that they are generating different likelihoods.

The change in link function from log to identity doesn't make up for that. That is because the link function only relates the mean to the linear predictors, not the functional form of the distribution. You can have a Normal variate with $\mu = X\beta$ or $\log\mu = X\beta$, and either way it's still a Normal variate - you can observe a negative value for your target variable, for example, regardless of which link function you use, but you can't if the target variable is actually distributed lognormally.

On to your actual question - it's perfectly valid to transform your target variable however you want before modeling it. You can also pile any link function you want, well any feasible one at any rate (no negative values for the mean of a Poisson!), on top of your transform. It's all just math at this point. The difficulty comes before and after the math - the "before" being identifying reasonable transforms, distributions, and link functions given your data and objectives, and the "after" being interpreting the results. Plots are a big help here, and plots of residuals from a model vs. estimated values from the model can also be helpful when iterating through model designs.

Unfortunately I know nothing about your application area and the standard models in use, so I can't offer any more specific help.