# nauf.pmm.stan: Posterior samples of marginal means from Bayesian 'nauf'... In nauf: Regression with NA Values in Unordered Factors

## Description

When `nauf_pmmeans` is used with Bayesian regressions, the elements of the resulting `nauf.pmm.list` have class `nauf.pmm.stan`.

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24``` ```## S3 method for class 'nauf.pmm.stan' summary(object, probs = c(0.025, 0.975), type = c("link", "response"), ...) ## S3 method for class 'summ.nauf.pmm.stan' print(x, row.names = FALSE, mcse = FALSE, rhat = NULL, ...) ## S3 method for class 'nauf.pmm.stan' as.array(x, ...) ## S3 method for class 'nauf.pmm.stan' as.matrix(x, ...) ## S3 method for class 'nauf.pmm.stan' print(x, ...) ## S3 method for class 'nauf.pmm.stan' as.data.frame(x, row.names = NULL, optional = FALSE, ...) ## S3 method for class 'summ.nauf.pmm.stan' as.data.frame(x, row.names = NULL, optional = FALSE, ...) ```

## Arguments

 `object` A `nauf.pmm.stan` object. `probs` A vector of quantiles to calculate for the estimates. The default is a 95 The median (0.5) is always added regardless of whether it is specified. `type` If `"link"` (the default), then the estimates are not transformed prior to summary; if `"response"`, then the inverse link function in the object's `family` element is applied to the `samples` element prior to summary. `...` See the `Methods` section. `x` Either a `nauf.pmm.stan` object, or the `summ.nauf.pmm.stan` object returned by calling `summary` on a `nauf.pmm.stan` object. `row.names, optional` Changes from the defaults are ignored. `mcse` A logical indicating whether the Monte Carlo standard errors should be printed (default `FALSE` since the column is always recoverable by dividing the `SD` column by the square root of the `ESS` column). `rhat` An optional logical indicating whether or not to print the Gelman-Rubin R-hat statistic. If `rhat = NULL` (the default), then the `Rhat` column of the summary is only printed if any of the statistics are greater that `1.1`. Regardless of the value of the `rhat` argument, a warning is issued if any of the statistics are greater than `1.1`.

## Details

The `nauf.pmm.stan` object is a list with the following elements.

names

A data frame with the levels of each factor (or 'inc_1' for covariates), with one row for each element in the third dimension of `samples`.

contrasts

The fixed effects model matrix showing the contrasts applied to the regression coefficients (rows correspond to the `names` element).

samples

An array with three dimensions. The first corresponds to iterations, the second to chains, and the third to parameters (the same structure returned by `as.array.stanfit`).

family

The regression family.

inv.lbl

The label of the inverse link (e.g. probability, rate, etc.).

misc

A list with additional information based on the type of model.

## Value

The returned object depends on the function. See the 'Methods' section.

## Methods

summary

Returns a data frame with class `summ.nauf.pmm.stan`, with means, standard deviations, medians, mean absolute differences, the posterior probability that the estimate is greater than zero, quantiles specified in `probs`, the effective sample size, Monte Carlo standard error, and Gelman-Rubin R-hat statistic. Additional arguments in `...` are ignored. Quantiles, effective samples size, and Monte Carlo standard error, and R-hat statistics are computed using `monitor`.

print

For `summ.nauf.pmm.stan` objects, the data frame is printed, omitting the Monte Carlo standard error and R-hat statistic based on `mcse` and `rhat`. If the inverse link function was used, then a message indicating the response type is also printed. Additional arguments in `...` are passed to `print.data.frame`. For `nauf.pmm.stan` objects, first `summary` is called, passing along `...`, and then print is called on the resulting `summ.nauf.pmm.stan`, also passing along `...` arguments.

as.data.frame

For `summ.nauf.pmm.stan` objects, removes the `data.frame` contained in a `summ.nauf.pmm.stan`. Additional arguments in `...` are ignored. For `nauf.pmm.stan` objects, first `summary` is called, passing along `...`, and then `as.data.frame` is called on the resulting `summ.nauf.pmm.stan` object, ignoring `...` arugments.

as.array

Returns the `samples` element of a `nauf.pmm.stan` object. Additional arguments in `...` are ignored.

as.matrix

Returns the `samples` element of a `namf.pmm.stan` object, flattening the array into a matrix such that the rows represent iterations ordered by chain and the columns represent parameters.

nauf documentation built on June 20, 2017, 9:05 a.m.