 Santa Tonio Morning

# Posts

### Some Thoughts After Reading <Statistical Rethinking>

Last night, I read the 1st chapter of Statistical Rethinking: A Bayesian Course with Examples in R and Stan from Richard McElreath. I found this is nice book to share with my friends. The core idea of that chapter is the relationship between NULL hypothesis and statistical model. That is, should we trust the statistical models to reject the NULL hypothesis? It is a long history to use statistical models to figure out what is true?

### Use R as a bash language

R language could be easily used as a bash script using Rscript *.R. system() is a R base function which could run command line within R. Below is a simple example which allows to automate create a new blog post: (1) Ask users to type in filename, title and language (2) Create a new markdown file in specific directory (i.e. your local posts saved path) (3) Add some metadata in .

### Introduction to Latent Attribute Network Analysis

A brief introduction of using Network Model to visualize latent attributes’ hierarchy of Diagnostic Modeling.

### Which Country own the most Liberty Nobel Prizes? France? Ireland?

It is of my interest to use ggplot package to visualize some fun data. In this post, I tried to play with a Nobel Prizes Data including countries, prize year, each prize. The goal is to plot a cumulative traceplot of Liberty Nobel Prizes for top 10 countries. Load Packages tidyverse package include some very useful tools such as ggplot2, tidyr and dplyr. library(tidyverse) library(LaCroixColoR) library(ggthemes) library(ggimage) ggimage package was

### Make a Game in R

Recently I found a interesting R package call nessy which allows you to create a simple game driven by shiny. Thus. I tried a little bit about this package. Making a interactive app in R is promising in the files like teaching, presentation and visualization. Finally, I created the following shiny app: library(nessy) library(shinyjs) jscode <- "shinyjs.closeWindow = function() { window.close(); }" ui <- cartridge( title = "{Memorize the Names!

### 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).

### Visuliaztion of Item Information Curves In R Item Information Curve

This blog is to show a new way to display item information curves using ggridges package. The ridge plot could show the IIF plots very clear when you have a large number of items.

ggplot(item_information_all %>% filter(item %in% 17:22)) +
aes(x = factor, y = item, height = info,
group = item, color = as.factor(item),
fill = as.factor(item)) +
ggridges::geom_ridgeline(alpha = 0.75) +
ggtitle("Peer Social Capital: Information Functions")  +
theme_ridges()

### [Manual]Using Jags and R2jags in R

This post is aimed to introduce the basics of using jags in R programming. Jags is a frequently used program for conducting Bayesian statistics.Most of information below is borrowed from Jeromy Anglim’s Blog. I will keep editing this post if I found more resources about jags. What is JAGS? JAGS stands for Just Another Gibbs Sampler. To quote the program author, Martyn Plummer, “It is a program for analysis of Bayesian hierarchical models using Markov Chain Monte Carlo (MCMC) simulation…” It uses a dialect of the BUGS language, similar but a little different to OpenBUGS and WinBUGS.