calibration function in R, please

19 views
Skip to first unread message

Sarah Wang

unread,
Jun 9, 2024, 10:02:19 AM6/9/24
to QCA with R
Hi Adrian, 

Could I please ask you three questions related to the calibration function in R?

1. calibrate() -  method = "direct" 
When I do not write the line "method="direct" ", does the calibrate function still use the direct method to calibrate data (in other words, the direct method is the default setting)? 
mydata$efficacy <- calibrate(mydata$efficacy,
                                                   type = "fuzzy",
                                                   method = "direct",
                                                   thresholds = c(-0.175,0.15,0.4),
                                                    logistic = TRUE)

2. Following above, if I want to use the indirect method to calibrate, I should specify it, by writing "method="indirect""? 


3. How do you use the calibrate () function to do the reverse calibration for the crisp set (direct method)?  
mydata$low_short <- calibrate(mydata$low_short,
                                                        type="crisp",
                                                        thresholds = c(0.15))
If I use this code, the results are: any case above 0.15 is assigned 1, and below 0.15 is assigned 0. - this is not what I wanted. I would like it reversed, that is to assign 1 to any case below 0.15. 

Can I use the following code? Does it still follow the direct method to calibrate this condition? 
Or direct method does not really apply to the crisp set? (direct and indirect methods only apply to fuzzy set calibration)

mydata$low_short <- ifelse (mydata$low_short >0.15,0,1) 


Thank you
Kind regards

Sarah 

Ingo Rohlfing

unread,
Jun 9, 2024, 11:36:17 AM6/9/24
to QCA with R
Hi Sarah,

in the order of your questions.
1. method = "direct" is the default argument of the calibrate() function, so there is no need to type it out (does not hurt either, of course).
2. This means the indirect method needs to be typed out with method = "indirect". You also need to specify the thresholds for the categories; there is an example for indirect calibration in the help-file of calibrate().
3. You can work with base R ifelse() or write 
mydata$low_short <- 1- calibrate(mydata$low_short,
                                                        type="crisp",
                                                        thresholds = c(0.15))
to get inverted set membership values.

Regards

Ingo

Adrian Dușa

unread,
Jun 9, 2024, 3:54:46 PM6/9/24
to Ingo Rohlfing, QCA with R
To point 1, just as method = "direct" is the default, so is logistic = TRUE. Both are defaults, and need not be specified (but, as Ingo rightly points, does not hurt either).

To point 2, the indirect method is thoroughly explained in my online book:

For point 3, there are many methods. Using ifelse() or subtracting from 1 as Ingo shows, or even:
mydata$low_short <- calibrate(1 - mydata$low_short,
                                                        type="crisp",
                                                        thresholds = 0.15)
should reach the same result.
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/9375fe49-d15e-46d4-9b72-acd3e25a689an%40googlegroups.com.

Sarah Wang

unread,
Jun 9, 2024, 9:32:19 PM6/9/24
to Adrian Dușa, Ingo Rohlfing, QCA with R
Thank you so much Ingo and Adrian. really clear

Kind regards

Sarah 



--
Sarah Wang
Reply all
Reply to author
Forward
0 new messages