Description Usage Arguments Details Value Examples

This function predicts values for two different scenarios over a range of values. It then takes the differences between the different simulations to return first differences for each value.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ```
mnl_fd_ova(
model,
data,
x,
z,
z_values,
xvari,
scenname,
scenvalues,
by = NULL,
nsim = 1000,
seed = "random",
probs = c(0.025, 0.975)
)
``` |

`model` |
the multinomial model, from a |

`data` |
the data with which the model was estimated |

`x` |
the name of the variable that should be varied (the x-axis variable in prediction plots) |

`z` |
define the variable for which you want to compute the difference. |

`z_values` |
determine the two values at which value you want to fix the scenario ( |

`xvari` |
former argument for |

`scenname` |
former argument for |

`scenvalues` |
former argument for |

`by` |
define the steps of |

`nsim` |
numbers of simulations |

`seed` |
set a seed for replication purposes. |

`probs` |
a vector with two numbers, defining the significance levels. Default to 5% significance level: |

The function uses the `mnl_pred_ova`

function for each scenario.
The results of these predictions are also returned and can therefore be
easily accessed. If you need predictions for multiple scenarios, you can use
this function to both plot the predictions for each scenario and the
differences between them.

The function returns a list with several elements. Most importantly the list includes the simulated draws 'S', the simulated predictions 'P', and a data set for plotting 'plotdata'.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ```
library(nnet)
library(MASS)
dataset <- data.frame(y = c(rep("a", 10), rep("b", 10), rep("c", 10)),
x1 = rnorm(30),
x2 = rnorm(30, mean = 1),
x3 = sample(1:10, 30, replace = TRUE))
mod <- multinom(y ~ x1 + x2 + x3, data = dataset, Hess = TRUE)
fdif <- mnl_fd_ova(model = mod, data = dataset,
x = "x1", z = "x3",
z_values = c(min(dataset$x3), max(dataset$x3)),
nsim = 10)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.