Extract variable estimates from the SQP 3.0 prediction algorithm

get_estimates(id, all_columns = FALSE, authorized = TRUE)

get_question_name(id)

Arguments

id

a numeric vector containing the id(s) of variable(s) of interest. Can be one or more id's.

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

TRUE to return only the authorized prediction or FALSE to return all available predictions. If set to FALSE a a warning is issued reminding the user to pick one prediction for each variable based on the user_id and user_username columns.

Value

get_estimates returns a tibble with the predictions. If id is of length 0, get_estimates returns an empty data frame. In both situations, the number of columns depends on the all_columns argument. get_question_name returns a character vector with the question name(s) unless id is of length 0 where it returns an empty character.

Details

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, get_estimates 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_estimates raises an error because there is no way of disentangling which prediction is authorized/unauthorized without the additional user_id column.

get_estimates 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 description 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

See also

sqp_login for logging in to the SQP 3.0 API through R and find_questions and find_studies for locating the variables of interest to use in get_estimates.

Examples

if (FALSE) { # Log in with sqp_login first. See ?sqp_login sqp_login() get_estimates(c(1, 2, 86)) get_estimates(c(1, 2, 86), all_columns = TRUE) # Explore variable names get_question_name(1) get_question_name(1:10) }