Last data update: 2014.03.03

R: General CCT Application function: load data, fit the model,...
cctapplyR Documentation

General CCT Application function: load data, fit the model, run checks on the fit, and optionally export results

Description

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

Usage

cctapply(data, clusters = 1, itemdiff = FALSE, samples = 10000, chains = 3,
         burnin = 2000, thinning = 1, runchecks = TRUE, exportfilename = "",
         polych = FALSE, parallel = FALSE, seed = NULL,plotr=TRUE)

Arguments

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 heterogeneous item difficulty should be used

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: exportfilename = "C:/CCTpack/CCTpackdata.Rdata"

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: runchecks = TRUE will plot the posterior predictive checks after the posterior mean results. The posterior mean results plot can be later called via cctresults().

Details

This is an "all-in-one" function for the GUI.

Value

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

Examples

data(hotcold)
# cctfit <- cctapply(data = hotcold, clusters = 2, itemdiff = TRUE, samples = 10000, 
#                     chains = 3, burnin = 2000, runchecks = TRUE)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(CCTpack)
Error in library(CCTpack) : there is no package called 'CCTpack'
Execution halted