---
title: "Introduction to RSP Package"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Introduction to RSP Package}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
  
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```
```{r setup}
library(RSP)
```
# RSP (R SHINY PSYCHOMETRY) PACKAGE

The package includes 5 comprehensive functions. These are respectively ```ITEMAN()```, ``` IRT() ``` ,```  PCA() ``` ,``` CFA()  ```, ```  SIMDATA() ```. Once you run the function you can click 'Open in Browser' for a better experience.


## 1. ITEMAN FUNCTION

This function computes item analysis and reliability analysis based on classical test theory(CTT) for 1-0 matrix and option matrix.



```{r eval=FALSE, message=FALSE, warning=FALSE, include=FALSE, paged.print=FALSE}
library(RSP)

ITEMAN()

```

In the function there are 6 tabs. 

### INTRODUCTION

In the first tab (INTRODUCTION) there is the package logo and short information about the content of the function.

### DATA UPLOAD

In the second tab you can choose the data type (1-0 matrix or opinion matrix). If you choose  the option matrix be sure that the first row of the data set should include the answer key

The function supports 3 different file formats, "CSV-comma separated", "CSV- semicolon separated" and "SAV-SPSS".


### ITEM ANALYSIS

In the third tab you can see the item analysis results.  In the table there are "Item Difficulty", "Point- biserial correlation" and "biserial correlation" results. Problematic items are highlighted in red and underlined. Moreover in this tab you can examine the change in the Cronbach Alpha coefficient when the items are removed or added.

### GRAPHICS

If you choose "option matrix" as the data type, in this tab you can find 2 different types of graphs regarding distractor analysis. The first type of graph shows the frequency at which options are ticked. The second shows the frequency with which the options are marked by the lower and upper group.

### TEST STATISTICS

In the fifth tab you can see basic test statistics regarding data set (Mean, standard deviation, variance, Cronbach Alpha, Two Halves Reliability, KR20 etc.)

### OUTPUT

In the sixth tab you can download item analysis results, test statistics, distractor analysis results in Excel format and graphs in pdf format.


## 2.IRT FUNCTION

This function does Item calibration according to item response theory models

```{r eval=FALSE, message=FALSE, warning=FALSE, include=FALSE, paged.print=FALSE}
library(RSP)

IRT()

```

In the function there are 7 tabs.

## HOME

In the first tab (HOME) there is the package logo and short information about the content of the function.

### UPLOAD DATA

In the second tab you can choose the data type (dichotomous and polytomous). The function supports 3 different file formats, "CSV-comma separated", "CSV- semicolon separated" and "SAV-SPSS".


### ASSUMPTION CHECK

In the third tab you can see the Q3 statistics for local independency. For uni-dimensionality you can see eigenvalues, explained variances and Horn's parallel analysis results.


### MODEL FIT

In the forth tab you can test which item response theory model fits better for your dataset. You should select two models to compare.


### CALIBRATION

In the fifth tab you can select IRT model, theta estimation method, and D coefficient.
You can see item parameters and Mean Theta

### PLOT

In the plot tab you can see different type of plots for the items and test

- Item characteristic Curves (ICC)
- Item information Function (IIF)
- Test information Function
- Marginal Reliability
- ICC for all items
- IIF for all items 


### OUTPUT

In the output tab you can download item parameters, theta estimations, model comparison results and full Q3 statistics in Excel format.


## 3.PCA FUNCTION

This function runs principal component analysis for dichotomous and polytomous data

```{r eval=FALSE, message=FALSE, warning=FALSE, include=FALSE, paged.print=FALSE}
library(RSP)

PCA()

```


### INTRODUCTION

In the first tab (INTRODUCTION) there is the package logo and short information about the content of the function.

### DATA UPLOAD

In the second tab you can choose the data type (dichotomous and polytomous). The function supports 3 different file formats, "CSV-comma separated", "CSV- semicolon separated" and "SAV-SPSS".


### DETERMINIG THE NUMBER OF FACTORS

In this tab you can see the results of horn's parallel analysis and scree plot to decide number of factors. You can modify the number of factors and rotation method. Moreover you see  the correlation coefficients among factors.


### FACTOR LOADINGS AND EXPLAINED VARIANCE

In this tab you can see factor loadings for the items, eigen values and explained variances. Items with a lower factor loading than the determined cutting score are indicated in red and underlined. You can examine the change in the KMO value when the items are removed or added.

### OUTPUT

In the output tab you can download factor loadings, eigen values and explained variances in Excel format.


## 4.CFA FUNCTION

This function computes measurement & structural models for dichotomous and polytomous data

```{r eval=FALSE, message=FALSE, warning=FALSE, include=FALSE, paged.print=FALSE}
library(RSP)

CFA()

```

### INTRODUCTION

In the first tab (INTRODUCTION) there is the package logo and short information about the content of the function.

### DATA UPLOAD

In the second tab you can choose the data type (dichotomous and polythmous). The function supports 3 different file formats, "CSV-comma separated", "CSV- semicolon separated" and "SAV-SPSS".

Moreover, in this tab you can see the multivariate normality test results (Mardia Multivariate Normality Test, Henze Zirkler Multivariate Nomality Test).


### STRUCTURAL MODEL

In this tab you can write the syntax for the model to be tested.  You can write syntax according to the example shown in gif. format.

You can see the estimates, standard coefficients, z values for the items. Moreover you can see commonly used fit indexes and modification indexes.

Also you can select the methods for prediction (MLO, MLR, GLS, WLS, DWLS, ULS), change the type and color of the path diagram. 


### OUTPUT

In the output tab you can download model summary, all fit indexes, and the modification indexes in Excel format and path diagram in pdf format.


## 4.SIMDATA FUNCTION

This function generates simulated data according to IRT for dichotomous, polytomous data and multidimensional data for factor analysis.


```{r eval=FALSE, message=FALSE, warning=FALSE, include=FALSE, paged.print=FALSE}
library(RSP)

SIMDATA()

```

### INTRODUCTION

In the first tab (INTRODUCTION) there is the package logo and short information about the content of the function.

### DICHOTOMOUS DATA GENERATION (IRT)

In this tab you can modify IRT model ( 1PL, 2PL, 3PL), number of items, number of respondents, range for Item Difficulty(b) , Item Discrimination(a), Guessing Parameter(c) and the number of replications. 

Moreover you can compute bias and RMSE values to compare real and estimated item parameters. You can download the generated data by clicking "Download Generated Data" button.

### POLYTHOMOUS DATA GENERATION

In this tab you can modify IRT model (PCM, RSM, GPCM,GRM), number of categories, number of items, number of respondents and the number of replications.You can download the generated data by clicking "Download Generated Data" button.


### MULTIDIMENSIAL DATA GENERATION

In this tab you can modify type of the data (dichotomous, polytomous, continuous), average factor loading, number of items, number of respondents, number of factors, number of the items with low factor loading and number of replications. You can download the generated data by clicking "Download Generated Data" button.


