-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
92 lines (71 loc) · 4.13 KB
/
README.Rmd
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
```
# tdcmStan
<!-- badges: start -->
[![Project Status: Active – The project has reached a stable, usable
state and is being actively
developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![lifecycle](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html)
[![R package version](https://www.r-pkg.org/badges/version/tdcmStan)](https://cran.r-project.org/package=tdcmStan)
[![Package downloads](https://cranlogs.r-pkg.org/badges/grand-total/tdcmStan)](https://cran.r-project.org/package=tdcmStan)
[![R-CMD-check](https://github.com/atlas-aai/tdcmStan/workflows/R-CMD-check/badge.svg)](https://github.com/atlas-aai/tdcmStan/actions)</br>
[![Codecov test coverage](https://codecov.io/gh/atlas-aai/tdcmStan/branch/main/graph/badge.svg)](https://app.codecov.io/gh/atlas-aai/tdcmStan?branch=main)
[![Netlify Status](https://api.netlify.com/api/v1/badges/b82caf01-0611-4f8b-bbca-5b89b5a80791/deploy-status)](https://app.netlify.com/sites/tdcmStan/deploys)
[![Signed by](https://img.shields.io/badge/Keybase-Verified-brightgreen.svg)](https://keybase.io/jeffreychoover)
![License](https://img.shields.io/badge/License-GPL_v3-blue.svg)
<!-- badges: end -->
The goal of tdcmStan is to facilitate the production of Stan code for estimating transition diagnostic classification models (TDCMs).
TDCMs are psychometric models that estimate respondents latent class membership longitudinally.
Using [R](https://www.r-project.org/), tdcmStan uses the Q-matrix to automatically produce the Stan code.
The tdcmStan package supports unconstrained TDCMs along with fungible TDCMs (i.e., TDCMs where the items parameters are assumed to be equivalent) and fungible TDCMs with no common items across time points.
The tdcmStan package also supports estimation of multi-threaded TDCMs, which increases the efficiency of model estimation.
## Installation
You can install the release version of tdcmStan from [CRAN](https://cran.r-project.org/):
```r
install.packages("tdcmStan")
```
To install the development version from [GitHub](https://github.com/) use:
``` r
# install.packages("remotes")
remotes::install_github("atlas-aai/tdcmStan")
```
## Usage
To demonstrate the workflow using tdcmStan, we present an example case for generating *Stan* code.
For this example, we will assume that we are going to be estimating a TDCM for a 5-item 1-attribute assessment that is administered at two time points.
The produced stan code is first saved in `stan_code`, and then the Stan code is saved as a Stan file in `Stan/tdcm.stan` where it can be read in for model estimation.
```{r ex-data, echo = TRUE, eval = FALSE}
library(tibble)
library(here)
library(readr)
library(tdcmStan)
q_matrix <- tibble(rep(1, 5))
stan_code <- create_stan_tdcm(q_matrix)
stan_code %>%
readr::write_lines(here("Stan/tdcm.stan"))
```
The tdcmStan package follows a similar process for the other variants of TDCMs.
To estimate a multi-threaded TDCM for this 5-item 1-attribute assessment, we would run:
```{r multi-threaded-tdcm, echo = TRUE, eval = FALSE}
fng_stan_code <- create_threaded_stan_tdcm(q_matrix)
```
To estimate a fungible TDCM for this 5-item 1-attribute assessment, we would run:
```{r fng-tdcm, echo = TRUE, eval = FALSE}
fng_stan_code <- create_fng_stan_tdcm(q_matrix)
```
To estimate a fungible TDCM for a 1-attribute assessment where respondents complete 5 items at each time point but respondents do not complete the same item twice, we would run:
```{r no-common-items-fng-tdcm, echo = TRUE, eval = FALSE}
q_matrix <- tibble(rep(1, 10))
fng_no_cmn_items_stan_code <- create_fng_no_common_item_tdcm(q_matrix)
```
Contributions are welcome.
To ensure a smooth process, please review the [Contributing Guide](https://dcm2.info/dev/CONTRIBUTING.html).
Please note that the dcm2 project is released with a [Contributor Code of Conduct](https://dcm2.info/CODE_OF_CONDUCT.html).
By contributing to this project, you agree to abide by its terms.