Title: | Survey Defense Tool |
---|---|
Description: | This tool is designed to analyze up to 5 Fraud Detection Questions integrated into a survey, focusing on potential fraudulent participants to clean the survey dataset from potential fraud. Fraud Detection Questions and further information available at <https://surveydefense.org>. |
Authors: | Philipp Brüggemann [aut, cre] |
Maintainer: | Philipp Brüggemann <[email protected]> |
License: | GPL-3 |
Version: | 0.2.0 |
Built: | 2024-12-11 07:19:44 UTC |
Source: | CRAN |
This function analyzes survey data based on up to 5 Fraud Detection Questions and generates results in Word and HTML formats.
FraudDetec1( output_dir, data, FraudList, correct_answers = c(0, 0, 0, 0, 0), ... )
FraudDetec1( output_dir, data, FraudList, correct_answers = c(0, 0, 0, 0, 0), ... )
output_dir |
Path specifying where the Word and HTML files will be saved. |
data |
The data frame containing all the survey data. |
FraudList |
A character vector of up to 5 Fraud Detection Questions. |
correct_answers |
A numeric vector representing correct answers for each question. Default is |
... |
Survey questions to be analyzed. |
A flextable object with the fraud detection analysis results. The results include summary statistics and metrics comparing responses from reliable and fraudulent participants.
if (requireNamespace("flextable", quietly = TRUE) && requireNamespace("officer", quietly = TRUE)) { library(flextable) library(officer) # Example data for fraud detection analysis Q1 <- c(4, 5, 3, 2, 5, 2) Q2 <- c(3, 4, 2, 5, 4, 3) Q3 <- c(5, 4, 3, 5, 4, 5) Q4 <- c(1, 2, 3, 4, 5, 2) Q5 <- c(5, 2, 2, 1, 4, 1) Q6 <- c(5, 2, 3, 5, 1, 2) Q7 <- c(5, 2, 4, 5, 3, 4) Fraud1 <- c(0, 1, 0, 0, 0, 0) Fraud2 <- c(0, 0, 0, 0, 0, 0) Fraud3 <- c(0, 1, 0, 0, 0, 0) Fraud4 <- c(0, 0, 1, 0, 0, 1) Fraud5 <- c(0, 0, 0, 1, 1, 1) Test_Data_Fraud <- data.frame(Q1, Q2, Q3, Q4, Q5, Q6, Q7, Fraud1, Fraud2, Fraud3, Fraud4, Fraud5) temp_dir <- tempdir() FraudDetec1( output_dir = temp_dir, data = Test_Data_Fraud, FraudList = c("Fraud1", "Fraud2", "Fraud3", "Fraud4", "Fraud5"), correct_answers = c(0, 0, 0, 0, 0), Q1, Q2, Q3, Q4, Q5, Q6, Q7 ) }
if (requireNamespace("flextable", quietly = TRUE) && requireNamespace("officer", quietly = TRUE)) { library(flextable) library(officer) # Example data for fraud detection analysis Q1 <- c(4, 5, 3, 2, 5, 2) Q2 <- c(3, 4, 2, 5, 4, 3) Q3 <- c(5, 4, 3, 5, 4, 5) Q4 <- c(1, 2, 3, 4, 5, 2) Q5 <- c(5, 2, 2, 1, 4, 1) Q6 <- c(5, 2, 3, 5, 1, 2) Q7 <- c(5, 2, 4, 5, 3, 4) Fraud1 <- c(0, 1, 0, 0, 0, 0) Fraud2 <- c(0, 0, 0, 0, 0, 0) Fraud3 <- c(0, 1, 0, 0, 0, 0) Fraud4 <- c(0, 0, 1, 0, 0, 1) Fraud5 <- c(0, 0, 0, 1, 1, 1) Test_Data_Fraud <- data.frame(Q1, Q2, Q3, Q4, Q5, Q6, Q7, Fraud1, Fraud2, Fraud3, Fraud4, Fraud5) temp_dir <- tempdir() FraudDetec1( output_dir = temp_dir, data = Test_Data_Fraud, FraudList = c("Fraud1", "Fraud2", "Fraud3", "Fraud4", "Fraud5"), correct_answers = c(0, 0, 0, 0, 0), Q1, Q2, Q3, Q4, Q5, Q6, Q7 ) }
This function analyzes survey data using up to 5 Fraud Detection Questions and generates a report in Word and HTML formats.
FraudDetec2( output_dir, data, FraudList, correct_answers = c(0, 0, 0, 0, 0), ... )
FraudDetec2( output_dir, data, FraudList, correct_answers = c(0, 0, 0, 0, 0), ... )
output_dir |
Path specifying where the Word and HTML files will be saved. |
data |
The data frame containing all the survey data. |
FraudList |
A character vector of up to 5 Fraud Detection Questions. |
correct_answers |
A numeric vector representing correct answers for each question. Default is |
... |
Survey questions to be analyzed. |
A flextable object with the fraud detection analysis results, including summary statistics for the overall sample and identified fraudulent responses.
if (requireNamespace("flextable", quietly = TRUE) && requireNamespace("officer", quietly = TRUE)) { library(flextable) library(officer) # Example data for fraud detection analysis Q1 <- c(4, 5, 3, 2, 5, 2) Q2 <- c(3, 4, 2, 5, 4, 3) Q3 <- c(5, 4, 3, 5, 4, 5) Q4 <- c(1, 2, 3, 4, 5, 2) Q5 <- c(5, 2, 2, 1, 4, 1) Q6 <- c(5, 2, 3, 5, 1, 2) Q7 <- c(5, 2, 4, 5, 3, 4) Fraud1 <- c(0, 1, 0, 0, 0, 0) Fraud2 <- c(0, 0, 0, 0, 0, 0) Fraud3 <- c(0, 1, 0, 0, 0, 0) Fraud4 <- c(0, 0, 1, 0, 0, 1) Fraud5 <- c(0, 0, 0, 1, 1, 1) Test_Data_Fraud <- data.frame(Q1, Q2, Q3, Q4, Q5, Q6, Q7, Fraud1, Fraud2, Fraud3, Fraud4, Fraud5) temp_dir <- tempdir() FraudDetec2( output_dir = temp_dir, data = Test_Data_Fraud, FraudList = c("Fraud1", "Fraud2", "Fraud3", "Fraud4", "Fraud5"), correct_answers = c(0, 0, 0, 0, 0), Q1, Q2, Q3, Q4, Q5, Q6, Q7 ) }
if (requireNamespace("flextable", quietly = TRUE) && requireNamespace("officer", quietly = TRUE)) { library(flextable) library(officer) # Example data for fraud detection analysis Q1 <- c(4, 5, 3, 2, 5, 2) Q2 <- c(3, 4, 2, 5, 4, 3) Q3 <- c(5, 4, 3, 5, 4, 5) Q4 <- c(1, 2, 3, 4, 5, 2) Q5 <- c(5, 2, 2, 1, 4, 1) Q6 <- c(5, 2, 3, 5, 1, 2) Q7 <- c(5, 2, 4, 5, 3, 4) Fraud1 <- c(0, 1, 0, 0, 0, 0) Fraud2 <- c(0, 0, 0, 0, 0, 0) Fraud3 <- c(0, 1, 0, 0, 0, 0) Fraud4 <- c(0, 0, 1, 0, 0, 1) Fraud5 <- c(0, 0, 0, 1, 1, 1) Test_Data_Fraud <- data.frame(Q1, Q2, Q3, Q4, Q5, Q6, Q7, Fraud1, Fraud2, Fraud3, Fraud4, Fraud5) temp_dir <- tempdir() FraudDetec2( output_dir = temp_dir, data = Test_Data_Fraud, FraudList = c("Fraud1", "Fraud2", "Fraud3", "Fraud4", "Fraud5"), correct_answers = c(0, 0, 0, 0, 0), Q1, Q2, Q3, Q4, Q5, Q6, Q7 ) }
Fraud Detection Analysis Tool 3
FraudDetec3( output_dir, data, FraudList, correct_answers = c(0, 0, 0, 0, 0), ... )
FraudDetec3( output_dir, data, FraudList, correct_answers = c(0, 0, 0, 0, 0), ... )
output_dir |
Path specifying where the Word and HTML files will be saved. |
data |
The data frame containing all the survey data. |
FraudList |
A character vector of up to 5 Fraud Detection Questions. |
correct_answers |
A numeric vector representing correct answers for each question. Default is |
... |
Survey questions to be analyzed. |
A flextable object with the results.
if (requireNamespace("flextable", quietly = TRUE) && requireNamespace("officer", quietly = TRUE)) { library(flextable) library(officer) # Example data for fraud detection analysis Q1 <- c(4, 5, 3, 2, 5, 2) Q2 <- c(3, 4, 2, 5, 4, 3) Q3 <- c(5, 4, 3, 5, 4, 5) Q4 <- c(1, 2, 3, 4, 5, 2) Q5 <- c(5, 2, 2, 1, 4, 1) Q6 <- c(5, 2, 3, 5, 1, 2) Q7 <- c(5, 2, 4, 5, 3, 4) Fraud1 <- c(0, 1, 0, 0, 0, 0) Fraud2 <- c(0, 0, 0, 0, 0, 0) Fraud3 <- c(0, 1, 0, 0, 0, 0) Fraud4 <- c(0, 0, 1, 0, 0, 1) Fraud5 <- c(0, 0, 0, 1, 1, 1) Test_Data_Fraud <- data.frame(Q1, Q2, Q3, Q4, Q5, Q6, Q7, Fraud1, Fraud2, Fraud3, Fraud4, Fraud5) temp_dir <- tempdir() FraudDetec3( output_dir = temp_dir, data = Test_Data_Fraud, FraudList = c("Fraud1", "Fraud2", "Fraud3", "Fraud4", "Fraud5"), correct_answers = c(0, 0, 0, 0, 0), Q1, Q2, Q3, Q4, Q5, Q6, Q7 ) }
if (requireNamespace("flextable", quietly = TRUE) && requireNamespace("officer", quietly = TRUE)) { library(flextable) library(officer) # Example data for fraud detection analysis Q1 <- c(4, 5, 3, 2, 5, 2) Q2 <- c(3, 4, 2, 5, 4, 3) Q3 <- c(5, 4, 3, 5, 4, 5) Q4 <- c(1, 2, 3, 4, 5, 2) Q5 <- c(5, 2, 2, 1, 4, 1) Q6 <- c(5, 2, 3, 5, 1, 2) Q7 <- c(5, 2, 4, 5, 3, 4) Fraud1 <- c(0, 1, 0, 0, 0, 0) Fraud2 <- c(0, 0, 0, 0, 0, 0) Fraud3 <- c(0, 1, 0, 0, 0, 0) Fraud4 <- c(0, 0, 1, 0, 0, 1) Fraud5 <- c(0, 0, 0, 1, 1, 1) Test_Data_Fraud <- data.frame(Q1, Q2, Q3, Q4, Q5, Q6, Q7, Fraud1, Fraud2, Fraud3, Fraud4, Fraud5) temp_dir <- tempdir() FraudDetec3( output_dir = temp_dir, data = Test_Data_Fraud, FraudList = c("Fraud1", "Fraud2", "Fraud3", "Fraud4", "Fraud5"), correct_answers = c(0, 0, 0, 0, 0), Q1, Q2, Q3, Q4, Q5, Q6, Q7 ) }
Fraud Detection Analysis Tool 4
FraudDetec4( output_dir, data, FraudList, correct_answers = c(0, 0, 0, 0, 0), ... )
FraudDetec4( output_dir, data, FraudList, correct_answers = c(0, 0, 0, 0, 0), ... )
output_dir |
Path specifying where the Word and HTML files will be saved. |
data |
The data frame containing all the survey data. |
FraudList |
A character vector of up to 5 Fraud Detection Questions. |
correct_answers |
A numeric vector representing correct answers for each question. Default is |
... |
Survey questions to be analyzed. |
A flextable object with the results.
if (requireNamespace("flextable", quietly = TRUE) && requireNamespace("officer", quietly = TRUE)) { library(flextable) library(officer) # Example data for fraud detection analysis Q1 <- c(4, 5, 3, 2, 5, 2) Q2 <- c(3, 4, 2, 5, 4, 3) Q3 <- c(5, 4, 3, 5, 4, 5) Q4 <- c(1, 2, 3, 4, 5, 2) Q5 <- c(5, 2, 2, 1, 4, 1) Q6 <- c(5, 2, 3, 5, 1, 2) Q7 <- c(5, 2, 4, 5, 3, 4) Fraud1 <- c(0, 1, 0, 0, 0, 0) Fraud2 <- c(0, 0, 0, 0, 0, 0) Fraud3 <- c(0, 1, 0, 0, 0, 0) Fraud4 <- c(0, 0, 1, 0, 0, 1) Fraud5 <- c(0, 0, 0, 1, 1, 1) Test_Data_Fraud <- data.frame(Q1, Q2, Q3, Q4, Q5, Q6, Q7, Fraud1, Fraud2, Fraud3, Fraud4, Fraud5) temp_dir <- tempdir() FraudDetec4( output_dir = temp_dir, data = Test_Data_Fraud, FraudList = c("Fraud1", "Fraud2", "Fraud3", "Fraud4", "Fraud5"), correct_answers = c(0, 0, 0, 0, 0), Q1, Q2, Q3, Q4, Q5, Q6, Q7 ) }
if (requireNamespace("flextable", quietly = TRUE) && requireNamespace("officer", quietly = TRUE)) { library(flextable) library(officer) # Example data for fraud detection analysis Q1 <- c(4, 5, 3, 2, 5, 2) Q2 <- c(3, 4, 2, 5, 4, 3) Q3 <- c(5, 4, 3, 5, 4, 5) Q4 <- c(1, 2, 3, 4, 5, 2) Q5 <- c(5, 2, 2, 1, 4, 1) Q6 <- c(5, 2, 3, 5, 1, 2) Q7 <- c(5, 2, 4, 5, 3, 4) Fraud1 <- c(0, 1, 0, 0, 0, 0) Fraud2 <- c(0, 0, 0, 0, 0, 0) Fraud3 <- c(0, 1, 0, 0, 0, 0) Fraud4 <- c(0, 0, 1, 0, 0, 1) Fraud5 <- c(0, 0, 0, 1, 1, 1) Test_Data_Fraud <- data.frame(Q1, Q2, Q3, Q4, Q5, Q6, Q7, Fraud1, Fraud2, Fraud3, Fraud4, Fraud5) temp_dir <- tempdir() FraudDetec4( output_dir = temp_dir, data = Test_Data_Fraud, FraudList = c("Fraud1", "Fraud2", "Fraud3", "Fraud4", "Fraud5"), correct_answers = c(0, 0, 0, 0, 0), Q1, Q2, Q3, Q4, Q5, Q6, Q7 ) }
Fraud Detection Analysis Tool 5
FraudDetec5( output_dir, data, FraudList, correct_answers = c(0, 0, 0, 0, 0), ... )
FraudDetec5( output_dir, data, FraudList, correct_answers = c(0, 0, 0, 0, 0), ... )
output_dir |
Path specifying where the Word and HTML files will be saved. |
data |
The data frame containing all the survey data. |
FraudList |
A character vector of up to 5 Fraud Detection Questions. |
correct_answers |
A numeric vector representing correct answers for each question. Default is |
... |
Survey questions to be analyzed. |
A flextable object with the results.
if (requireNamespace("flextable", quietly = TRUE) && requireNamespace("officer", quietly = TRUE)) { library(flextable) library(officer) # Example data for fraud detection analysis Q1 <- c(4, 5, 3, 2, 5, 2) Q2 <- c(3, 4, 2, 5, 4, 3) Q3 <- c(5, 4, 3, 5, 4, 5) Q4 <- c(1, 2, 3, 4, 5, 2) Q5 <- c(5, 2, 2, 1, 4, 1) Q6 <- c(5, 2, 3, 5, 1, 2) Q7 <- c(5, 2, 4, 5, 3, 4) Fraud1 <- c(0, 1, 0, 0, 0, 0) Fraud2 <- c(0, 0, 0, 0, 0, 0) Fraud3 <- c(0, 1, 0, 0, 0, 0) Fraud4 <- c(0, 0, 1, 0, 0, 1) Fraud5 <- c(0, 0, 0, 1, 1, 1) Test_Data_Fraud <- data.frame(Q1, Q2, Q3, Q4, Q5, Q6, Q7, Fraud1, Fraud2, Fraud3, Fraud4, Fraud5) temp_dir <- tempdir() FraudDetec5( output_dir = temp_dir, data = Test_Data_Fraud, FraudList = c("Fraud1", "Fraud2", "Fraud3", "Fraud4", "Fraud5"), correct_answers = c(0, 0, 0, 0, 0), Q1, Q2, Q3, Q4, Q5, Q6, Q7 ) }
if (requireNamespace("flextable", quietly = TRUE) && requireNamespace("officer", quietly = TRUE)) { library(flextable) library(officer) # Example data for fraud detection analysis Q1 <- c(4, 5, 3, 2, 5, 2) Q2 <- c(3, 4, 2, 5, 4, 3) Q3 <- c(5, 4, 3, 5, 4, 5) Q4 <- c(1, 2, 3, 4, 5, 2) Q5 <- c(5, 2, 2, 1, 4, 1) Q6 <- c(5, 2, 3, 5, 1, 2) Q7 <- c(5, 2, 4, 5, 3, 4) Fraud1 <- c(0, 1, 0, 0, 0, 0) Fraud2 <- c(0, 0, 0, 0, 0, 0) Fraud3 <- c(0, 1, 0, 0, 0, 0) Fraud4 <- c(0, 0, 1, 0, 0, 1) Fraud5 <- c(0, 0, 0, 1, 1, 1) Test_Data_Fraud <- data.frame(Q1, Q2, Q3, Q4, Q5, Q6, Q7, Fraud1, Fraud2, Fraud3, Fraud4, Fraud5) temp_dir <- tempdir() FraudDetec5( output_dir = temp_dir, data = Test_Data_Fraud, FraudList = c("Fraud1", "Fraud2", "Fraud3", "Fraud4", "Fraud5"), correct_answers = c(0, 0, 0, 0, 0), Q1, Q2, Q3, Q4, Q5, Q6, Q7 ) }