Skip to content

Commit

Permalink
version 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Leander De Schutter authored and cran-robot committed Aug 21, 2021
0 parents commit 62a1ec7
Show file tree
Hide file tree
Showing 13 changed files with 2,106 additions and 0 deletions.
23 changes: 23 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Package: conmet
Title: Construct Measurement Evaluation Tool
Version: 0.1.0
Authors@R:
person(given = "Leander",
family = "De Schutter",
role = c("aut", "cre"),
email = "deschutter@rsm.nl",
comment = c(ORCID = "0000-0001-9826-4896"))
Description: With this package you can run 'ConMET' locally in R. 'ConMET' is an R-shiny application that facilitates performing and evaluating confirmatory factor analyses (CFAs) and is useful for running and reporting typical measurement models in applied psychology and management journals. 'ConMET' automatically creates, compares and summarizes CFA models. Most common fit indices (E.g., CFI and SRMR) are put in an overview table. ConMET also allows to test for common method variance. The application is particularly useful for teaching and instruction of measurement issues in survey research. The application uses the 'lavaan' package (Rosseel, 2012) to run CFAs.
Depends: R (>= 3.5.0), shiny, shinydashboard
Imports: foreign, waiter, shinyWidgets, purrr, lavaan, summarytools,
stringr, dplyr, Hmisc, semTools, openxlsx, DT
License: GPL-3
Encoding: UTF-8
RoxygenNote: 7.1.1
NeedsCompilation: no
Packaged: 2021-08-20 13:40:18 UTC; 68883lde
Author: Leander De Schutter [aut, cre]
(<https://orcid.org/0000-0001-9826-4896>)
Maintainer: Leander De Schutter <deschutter@rsm.nl>
Repository: CRAN
Date/Publication: 2021-08-21 09:40:09 UTC
12 changes: 12 additions & 0 deletions MD5
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
b8ffad15e9fd92225b62962b5f2e6d7a *DESCRIPTION
990beddca8690faa1c5d584660c7ef23 *NAMESPACE
5b2b392465a86868323b8b4194bbd331 *R/run_conmet.R
9fc8fab0d8f5dceee33698ef8602515a *inst/myapp/CMV.html
fc125d025032a80d41f4223f33732ee3 *inst/myapp/Estimator.html
3f1274795c8ea26ee3da644dd1ecfc2f *inst/myapp/HowTo.html
8e2a5528540ef31089a26287d643ccfd *inst/myapp/about_tab.html
84d64c491c7e79e21611194654be1ff2 *inst/myapp/app.R
a41c5caaa2e3f9c0a2fe73e02ef196c5 *inst/myapp/fit_indices.html
8437e45661052cf203afdc0aea720f95 *inst/myapp/info.md
9caf3c150637b1acdf83e8adc2c8fd4f *inst/myapp/reliabilities_tab.html
9e54d9fdd100fde51b73d764d47981d2 *man/run_conmet.Rd
5 changes: 5 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Generated by roxygen2: do not edit by hand

export(run_conmet)
import(shiny)
import(shinydashboard)
19 changes: 19 additions & 0 deletions R/run_conmet.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#' Runs the Construct Measurement Evaluation Tool.
#'
#' @description 'ConMET' is an R-shiny application that facilitates performing and evaluating confirmatory factor analyses (CFAs) and is useful for running and reporting typical measurement models in applied psychology and management journals. 'ConMET' automatically creates, compares and summarizes CFA models. Most common fit indices (E.g., CFI and SRMR) are put in an overview table. 'ConMET' also allows to test for common method variance. The application is particularly useful for teaching and instruction of measurement issues in survey research. \cr The application uses the \code{\link[lavaan]{cfa}} function from the 'lavaan' package (Rosseel, 2012) to run CFAs.
#' \cr \cr Yves Rosseel (2012). lavaan: An R Package for Structural Equation Modeling. \emph{Journal of Statistical Software, 48(2)}, 1-36. URL https://www.jstatsoft.org/v48/i02/.
#' @import shiny shinydashboard
#' @return Runs the 'ConMET' shiny application.
#' @examples
#' if(interactive()){
#' library(conmet)
#' run_conmet()
#' }
#' @export
run_conmet <- function() {
appDir <- system.file("myapp", package = "conmet")
if (appDir == "") {
stop("Could not find the 'myapp' directory. Try re-installing `conmet`.", call. = FALSE)
}
shiny::runApp(appDir, display.mode = "normal")
}
18 changes: 18 additions & 0 deletions inst/myapp/CMV.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<span style="font-size:16px;"><span style="font-family:Arial,Helvetica,sans-serif;">Common-method variance&nbsp;(CMV) is the spurious &quot;variance that is attributable to the&nbsp;measurement&nbsp;method rather than to the&nbsp;constructs&nbsp;the measures are assumed to represent&quot; (Podsakoff, MacKenzie, Lee, &amp; Podsakoff, 2003).&nbsp;</span></span>
<div>&nbsp;</div>

<div><span style="font-size:16px;"><span style="font-family:Arial,Helvetica,sans-serif;">You can control for this method variance by adding a 'methods factor' to the proposed measurement model. This methods factor will have all variables as indicators and the covariance between this methods factor and all other factors will be fixed to zero.&nbsp;</span></span></div>

<div>&nbsp;</div>

<div><span style="font-size:16px;"><span style="font-family:Arial,Helvetica,sans-serif;">Because the CMV model requires many parameters to be estimated, there are often convergence issues. Therefore, you can also fix all indicators of the 'methods factor' to be equal. That way, all indicators of the methods factor will have the same loading and less parameters need to be estimated.</span></span></div>

<div>&nbsp;</div>

<div><span style="font-size:16px;"><span style="font-family:Arial,Helvetica,sans-serif;">When the common method model has a better fit, you could look at the extent to which the intercorrelations among the main variables significantly differed from the proposed model (for an example, see Shin et al., 2017). You can find the correlations in the lavaan output in 'Detailed CFA Summary'. (i.e., std.all column at the covariance section).&nbsp;&nbsp;</span></span></div>

<div><br />
<span style="font-size:16px;"><span style="font-family:Arial,Helvetica,sans-serif;"><strong>References</strong></span></span><br />
<span style="font-size:13px;"><span style="font-family:Arial,Helvetica,sans-serif;">Podsakoff, P.M., MacKenzie, S.B., Lee, J.-Y. &amp; Podsakoff, N.P. (2003). Common method biases in behavioral research: A critical review of the literature and recommended remedies. <em>Journal of Applied Psychology. 88 (5)</em>: 879&ndash;903.</span></span></div>

<div><span style="font-size:13px;"><span style="font-family:Arial,Helvetica,sans-serif;"><span style="color: rgb(34, 34, 34);">Shin, Y., Kim, M. S., Choi, J. N., Kim, M., &amp; Oh, W. K. (2017). Does leader-follower regulatory fit matter? The role of regulatory fit in followers&rsquo; organizational citizenship behavior.&nbsp;</span><em>Journal of Management</em><span style="color: rgb(34, 34, 34);">,&nbsp;</span><em>43</em><span style="color: rgb(34, 34, 34);">(4), 1211-1233.</span></span></span></div>
62 changes: 62 additions & 0 deletions inst/myapp/Estimator.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<span style="font-family:Arial,Helvetica,sans-serif;"><span style="font-size:16px;"><span style="line-height:107%"><b>Which estimator to use</b></span><br />
<br />
<span style="line-height:107%">Depending on the way your items are measured or how they are distributed, you may want to use another estimator. You can check the normality assumption in the &quot;Descriptives&quot; tab.&nbsp;</span><br />
<br />
<span style="line-height:107%">Gana and Broc (2019) recommend the following regarding the main estimators:</span></span></span><br />
&nbsp;
<table class="MsoTableGrid" style="border-collapse:collapse; border:none">
<tbody>
<tr>
<td style="border-bottom:2px solid black; width:301px; padding:0cm 7px 0cm 7px; border-top:2px solid black; border-right:2px solid black; border-left:2px solid black" valign="top"><span style="font-family:Arial,Helvetica,sans-serif;"><span style="font-size:16px;"><span style="line-height:normal"><b>Data type and normality assumption</b></span></span></span></td>
<td style="border-bottom:2px solid black; width:301px; padding:0cm 7px 0cm 7px; border-top:2px solid black; border-right:2px solid black; border-left:none" valign="top"><span style="font-family:Arial,Helvetica,sans-serif;"><span style="font-size:16px;"><span style="line-height:normal"><b>Recommended estimator</b></span></span></span></td>
</tr>
<tr>
<td style="border-bottom:2px solid black; width:301px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:2px solid black" valign="top"><span style="font-family:Arial,Helvetica,sans-serif;"><span style="font-size:16px;"><span style="line-height:normal"><i>Continuous data</i></span></span></span></td>
<td style="border-bottom:2px solid black; width:301px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:none" valign="top">&nbsp;</td>
</tr>
<tr>
<td style="border-bottom:2px solid black; width:301px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:2px solid black" valign="top">
<ol>
<li style="margin-left:8px"><span style="font-family:Arial,Helvetica,sans-serif;"><span style="font-size:16px;"><span style="line-height:normal">Approximately normal distribution</span></span></span></li>
</ol>
</td>
<td style="border-bottom:2px solid black; width:301px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:none" valign="top"><span style="font-family:Arial,Helvetica,sans-serif;"><span style="font-size:16px;"><span style="line-height:normal">ML</span></span></span></td>
</tr>
<tr>
<td style="border-bottom:2px solid black; width:301px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:2px solid black" valign="top">
<ol start="2">
<li style="margin-left:8px"><span style="font-family:Arial,Helvetica,sans-serif;"><span style="font-size:16px;"><span style="line-height:normal">Violation of normality assumption</span></span></span></li>
</ol>
</td>
<td style="border-bottom:2px solid black; width:301px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:none" valign="top"><span style="font-family:Arial,Helvetica,sans-serif;"><span style="font-size:16px;"><span style="line-height:normal">ML (in case of moderate violation)</span><br />
<span style="line-height:normal">MLM, MLR</span></span></span></td>
</tr>
<tr>
<td style="border-bottom:2px solid black; width:301px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:2px solid black" valign="top"><span style="font-family:Arial,Helvetica,sans-serif;"><span style="font-size:16px;"><span style="line-height:normal"><i>Ordinal/Categorical data</i></span></span></span></td>
<td style="border-bottom:2px solid black; width:301px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:none" valign="top">&nbsp;</td>
</tr>
<tr>
<td style="border-bottom:2px solid black; width:301px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:2px solid black" valign="top">
<ol>
<li style="margin-left:8px"><span style="font-family:Arial,Helvetica,sans-serif;"><span style="font-size:16px;"><span style="line-height:normal">Approximately normal distribution</span></span></span></li>
</ol>
</td>
<td style="border-bottom:2px solid black; width:301px; padding:0cm 7px 0cm 7px; border-top:none; border-right:2px solid black; border-left:none" valign="top"><span style="font-family:Arial,Helvetica,sans-serif;"><span style="font-size:16px;"><span style="line-height:normal">ML (if at least 6 response categories)</span><br />
<span style="line-height:normal">MLM, MLR (if at least 4 response categories)</span><br />
<span style="line-height:normal">WLSMV (binary response or 3 response categories)</span></span></span></td>
</tr>
<tr>
<td style="border-bottom:2px solid black; width:301px; padding:0cm 7px 0cm 7px; height:49px; border-top:none; border-right:2px solid black; border-left:2px solid black" valign="top">
<ol start="2">
<li style="margin-left:8px"><span style="font-family:Arial,Helvetica,sans-serif;"><span style="font-size:16px;"><span style="line-height:normal">Violation of normality assumption</span></span></span></li>
</ol>
</td>
<td style="border-bottom:2px solid black; width:301px; padding:0cm 7px 0cm 7px; height:49px; border-top:none; border-right:2px solid black; border-left:none" valign="top"><span style="font-family:Arial,Helvetica,sans-serif;"><span style="font-size:16px;"><span style="line-height:normal">ML (if at least 6 response categories)</span><br />
<span style="line-height:normal">MLM, MLR (if at least 4 response categories)</span><br />
<span style="line-height:normal">WLSMV (in case of severe violation)</span></span></span></td>
</tr>
</tbody>
</table>
<br />
<span style="font-family:Arial,Helvetica,sans-serif;"><span style="font-size:16px;"><span style="line-height:107%"><b>References</b></span></span><br />
<span style="font-size:13px;"><span style="line-height:107%"><span lang="EN-US"><span style="background:white"><span style="line-height:107%"><span style="color:#222222">Gana, K., &amp; Broc, G. (2019).&nbsp;</span></span></span></span><i style="font-variant-ligatures:normal; text-decoration-thickness:initial; text-decoration-style:initial; text-decoration-color:initial">Structural equation modeling with lavaan</i><span style="font-variant-ligatures:normal"><span style="text-decoration-thickness:initial"><span style="text-decoration-style:initial"><span style="text-decoration-color:initial"><span style="float:none">. </span></span></span></span></span><span style="background:white"><span style="line-height:107%"><span style="color:#222222">John Wiley &amp; Sons.</span></span></span></span></span></span>
17 changes: 17 additions & 0 deletions inst/myapp/HowTo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<div><span style="font-size:16px;"><span style="font-family:Arial,Helvetica,sans-serif;"><span style="line-height:107%"><span lang="EN-US" style="border: 1pt none windowtext; padding: 0cm;">ConMET (Construct Measurement Evaluation Tool) is an application that makes it easier to analyze typical CFA models that you have to report in most journals. With this app you can work much faster because it automatically creates, tests, and compares nested measurement models. It also provides you with a table that summarizes the results, which you can insert directly into your manuscript. Another advantage is that the application has a point-and-click user interface, which means you don't have to program to run CFAs.</span></span><br />
<br />
<span style="line-height:107%"><b><span lang="EN-US" style="border: 1pt none windowtext; padding: 0cm;">Step 1: Loading Data</span></b></span><br />
<span style="line-height:107%"><span lang="EN-US" style="border: 1pt none windowtext; padding: 0cm;">First, you need to load your data. Currently SPSS and Excel files are accepted.</span></span><br />
<br />
<span style="line-height:107%"><b><span lang="EN-US" style="border: 1pt none windowtext; padding: 0cm;">Step 2: Selecting Items</span></b></span><br />
<span style="line-height:107%"><span lang="EN-US" style="border: 1pt none windowtext; padding: 0cm;">Once the data is uploaded, you can select items that constitute your measurement model. There are two options: (1) let the app automatically detect the factors or (2) manually select which items belong to which construct. &nbsp;</span></span><br />
<span style="line-height:107%"><span lang="EN-US" style="border: 1pt none windowtext; padding: 0cm;">Clear labeling is crucial for the application to work well. Choose a clear name for a scale and then add the item number at the end of the name. For example, the first item of a 5-item performance scale should, for instance, be labelled as &ldquo;Perf1&rdquo; or &ldquo;Performance1&rdquo;. To indicate that an item is reverse coded, you could add an &ldquo;R&rdquo; or &ldquo;Rev&rdquo; at the end. &nbsp;For example, &ldquo;Perf3R&rdquo; or &ldquo;Perf3_Rev&rdquo;. </span></span><br />
<span style="line-height:107%"><span lang="EN-US" style="border: 1pt none windowtext; padding: 0cm;">The app clusters items using a simple process:</span></span></span></span>
<ol>
<li style="margin-left:8px"><span style="font-size:16px;"><span style="font-family:Arial,Helvetica,sans-serif;"><span style="line-height:107%"><span lang="EN-US" style="border: 1pt none windowtext; padding: 0cm;">First it removes characters that indicate that an item was reversed. It will remove the following substrings if they appear at the end: &ldquo;R&rdquo;, &ldquo;Rev&rdquo;, &ldquo;REV&rdquo;, &ldquo;_R&rdquo;, &ldquo;_Rev&rdquo; and &ldquo;_REV&rdquo;. For example, &ldquo;OCB1R&rdquo; becomes &ldquo;OCB1&rdquo;. Or &ldquo;CSR1_REV&rdquo; becomes &ldquo;CSR1&rdquo;. </span></span></span></span></li>
<li style="margin-left:8px"><span style="font-size:16px;"><span style="font-family:Arial,Helvetica,sans-serif;"><span style="line-height:107%"><span lang="EN-US" style="border: 1pt none windowtext; padding: 0cm;">Then it deletes all digits in the variable names. For example, &ldquo;OCB1&rdquo; becomes &ldquo;OCB&rdquo;, &ldquo;Trust1_2&rdquo; becomes &ldquo;Trust_&rdquo;, or &ldquo;Proc13&rdquo; becomes &ldquo;Proc&rdquo;.&nbsp;Now all items belonging to the same factor should have the same unique substring.</span></span></span></span></li>
<li style="margin-left:8px"><span style="font-size:16px;"><span style="font-family:Arial,Helvetica,sans-serif;"><span style="line-height:107%"><span lang="EN-US" style="border: 1pt none windowtext; padding: 0cm;">After this, it checks if some variable names still end with a special character (e.g., &ldquo;_&rdquo;) and this will be removed. </span></span></span></span></li>
<li style="margin-bottom:12px; margin-left:8px"><span style="font-size:16px;"><span style="font-family:Arial,Helvetica,sans-serif;"><span style="line-height:107%"><span lang="EN-US" style="border: 1pt none windowtext; padding: 0cm;">Finally, the stripped down variable name will be used as the label of the latent factor (e.g., OCB) and all items that have these same string will be treated as an indicator (e.g., OCB1 and OCB2_R but not OCBO1). </span></span></span></span></li>
</ol>
<span style="font-size:16px;"><span style="font-family:Arial,Helvetica,sans-serif;"> <strong><span style="line-height:107%"><span lang="EN-US"><span style="line-height:107%">Step 3: Run CFA</span></span></span></strong><br />
<span style="line-height:107%"><span lang="EN-US"><span style="line-height:107%">Once you have selected &ldquo;Extract Factors&rdquo;, a proposed measurement model appears. This should reflect the model you want to test. To run the model you can go the &ldquo;CFA Specifications Tab&rdquo;.</span></span></span></span></span></div>
Loading

0 comments on commit 62a1ec7

Please sign in to comment.