Skip to content

Commit 63fa27c

Browse files
committed
First iteration of the README.Rmd file added.
1 parent 1ec41e8 commit 63fa27c

File tree

3 files changed

+130
-1
lines changed

3 files changed

+130
-1
lines changed

.Rbuildignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ desktop.ini
44
ShortForm.Rproj
55
iteration.html
66
summary.txt
7-
.travis.yml
7+
.travis.yml
8+
README.md

README.Rmd

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
output:
3+
github_document:
4+
html_preview: false
5+
---
6+
```{r, echo = FALSE}
7+
knitr::opts_chunk$set(
8+
collapse = TRUE,
9+
comment = "#>",
10+
fig.path = "README-"
11+
)
12+
```
13+
14+
# ShortForm
15+
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/ShortForm)](http://cran.r-project.org/package=ShortForm)
16+
[![Travis-CI Build Status](http://travis-ci.org/AnthonyRaborn/ShortForm.svg?branch=master)](http://travis-ci.org/AnthonyRaborn/ShortForm)
17+
18+
Automatic Short Form Creation for scales. Currently, only the Ant Colony Algorithm is implemented. The original R imnplementation for this algorithm is from Leite, Huang, & Marcoulides (2008) <doi:10.1080/00273170802285743>.
19+
20+
## Installation
21+
```{r gh-installation, eval = FALSE}
22+
# install.packages("devtools")
23+
devtools::install_github("AnthonyRaborn/ShortForm") # the developmental version
24+
install.packages("ShortForm") # the CRAN-approved version
25+
```
26+
27+
## Usage
28+
29+
Here is a (slightly modified) example from the help documentation using lavaan.
30+
31+
```{r example, eval = FALSE}
32+
# using simulated test data and the default values for lavaan.model.specs
33+
# (with one exception), fit a 20-item short form
34+
# first, read in the original or "full" model
35+
data(exampleAntModel) # a character vector for a lavaan model
36+
37+
# then, create the list of the items by the factors
38+
# in this case, all items load onto the general 'Ability' factor
39+
list.items <- list(c('Item1','Item2','Item3','Item4','Item5',
40+
'Item6','Item7','Item8','Item9','Item10',
41+
'Item11','Item12','Item13','Item14','Item15',
42+
'Item16','Item17','Item18','Item19','Item20',
43+
'Item21','Item22','Item23','Item24','Item25',
44+
'Item26','Item27','Item28','Item29','Item30',
45+
'Item31','Item32','Item33','Item34','Item35',
46+
'Item36','Item37','Item38','Item39','Item40',
47+
'Item41','Item42','Item43','Item44','Item45',
48+
'Item46','Item47','Item48','Item49','Item50',
49+
'Item51','Item52','Item53','Item54','Item55','Item56'))
50+
51+
# load the data
52+
data(simulated_test_data)
53+
# finally, call the function with some minor changes to the default values.
54+
# since the data is binary, let lavaan know by putting the items in the
55+
# 'orderd' element of the lavaan.model.specs list.
56+
abilityShortForm = antcolony.lavaan(data = simulated_test_data,
57+
ants = 5, evaporation = 0.7, antModel = exampleAntModel,
58+
list.items = list.items, full = 56, i.per.f = 20,
59+
lavaan.model.specs = list(model.type = "cfa", auto.var = T, estimator = "default", ordered = unlist(list.items), int.ov.free = TRUE, int.lv.free = FALSE, auto.fix.first = TRUE, auto.fix.single = TRUE, auto.cov.lv.x = TRUE, auto.th = TRUE, auto.delta = TRUE, auto.cov.y = TRUE)
60+
factors = 'Ability', steps = 3, fit.indices = c('cfi', 'rmsea'),
61+
fit.statistics.test = "(cfi > 0.95)&(rmsea < 0.05)",
62+
summaryfile = 'summary.txt',
63+
feedbackfile = 'iteration.html',
64+
max.run = 500)
65+
abilityShortForm[[1]] # print the results of the final short form
66+
```
67+
68+
A similar example can be found in the `antcolony.mplus` function, but requires you to have a valid Mplus installation on the computer.

README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
2+
ShortForm
3+
=========
4+
5+
[![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/ShortForm)](http://cran.r-project.org/package=ShortForm) [![Travis-CI Build Status](http://travis-ci.org/AnthonyRaborn/ShortForm.svg?branch=master)](http://travis-ci.org/AnthonyRaborn/ShortForm)
6+
7+
Automatic Short Form Creation for scales. Currently, only the Ant Colony Algorithm is implemented. The original R imnplementation for this algorithm is from Leite, Huang, & Marcoulides (2008) <doi:10.1080/00273170802285743>.
8+
9+
Installation
10+
------------
11+
12+
``` r
13+
# install.packages("devtools")
14+
devtools::install_github("AnthonyRaborn/ShortForm") # the developmental version
15+
install.packages("ShortForm") # the CRAN-approved version
16+
```
17+
18+
Usage
19+
-----
20+
21+
Here is a (slightly modified) example from the help documentation using lavaan.
22+
23+
``` r
24+
# using simulated test data and the default values for lavaan.model.specs
25+
# (with one exception), fit a 20-item short form
26+
# first, read in the original or "full" model
27+
data(exampleAntModel) # a character vector for a lavaan model
28+
29+
# then, create the list of the items by the factors
30+
# in this case, all items load onto the general 'Ability' factor
31+
list.items <- list(c('Item1','Item2','Item3','Item4','Item5',
32+
'Item6','Item7','Item8','Item9','Item10',
33+
'Item11','Item12','Item13','Item14','Item15',
34+
'Item16','Item17','Item18','Item19','Item20',
35+
'Item21','Item22','Item23','Item24','Item25',
36+
'Item26','Item27','Item28','Item29','Item30',
37+
'Item31','Item32','Item33','Item34','Item35',
38+
'Item36','Item37','Item38','Item39','Item40',
39+
'Item41','Item42','Item43','Item44','Item45',
40+
'Item46','Item47','Item48','Item49','Item50',
41+
'Item51','Item52','Item53','Item54','Item55','Item56'))
42+
43+
# load the data
44+
data(simulated_test_data)
45+
# finally, call the function with some minor changes to the default values.
46+
# since the data is binary, let lavaan know by putting the items in the
47+
# 'orderd' element of the lavaan.model.specs list.
48+
abilityShortForm = antcolony.lavaan(data = simulated_test_data,
49+
ants = 5, evaporation = 0.7, antModel = exampleAntModel,
50+
list.items = list.items, full = 56, i.per.f = 20,
51+
lavaan.model.specs = list(model.type = "cfa", auto.var = T, estimator = "default", ordered = unlist(list.items), int.ov.free = TRUE, int.lv.free = FALSE, auto.fix.first = TRUE, auto.fix.single = TRUE, auto.cov.lv.x = TRUE, auto.th = TRUE, auto.delta = TRUE, auto.cov.y = TRUE)
52+
factors = 'Ability', steps = 3, fit.indices = c('cfi', 'rmsea'),
53+
fit.statistics.test = "(cfi > 0.95)&(rmsea < 0.05)",
54+
summaryfile = 'summary.txt',
55+
feedbackfile = 'iteration.html',
56+
max.run = 500)
57+
abilityShortForm[[1]] # print the results of the final short form
58+
```
59+
60+
A similar example can be found in the `antcolony.mplus` function, but requires you to have a valid Mplus installation on the computer.

0 commit comments

Comments
 (0)