I'm trying to change negative values to positive from my linear model.
Here is my attempt:
dist <-
c(2, 2.1, 2.21, 2.31, 2.41, 2.52, 2.62, 2.72, 2.83, 2.93, 3.03,
3.14, 3.24, 3.34, 3.45, 3.55, 3.66, 3.76, 3.86, 3.97, 4.07, 4.17,
4.28, 4.38, 4.48, 4.59, 4.69, 4.79, 4.9, 5)
accuracy <-
c(0.13, 1.21, 2, 0.78, 0.4, 1.47, 0.28, 2.18, 0.74, 0.51, 1.12,
0.48, 1.71, 3.35, 1.36, 0.95, 0.78, 3.51, 0.24, 5, 3.25, 4.29,
7.33, 4.12, 20.25, 7.05, 36.25, 2.78, 14.93, 13.45)
> summary(lm(glm(log(accuracy)~log(dist))))
Call:
lm(formula = glm(log(accuracy) ~ log(dist)))
Residuals:
Min 1Q Median 3Q Max
-2.57614 -0.72039 0.02401 0.56570 1.73818
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -3.7278 0.8123 -4.589 8.52e-05 ***
log(dist) 3.6107 0.6513 5.544 6.29e-06 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.9594 on 28 degrees of freedom
Multiple R-squared: 0.5233, Adjusted R-squared: 0.5062
F-statistic: 30.73 on 1 and 28 DF, p-value: 6.291e-06
I've used the logarithm to try make the intercept a positive number, but I still get a negative.
How do I make the intercept a positive number?