get_sqp.RdExtract variable estimates from the SQP 3.0 prediction algorithm
get_sqp(study, question_name, country, lang, all_columns = FALSE, authorized = TRUE)
| study | string with the name of the study. Upper and lower cases are ignored and regular expressions are supported. |
|---|---|
| question_name | A vector of strings specifying the variable names. A search is performed for similar names from all variables in the study. Upper or lower case is ignored and regular expressions are supported. |
| country | the country where the question was applied in two letter ISO code. See the ISO two letter country name list here for all options. Upper or lower case is ignored. |
| lang | the language the question should be in, in a three
letter character. See the ISO three letter country name list
here
for all options. Upper or lower case is ignored. This should be
a language spoken in |
| all_columns | a logical stating whether to extract all available columns from the SQP 3.0 database. See the details section for a list of all possible variables. |
| authorized |
|
get_sqp returns a tibble with the
predictions. The number of columns depends on the all_columns
argument.
get_sqp is a simple wrapper around find_questions,
find_studies and get_estimates for a direct
downloading strategy of the SQP data. For a lower-level approach use
a combination of these functions to extract SQP data.
SQP predictions can be both 'authorized' predictions, which are
performed by the SQP 3.0 software, and 'crowd-sourced' predictions which are
added to the database by other users. By default, sqp_data
always returns the 'authorized' prediction when it is available. When
it is not, it returns the first non-authorized prediction, and so on.
If the user wants to choose a specific prediction, then
authorized = FALSE will return all available predictions for each
question.
If authorized = FALSE and all_columns = FALSE,
get_sqp raises an error because there is no way of
disentangling which prediction is authorized/unauthorized without the
additional user_id column (observed when all_columns = TRUE).
sqp_data returns a four column tibble with
the question name and the estimates for quality, reliability
and validity. However, if all_columns is set to TRUE
the returned tibble contains new columns. Below you can
find the descriptionof of all columns:
question: the literal name of the question in the questionnaire of the study
question_id: the API internal ID of the question
id: this is the coding ID, that is, the coding of the authorized prediction
created: Date of the API request
routing_id: Version of the coding scheme applied to get that prediction.
authorized: Whether it is an 'authorized' prediction or not. See the details section
complete: Whether all fields of the coding are complete
user_id: The id of the user that crowd-sourced the prediction
error: Whether there was an error in making the prediction. For an example, see http://sqp.upf.edu/loadui/#questionPrediction/12552/42383
errorMessage: The error message, if there was an error
reliability: The strenght between the true score factor and the observed variable or 1 - proportion random error in the observed variance. Computed as the squared of the reliability coefficient
validity: The strength between the latent concept factor and the true score factor or 1 - proportion method error variance in the true score variance. Computed as the square of the validity coefficient
quality: The strength between the latent concept factor and the observed variable or 1 - proportion of random and method error variance in the latent concept's variance. Computed as the product of reliability and validity.
reliabilityCoefficient: The effect between the true score factor and the observed variable
validityCoefficient: The effect between the latent concept factor and the true score factor
methodEffectCoefficient: The effect between the method factor and the true score factor
qualityCoefficient: It is computed as the square root of the quality
reliabilityCoefficientInterquartileRange: Interquartile range for the reliability coefficient
validityCoefficientInterquartileRange: Interquartile range for the validity coefficient
qualityCoefficientInterquartileRange: Interquartile range for the quality coefficient
reliabilityCoefficientStdError: Predicted standard error of the reliability coefficient
validityCoefficientStdError: Predicted standard error of the validity coefficient
qualityCoefficientStdError: Predicted standard error of the quality coefficient
sqp_login for logging in to the SQP 3.0 API through R
and find_questions, find_studies and
get_estimates for the lower-level approach of extracting
estimates.
if (FALSE) { # Log in with sqp_login first. See ?sqp_login sqp_login() # 'es' and 'spa' here stands for Spain and Spanish get_sqp("ESS Round 4", "tvtot", "es", "spa") get_sqp( "ESS Round 4", c("tvtot", "ppltrst", "pplfair"), "se", "swe" ) # Sweden-Swedish get_sqp( "ESS Round 4", c("tvtot", "ppltrst", "pplfair"), "se", "swe" ) # Germany-German get_sqp( "ESS Round 1", c("vote", "trstplt"), "de", "deu", all_columns = TRUE ) }