This function performs a full Q methodology analysis. Both principal components analysis or centroid factor extraction can be used. The main results are factor characteristics, statement z-scores and factor scores, and distinguishing and consensus statements.

```
qmethod(dataset, nfactors, extraction = "PCA", rotation = "varimax",
forced = TRUE, distribution = NULL, cor.method = "pearson",
silent = FALSE, spc = 10^-5, ...)
```

dataset

a matrix or a data frame containing original data, with statements as rows, Q-sorts as columns, and the column scores in the distribution in each cell. The matrix or data frame should not contain character strings. The results keep row names and column names if set in the `dataset`

(see 'Details').

nfactors

number of factors to extract.

extraction

extraction method, either Principal Components Analysis or centroid factor extraction. It defaults to `"PCA"`

.

rotation

rotation method, defaults to `"varimax"`

. For `"centroid"`

extraction, `"none"`

and `"varimax"`

are implemented. For `"PCA"`

other possible rotations allowed in `principal`

function can be used: `"none"`

, `"varimax"`

, `"quartimax"`

, `"promax"`

, `"oblimin"`

, `"simplimax"`

, and `"cluster"`

. Note that only 'varimax' and manual rotation are standard in Q methodology.

forced

logical; Is the ranking of the items forced to match the distributions? Set to `TRUE`

if all respondents ranked the items strictly following the distribution scores, in which case the values of the distribution are calculated automatically. Set to `FALSE`

if respondents were able to rank the items without following the distribution, and the values of the distribution have to be provided as an array in the argument `distribution`

. See more details below in 'Notes'.

distribution

logical; when forced = `FALSE`

, the distribution has to be provided as a vector of numbers, such as `c(-2, -1, -1, 0, 1, 1, 2, 2)`

. See more details below in 'Notes' number 2.

cor.method

character string indicating which correlation coefficient is to be computed, to be passed on to the function `cor`

: `"pearson"`

(default), `"kendall"`

, or `"spearman"`

.

silent

logical; when = `TRUE`

, a summary message is printed.

spc

If centroid extraction is selected, this is the threshold to accept factor results, set to 0.00001 by default (in Brown 1980, this is set to 0.02; see `centroid`

)

...

other parameters to pass to functions such as `principal`

Returns a list of class `QmethodRes`

, with eight objects:

a list with the basic values of the analysis: date (`"date"`

), number of statements (`"nstat"`

), number of Q-sorts (`"nqsort"`

), whether the distribution was 'forced' (`"distro"`

), number of factors extracted (`"nfactors"`

), method for factor extraction (`"extraction"`

), method for rotation (`"rotation"`

), method for correlation (`"cor.method"`

), package version (`"pkg.version"`

), and a summary of this information for display purposes (`"info"`

).

original data.

factor loadings for Q-sorts.

logical dataframe of flagged Q-sorts.

statements z-scores.

statements factor scores, matched to the ordered array of values in the first row of the dataset.

factor characteristics (see `qfcharact`

):

`"characteristics"`

: data frame with the following values for each factor: average reliability coefficient, number of loading Q-sorts, eigenvalues, percentage of explained variance, composite reliability, standard error of factor scores.`"cor_zsc"`

: matrix of correlation coefficients between factors z-scores.`"sd_dif"`

: matrix of standard errors of differences.

distinguishing and consensus statements (see `qdc`

).

The forced/ non-forced distribution (argument `forced`

) refers to whether respondents were able to sort the items freely or they had to fit them in the distribution (i.e. the pyramid). If the `qmethod`

function returns the following error: `"Q method input: The argument 'forced' is set as 'TRUE', but ..."`

and you are unsure of how to solve it, continue reading.

First, ensure that the data are correctly introduced. For example, typos in the numbers entered result from forced distribution Q-sorts appearing as non-forced.

Second, if you data are indeed non-forced, set the argument `"forced = FALSE"`

and specify the argument `"distribution = ..."`

. For the argument `"distribution"`

, specify a numerical vector with as many elements as there are cells in your original distribution (i.e. as many items in the Q-set), and with the values of the columns. Repeat the values of each column as many times as there are cells in that column. For example, for the distribution shown in Figure 1 in this paper at *The R Journal*, the argument `distribution`

should be:

c(-4, -4, -3, -3, -3, -2, -2, -2, -2, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4 )

Or alternatively (a different way of getting the same vector):

c(rep(-4, 2), rep(-3, 3), rep(-2, 4), rep(-1, 5), rep( 0, 5), rep( 1, 5), rep( 2, 4), rep( 3, 3), rep( 4, 2))

If you don't want to specify a given distribution, you can specify `distribution = c(1:nrow(dataset)`

and then ignore the factor scores in the output of results.

**IMPORTANT**: The arguments `forced`

and `distribution`

are relevant only for the calculation of factor (normalised) scores. All other values in the results (e.g. z-scores) are unaffected by these specifications. **If in doubt in a study with non-forced distribution, best to interpret the z-scores instead of the factor scores**.

This function wraps together all the steps required for a complete analysis: extracting component loadings (`principal`

or `centroid`

); flagging Q-sorts (`qflag`

); calculating weights, z-scores, and rounded scores (`qzscores`

), calculating general characteristics (`qfcharact`

), and finding distinguishing and consensus statements (`qdc`

).

The default `qmethod`

performs automatic flagging and uses varimax rotation. Varimax rotation can be replaced by `"none"`

or other methods for rotation allowed in `principal`

from psych package.

If the input data contains row names and variable names, these will be kept throughout the analysis. Input data is validated, and it will give an error if there are non numerical values or if either the number of statements and Q-sorts introduced do not match the input data. It also returns error if the argument `forced`

is set to `TRUE`

but Q-sorts contain differing distributions.

Zabala, A., 2014. qmethod: a package to analyse human perspectives using Q methodology. *The R Journal*, 6(2):163-173. Available from: https://journal.r-project.org/archive/2014-2/zabala.pdf (Open access).

Brown, S. R., 1980 *Political subjectivity: Applications of Q methodology in political science*, New Haven, CT: Yale University Press.

See further references on the methodology in `qmethod-package`

.

`qzscores`

and `centroid`

in this package, and `principal`

in package psych.

# NOT RUN { data(lipset) results <- qmethod(lipset[[1]], nfactors = 3, rotation = "varimax") summary(results) results #shows all results # }

Run the code above in your browser using DataCamp Workspace