Study Notes: gt package and format table

A introduction about gt package is here knitr::opts_chunk$set(echo = TRUE, warning = FALSE, message = FALSE, fig.align = "default", eval = TRUE) library(gt) suppressMessages(library(tidyverse)) Basics of gt A basic gt table can be created as so data("iris") glimpse(iris) ## Rows: 150 ## Columns: 5 ## $ Sepal.Length <dbl> 5.1, 4.9, 4.7, 4.6, 5.0, 5.4, 4.6, 5.0, 4.4, 4.9, 5.4, 4… ## $ Sepal.Width <dbl> 3.5, 3.0, 3.2, 3.1, 3.6, 3.

Introduce gganimate for Psychometric

A new R packge (gganimate ) provides some new features for animation in R. Its big advantage is it could make use of ggplot API and embeded into ggplot. Next, I will use a sample data to show the example. Then I will use some real educational data to explore a little bit what we can do in psychometric area. A Simple Example I want to introduce this package.

Lasso Regression Example using glmnet package in R

More details please refer to the link below: (https://web.stanford.edu/~hastie/glmnet/glmnet_alpha.html#lin) This post shows how to use glmnet package to fit lasso regression and how to visualize the output. The description of data is shown in here. dt <- readRDS(url("https://s3.amazonaws.com/pbreheny-data-sets/whoari.rds")) attach(dt) fit <- glmnet(X, y) Visualize the coefficients plot(fit) Label the path plot(fit, label = TRUE) The summary table below shows from left to right the number of nonzero coefficients (DF), the percent (of null) deviance explained (%dev) and the value of \(\lambda\) (Lambda).

Introduce Descrepancy Measures

Descrepancy Measures This Blog is the notes for my recent project about reliability and model checking. Next I want to organize a little about one important concept in model checking - discrepancy measures. Descrepancy Measures \(\chi^2\) measures for item-pairs (Chen & Thissen, 1997) \[ X^2_{jj'}=\sum_{k=0}^{1} \sum_{k'=0}^{1} \frac{(n_{kk'}-E(n_{kk'}))^2}{E(n_{kk'})} \] \(G^2\) for item pairs \[ G^2_{jj'}=-2\sum_{k=0}^{1} \sum_{k'=0}^{1} \ln \frac{E(n_{kk'})}{n_{kk'}} \] model-based covariance (MBC; Reckase, 1997) \[ COV_{jj'} = \frac{\sum_{i=1}^{N}(X_{ij}-\overline{X_j})(X_{ij'}-\overline{X_{j'}}) }{N} \\ MBC_{jj'} = \frac{\sum_{i=1}^{N}(X_{ij}-E(X_{ij}))(X_{ij'}-E(X_{ij'}))}{N} \]

Latent Profile Analysis using MCLUST (in R)

Hi there! This is Jihong. This is a webpage folked from JOSHUA M. ROSENBERG. It aims to provid a very clear example about how to conduct Latent Profile Analysis using MCLUST in r. Import data and load packages library(tidyverse) library(mclust) library(hrbrthemes) # typographic-centric ggplot2 themes data("iris") df <- select(iris, -Species) # 4 variables explore_model_fit <- function(df, n_profiles_range = 1:9, model_names = c("EII", "VVI", "EEE", "VVV")) { x <- mclustBIC(df, G = n_profiles_range, modelNames = model_names) y <- x %>% as.

Simulation Study of Linking using mirt

Introduction Calibration of Form A Look at the data Plot the density of true \(\theta\) of Group A CTT Table Clean data Classical Test Theory Final Calibration of Form A Model Specification Calibration of Form B Final Calibration of Form A Model Specification of B b-plot a-plot Linking This simulation study is to show how to do IRT Linking Process using mirt R Package.

One Example of Measurement Invariance

What is Measurement Invariance (MI)? Why we should use Measurement Invariance? How to use Measurement Invariance Multiple Group CFA Invariance Example (data from Brown Charpter 7): Major Deression Criteria across Men and Women (n =345) Data Import Model Specification Model Options Runing Model Model Comparision STRUCTUAL INVARIANCE TESTS Factor Variance Invariance Model Factor Mean Invariance Model Model Comparision Recently, I was asked by my friend why should we use Measurement Invariance in real research.