[R] Negative values on output
sam cruickshank
sam_l_cruickshank at hotmail.com
Tue Aug 19 20:09:13 CEST 2014
Good afternoon,
I am completed a linear regression model which I personally am happy with the output and residual charts (although they are a bit bunched). I have been using visreg() to visualise my data, and although I have logged the dependent variable (as it is cost data), on one of the graphical outputs I am getting negative fitted values for one of the Continents. Attached is the data used, below is the code for the model and graph. If anyone has any ideas I would hugely appreciate it, I tried a glm with log link too and this didn't help.
LM22 <- lm(logTotal ~ logArea + Continent + factor(Method1) + Popdens, data=dummy)
Output Residuals: Min 1Q Median 3Q Max -1.22742 -0.31675 -0.00909 0.28885 1.20224
Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -1.40972 0.77661 -1.815 0.081506 . logArea 0.03811 0.04041 0.943 0.354619 ContinentAsia 3.51165 0.80009 4.389 0.000182 ***ContinentAustralasia 3.48549 0.97433 3.577 0.001454 ** ContinentEurope 2.44829 0.82369 2.972 0.006452 ** ContinentGlobal 2.37910 1.00668 2.363 0.026197 * ContinentNorth America 2.27953 0.62960 3.621 0.001303 ** ContinentSouth America 3.60997 0.77627 4.650 9.22e-05 ***factor(Method1)2 1.11259 0.38386 2.898 0.007696 ** factor(Method1)3 0.82519 0.47470 1.738 0.094459 . factor(Method1)4 -0.06737 0.67341 -0.100 0.921104 Popdens -0.14261 0.31675 -0.450 0.656435 ---Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1
Residual standard error: 0.6151 on 25 degrees of freedom (12 observations deleted due to missingness)Multiple R-squared: 0.6998, Adjusted R-squared: 0.5677 F-statistic: 5.297 on 11 and 25 DF, p-value: 0.0002714
visreg(LM22) gives me a graph with "Africa" being within the realm of negative "Total" which is impossible. If you tell me how can provide the data and graphs, but the email was kicked back with them in.
[[alternative HTML version deleted]]
More information about the R-help
mailing list