I have a PDF (Probability Density Function) generated from a vector of 1,000,000 empirical values. This empirical PDF is heavily skewed to the right.
In this form, I can't make accurate predictions using a linear regression.
To fix this, is there some method to find the function F(x) to transform (i.e. "squash") the values in the vector into a standard normal distribution, so I can feed said transformed vector into a linear regression?
Of course, this would also involve finding the inverse of F(x) that transforms (i.e. "de-squashes") any predictions back into the original empirical PDF.
What I have tried
So far, I have managed to generate the density function from the empirical data:
Here is the R code:
par(mfrow=c(2,1))
install.packages("bootstrap")
library(bootstrap)
data(stamp)
nobs <- dim(stamp)[1]
hist(stamp$Thickness,col="grey",breaks=100,freq=F)
dens <- density(stamp$Thickness)
lines(dens,col="blue",lwd=3)
plot(density(stamp$Thickness),col="black",lwd=3, main="Simulation to choose density plot")
for(i in 1:10)
{
newThick <- rnorm(nobs,mean=stamp$Thickness,sd=dens$bw*1.5)
lines(density(newThick,bw=dens$bw),col="grey",lwd=3)
}
# If I wanted to do a linear regression to predict stamp thickness,
# what is the function F(x) to "squash" (i.e. transform) the "stamp"
# vector into a normal distribution, and the corresponding inverse
# function Finv(x) to "desquash" (i.e. untransform) any predictions back
# into the original prediction?
Update 1
@Andre Silva sugggested that:
What need to have normal distribution are the residuals (predicted versus observed) derived from your (multiple) linear regression model.
According to post on Multiple Linear Regression:
After fitting the regression line, it is important to investigate the residuals to determine whether or not they appear to fit the assumption of a normal distribution. A normal quantile plot of the standardized residuals y - is shown to the left. Despite two large values which may be outliers in the data, the residuals do not seem to deviate from a random sample from a normal distribution in any systematic manner.
Update 2
See Left skewed vs. symmetric distribution observed for R code that illustrates that the only relevant concern is if the residuals are normally distributed.