简体   繁体   中英

How can I graph to check in what way a significant predictor is effecting my outcome variable?

How can create a visual to see how time of day effected morality levels? time of day is a 1/2 variable and morality was measured by a scale.

Reg2<-lm(Morality~TimeofDay,data=Data316b)
summary(Reg2)

Call:
lm(formula = Morality ~ TimeofDay, data = Data316b)

Residuals:
     Min       1Q   Median       3Q      Max 
-1.43214 -0.48304 -0.06607  0.47589  1.21786 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)   3.5500     0.1915  18.539   <2e-16 ***
TimeofDay     0.4821     0.1915   2.107   0.0418 *

Signif. codes:  0 ‘***' 0.001* * 0.01'*' 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.6633 on 38 degrees of freedom
  (3 observations deleted due to missingness)
Multiple R-squared:  0.1046,    Adjusted R-squared:  0.081 
F-statistic: 4.438 on 1 and 38 DF,  p-value: 0.04181

I think you want

plot(Morality~TimeofDay,data=Data316b)
Reg2 <- lm(Morality~TimeofDay,data=Data316b) summary(Reg2)
abline(Reg2)

or:

library("ggplot2")
ggplot(Data316b,aes(TimeofDay,Morality))+
   geom_point() + geom_smooth(method="lm")

PS are you really measuring morality [sic] as a function of time-of-day, or is it mortality that's changing??

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM