# Sum of predicted values to the power of 10 [closed]

When I take predicted values from a linear model to the power of 10, their sum is always a lot bigger than the original. Is it even allowed to sum, and does anybody have a reference for how this should be done?

E.g. lets say x is log(body.mass) and y is log(population.size). If I from the predicted values need to get the actual population size I would need sum(10^predicted.values) but this is always smaller than the original data.

Simple example in R code:

n = 10000
x = rnorm(n)
y = x + rnorm(n)
m = lm(y ~ x)
p = predict(m)

sum(10^y)/sum(10^p)


Gives results (if run a few times) from 6 to 40 times as many total individuals in the original data than the predicted.

• Could you tell us more on why exactly are you doing, what you're doing? – Tim Mar 26 '18 at 16:05
• Yes. I am estimating the total population size from body mass, per species, for species with unknown population sizes but known body masses. And we are using the log(pop.size)~log(body.mass) as regression since that is a pretty strong relationship and body mass is known. – Rasmus Ø. Pedersen Mar 26 '18 at 16:12
• I think you may be missing two steps between lines "y=..." and "m = ...". You should put in something like "x2 = log10(x)" and "y2 = log10(y)". Then your line "m" should be "m = lm(y2 ~ x2)". – EngrStudent - Reinstate Monica Mar 26 '18 at 18:43
• You mean that the sum or predicted values is smaller, right? sum(10^p)<sum(10^y) – Sextus Empiricus Mar 26 '18 at 23:28

You are tripped up by a common pitfall in the lognormal distribution: the expectation of the lognormal is not the exponential of the expectation $\mu$ on the log scale. You need to account for the heavy-tailedness by including the residual variance and calculate $e^{\mu+\sigma^2/2}$.
sum(exp(y))/sum(exp(p))