I read some questions about this subject, but I couldn't find an answer.
I have 30 samples and my model is:
y ~ poly(x,3) + z
The result is:
Estimate SE Z P
(Intercept) -2.851 0.234 -12.173 < 0.0001
poly(x)1 -0.784 1.036 -0.758 0.449
poly(x)2 1.937 0.845 2.293 0.022 *
poly(x)3 2.754 0.768 3.587 0.0003 **
z 0.342 0.105 3.268 0.001 *
First, I've tried to plot the curve using geom_smooth
.
a) geom_smooth(method = "betareg", se=FALSE, formula = y ~ poly(x,3))
b) geom_smooth(method = "betareg", se=FALSE, formula = y ~ z)
Then, I got these graphics: https://i.stack.imgur.com/PSKNG.png But, in this case, I didn't consider the real model, but modeled the variables separately, which is probably a wrong way to show the data.
Second, I tried to use visreg
, but it does not work with "poly(x,3)"
in the model: "Error in poly(x, 3): 'degree' must be less than number of unique points". If I use "I(x^3)"
it works, but it changes the model a little.
Third, I'm trying to use plogis
, but I don't know how can I insert the parameter estimates in the function and then in the ggplot graph.