(Updated 2019/03) A Mistake Caused by Ifelse and Factors

R
Updated 2019/03: Just as I expected at the end of this post two years ago, a new package vctrs has come out to handle type stability. You can watch Hadley’s talk at the RStudio conference 2019, in which he talked about base ifelse being too free and dplyr::if_else being too strict. I made a mistake in one of the data processing script I wrote in R a while ago and figured I should share the story with everybody.

RStudio Best Practice: General Options

Over the years RStudio has become the most powerful and versatile IDE of R. I started using RStudio back in 2011, when R was in its version 2.12. Back in the day, RStudio was a better choice for me than the default R-GUI simply because of the auto-completion it provided. Being a C++ and Xcode user, memorizing all those R commands in an early learning stage was impossible for me.

Using 2D Normal Mixtures for Spatial Point Patterns

This post describes the design and usage of the sppmix package, which defines classes and methods for spatial point pattern data and mixture models. You can install the package by this command. devtools::install_github("wangyuchen/sppmix") A two dimensional normal mixture is a basic building block of this package. We created a S3 class normmix and related methods for operations with normal mixture. In this post, you’ll learn everything that related to a normmix object.

Logistic Regression in R with Single-Trial Data

The examples in this post is taken from a class I took at the University of Missouri. These examples are originally provided in SAS and I translated them to R. The relationship between countries’ credit ratings and the volatility of the countries’ stock markets was examined in the Journal of Portfolio Management (Spring 1996). Our interest lies in whether volatility (standard deviation of stock returns) and credit rating (in percent) can be used to classify a country into one of the two market types (developed or emerging).

Nonlinear Regression in R

The examples in this post is taken from a class I took at the University of Missouri. These examples are originally provided in SAS and I translated them to R. Non-linear Regression with Available Starting Values The velocity of a chemical reaction (\(y\)) is modeled as a function of the concentration of the chemical (\(x\)). There are a total of 18 observations. The desired model is \[ y_i = \frac{\theta_0 x_i}{\theta_1 + x_i} + \epsilon_i.

HTML5 Slides with Markdown and Reveal.js (Chinese)

遇到一个小报告要做幻灯片,受了上周R沙龙上看到的可视化报告的影响,就想既然要做,不如做的好看点吧。想起第一次看到的HTML5幻灯片确实很震撼,后来才知道那个模板叫 impress.js ,我以前用过一次google的那个html5 slides,也用过Rmd文件用 pandoc 转成幻灯片, 总觉得各种支持不太好,做起来累,效果也远没有达到令人满意的地步。

Introduction to Meta-Analysis

This is a workshop on meta-analysis at East China Normal University. The slides of this talk is written in markdown and reveal.js. You can find the slides at https://www.prioritydetails.com/slides/meta-analysis/

Introduction to Cluster Analysis in R

R
Introduction Cluster analysis or clustering is the task of grouping a set of objects in such a way that objects in the same group (called cluster) are more similar (in some sense or another) to each other than to those in other groups (clusters). Clustering can be applied to microarray data to identify groups of possibly co-regulated genes or spatial gene expression patterns. In Anja von Heydebreck’s presentation Clustering analysis for microarray data, he introduced many clustering methods including K-means clustering, PAM and Hierarchical clustering.

R and Object-Oriented Statistical Analysis

R
This is a talk at the 5th China R Conference. I talked about what is object-oriented programming and how R’s OOP system S3 and S4 work. You can see the slides at https://www.prioritydetails.com/slides/ChinaR2012.pdf (Chinese).