fit_zoid | R Documentation |

Fit a trinomial mixture model that optionally includes covariates to estimate effects of factor or continuous variables on proportions.

```
fit_zoid(
formula = NULL,
design_matrix,
data_matrix,
chains = 3,
iter = 2000,
warmup = floor(iter/2),
overdispersion = FALSE,
overdispersion_sd = 5,
posterior_predict = FALSE,
moment_match = FALSE,
prior_sd = NA,
...
)
```

`formula` |
The model formula for the design matrix. Does not need to have a response specified. If =NULL, then the design matrix is ignored and all rows are treated as replicates |

`design_matrix` |
A data frame, dimensioned as number of observations, and covariates in columns |

`data_matrix` |
A matrix, with observations on rows and number of groups across columns |

`chains` |
Number of mcmc chains, defaults to 3 |

`iter` |
Number of mcmc iterations, defaults to 2000 |

`warmup` |
Number iterations for mcmc warmup, defaults to 1/2 of the iterations |

`overdispersion` |
Whether or not to include overdispersion parameter, defaults to FALSE |

`overdispersion_sd` |
Prior standard deviation on 1/overdispersion parameter, Defaults to inv-Cauchy(0,5) |

`posterior_predict` |
Whether or not to return draws from posterior predictive distribution (requires more memory) |

`moment_match` |
Whether to do moment matching via |

`prior_sd` |
Parameter to be passed in to use as standard deviation of the normal distribution in transformed space. If covariates are included this defaults to 1, but for models with single replicate, defaults to 1/n_bins. |

`...` |
Any other arguments to pass to |

```
y <- matrix(c(3.77, 6.63, 2.60, 0.9, 1.44, 0.66, 2.10, 3.57, 1.33),
nrow = 3, byrow = TRUE
)
# fit a model with no covariates
fit <- fit_zoid(data_matrix = y, chains = 1, iter = 100)
# fit a model with 1 factor
design <- data.frame("fac" = c("spring", "spring", "fall"))
fit <- fit_zoid(formula = ~fac, design_matrix = design, data_matrix = y, chains = 1, iter = 100)
# try a model with random effects
set.seed(123)
y <- matrix(runif(99,1,4), ncol=3)
design <- data.frame("fac" = sample(letters[1:5], size=nrow(y), replace=TRUE))
design$fac <- as.factor(design$fac)
fit <- fit_zoid(formula = ~(1|fac), design_matrix = design, data_matrix = y, chains = 1, iter = 100)
```

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.