{"id":378743,"date":"2023-09-28T19:00:00","date_gmt":"2023-09-29T01:00:00","guid":{"rendered":"\/r-blog\/2023-09-29-r-markdown\/likertsystems\/"},"modified":"2023-09-28T19:00:00","modified_gmt":"2023-09-29T01:00:00","slug":"reveal-the-stories-behind-those-likert-type-data","status":"publish","type":"post","link":"https:\/\/www.r-bloggers.com\/2023\/09\/reveal-the-stories-behind-those-likert-type-data\/","title":{"rendered":"Reveal the stories behind those Likert-type data"},"content":{"rendered":"<!-- \r\n<div style=\"min-height: 30px;\">\r\n[social4i size=\"small\" align=\"align-left\"]\r\n<\/div>\r\n-->\r\n\r\n<div style=\"border: 1px solid; background: none repeat scroll 0 0 #EDEDED; margin: 1px; font-size: 12px;\">\r\n[This article was first published on  <strong><a href=\"https:\/\/www.jobnmadu.com\/r-blog\/2023-09-29-r-markdown\/likertsystems\/\"> R-Blog on Data modelling to develop ...<\/a><\/strong>, and kindly contributed to <a href=\"https:\/\/www.r-bloggers.com\/\" rel=\"nofollow\">R-bloggers<\/a>].  (You can report issue about the content on this page <a href=\"https:\/\/www.r-bloggers.com\/contact-us\/\">here<\/a>)\r\n<hr>Want to share your content on R-bloggers?<a href=\"https:\/\/www.r-bloggers.com\/add-your-blog\/\" rel=\"nofollow\"> click here<\/a> if you have a blog, or <a href=\"http:\/\/r-posts.com\/\" rel=\"nofollow\"> here<\/a> if you don't.\r\n<\/div>\n\n<div id=\"introduction\" class=\"section level1\">\n<h1>Introduction<\/h1>\n<p>This blog is about two new functions, <code>Model_factors<\/code> and <code>garrett_ranking<\/code> that have been added to the <code>Dyn4cast<\/code> package. The two functions provides means for gaining deeper insights into the meaning behind Likert-type variables collected from respondents. Garrett ranking provides the ranks of the observations of the variables based on the level of seriousness attached to it by the respondents. On the other hand, Model factors determines and retrieve the latent factors inherent in such data which now becomes continuous data. The factors or data frame retrieved from the variables can be used in other analysis like regression and machine learning.<\/p>\n<p>The two functions are part of factor analysis, essentially, exploratory factor analysis (EFA), used to unravel the underlying structure of the observed variables. The analysis also helps to reduce the complex structure by determining a smaller number of latent factors that sufficiently represent the variation in the observed variables. With EFA, no prior knowledge or hypothesis about the number or nature of the factors is assumed. These are great tools to help tell the story behind your data. The data used for <code>Model_factors<\/code> is prepared using <code>fa.parallel<\/code> and <code>fa<\/code> functions in the <code>psych<\/code> package. The interesting thing about these functions are their simplicity, and we still maintain the <em>one line<\/em> code technique.<\/p>\n<p>The basic usage of the codes are:<\/p>\n<p><code>garrett_ranking(data, num_rank, ranking = NULL, m_rank = c(2:15))<\/code><\/p>\n<p><code>Data<\/code> The data for the Garrett Ranking.<\/p>\n<p><code>num_rank<\/code> number of ranks applied to the data. If the data is a five-point Likert-type data, then number of ranks is 5.<\/p>\n<p><code>Ranking<\/code> A vector of list representing the ranks applied to the data. If not available, positional ranks are applied.<\/p>\n<p><code>m_rank<\/code> scope of ranking (2-15).<\/p>\n<p><code>Model_factors(data = dat, DATA = Data)<\/code><\/p>\n<p><code>data<\/code> <code>R<\/code> object\u2060 obtained from EFA using the <code>fa<\/code> function in <code>psych<\/code> package<\/p>\n<p><code>DATA<\/code> <code>data.frame<\/code> of the raw data used to obtain data object.<\/p>\n<p>Let us go!<\/p>\n<\/div>\n<div id=\"load-library\" class=\"section level1\">\n<h1>Load library<\/h1>\n<pre>library(Dyn4cast)<\/pre>\n<\/div>\n<div id=\"garrett-ranking\" class=\"section level1\">\n<h1>Garrett Ranking<\/h1>\n<div id=\"ranking-is-supplied\" class=\"section level2\">\n<h2>ranking is supplied<\/h2>\n<pre>garrett_data &lt;- data.frame(garrett_data)\nranking &lt;- c(\n&quot;Serious constraint&quot;, &quot;Constraint&quot;,\n&quot;Not certain it is a constraint&quot;, &quot;Not a constraint&quot;,\n&quot;Not a serious constraint&quot;\n)\ngarrett_ranking(garrett_data, 5, ranking)\r\n$`Data mean table`\nS\/No Description Mean Remark Rank\n1 1 S1 14.758621 Above 1\n2 2 S2 8.172414 Above 2\n3 7 S7 7.034483 Above 3\n4 13 S13 7.034483 Above 4\n5 3 S3 5.965517 Above 5\n6 9 S9 4.517241 Above 6\n7 15 S15 4.517241 Above 7\n8 6 S6 3.965517 Above 8\n9 12 S12 3.965517 Above 9\n10 5 S5 3.413793 Above 10\n11 11 S11 3.413793 Above 11\n12 4 S4 3.310345 Above 12\n13 10 S10 3.310345 Above 13\n14 8 S8 1.862069 Below 14\n15 14 S14 1.862069 Below 15\n$`Garrett value`\n# A tibble: 5 \u00d7 4\nNumber `Garrett point` `Garrett index` `Garrett value`\n&lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt;\n1 1 3.33 15 85\n2 2 10 25 75\n3 3 16.7 31 69\n4 4 23.3 36 64\n5 5 30 40 60\n$`Garrett ranked data`\nS\/No Description Serious constraint Constraint\n1 2 S2 5 3\n2 9 S9 7 6\n3 15 S15 7 6\n4 5 S5 10 2\n5 11 S11 10 2\n6 4 S4 4 4\n7 10 S10 4 4\n8 3 S3 1 2\n9 1 S1 0 0\n10 6 S6 0 4\n11 12 S12 0 4\n12 7 S7 0 2\n13 13 S13 0 2\n14 8 S8 0 0\n15 14 S14 0 0\nNot certain it is a constraint Not a constraint Not a serious constraint\n1 2 2 1\n2 0 5 1\n3 0 5 1\n4 8 5 0\n5 8 5 0\n6 6 7 3\n7 6 7 3\n8 5 5 1\n9 2 1 0\n10 6 5 6\n11 6 5 6\n12 0 2 2\n13 0 2 2\n14 5 2 17\n15 5 2 17\nTotal Total Garrett Score Mean score Rank\n1 13 976 75.07692 1\n2 19 1425 75.00000 2\n3 19 1425 75.00000 3\n4 25 1872 74.88000 4\n5 25 1872 74.88000 5\n6 24 1682 70.08333 6\n7 24 1682 70.08333 7\n8 14 960 68.57143 8\n9 3 202 67.33333 9\n10 21 1394 66.38095 10\n11 21 1394 66.38095 11\n12 6 398 66.33333 12\n13 6 398 66.33333 13\n14 24 1493 62.20833 14\n15 24 1493 62.20833 15<\/pre>\n<\/div>\n<div id=\"ranking-not-supplied\" class=\"section level2\">\n<h2>ranking not supplied<\/h2>\n<pre>garrett_ranking(garrett_data, 5)\r\n$`Data mean table`\nS\/No Description Mean Remark Rank\n1 1 S1 14.758621 Above 1\n2 2 S2 8.172414 Above 2\n3 7 S7 7.034483 Above 3\n4 13 S13 7.034483 Above 4\n5 3 S3 5.965517 Above 5\n6 9 S9 4.517241 Above 6\n7 15 S15 4.517241 Above 7\n8 6 S6 3.965517 Above 8\n9 12 S12 3.965517 Above 9\n10 5 S5 3.413793 Above 10\n11 11 S11 3.413793 Above 11\n12 4 S4 3.310345 Above 12\n13 10 S10 3.310345 Above 13\n14 8 S8 1.862069 Below 14\n15 14 S14 1.862069 Below 15\n$`Garrett value`\n# A tibble: 5 \u00d7 4\nNumber `Garrett point` `Garrett index` `Garrett value`\n&lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt;\n1 1 3.33 15 85\n2 2 10 25 75\n3 3 16.7 31 69\n4 4 23.3 36 64\n5 5 30 40 60\n$`Garrett ranked data`\nS\/No Description 1st Rank 2nd Rank 3rd Rank 4th Rank 5th Rank Total\n1 2 S2 5 3 2 2 1 13\n2 9 S9 7 6 0 5 1 19\n3 15 S15 7 6 0 5 1 19\n4 5 S5 10 2 8 5 0 25\n5 11 S11 10 2 8 5 0 25\n6 4 S4 4 4 6 7 3 24\n7 10 S10 4 4 6 7 3 24\n8 3 S3 1 2 5 5 1 14\n9 1 S1 0 0 2 1 0 3\n10 6 S6 0 4 6 5 6 21\n11 12 S12 0 4 6 5 6 21\n12 7 S7 0 2 0 2 2 6\n13 13 S13 0 2 0 2 2 6\n14 8 S8 0 0 5 2 17 24\n15 14 S14 0 0 5 2 17 24\nTotal Garrett Score Mean score Rank\n1 976 75.07692 1\n2 1425 75.00000 2\n3 1425 75.00000 3\n4 1872 74.88000 4\n5 1872 74.88000 5\n6 1682 70.08333 6\n7 1682 70.08333 7\n8 960 68.57143 8\n9 202 67.33333 9\n10 1394 66.38095 10\n11 1394 66.38095 11\n12 398 66.33333 12\n13 398 66.33333 13\n14 1493 62.20833 14\n15 1493 62.20833 15<\/pre>\n<\/div>\n<\/div>\n<div id=\"you-can-rank-subset-of-the-data\" class=\"section level1\">\n<h1>you can rank subset of the data<\/h1>\n<pre>garrett_ranking(garrett_data, 8)\r\n$`Data mean table`\nS\/No Description Mean Remark Rank\n1 1 S1 14.758621 Above 1\n2 2 S2 8.172414 Above 2\n3 7 S7 7.034483 Above 3\n4 13 S13 7.034483 Above 4\n5 3 S3 5.965517 Above 5\n6 9 S9 4.517241 Above 6\n7 15 S15 4.517241 Above 7\n8 6 S6 3.965517 Below 8\n9 12 S12 3.965517 Below 9\n10 5 S5 3.413793 Below 10\n11 11 S11 3.413793 Below 11\n12 4 S4 3.310345 Below 12\n13 10 S10 3.310345 Below 13\n14 8 S8 1.862069 Below 14\n15 14 S14 1.862069 Below 15\n$`Garrett value`\n# A tibble: 8 \u00d7 4\nNumber `Garrett point` `Garrett index` `Garrett value`\n&lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt;\n1 1 3.33 15 85\n2 2 10 25 75\n3 3 16.7 31 69\n4 4 23.3 36 64\n5 5 30 40 60\n6 6 36.7 43 57\n7 7 43.3 47 53\n8 8 50 50 50\n$`Garrett ranked data`\nS\/No Description 1st Rank 2nd Rank 3rd Rank 4th Rank 5th Rank 6th Rank\n1 7 S7 4 2 2 0 2 0\n2 13 S13 4 2 2 0 2 0\n3 2 S2 2 0 2 5 3 2\n4 9 S9 0 4 4 7 6 0\n5 15 S15 0 4 4 7 6 0\n6 3 S3 1 3 4 1 2 5\n7 5 S5 0 1 0 10 2 8\n8 11 S11 0 1 0 10 2 8\n9 4 S4 0 1 3 4 4 6\n10 10 S10 0 1 3 4 4 6\n11 6 S6 0 1 1 0 4 6\n12 12 S12 0 1 1 0 4 6\n13 1 S1 0 0 0 0 0 2\n14 8 S8 1 0 0 0 0 5\n15 14 S14 1 0 0 0 0 5\n7th Rank 8th Rank Total Total Garrett Score Mean score Rank\n1 2 2 14 954 68.14286 1\n2 2 2 14 954 68.14286 2\n3 2 1 17 1078 63.41176 3\n4 5 1 27 1699 62.92593 4\n5 5 1 27 1699 62.92593 5\n6 5 1 22 1370 62.27273 6\n7 5 0 26 1556 59.84615 7\n8 5 0 26 1556 59.84615 8\n9 7 3 28 1641 58.60714 9\n10 7 3 28 1641 58.60714 10\n11 5 6 23 1291 56.13043 11\n12 5 6 23 1291 56.13043 12\n13 1 0 3 167 55.66667 13\n14 2 17 25 1326 53.04000 14\n15 2 17 25 1326 53.04000 15\r\ngarrett_ranking(garrett_data, 4)\r\n$`Data mean table`\nS\/No Description Mean Remark Rank\n1 1 S1 14.758621 Above 1\n2 2 S2 8.172414 Above 2\n3 7 S7 7.034483 Above 3\n4 13 S13 7.034483 Above 4\n5 3 S3 5.965517 Above 5\n6 9 S9 4.517241 Above 6\n7 15 S15 4.517241 Above 7\n8 6 S6 3.965517 Above 8\n9 12 S12 3.965517 Above 9\n10 5 S5 3.413793 Above 10\n11 11 S11 3.413793 Above 11\n12 4 S4 3.310345 Above 12\n13 10 S10 3.310345 Above 13\n14 8 S8 1.862069 Below 14\n15 14 S14 1.862069 Below 15\n$`Garrett value`\n# A tibble: 4 \u00d7 4\nNumber `Garrett point` `Garrett index` `Garrett value`\n&lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt;\n1 1 3.33 15 85\n2 2 10 25 75\n3 3 16.7 31 69\n4 4 23.3 36 64\n$`Garrett ranked data`\nS\/No Description 1st Rank 2nd Rank 3rd Rank 4th Rank Total\n1 9 S9 6 0 5 1 12\n2 15 S15 6 0 5 1 12\n3 2 S2 3 2 2 1 8\n4 5 S5 2 8 5 0 15\n5 11 S11 2 8 5 0 15\n6 3 S3 2 5 5 1 13\n7 4 S4 4 6 7 3 20\n8 10 S10 4 6 7 3 20\n9 1 S1 0 2 1 0 3\n10 7 S7 2 0 2 2 6\n11 13 S13 2 0 2 2 6\n12 6 S6 4 6 5 6 21\n13 12 S12 4 6 5 6 21\n14 8 S8 0 5 2 17 24\n15 14 S14 0 5 2 17 24\nTotal Garrett Score Mean score Rank\n1 919 76.58333 1\n2 919 76.58333 2\n3 607 75.87500 3\n4 1115 74.33333 4\n5 1115 74.33333 5\n6 954 73.38462 6\n7 1465 73.25000 7\n8 1465 73.25000 8\n9 219 73.00000 9\n10 436 72.66667 10\n11 436 72.66667 11\n12 1519 72.33333 12\n13 1519 72.33333 13\n14 1601 66.70833 14\n15 1601 66.70833 15<\/pre>\n<\/div>\n<div id=\"latent-variables-recovery\" class=\"section level1\">\n<h1>Latent Variables Recovery<\/h1>\n<pre>library(psych)\nData &lt;- Quicksummary\nGGn &lt;- names(Data)\nGG &lt;- ncol(Data)\nGGx &lt;- c(paste0(&quot;x0&quot;, 1:9), paste(&quot;x&quot;, 10:ncol(Data), sep = &quot;&quot;))\nnames(Data) &lt;- GGx\nlll &lt;- fa.parallel(Data, fm = &quot;minres&quot;, fa = &quot;fa&quot;)<\/pre>\n<p><img src=\"https:\/\/i0.wp.com\/www.jobnmadu.com\/r-blog\/2023-09-29-r-markdown\/LikertSystems_files\/figure-html\/unnamed-chunk-5-1.png?w=450&#038;ssl=1\" style=\"display: block; margin: auto;\" data-recalc-dims=\"1\" \/><\/p>\n<pre>Parallel analysis suggests that the number of factors = 5 and the number of components = NA \r\ndat &lt;- fa(Data, nfactors = lll[[&quot;nfact&quot;]], rotate = &quot;varimax&quot;, fm = &quot;minres&quot;)\nDD &lt;- Model_factors(data = dat, DATA = Data)\r\n\nLoadings:\nMR1 MR2 MR3 MR5 MR4\nx11 0.513\nx12 0.611\nx13 0.559\nx20 0.556\nx24 0.617 0.527\nx25 0.718\nx26 0.595\nx01 0.625\nx02 0.783 0.541\nx10 0.631\nx28 -0.610\nx04 0.740\nx05 0.792\nx06 0.720\nx08 0.594 0.452\nx17 0.667\nx18 0.527\nx19 0.592\nx03 0.523\nx07 0.417\nx09 0.403\nx14\nx15 0.480\nx16\nx21 0.492\nx22 0.481\nx23 -0.440 0.499\nx27 0.465\nx29\nMR1 MR2 MR3 MR5 MR4\nSS loadings 3.854 2.895 2.786 2.441 2.203\nProportion Var 0.133 0.100 0.096 0.084 0.076\nCumulative Var 0.133 0.233 0.329 0.413 0.489\r\nDD$Latent_1\r\n MR1 loading\n1 x11 0.513\n2 x12 0.611\n3 x13 0.559\n4 x20 0.556\n6 x25 0.718\n7 x26 0.595\n8 x15 0.480\n9 x21 0.492\r\nDD$Latent_3\r\n MR3 loading\n1 x04 0.740\n2 x05 0.792\n3 x06 0.720\r\nDD$Latent_5\r\n MR5 loading\n1 x17 0.667\n2 x18 0.527\n3 x19 0.592\n4 x07 0.417\n5 x09 0.403\r\nDD$Latent_frame\r\n# A tibble: 103 \u00d7 5\nMR1 MR2 MR3 MR4 MR5\n&lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt;\n1 16.7 6.28 2.99 11.2 10.4\n2 18.6 6.28 2.99 9.76 10.4\n3 16.3 3.23 2.99 11.5 9.22\n4 16.7 6.28 2.99 11.2 10.4\n5 18.1 5.65 2.99 11.2 10.4\n6 18.1 6.28 2.99 11.2 10.4\n7 19.1 6.28 2.25 11.2 9.22\n8 18.1 5.65 2.99 11.2 10.4\n9 18.1 5.65 2.99 11.2 10.4\n10 19.1 6.28 2.25 11.2 9.22\n# \u2139 93 more rows<\/pre>\n<p>Welcome to the world of Data Science and easy Machine Learning!<\/p>\n<\/div>\n<div style=\"border: 1px solid; background: none repeat scroll 0 0 #EDEDED; margin: 1px; font-size: 13px;\">\r\n<div style=\"text-align: center;\">To <strong>leave a comment<\/strong> for the author, please follow the link and comment on their blog: <strong><a href=\"https:\/\/www.jobnmadu.com\/r-blog\/2023-09-29-r-markdown\/likertsystems\/\"> R-Blog on Data modelling to develop ...<\/a><\/strong>.<\/div>\r\n<hr \/>\r\n<a href=\"https:\/\/www.r-bloggers.com\/\" rel=\"nofollow\">R-bloggers.com<\/a> offers <strong><a href=\"https:\/\/feedburner.google.com\/fb\/a\/mailverify?uri=RBloggers\" rel=\"nofollow\">daily e-mail updates<\/a><\/strong> about <a title=\"The R Project for Statistical Computing\" href=\"https:\/\/www.r-project.org\/\" rel=\"nofollow\">R<\/a> news and tutorials about <a title=\"R tutorials\" href=\"https:\/\/www.r-bloggers.com\/how-to-learn-r-2\/\" rel=\"nofollow\">learning R<\/a> and many other topics. <a title=\"Data science jobs\" href=\"https:\/\/www.r-users.com\/\" rel=\"nofollow\">Click here if you're looking to post or find an R\/data-science job<\/a>.\r\n\r\n<hr>Want to share your content on R-bloggers?<a href=\"https:\/\/www.r-bloggers.com\/add-your-blog\/\" rel=\"nofollow\"> click here<\/a> if you have a blog, or <a href=\"http:\/\/r-posts.com\/\" rel=\"nofollow\"> here<\/a> if you don't.\r\n<\/div>","protected":false},"excerpt":{"rendered":"<div style = \"width:60%; display: inline-block; float:left; \">\n<p>Introduction<br \/>\nThis blog is about two new functions, Model_factors and garrett_ranking that have been added to the Dyn4cast package. The two functions provides means for gaining deeper insights into the meaning behind Likert-type variables collected fr&#8230;<\/p><\/div>\n<div style = \"width: 40%; display: inline-block; float:right;\"><\/div>\n<div style=\"clear: both;\"><\/div>\n","protected":false},"author":2842,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"aioseo_notices":[],"jetpack-related-posts":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/posts\/378743"}],"collection":[{"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/users\/2842"}],"replies":[{"embeddable":true,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/comments?post=378743"}],"version-history":[{"count":1,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/posts\/378743\/revisions"}],"predecessor-version":[{"id":378744,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/posts\/378743\/revisions\/378744"}],"wp:attachment":[{"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/media?parent=378743"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/categories?post=378743"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/tags?post=378743"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}