From 9ce2c461d2528520bd075275bcf5fdca81aedf3b Mon Sep 17 00:00:00 2001 From: Julius Pfadt Date: Mon, 12 Aug 2024 11:16:07 +0200 Subject: [PATCH] fix rebase conflict --- R/confirmatoryfactoranalysis.R | 15 +- po/R-ja.po | 14 +- .../test-confirmatoryfactoranalysis.R | 152 +++++++++--------- 3 files changed, 98 insertions(+), 83 deletions(-) diff --git a/R/confirmatoryfactoranalysis.R b/R/confirmatoryfactoranalysis.R index 247ebe61..97689ece 100644 --- a/R/confirmatoryfactoranalysis.R +++ b/R/confirmatoryfactoranalysis.R @@ -14,11 +14,7 @@ # along with this program. If not, see . # -# This is a temporary fix -# TODO: remove it when R will solve this problem! -gettextf <- function(fmt, ..., domain = NULL) { - return(sprintf(gettext(fmt, domain = domain), ...)) -} + confirmatoryFactorAnalysisInternal <- function(jaspResults, dataset, options, ...) { jaspResults$addCitation("Rosseel, Y. (2012). lavaan: An R Package for Structural Equation Modeling. Journal of Statistical Software, 48(2), 1-36. URL http://www.jstatsoft.org/v48/i02/") @@ -203,6 +199,12 @@ confirmatoryFactorAnalysisInternal <- function(jaspResults, dataset, options, .. "diagonallyWeightedLeastSquares" = "DWLS" ) + if (anyNA(dataset)) { + naAction <- ifelse(options$naAction == "twoStageRobust", "robust.two.stage", + ifelse(options$naAction == "twoStage", "two.stage", options$naAction)) + } else { + naAction <- "default" + } cfaResult[["lav"]] <- try(lavaan::lavaan( model = mod, @@ -226,8 +228,7 @@ confirmatoryFactorAnalysisInternal <- function(jaspResults, dataset, options, .. auto.cov.y = TRUE, mimic = options$packageMimiced, estimator = estimator, - missing = ifelse(options$naAction == "twoStageRobust", "robust.two.stage", - ifelse(options$naAction == "twoStage", "two.stage", options$naAction)) + missing = naAction )) # are there ordered variables in the data? diff --git a/po/R-ja.po b/po/R-ja.po index 7e644a56..bae356ec 100644 --- a/po/R-ja.po +++ b/po/R-ja.po @@ -1,17 +1,29 @@ msgid "" msgstr "" "Project-Id-Version: jaspFactor 0.13.0\n" +<<<<<<< HEAD "POT-Creation-Date: 2024-07-13 03:29\n" "PO-Revision-Date: 2024-07-02 15:09+0000\n" "Last-Translator: Daiki Hojo \n" "Language-Team: Japanese \n" +======= +"POT-Creation-Date: 2023-05-08 16:33\n" +"PO-Revision-Date: 2024-06-24 10:09+0000\n" +"Last-Translator: 上野真翔 \n" +"Language-Team: Japanese \n" +>>>>>>> 1eb6579 (Translated using Weblate (Japanese) (#229)) "Language: ja\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" +<<<<<<< HEAD "X-Generator: Weblate 5.7-dev\n" +======= +"X-Generator: Weblate 5.6-rc\n" +>>>>>>> 1eb6579 (Translated using Weblate (Japanese) (#229)) msgid "Second-Order" msgstr "二次" @@ -334,7 +346,7 @@ msgid "Average variance extracted" msgstr "平均分散抽出" msgid "AVE" -msgstr "AVE" +msgstr "" msgid "Heterotrait-monotrait ratio" msgstr "Heterotrait-monotrait 比" diff --git a/tests/testthat/test-confirmatoryfactoranalysis.R b/tests/testthat/test-confirmatoryfactoranalysis.R index d3ce90e6..b95da7d1 100644 --- a/tests/testthat/test-confirmatoryfactoranalysis.R +++ b/tests/testthat/test-confirmatoryfactoranalysis.R @@ -584,35 +584,35 @@ results <- jaspTools::runAnalysis("confirmatoryFactorAnalysis", "holzingerswinef test_that("Factor Covariances table results match", { table <- results[["results"]][["estimates"]][["collection"]][["estimates_fc"]][["data"]] jaspTools::expect_equal_tables(table, - list(0.252069643751425, 0.564393435959575, 0.4082315398555, 1, "Factor 1", - "", 2.99674828285745e-07, "Factor 2", 0.0796759008511687, - 5.12365138635909, 0.153674632748802, 0.370774902932515, 0.262224767840658, - 1, "Factor 1", "", 2.1939154322137e-06, "Factor 3", - 0.0553837396748543, 4.73468872597123, 0.0768417287748731, 0.270147907288013, - 0.173494818031443, 1, "Factor 2", "", 0.000434506858657757, - "Factor 3", 0.0493137067920418, 3.51818651076219, 0.252069643751426, - 0.564393435959575, 0.4082315398555, 2, "Factor 1", "", - 2.99674828285745e-07, "Factor 2", 0.0796759008511687, 5.1236513863591, - 0.153674632748802, 0.370774902932515, 0.262224767840658, 2, - "Factor 1", "", 2.1939154322137e-06, "Factor 3", 0.0553837396748543, - 4.73468872597123, 0.0768417287748731, 0.270147907288013, 0.173494818031443, - 2, "Factor 2", "", 0.000434506858657757, "Factor 3", - 0.0493137067920418, 3.51818651076219)) + list(0.264127499425447, 0.552335580285554, 0.4082315398555, 1, "Factor 1", + "", 2.81820449199444e-08, "Factor 2", 0.0735238206246278, + 5.55237114158833, 0.15192499892102, 0.372524536760297, 0.262224767840658, + 1, "Factor 1", "", 3.16848206827203e-06, "Factor 3", + 0.0562764263984793, 4.65958456537219, 0.07683979972175, 0.270149836341137, + 0.173494818031443, 1, "Factor 2", "", 0.000434621849370931, + "Factor 3", 0.0493146910209044, 3.51811629434927, 0.264127499425447, + 0.552335580285554, 0.4082315398555, 2, "Factor 1", "", + 2.81820449199444e-08, "Factor 2", 0.0735238206246278, 5.55237114158833, + 0.15192499892102, 0.372524536760297, 0.262224767840658, 2, "Factor 1", + "", 3.16848206827203e-06, "Factor 3", 0.0562764263984793, + 4.65958456537219, 0.0768397997217501, 0.270149836341137, 0.173494818031443, + 2, "Factor 2", "", 0.000434621849370931, "Factor 3", + 0.0493146910209044, 3.51811629434927)) }) test_that("Factor variances table results match", { table <- results[["results"]][["estimates"]][["collection"]][["estimates_fv"]][["data"]] jaspTools::expect_equal_tables(table, - list(0.51579922628888, 1.10282884918973, 0.809314037739304, 1, "Factor 1", - 6.50814258040811e-08, 0.149755206608709, 5.40424641030303, 0.759562812574203, - 1.19941902306092, 0.97949091781756, 1, "Factor 2", 0, 0.112210278851102, - 8.7290658917023, 0.203306550279352, 0.564190199988996, 0.383748375134174, - 1, "Factor 3", 3.06899737032573e-05, 0.0920638472329718, 4.16828523538758, - 0.51579922628888, 1.10282884918973, 0.809314037739304, 2, "Factor 1", - 6.50814258040811e-08, 0.149755206608709, 5.40424641030303, 0.759562812574203, - 1.19941902306092, 0.97949091781756, 2, "Factor 2", 0, 0.112210278851102, - 8.72906589170229, 0.203306550279352, 0.564190199988996, 0.383748375134174, - 2, "Factor 3", 3.06899737032573e-05, 0.0920638472329717, 4.16828523538759 + list(0.524213173797399, 1.09441490168121, 0.809314037739305, 1, "Factor 1", + 2.64057073984247e-08, 0.145462297364005, 5.56373749353123, 0.759767572610602, + 1.19921426302452, 0.97949091781756, 1, "Factor 2", 0, 0.112105807525091, + 8.73720050228737, 0.214781179470692, 0.552715570797657, 0.383748375134174, + 1, "Factor 3", 8.53300875691687e-06, 0.0862093370063297, 4.45135513692674, + 0.524213173797399, 1.09441490168121, 0.809314037739305, 2, "Factor 1", + 2.64057073984247e-08, 0.145462297364005, 5.56373749353123, 0.759767572610602, + 1.19921426302452, 0.97949091781756, 2, "Factor 2", 0, 0.112105807525091, + 8.73720050228737, 0.214781179470692, 0.552715570797656, 0.383748375134174, + 2, "Factor 3", 8.53300875691687e-06, 0.0862093370063297, 4.45135513692674 )) }) @@ -649,18 +649,19 @@ test_that("Intercepts table results match", { test_that("Factor Intercepts table results match", { table <- results[["results"]][["estimates"]][["collection"]][["estimates_Factor Intercepts"]][["data"]] jaspTools::expect_equal_tables(table, - list(4.86032703729577, 5.21479167387077, 5.03755935558327, 1, "Factor 1", - 0, 0.090426313792235, 55.7089982364829, 2.75710153479434, 3.10340246097582, - 2.93025199788508, 1, "Factor 2", 0, 0.088343696341633, 33.1687728635842, - 3.90410200426111, 4.22060103316011, 4.06235151871061, 1, "Factor 3", - 0, 0.0807410318239286, 50.3133465964288, 4.68082259954853, 5.03876634316866, - 4.85979447135859, 2, "Factor 1", 0, 0.0913138574084872, 53.2207773199043, - 3.03093169693174, 3.3907128242691, 3.21082226060042, 2, "Factor 2", - 0, 0.0917825863575222, 34.9829132957014, 4.13415749314571, 4.48968795507957, - 4.31192272411264, 2, "Factor 3", 0, 0.0906982130126474, 47.5414297689786 + list(4.86029752114904, 5.21482119001743, 5.03755935558323, 1, "Factor 1", + 0, 0.0904413733274764, 55.6997220436148, 2.75677120171169, 3.10373279405854, + 2.93025199788512, 1, "Factor 2", 0, 0.0885122367256859, 33.1056146165016, + 3.90407881578928, 4.2206242216325, 4.06235151871089, 1, "Factor 3", + 0, 0.0807528628944437, 50.3059752076035, 4.68063900389833, 5.03894993881863, + 4.85979447135848, 2, "Factor 1", 0, 0.0914075303797947, 53.1662375207625, + 3.03056822444163, 3.39107629675968, 3.21082226060066, 2, "Factor 2", + 0, 0.0919680349133189, 34.9123721478544, 4.13410767934369, 4.48973776888174, + 4.31192272411271, 2, "Factor 3", 0, 0.0907236286848159, 47.5281113269049 )) }) + options$interceptsFixedToZero <- "meanManifest" set.seed(1) results <- jaspTools::runAnalysis("confirmatoryFactorAnalysis", "holzingerswineford.csv", options) @@ -668,51 +669,52 @@ results <- jaspTools::runAnalysis("confirmatoryFactorAnalysis", "holzingerswinef test_that("Factor Intercepts table results match", { table <- results[["results"]][["estimates"]][["collection"]][["estimates_Factor Intercepts"]][["data"]] jaspTools::expect_equal_tables(table, - list(3.65754400738779, 7.85746191244071, 5.75750295991425, 1, "Factor 1", - 7.71475485716877e-08, 1.0714273165684, 5.37367572291749, 2.67329743888011, - 3.38328888769281, 3.02829316328646, 1, "Factor 2", 0, 0.181123595742837, - 16.7194845644854, 3.71374413938686, 5.75309790047635, 4.7334210199316, - 1, "Factor 3", 0, 0.520252866168884, 9.09830839527763, 4.96696097397706, - 7.02507093096112, 5.99601595246909, 2, "Factor 1", 0, 0.525037697941945, - 11.4201627349282, 2.92991249413903, 3.60159845584644, 3.26575547499273, - 2, "Factor 2", 0, 0.171351608245249, 19.058796753857, 2.793007701454, - 5.28401148493782, 4.03850959319591, 2, "Factor 3", 2.08242978416706e-10, - 0.635471825791837, 6.35513555327757)) + list(4.17946249998224, 7.33554341971368, 5.75750295984796, 1, "Factor 1", + 8.61755111714047e-13, 0.805137478195059, 7.15095634692725, 2.67401208793776, + 3.38257423864503, 3.02829316329139, 1, "Factor 2", 0, 0.180758972179162, + 16.7532107910519, 3.61178718674901, 5.85505485314677, 4.73342101994789, + 1, "Factor 3", 2.22044604925031e-16, 0.572272675440052, 8.27126861562646, + 5.00292685139523, 6.98910505353057, 5.9960159524629, 2, "Factor 1", + 0, 0.506687423289933, 11.833757217676, 2.93332374830556, 3.59818720167768, + 3.26575547499162, 2, "Factor 2", 0, 0.169611140463926, 19.2543689409729, + 2.91399967225576, 5.16301951397701, 4.03850959311639, 2, "Factor 3", + 1.9373391779709e-12, 0.573740094068369, 7.03891820506995)) }) test_that("Intercepts table results match", { table <- results[["results"]][["estimates"]][["collection"]][["estimates_Intercepts"]][["data"]] jaspTools::expect_equal_tables(table, - list(-2.82086049306897, 1.37206410197526, -0.724398195546852, 1, "x1", - 0.498257853951389, 1.06964327613096, -0.677233440074615, 1.6579921814542, - 4.92350462308137, 3.29074840226779, 1, "x2", 7.80789775793878e-05, - 0.833054195736533, 3.95022126904759, -3.9895831284748, -1.14311728496707, - -2.56635020672093, 1, "x3", 0.000409050402817135, 0.726152589017015, - -3.53417483534002, -0.437370677504958, 0.216400318827097, -0.110485179338931, - 1, "x4", 0.507679587603854, 0.166781380037826, -0.662455121272365, - 0.417590399459313, 1.09105191834536, 0.754321158902338, 1, "x5", - 1.13050308931939e-05, 0.17180456482829, 4.39057693057366, -0.968470973968885, - -0.319200985157928, -0.643835979563407, 1, "x6", 0.000101440416994558, - 0.165633142734335, -3.88712046957944, -1.69451524371202, 0.339644579320786, - -0.677435332195615, 1, "x7", 0.191739032345593, 0.518927857623404, - -1.30545185085678, -2.84093538587357, -0.0293351814438569, -1.43513528365872, - 1, "x8", 0.0454071513513012, 0.717258129896075, -2.00086304196601, - 1.05054048576094, 3.17460074594772, 2.11257061585433, 1, "x9", - 9.67009333712188e-05, 0.541862064033088, 3.89872396700082, -2.16953548981766, - -0.134323505968075, -1.15192949789287, 2, "x1", 0.0265086185992982, - 0.51919627092719, -2.21867829642869, 1.74677342548164, 3.48493867238887, - 2.61585604893525, 2, "x2", 3.65035446314721e-09, 0.443417649665415, - 5.89930520562065, -2.34974383123603, -0.578109270848743, -1.46392655104239, - 2, "x3", 0.00119911054203281, 0.451955896731194, -3.23909160524368, - -0.36798865865047, 0.227876404599755, -0.0700561270253575, 2, - "x4", 0.64489351397835, 0.152009186890762, -0.460867717657759, - 0.592141420248959, 1.21531497293793, 0.903728196593445, 2, "x5", - 1.31048960572144e-08, 0.158975766290729, 5.68469155821359, -1.12184965654026, - -0.545494482595909, -0.833672069568086, 2, "x6", 1.4279661453287e-08, - 0.14703208285728, -5.67000108661529, -0.977643544907075, 1.51717429862637, - 0.269765376859647, 2, "x7", 0.671665767304788, 0.636444818173255, - 0.423862947983357, 0.174180036260091, 2.10442292951146, 1.13930148288577, - 2, "x8", 0.0206848446354611, 0.492417949635013, 2.31368796310175, - -2.8898649408433, 0.071731221352461, -1.40906685974542, 2, "x9", - 0.0621783869832733, 0.755523107964345, -1.86502152600198)) + list(-2.29778247855469, 0.848986087595441, -0.724398195479626, 1, "x1", + 0.366853737408441, 0.802761834138649, -0.902382456008132, 1.85617988285797, + 4.72531692159857, 3.29074840222827, 1, "x2", 6.92600081286798e-06, + 0.731936163463202, 4.49595001107458, -4.02924675462711, -1.10345365887017, + -2.56635020674864, 1, "x3", 0.000585265324847928, 0.746389504816217, + -3.4383524824355, -0.436594394646065, 0.215624035960278, -0.110485179342894, + 1, "x4", 0.506669795232088, 0.166385310074817, -0.66403205483232, + 0.411738355496194, 1.09690396231017, 0.754321158903182, 1, "x5", + 1.59186892401131e-05, 0.174790356409219, 4.31557652492663, -0.963464116512774, + -0.324207842607803, -0.643835979560288, 1, "x6", 7.88032553507012e-05, + 0.163078576684914, -3.94801078503555, -1.79670881046573, 0.441838146039328, + -0.6774353322132, 1, "x7", 0.235519815460555, 0.571068390583304, + -1.18625955031629, -2.82560377715776, -0.0446667901569227, -1.43513528365734, + 1, "x8", 0.0430808812206047, 0.709435736813664, -2.02292499402844, + 1.1473885322431, 3.07775269949798, 2.11257061587054, 1, "x9", + 1.78730489270862e-05, 0.492448887449298, 4.28992870064723, -2.13315005814143, + -0.170708937633256, -1.15192949788734, 2, "x1", 0.0213944067107943, + 0.500631934052784, -2.30095089732308, 1.7331229546958, 3.49858914314841, + 2.6158560489221, 2, "x2", 6.31936569739366e-09, 0.450382303547, + 5.8080791103932, -2.32301431624246, -0.604838785827062, -1.46392655103476, + 2, "x3", 0.000838169615160922, 0.438318138488296, -3.33987216701472, + -0.364138025561973, 0.224025771510095, -0.070056127025939, 2, + "x4", 0.640569850098464, 0.150044542071035, -0.466902201566069, + 0.591160705852981, 1.21629568733627, 0.903728196594626, 2, "x5", + 1.45442131671558e-08, 0.15947613997356, 5.66685522200663, -1.12225205224369, + -0.545092086893686, -0.833672069568687, 2, "x6", 1.49536132365569e-08, + 0.147237390559869, -5.66209484152535, -0.856856508594173, 1.3963872624749, + 0.269765376940363, 2, "x7", 0.638850919242091, 0.574817646865548, + 0.469306011065214, 0.17776569210359, 2.10083727362224, 1.13930148286292, + 2, "x8", 0.0202159309776238, 0.490588499760096, 2.32231591939079, + -2.58679331205368, -0.231340407552876, -1.40906685980328, 2, + "x9", 0.0190291696997005, 0.600891884514286, -2.34495904524032 + )) })