0

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.

  • Hi Barbara, welcome to Stack Overflow. It will be much easier to help if you provide at least a sample of your data with `dput()` or if your data is very large `dput(data[1:10,])`. You can edit your question and paste the output. You can surround it with three backticks (```) for better formatting. See [How to make a reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) for more info. – Ian Campbell Apr 23 '20 at 15:55

1 Answers1

0

I think gridExtra can help you. since you create separate ggplot objects yourself (one for each graphic you want to obtain). Here are a few examples you can start with.

Arranging multiple grobs on a page

robintux
  • 93
  • 1
  • 9