I know a question of this nature has been posted previously but I am in doubt whether my data table is peculiar to my prediction model.
I have noise data (dependent variable) which I sampled at different intervals of distance (independent variable) from the road.
My data looks something like this. I conducted multiple measurements at each intervals:
> dput(data.frame(dist, leq))
structure(list(dist = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 10L,
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 20L, 20L,
20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 40L, 40L, 40L,
40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L, 40L), leq = c(65.15,
68.55, 66.06, 65.99, 64.86, 66.77, 65.25, 67.65, 66.74, 66.71,
64.43, 65.61, 65.02, 66.04, 61.54, 62.84, 64.05, 67.57, 64.42,
62.58, 63.24, 62.86, 62.07, 66.08, 61.2, 65.73, 60.95, 65.77,
59.45, 60.13, 62.82, 64.96, 61.13, 62.45, 60.43, 61.58, 65.25,
60.04, 61.21, 59.44, 62.57, 62.41, 58.78, 58.88, 64.04, 59.37,
57.89, 61.42, 58.4, 62.13, 58.93, 63.95, 56.25, 56.37, 56.93,
57.37, 66.04, 57.07, 58.54, 57.65)), .Names = c("dist", "leq"
), row.names = c(NA, -60L), class = "data.frame")
I log transformed my independent variable
logdist<-log(dist+0.1)
after running a Kolmogorov‑Smirnov test (statistically significant, data is not normally distributed) and a Shapiro test (statistically significant, the residuals aren't normally distributed).
This is what it looks like plotted:
I then ran a linear regression for noise and distance
Call:
lm(formula = logdist ~ leq)
Residuals:
Min 1Q Median 3Q Max
-3.0943 -0.7311 0.0163 0.8371 3.6267
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 29.88748 3.83556 7.792 1.37e-10 ***
leq -0.45159 0.06129 -7.368 7.07e-10 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1.535 on 58 degrees of freedom
Multiple R-squared: 0.4834, Adjusted R-squared: 0.4745
F-statistic: 54.28 on 1 and 58 DF, p-value: 7.066e-10
This is where I'm lost; I want to predict mean noise level from 0 to a 100 m in steps of 10 m, and then identify the mean predicted noise level at 50 m:
pred<-predict(reg2, data.frame(logdist=seq(0, 100, 10)))
dist<-seq(0,100,10)
cbind(dist2,reg2)
pred2<-predict(reg2,data.frame(logdist=50),interval="predict")
My results:
> pred2
fit lwr upr
1 0.46661760 -2.64902534 3.582261
2 -1.06877685 -4.25518137 2.117628
3 0.05567379 -3.07361956 3.184967
4 0.08728485 -3.04081911 3.215389
5 0.59757771 -2.51454427 3.709700
6 -0.26495270 -3.40761110 2.877706
7 0.42145894 -2.69549138 3.538409
8 -0.66234891 -3.82482580 2.500128
9 -0.25140510 -3.39345106 2.890641
10 -0.23785750 -3.37929522 2.903580
I'm honestly beyond confused on how to interpret my data. I feel like I missed a step. I know that I need to reverse the transformation to make practical sense of my predictions, but even then the values seem well below than what I would be expecting.