Problems after upgrading R and QCA package versions

61 views
Skip to first unread message

Stefano Assanti

unread,
Apr 19, 2024, 6:33:33 AM4/19/24
to QCA with R

Dear Adrian,

Having recently upgraded both my versions of R and the QCA package, I am encountering a number of errors, anomalies or slowdowns that prevent me from performing functions and analyses that I used to run easily and without problems before the upgrade.

I would be grateful if you could give me your opinion on the origin of these problems and help me to understand whether they are idiosyncratic to my data or possibly a result of the updates that have been made.

In particular, in the last few days I have experienced:  

- A general slowdown in the execution of functions that involve more complex calculations, such as the intersection() or negate() functions, as well as the minimise() function to produce the intermediate solution.

- The following error occurs when using the truthTable() function:

> TT_d <- truthTable(data = d, outcome = "POP", + conditions = c("TRUST", "HRSS", "AO","OO","MSO","PR"), # + incl.cut = 0.8, pri.cut = 0.55, n.cut = 2, sort.by = "OUT, incl, PRI", show.cases = TRUE, dcc=T) > TT_d

Error in `[<-.data.frame`(`*tmp*`, !missincl, "incl", value = c("0.808", : missing values are not allowed in subscripted assignments of data frames
[After some checking I found that if I add the 'complete = TRUE' option this error doesn't appear and the truthtable() function produces its output normally.]

- The esa() function does not remove any of the contradictory simplifying assumptions, nor the untenable assumption with the dediacated options 'contrad_rows ='  and 'nec_cond =' (but this may depend on the malfunctioning of the esa() function, which you have already pointed out in previous discussion).

- The theory.evaluation() function produces no output and gives the following error message: 

> TE_Y <- theory.evaluation(theory = "TY", + empirics = eis, + outcome = "POP", + sol = 1, + print.fit = T) Error in rbind(deparse.level, ...) : object 'xideclared' not found


I have made several attempts to find out what the problem is (uninstalled and reinstalled R and the QCA analysis packages, worked on different PCs, worked with different combinations of conditions and samples) without finding a solution. 

I 'm working on the following configuration: 

> R.version _ platform x86_64-w64-mingw32 arch x86_64 os mingw32 crt ucrt system x86_64, mingw32 status major 4 minor 3.3 year 2024 month 02 day 29 svn rev 86002 language R version.string R version 4.3.3 (2024-02-29 ucrt) nickname Angel Food Cake > sessionInfo() R version 4.3.3 (2024-02-29 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19045)

...

other attached packages: [1] haven_2.5.4 SetMethods_4.0 stargazer_5.2.3 ggrepel_0.9.5 ggplot2_3.5.0 QCA_3.22 admisc_0.35


Unfortunately I am not able to share even part of the data I am working on, but if it would help I could send it to you privately.

I take the opportunity of this message to thank you for sharing your time and expertise with this community, which has helped my research on so many occasions.

Kind regards,

Stefano

Adrian Dușa

unread,
Apr 20, 2024, 2:48:17 AM4/20/24
to Stefano Assanti, QCA with R
Dear Stefano,

Indeed, without access to a reproducible example, it is difficult to say what is going on.
One possibility is that you are loading multiple packages that perhaps overlap in function naming, for instance package dplyr (part of the tidyverse that package haven relies upon) overwrites the function recode() from package admisc.
I would only load package QCA and nothing else, and see if the offending truthTable() command still gives an error.

Otherwise, please privately send an example of your data, and also the complete R script you are using until the error occurs (from starting a fresh instance of R, to loading the packages, to using the QCA commands).

I'm sure there is a simple explanation of this, provided you send me those files.

All the best,
Adrian


--
You received this message because you are subscribed to the Google Groups "QCA with R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qcawithr+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/qcawithr/bd1bb422-287c-4bda-bdf2-c17fe9015f0bn%40googlegroups.com.

Adrian Dușa

unread,
Apr 20, 2024, 9:35:08 AM4/20/24
to Stefano Assanti, QCA with R
For the record, I have exchanged a couple of private messages with Stefano upon taking a closer look at the complete R script.
Part of the problems, as I have anticipated, are generated from loading too many packages with overlapping namespaces (functions with the same names).

Other problems that are more serious are also not related to package QCA but to the package SetMethods. It is true that, in version 3.22 I have introduced a series of novelties that will be part of a future publication of mine. Apparently, the code implementation for those novelties has a negative impact on the functionality in package SetMethods.

What I usually do, before releasing a CRAN version of package QCA, is to test for potential problems in reverse dependencies (in packages that depend on package QCA). My tests, as well as CRAN tests, did not reveal any problems for the simple reason the examples for the function theory.evaluation() in package SetMethods are all commented out. Readers can see the examples, but they are not run by R to notice a problem.

Absent these flags, I had no idea the new code will affect package SetMethods. In such a situation, users should address the maintainer of that package. I might have an idea of how to solve them, but I cannot implement those changes to patch a new version.

In the meantime, there are alternatives in the functions from the main package QCA. In a previous message I suggested employing the argument "exclude" to change a truth table, instead of using the function esa() from SetMethods to change a truth table, which can be done as simply as:

new_TT <- change(TT, exclude = CSA)
(where CSA is for instance a vector of contradictory simplifying assumptions).

Instead of intersect()-ing truth table rows to find these CSAs, one can employ the command:
CSA <- findRows(TT, type = 2)

Likewise, the function theory.evaluation() has an alternative in package QCA, in the function modelFit()
(suggestions are welcome if users feel an improved or extended output is needed)

I hope this explains the situation,
Adrian


On Fri, Apr 19, 2024 at 1:33 PM Stefano Assanti <ste.a...@gmail.com> wrote:
--

Stefano Assanti

unread,
Apr 21, 2024, 5:01:18 PM4/21/24
to QCA with R

Dear Adrian,

Thank you for such a clear and comprehensive explanation.

While waiting for the SetMethods package to be updated, I will continue my analyses as suggested, using the alternatives offered by the QCA package. Regarding the latter, I still have a few questions that may be of interest to other users.

The 'modelfit()' function in the QCA package automatically calculates all possible intersections between the theoretical expectations and the solutions obtained by the minimization process (and/or their negations), and provides parameters of fit. It is then possible to calculate the percentage of cases in each intersection and distinguish them by their membership of the outcome (above or below 0.5) using the 'compute()' function.

If the QCA solution being evaluated contains logical reminders, researchers should identify them so that the empirical support for each intersection can be more accurately assessed, as pointed out by Schneider and Wagemann (2012: 304). I wonder if there is a way to automate their identification, as to my knowledge there is no specific command in either QCA or SetMethods that provides such a result.

Finally, I would like to give some feedback on my experience after updating the QCA package and R. After several tests (using only the QCA package), I noticed that the 'modelfit()' function's computation time increases significantly with solution complexity. More specifically, starting with solutions containing 4 terms, a warning appears informing that "the negation of such models is potentially computationally intensive". I wonder if this could be due to the updates, as before  I used to run similar calculations in moderate time, whereas now in some cases they do not produce any output even after several hours.

Once again, thank you for all the valuable help you've provided!

Best,

Stefano

Adrian Dușa

unread,
Apr 22, 2024, 4:55:46 PM4/22/24
to Stefano Assanti, QCA with R
Hello Stefano,

In principle, yes it is perfectly possible to calculate the percentage of cases in each intersection.
I would first try to take a look into the SetMethods code that does that, to have an idea what they are doing, and then I would create my own. This would be quite easy, I believe.

I do not recall what S&W wrote on that particular page, but QCA solutions cannot contain remainders.
The remainders are <used> in the minimization process to identify the prime implicants that form the solutions. So I am not quite certain what exactly it is that you are looking for.

Lastly, the modelFit() function has been fixed twice, in version 3.14 and 3.17 (as per the ChangeLog file). Don't know what "before" means (which version?) that did not take long. The thing is, negation of a solution is indeed computationally intensive. If you could point out what code under which version of package QCA used to work fast(er), I would be very interested to check it out.

All the best,
Adrian

On Mon, Apr 22, 2024 at 12:01 AM Stefano Assanti <ste.a...@gmail.com> wrote:

Dear Adrian,

Thank you for such a clear and comprehensive explanation.

Stefano Assanti

unread,
Apr 24, 2024, 2:13:49 PM4/24/24
to QCA with R
Dear Adrian,

Thanks again for the further clarification!

The version of QCA I was using was the 3.16. The commands I would normally run at higher speed were linked to the theory.evaluation() function, and therefore to the SetMethods package.

In the next few days I will try to install the latest version of the SetMethods package available on github and re-run my analysis. Should I find any other anomalies, I will report them in this conversation.

Thanks again!

Best,
Stefano 

Reply all
Reply to author
Forward
0 new messages