Hi,
I am trying to plot densities for the logit and probit models with plot function but it's not working out.
The code is below.
if ggplot2 can be used to achieve same outcome then it would be of great help.
dataset available here MP NSS.dta - Google Drive
If you check out this post, Plotting your logistic regression model, it takes you through both the base and ggplot2 versions of making a chart from the model. The R Markdown document is also available:
If you can make this into a self-contained reprex, so others can see the code and output, that would be great. It's hard to tell what the problem is from description alone, and it's a tall-ask of others to download an external data file, etc.
For curve() it wants an expression that uses the variable x. Replace MP_NSS$unitvalue_rice_wheat with x. Use add = TRUE to draw on top of the previous plot.
So, if you take a look at the URL here, you can see it begins with localhost, which means it's only on your computer (it's not a link to something other people can see on the web).
I definitely recommend taking the 10-15 minutes at some point to watch Jenny Bryan’s quick, helpful overview of the package and how to use it (Jenny starts ~10:40):
Others on these boards, including those new to R (looking at you, @christinelly ), can definitely attest to the worthiness (and relative ease) of getting reprex-ing down!