Description Usage Arguments Details Value Examples

loads the data, fits the appropriate model, runs the posterior predictive checks, and optionally exports results

1 2 3 |

`data` |
a 2-dimensional matrix or array, missing values should be input as NA. |

`clusters` |
The number of possible clusters (cultures) to use |

`itemdiff` |
Whether item difficulty should be measured and accounted for |

`biases` |
Whether response biases should be measured and accounted for |

`samples` |
The number of samples for the inference |

`chains` |
The number of chains for the inference |

`burnin` |
The number of burn-in for the inference |

`thinning` |
The amount of thinning in the inference |

`runchecks` |
If the posterior predictive checks should be calculated after the inference |

`exportfilename` |
If you'd like to export: specify a filename and optionally its location. Ex: |

`polych` |
used for ordinal data only, if the polychoric correlations, rather than Pearson correlations, should be used (for the posterior predictive checks) – these take a long time to calculate but are more precise in the ordinal data case. |

`parallel` |
Whether the inference should be computed in parallel (1 chain per logical processor) |

`seed` |
Set the random number seed here (to reproduce results as before). If not specified, the seed is randomly generated. |

`plotr` |
Whether to plot the posterior mean results for each parameter. Note: |

This is the main function to fit the consensus models. The function fits the model using hierarchical Bayesian inference. The Bayesian sampling is performed using JAGS.

`cctfit`

is returned, which has the structure of a 'jagsfit' object as in Rjags, but has additional data included.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | ```
# Load Data (here binary responses, 1/0 for yes/no)
data(hotcold)
# Calculate scree plot to decide how many clusters to run, looks like 2 clusters here
dat <- cctscree(hotcold)
# Retrieve factors from the scree plot
cctfac(dat) # dat$factors
# Fit the Model
# cctfit <- cctapply(data = hotcold, clusters = 2, itemdiff = TRUE, samples = 10000,
# chains = 3, burnin = 2000, seed = 1, runchecks = FALSE)
# Calculate Fit Diagnostics (Posterior Predictive Checks)
# cctfit <- cctppc(cctfit)
# Plot Parameter Results
# cctresults(cctfit)
# Tables of Subject and Item Parameter Values and Credible Intervals
# cctsubj(cctfit) # cctfit$subj
# cctsubjhdi(cctfit) # cctfit$subjhdi
# cctitem(cctfit) # cctfit$item
# cctitemhdi(cctfit) # cctfit$itemhdi
# Show Missing Value Model Estimates if there was missing data
# cctmvest(cctfit)
# Export Results (saves data and plots)
# cctexport(cctfit,filename="CCTpackdata.Rdata")
# Load and Fit Example Data for ordered categorical or continuous responses
# data(raterdata)
# cctfit <- cctapply(data = raterdata, clusters = 1, itemdiff = TRUE, samples = 10000,
# chains = 3, burnin = 2000, seed = 1, runchecks = FALSE)
# data(continuousdata)
# cctfit <- cctapply(data = continuousdata, clusters = 1, itemdiff = TRUE, samples = 10000,
# chains = 3, burnin = 2000, seed = 1, runchecks = FALSE)
##Note: if an insufficient memory message occurs, you can increase the
##memory allocation by the command 'memory.limit(25000)' (or as high as needed)
``` |

```
Loading required package: R2jags
Loading required package: rjags
Loading required package: coda
Linked to JAGS 4.3.0
Loaded modules: basemod,bugs
Attaching package: 'R2jags'
The following object is masked from 'package:coda':
traceplot
Warning message:
no DISPLAY variable so Tk is not available
...Binary (dichotomous) data detected
...23 respondents and 27 items
...Data has 14 missing values out of 621
...Producing Scree Plot, missing data handled by mode of respective columns
[1] 4.77 4.04 1.28 1.14 0.80 0.43 0.23 0.11
```

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.