diff --git a/README.Rmd b/README.Rmd index 2778ce9..0aaaee0 100644 --- a/README.Rmd +++ b/README.Rmd @@ -19,6 +19,7 @@ knitr::opts_chunk$set( [![R-CMD-check](https://github.com/markolalovic/latent2likert/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/markolalovic/latent2likert/actions/workflows/R-CMD-check.yaml) [![codecov](https://codecov.io/gh/markolalovic/latent2likert/branch/main/graph/badge.svg?token=HZTG6RUB2J)](https://app.codecov.io/gh/markolalovic/latent2likert) [![CRAN status](https://www.r-pkg.org/badges/version/latent2likert)](https://CRAN.R-project.org/package=latent2likert) +[![downloads](https://cranlogs.r-pkg.org/badges/latent2likert)](https://cranlogs.r-pkg.org/badges/latent2likert) ## Overview diff --git a/README.html b/README.html index 68b5eb5..5937853 100644 --- a/README.html +++ b/README.html @@ -607,7 +607,7 @@

latent2likert Package logo

-

R-CMD-check codecov CRAN status

+

R-CMD-check codecov CRAN status downloads

Overview

@@ -659,7 +659,7 @@

Using rlikert

Likert scale, use:

library(latent2likert)
 rlikert(size = 10, n_items = 1, n_levels = 5)
-#>  [1] 4 4 2 3 5 2 4 2 3 3
+#> [1] 1 3 3 3 2 4 1 3 3 1

To generate responses to multiple items with specified parameters:

rlikert(size = 10,
@@ -669,16 +669,16 @@ 

Using rlikert

sd = c(0.8, 1, 1), corr = 0.5) #> Y1 Y2 Y3 -#> [1,] 3 2 4 -#> [2,] 2 1 1 -#> [3,] 2 1 2 -#> [4,] 3 2 4 -#> [5,] 2 2 4 -#> [6,] 2 3 5 -#> [7,] 3 1 2 -#> [8,] 2 2 3 -#> [9,] 2 3 5 -#> [10,] 3 2 5
+#> [1,] 2 1 3 +#> [2,] 2 2 2 +#> [3,] 4 3 2 +#> [4,] 3 3 4 +#> [5,] 4 5 6 +#> [6,] 2 1 4 +#> [7,] 1 2 3 +#> [8,] 3 1 6 +#> [9,] 3 3 4 +#> [10,] 3 2 6

You can also provide a correlation matrix:

corr <- matrix(c(1.00, -0.63, -0.39, 
                  -0.63, 1.00, 0.41, 
@@ -694,17 +694,17 @@ 

Using rlikert

and these estimates are typically lower:

cor(data)
 #>            Y1         Y2         Y3
-#> Y1  1.0000000 -0.5223151 -0.3449648
-#> Y2 -0.5223151  1.0000000  0.3398699
-#> Y3 -0.3449648  0.3398699  1.0000000
+#> Y1 1.0000000 -0.5774145 -0.3838274 +#> Y2 -0.5774145 1.0000000 0.3856997 +#> Y3 -0.3838274 0.3856997 1.0000000

Using estimate_params

Given the data, you can estimate the values of latent parameters using:

estimate_params(data, n_levels = c(4, 5, 6), skew = 0)
 #>          items
-#> estimates           Y1           Y2           Y3
-#>      mean  0.006261483 -0.952847125 -0.011843866
-#>      sd    0.745185144  1.012219189  0.954714824
+#> estimates Y1 Y2 Y3 +#> mean -0.0526979746 -0.9696916596 -0.0009229545 +#> sd 0.8163184862 1.0533629380 1.0381389630

Transformation

To visualize the transformation, you can use plot_likert_transform(). It plots the densities of latent diff --git a/README.md b/README.md index 86a77a0..8b32058 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ [![codecov](https://codecov.io/gh/markolalovic/latent2likert/branch/main/graph/badge.svg?token=HZTG6RUB2J)](https://app.codecov.io/gh/markolalovic/latent2likert) [![CRAN status](https://www.r-pkg.org/badges/version/latent2likert)](https://CRAN.R-project.org/package=latent2likert) +[![downloads](https://cranlogs.r-pkg.org/badges/latent2likert)](https://cranlogs.r-pkg.org/badges/latent2likert) ## Overview @@ -76,7 +77,7 @@ scale, use: ``` r library(latent2likert) rlikert(size = 10, n_items = 1, n_levels = 5) -#> [1] 4 4 2 3 5 2 4 2 3 3 +#> [1] 1 3 3 3 2 4 1 3 3 1 ``` To generate responses to multiple items with specified parameters: @@ -89,16 +90,16 @@ rlikert(size = 10, sd = c(0.8, 1, 1), corr = 0.5) #> Y1 Y2 Y3 -#> [1,] 3 2 4 -#> [2,] 2 1 1 -#> [3,] 2 1 2 -#> [4,] 3 2 4 -#> [5,] 2 2 4 -#> [6,] 2 3 5 -#> [7,] 3 1 2 -#> [8,] 2 2 3 -#> [9,] 2 3 5 -#> [10,] 3 2 5 +#> [1,] 2 1 3 +#> [2,] 2 2 2 +#> [3,] 4 3 2 +#> [4,] 3 3 4 +#> [5,] 4 5 6 +#> [6,] 2 1 4 +#> [7,] 1 2 3 +#> [8,] 3 1 6 +#> [9,] 3 3 4 +#> [10,] 3 2 6 ``` You can also provide a correlation matrix: @@ -122,9 +123,9 @@ these estimates are typically lower: ``` r cor(data) #> Y1 Y2 Y3 -#> Y1 1.0000000 -0.5223151 -0.3449648 -#> Y2 -0.5223151 1.0000000 0.3398699 -#> Y3 -0.3449648 0.3398699 1.0000000 +#> Y1 1.0000000 -0.5774145 -0.3838274 +#> Y2 -0.5774145 1.0000000 0.3856997 +#> Y3 -0.3838274 0.3856997 1.0000000 ``` ## Using `estimate_params` @@ -134,9 +135,9 @@ Given the data, you can estimate the values of latent parameters using: ``` r estimate_params(data, n_levels = c(4, 5, 6), skew = 0) #> items -#> estimates Y1 Y2 Y3 -#> mean 0.006261483 -0.952847125 -0.011843866 -#> sd 0.745185144 1.012219189 0.954714824 +#> estimates Y1 Y2 Y3 +#> mean -0.0526979746 -0.9696916596 -0.0009229545 +#> sd 0.8163184862 1.0533629380 1.0381389630 ``` ## Transformation