R

(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.

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.

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