Description Usage Arguments Details Value Data Processing Steps Author(s) References

`dspDat`

is used to create an object of `class`

`"dspDat"`

;
the resultant object may then be used as input to the `dsp`

function to
sample an MCMC chain for the methodology proposed by Dunson and Stanford in
*Bayesian Inferences on Predictors of Conception Probabilities* (2005).
The `dspDat`

function is essentially a convenience function provided to
(if necessary) merge multiple datasets of varying time-specificities, as is
common for the type of fertility data for which the aformentioned methodology
is designed.

1 2 |

`formula` |
An object of class |

`baseline` |
Either |

`cycle` |
Either |

`daily` |
A |

`idName` |
A string specifying the name of the column in each of the
non- |

`cycName` |
A string specifying the name of the column in each of the
non- |

`sexName` |
A string specifying the name of the column in the |

`fwName` |
If non- As a convenience, if the name specified by |

`fwLen` |
A value specifying the number of days belonging to a cycle's fertile window. The length of the fertile window is assumed to be same across all cycles. |

`useNA` |
One of either |

The `class`

`"dspDat"`

is equipped with a `summary`

function.

It is natural to record fertility study data in up to three datasets
of varying time-specificities. First, a dataset of variables that do not
change throughout the study which we denote as the `baseline`

data,
second a dataset of cycle-specific variables which we denote as the
`cycle`

data, and third a dataset of day-specific variables which we
denote as the `daily`

data. `dspDat`

is provided as a
convenience function which merges all of the provided datasets into one
day-specific dataset and creates some internal objects for use by the MCMC
sampler function `dsp`

.

At a minimum the `daily`

data must be provided so that daily
intercourse data is available. `baseline`

and `cycle`

data are
optional, so long as pregnancy information is included in one of either the
`cycle`

data or `daily`

data. For example, if the data was
collected only in a daily format or has already been combined, then only a
day-specific dataset would need to be passed to `dspDat`

.

The usual `model.matrix`

is used to construct the design
matrix for the specified model, so any of the usual
`formula`

commands are available. In particular, a
formula has an implied intercept term which may not be desireable for these
types of models. To remove this use either `y ~ x - 1`

or ```
y ~ 0
+ x
```

.

`dspDat`

returns an object of `class`

`"dspDat"`

. An object of class `"dspDat"`

is a list containing
the following components:

`cleanDat`

A list containing objects

`bas`

,`cyc`

, and`day`

, which are the datasets after removing missing and reducing the`daily`

data to fertile window days as described in*Data Processing Steps*. If`NULL`

was supplied for`baseline`

or`cycle`

, then the value of`bas`

or`cyc`

is also`NULL`

.`redDat`

A list containing objects

`bas`

,`cyc`

, and`day`

, which are the datasets after reducing the cleaned data to the set of IDs and cycles that are common to every non-`NULL`

dataset. If`NULL`

was supplied for`baseline`

or`cycle`

, then the value of`bas`

or`cyc`

is also`NULL`

.`combDat`

*******

`modelObj`

A list containing objects

`Y`

,`X`

,`U`

, and`id`

.`Y`

,`X`

,`U`

are as in the Dunson and Stanford paper, and`id`

is a vector of subject IDs such that each observation specifies the subject ID for the corresponding observation.`samplerObj`

A list containing objects for use by the

`dsp`

function when executing the MCMC algorithm`datInfo`

A list containing objects for use by the

`summary`

function

- Cleaning data
If either a

`baseline`

or`cycle`

dataset is provided, then all observations that contain missing data among the model variables are removed. All non-fertile window days are removed from the`daily`

dataset, and any cycles that either contain missing in the fertile window or have too many or too few fertile window days are also removed.- Reducing data
Each non-

`NULL`

dataset is reduced to the set of IDs and cycles that are common to every non-`NULL`

dataset.

David A. Pritchard and Sam Berchuck, 2015

Dunson, David B., and Joseph B. Stanford. "Bayesian inferences on
predictors of conception probabilities." *Biometrics* 61.1 (2005):
126-133.

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.