pVals | R Documentation |

This is one of the auxiliary functions used to execute the rpdTest function. This function can be used to calculate p-values based on Monte Carlo simulation. Users generally do not need to call this function except for testing purposes. For more detailed description one can find inrpdTest.

```
pVals(x, p, lambda = 1, B = 200, z = 40, rs = 1250, n.cores, nDim, r)
```

`x` |
the obtained multinomial distribution data.Same data structure as the data parameter in rpdTest. |

`p` |
the probability vector in the null hypothesis. It is necessary to ensure beforehand that the vectors are valid. |

`lambda` |
a control parameter of the statistic calculation, adjusting it will significantly change the final obtained statistic. |

`B` |
an integer specifying the number of simulation data on the expected null distribution (p) of the Monte Carlo simulation. |

`z` |
an integer specifying the number by which to divide the observation data group in a Monte Carlo simulation. |

`rs` |
an integer that adjusts the number of statistics calculated in simulation. |

`n.cores` |
an integer used to specify the number of cores used to perform parallel operations. The default is to use the maximum number of cores available to the computer minus one. |

`nDim` |
an integer indicating the dimension of the uniformly distributed vectors generated during the computation of the statistic. It is equal to the number of experiments for the multinomial distribution. |

`r` |
an integer indicating the dimension of the data parameter. It is equal to the number of possible outcomes of the multinomial distribution. |

an numeric value indicating simulated p-value.

```
d <- c(20,40)
#The next line is equivalent to rpdTest(d,sim.pValue = TRUE,n.cores = 2)$p.value
#It usually takes 1-2 minutes to perform this calculation process
pVals(d, c(1/2,1/2), B = 200, z = 40, rs = 1250, n.cores = 2, nDim = sum(d), r = length(d))
```

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.