Description Usage Arguments Details Value Author(s) See Also Examples

Perform a test for goodness-of-fit.

1 2 |

`target` |
a data frame or vector of the observed summary statistic. |

`sumstat` |
a vector, matrix or data frame of the simulated summary statistics. |

`nb.replicate` |
number of replicates used to estimate the null distribution of the goodness-of-fit statistic. |

`tol` |
a tolerance rate. Defaults to 0.01 |

`statistic` |
define the goodness-of-fit statistic. Typical values are |

`subset` |
optional. A logical expression indicating elements or rows to keep.
Missing values in |

`trace` |
a boolean indicating if a trace should be displayed when calling the
function. Default to |

The null distribution is estimated using already performed simulations
contained in `sumstat`

as pseudo-observed datasets. For each
pseudo-observed dataset, the rejection algorithm is performed to obtain
a value of the goodness-of-fit statistic. A better estimate of the
P-value is obtained for larger `nb.replicate`

but the running time
of the function is increased.

An object of class `"gfit"`

, which is a list with the following
elements

`dist.obs` |
the value of the goodness-of-fit statistic for the data. |

`dist.sim` |
a vector of size |

Louisiane Lemaire and Michael Blum.

`abc`

, `plot.gfit`

, `summary.gfit`

,
`gfitpca`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ```
## human demographic history
require(abc.data)
data(human)
## Perform a test of goodness-of-fit.
## The data are the European data and we test the fit of the bottleneck
## model (good fit) and of the constant-size population model (poor fit)
## Use larger values of \code{nb.replicate} (e.g. 1000)
## for real applications
res.gfit.bott=gfit(target=stat.voight["italian",],
sumstat=stat.3pops.sim[models=="bott",], statistic=mean, nb.replicate=10)
res.gfit.const=gfit(target=stat.voight["italian",],
sumstat=stat.3pops.sim[models=="const",], statistic=mean, nb.replicate=10)
## Plot the distribution of the null statistic and indicate where is the
## observed value.
plot(res.gfit.bott, main="Histogram under H0")
## Call the function \code{summary}
## It computes the P-value, call \code{summary} on the vector
## \code{dist.sim} and returns the value of the observed statistic
summary(res.gfit.bott)
``` |

```
Loading required package: abc.data
Loading required package: nnet
Loading required package: quantreg
Loading required package: SparseM
Attaching package: 'SparseM'
The following object is masked from 'package:base':
backsolve
Loading required package: MASS
Loading required package: locfit
locfit 1.5-9.1 2013-03-22
$pvalue
[1] 0.5
$s.dist.sim
Min. 1st Qu. Median Mean 3rd Qu. Max.
1.626 1.828 1.997 2.195 2.374 3.728
$dist.obs
[1] 1.997769
```

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.