Chapter 7 Miscellaneous
7.1 NCA software
7.1.1 Main NCA software: R package
The main NCA software is a free package in R called NCA
(Dul & Buijs, 2023).The first version of this software was released in 2015 just before the online publication of NCA’s core paper (Dul, 2016b) on 15 July, 2015. Since then the software was updated several times to correct bugs, integrate new NCA developments, and make improvements based on feedback from users.
The following versions have been released so far:
NCA_1.0 (2015-07-02)
NCA_1.1 (2015-10-10)
NCA_2.0 (2016-05-18)
NCA_3.0 (2018-08-01)
NCA_3.0.1 (2018-08-21)
NCA_3.0.2 (2019-11-22)
NCA_3.0.3 (2020-06-11)
NCA_3.1.0 (2021-03-02)
NCA_3.1.1 (2021-05-03)
NCA_3.2.0 (2022-04-05)
NCA_3.2.1 (2022-09-15)
NCA_3.3.0 (2023-02-06)
NCA_3.3.1 (2023-02-10)
NCA_3.3.2 (2023-06-27)
NCA_3.3.3 (2023-09-05)
NCA_4.0.0 (2024-02-16)
NCA_4.0.1 (2024-02-23)
NCA_4.0.2 (2024-11-09)
When the first digit of the version number increases, major changes were implemented. Version 1 was the first limited version, version 2 was the first comprehensive version, version 3 includes the statistical test for NCA, and version 4 introduced two new functions nca_random
and nca_power
. The second digit refers to larger changes and the third digit minor changes.
The currently installed version of the NCA software and the availability of a new version can be checked as follows:
The cumulative number of downloads of the NCA software from the CRAN website are shown in Figure 7.1.
Until 31 December 2023 the software was downloaded more than 47,000 times.
The current cumulative number of downloads can be obtained by:
library("cranlogs")
x <- cran_downloads(packages = "NCA", from = "2015-07-02", to = Sys.Date())
cat("total downloads on")
## total downloads on
## [1] "2024-12-12"
## [1] 56245
The Quick Start Guide
(also here)
helps novice users of R and NCA to get started, but the guide also includes more advanced features. The NCA
package has a build-in help function with examples. Within R, the help function can be called as follows:
When help is needed for a specific function in NCA
, for example nca_analysis
the help for this function can be called as follows:
7.1.2 Other NCA software packages
Based on the R package a Stata module is available for conducting NCA (Spinelli et al., 2023). NCA is also part of the SmartPLS software for conducting NCA in combination with PLS-SEM (SmartPLS Development Team, 2023). These versions enable conducting a basic NCA in other software environments than R, but lack more advanced functions and recent developments of NCA. Currently, no NCA software is available for other platforms like SPSS or SAS.
7.2 Learning about NCA
Several possibilities exist to learn about NCA. Apart from reading books and publications about the NCA methodology (Table 0.2) and reading publications with examples of NCA applications (Table 0.1) several on site and online courses are available at the introduction and advanced levels. Major international conferences often host a professional development workshop on site to learn about NCA. An example is annual conference of the the Academy of Management. Also online short introduction courses exist for NCA. An example is a free on-demand introduction seminar hosted by Instats. A longer free introduction MOOC course is available from Coursera. At the advanced level, an on-demand course is hosted by Instats. Also an NCA paper development workshop is regularly organized. More information about NCA training and events can be found in the NCA website.
7.3 Producing high-quality NCA scatter plots
One of the primary results of NCA is the ‘NCA plot’, which is a scatter plot with ceiling line(s). Users often wish to save a high quality NCA plot for further use, for example for a publication. There are several ways to make and save a high quality NCA plot. In this section six ways are presented that have different levels of user flexibility:
Standard plot.
Standard plot with basic adaptations.
Standard plot with advanced adaptations.
Advanced plot with
plotly
.Advanced plot with
ggplot
.From within R script.
7.3.1 Standard plot
When NCA for R is used with RStudio, the standard NCA plot is displayed in the Plots window of RStudio. The plot can be produced with the argument plots = TRUE
of the nca_output
function. For the example dataset in NCA package, the standard plot can be obtained as follows:
library (NCA)
data(nca.example)
model <- nca_analysis(nca.example, 1, 3)
nca_output(model, plots = TRUE, summaries = FALSE)
7.3.2 Standard plot with basic adaptations
It may be desirable to change the appearance of the plot, such as the color of the points and the lines, the type of lines and the type of points. These characteristics can be changed with the graphical functions that are included in the NCA software. Before running nca_output, the NCA plot can be customized by changing the point type (for all points), the line types and line colors (for each ceiling line separately) and the line width (for all ceiling lines). For instance, a publisher may require a black and white or grayscale plot, with thicker lines and with solid points. Then the standard plot can be adapted as follows (changing of plot dimensions and the saving the plot is the same as for the standard plot):
line.colors['ce_fdh'] <- 'black'
line.colors['cr_fdh'] <- 'black'
line.colors['ols'] <- 'grey'
point.color <- "black"
point.type <- 20
line.width <- 2
nca_output(model, plots = TRUE, summaries = FALSE)
7.3.3 Standard plot with advanced adaptations
If further changes in the plot are needed, for example changes of the individual line types or the plot title, a special R script must be downloaded from:
https://raw.githubusercontent.com/eur-rsm/nca_scripts/master/display_plot.R
This script is used as an alternative for making the NCA plot with plots = TRUE
in the nca_output
function. The script can be copy/paste or otherwise loaded in your R session.
# Default values copied from p_constants
line_colors <- list(ols="green", lh="red3", cols="darkgreen",
qr="blue", ce_vrs="orchid4", cr_vrs="violet",
ce_fdh="red", cr_fdh="orange", sfa="darkgoldenrod",
c_lp="blue")
line_types <- list(ols=3, lh=2, cols=3,
qr=4, ce_vrs=5, cr_vrs=1,
ce_fdh=6, cr_fdh=1, sfa=7,
c_lp=2)
line_width <- 1.5
point_type <- 23
point_color <- 'red'
display_plot <-
function (plot) {
flip.x <- plot$flip.x
flip.y <- plot$flip.y
# Determine the bounds of the plot based on the scope
xlim <- c(plot$scope.theo[1 + flip.x], plot$scope.theo[2 - flip.x])
ylim <- c(plot$scope.theo[3 + flip.y], plot$scope.theo[4 - flip.y])
# Reset/append colors etc. if needed
for (method in names(line_types)) {
line.types[[method]] <- line_types[[method]]
}
if (is.numeric(line_width)) {
line.width <- line_width
}
if (is.numeric(point_type)) {
point.type <- point_type
}
if (point_color %in% colors()) {
point.color <- point_color
}
# Only needed until the next release (3.0.2)
if (!exists("point.color")) {
point.color <- "blue"
}
# Plot the data points
plot (plot$x, plot$y, pch=point.type, col=point.color, bg=point.color,
xlim=xlim, ylim=ylim, xlab=colnames(plot$x), ylab=tail(plot$names, n=1))
# Plot the scope outline
abline(v=plot$scope.theo[1], lty=2, col="grey")
abline(v=plot$scope.theo[2], lty=2, col="grey")
abline(h=plot$scope.theo[3], lty=2, col="grey")
abline(h=plot$scope.theo[4], lty=2, col="grey")
# Plot the legend before adding the clipping area
legendParams = list()
for (method in plot$methods) {
line.color <- line.colors[[method]]
line.type <- line.types[[method]]
name <- gsub("_", "-", toupper(method))
legendParams$names = append(legendParams$names, name)
legendParams$types = append(legendParams$types, line.type)
legendParams$colors = append(legendParams$colors, line.color)
}
if (length(legendParams) > 0) {
legend("topleft", cex=0.7, legendParams$names,
lty=legendParams$types, col=legendParams$colors, bg=NA)
}
# Apply clipping to the lines
clip(xlim[1], xlim[2], ylim[1], ylim[2])
# Plot the lines
for (method in plot$methods) {
line <- plot$lines[[method]]
line.color <- line.colors[[method]]
line.type <- line.types[[method]]
if (method %in% c("lh", "ce_vrs", "ce_fdh")) {
lines(line[[1]], line[[2]], type="l",
lty=line.type, col=line.color, lwd=line.width)
} else {
abline(line, lty=line.type, col=line.color, lwd=line.width)
}
}
# Plot the title
title(paste0("Advanced Standard NCA Plot : ", plot$title), cex.main=1)
}
The different default values of the plot can be changed as desired. For example, a researcher may wish to change the ols
line into a dotted line (line.type
to value 3), and to have a point type that is squared (point.type = 23
) with red color of the points (point.color = 'red'
). Also, the title of the plot can be changed at the end of the script into for example “Advanced NCA plot …”.
For producing the plot the final call is :
The plot can be reset to default values by:
7.3.4 Plot with plotly
The NCA software can also produce a plot made by plotly
. The main goal is to provide the user a possibility for graphical exploration of NCA results. However, it is also possible to save the plot. The plot with plotly
can be produced with the nca_output
function as follows:.
It is possible to label subgroups of points. For example, the continents of the countries in the nca.example
dataset can be identified as follows (in the order of the rows in the dataset):
labels <- c("Australia", "Europe", "Europe", "North America", "Europe", "Europe", "Europe", "Europe", "Europe", "Europe", "Europe", "Europe", "Europe", "Asia", "North America", "Europe", "Australia", "Europe", "Europe", "Europe", "Europe", "Asia", "Europe", "Europe", "Europe", "Europe", "Europe", "North America")
nca_output(model, plotly=labels, summaries = FALSE)
The plot opens in the Viewer tab of the plots window (Figure 7.5). The interactive version can be approached here. The plot identifies the ‘peers’ in red. Peers are points near the ceiling line that are used for drawing the default and other ceiling lines. When moving in the computer screen the pointer over the top of the plot, a toolbar pops up. One of its functions is “Download plot as png”, which saves the plot in the download folder of the computer (not in the working directory). Saving is also possible with Export tab -> Save as Image.
7.3.5 Plot with ggplot
The function ggplot
is an advanced graphical function in R. Output of NCA can be used as input for ggplot
. For example, when the ceiling line is a straight line (such as the default ceiling line cr_fdh
) the intercept and slope of the ceiling line can be used in ggplot
to plot the ceiling line.
First, these NCA parameters must be extracted from the NCA results:
intercept <- model$plots$Individualism$lines$cr_fdh$coefficients[1]
slope <- model$plots$Individualism$lines$cr_fdh$coefficients[2]
Next the ggplot
can be produced:
library (ggplot2)
ggplot(nca.example, aes(Individualism,`Innovation performance`))+
geom_point() +
geom_abline(intercept=intercept, slope=slope, col = "red")
The ggplot
function gives many graphical opportunities (see its documentation) to make the plot as desired.
Changing of plot dimensions and the saving the plot is the same as for the standard plot.
7.3.6 Saving the plot from within the R script
All above options for saving an NCA plot are based on first displaying the plot in R and then saving it. It is also possible to save the plot from within the R script. The following script saves a standard NCA plot as a png file with the name “nca.example.png”) in the working directory with a given size and resolution:
png("nca_example.png",units="cm", 15,15, res=300)
nca_output(model, plots = TRUE, summaries = FALSE)
dev.off()
It is also possible to save a pdf file: