I have used the vglm() function from the VGAM package to obtain a Weibull model for some data. I would like to plot the curve that this model is represented by. How do I do this?
Here's my input and output (I am comparing 'p_seen' to 'calculated_logmar', which exist in the dataframe 'dframe1'):
> my_model <- vglm(formula = p_seen ~ calculated_logmar, family = weibull, data = dframe1) Pearson Residuals: log(shape) log(scale) 1 0.78928 -0.093136 2 -1.21092 -0.978527 3 0.12519 0.020018 Coefficients: Estimate Std. Error z value (Intercept):1 1.4797e+01 1.0803e+00 13.69619 (Intercept):2 4.5824e-06 2.3095e-05 0.19841 calculated_logmar -1.5324e+01 1.4448e+00 -10.60582 Number of linear predictors: 2 Names of linear predictors: log(shape), log(scale) Dispersion Parameter for weibull family: 1 Log-likelihood: 9.46132 on 3 degrees of freedom Number of iterations: 30
I understand that the coefficients must relate somehow to the model itself, but I have no idea how to turn these coefficients into meaningful plots.
PS: I would like to use ggplot2 to visualise my data if possible.
Edit: I have tried using the command:
plotvgam(my_model, se = TRUE, lcol = dframe1$calculated_logmar, scol = dframe1$calculated_logmar, which.term = 1)
This gives me a plot of 'calculated_logmar' against 'partial for calculated_logmar'. What I'm looking for is the actual curve of the model, showing calculated_logmar plotted against p_seen. If it is possible, I'd like to render this using ggplot2. Any help would be appreciated.