# mnl_fd_ova: Multinomial First Differences Prediction (Observed Value... In MNLpred: Simulated Predicted Probabilities for Multinomial Logit Models

## Description

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.

## Usage

 ``` 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) ) ```

## Arguments

 `model` the multinomial model, from a `multinom`()-function call (see the `nnet` package) `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 (`z`). The first differences will be computed by subtracting the values of the first supplied scenario from the second one. `xvari` former argument for `x` (deprecated). `scenname` former argument for `z` (deprecated). `scenvalues` former argument for `z_values` (deprecated). `by` define the steps of `x`. `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: `c(0.025, 0.975)`

## Details

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.

## Value

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'.

## Examples

 ``` 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) ```

MNLpred documentation built on July 16, 2021, 9:06 a.m.