Comments (2)
I think the confusion here just stems from what the estimates in the regression table mean. This can get sort of tricky, which is why I always tell students to visualize model predictions with something like sjPlot
;)
This is what the four lines of the fixed effects are telling you:
(Intercept) - The predicted value of log_Grazing_Percentage
when Period
and Count_RSSI_GE_Minus50
are at zero. I'm assuming that Period is only really ever 1 or 2 in your data, so this value isn't easily interpretable.
Period - The difference in log_Grazing_Percentage
for a change of 1 in Period
when Count_RSSI_GE_Minus50 is at zero
Count_RSSI_GE_Minus50 - The estimated slope of this variable when Period
is at zero. This isn't directly interpretable, because it is extrapolating beyond the observed values of Period to guess what the effect would be if the linear trends fit by the data continued.
Period:Count_RSSI_GE_Minus50 - Interactions can always be thought of in two reversible ways, so this is both how the effect of Period
changes based on the values of Count_RSSI_GE_Minus50
, and how the slope of the effect for Count_RSSI_GE_Minus50
changes based on Period
.
So, to get the slope of Count_RSSI_GE_Minus50
when Period=1
, you need to add multiply the interaction term by one (for Period = 1) and add it to the slope of your continuous variable estimated for when Period = 0
.
# Slope of Count RSSI for Period = 1
0.006633 + (-0.003454*1)
[1] 0.003179
Then to get the slope when Period = 2
, you multiply the interaction term by 2
# Slope of Count RSSI for Period = 2
> 0.006633 + (-0.003454*2)
[1] -0.000275
The following code tests some values to make predictions manually, and it looks like everything checks out:
Intercept <- 1.274435
Period <- -0.012244
Count_RSSI <- 0.006633
Interaction <- -0.003454
# Slope of Count RSSI for Period = 1
Count_RSSI + (Interaction*1)
# Slope of Count RSSI for Period = 2
Count_RSSI + (Interaction*2)
# Predicted log grazing when Period = 1 and RSSI = 0
Intercept + (Period*1) + (Count_RSSI*0) + (Interaction*0*1)
# Predicted log grazing when Period = 1 and RSSI = 80
Intercept + (Period*1) + (Count_RSSI*80) + (Interaction*80*1)
# Predicted log grazing when Period = 2 and RSSI = 0
Intercept + (Period*2) + (Count_RSSI*0) + (Interaction*0*2)
# Predicted log grazing when Period = 2 and RSSI = 80
Intercept + (Period*2) + (Count_RSSI*80) + (Interaction*80*2)
Also, I think you may want to fit Period as a random slope instead of the structure you currently have. Something like this may be more appropriate, although I would definitely check with someone in your field who has domain knowledge who is comfortable with using mixed models
lmer(log_Grazing_Percentage ~ Period + Count_RSSI_GE_Minus50 + Period:Count_RSSI_GE_Minus50 +
(1 + Period| Animal_id)
from sjplot.
By default, predict()
is used, however, you could also switch to a different package. The main points are:
-
plot_model(type = "pred")
plots adjusted predictions (sometimes "estimated marginal means") for the response value, i.e. it shows you the predicted value of your outcome, depending on meaningful (or representative) values of certain predictors (so called focal terms).The formula (by default) is just:
y = b0 + b1*x1 + b2*x2 + ... bn*xn
, where you vary the value of your focal terms, and hold the other values constant. -
Results may differ, depending on how you hold constant the non-focal terms. You can answer slightly different question based on this decision. I suggest reading this vignette for details.
Furthermore, if you're interested in predictions, I suggest using the ggeffects package directly. sjPlot::plot_model(type = "pred")
is just a wrapper around that package, but less flexible.
The situation with mixed models is slightly more complicated, because you can condition on random effects or not. There's also a vignette here.
from sjplot.
Related Issues (20)
- Feature Request: plots using standard error for error bars rather than confidence intervals
- Vertically Merging Univariate Tables from Random Effect Models with sjPlot HOT 1
- Extracting BIC
- What is the predicted "risk score" for cox models?
- plot_model() can't change legend title when color is set to black and white
- Error ci_style with typre="pred" for ggeffects version 1.3.2 HOT 6
- sjt.pca() function HOT 1
- Can't load sjPlot: object ‘standard_error_robust’ is not exported by 'namespace:parameters' HOT 4
- support for a quantile regression
- factor level labels not corresponding
- questions about *, ** and ***
- "Model has log-transformed response. Back-transforming predictions to original response scale. Standard errors are still on the log-scale." - solution? HOT 1
- `tab_model` not working with large `rlmerMod` model with compositional data
- Site Not Found HOT 1
- Wrong AIC values with tab_model HOT 2
- Plotting three-way interactions without panels?
- Confidence interval bands partially or completely disappear when axes rescaled
- Discrepancy between summary() and tab_model() for brms models HOT 5
- I installed the sjPlot package successfully but when I opened it with library I got that it called the estimability package HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sjplot.