Publications by Enwu Liu

Plot restricted cubic spline

09.08.2024

This note is to study the ‘plotRCS’ package, developed by Dr. Rongrui Huo at Guangxi Medical University Cancer Hospital in Nanning, China. All functions were originally written by Dr. Huo, with minor modifications made by me to suit my specific needs. rcsplot_check <- function(data, outcome = NULL, ...

343 sym R (25424 sym/19 pcs) 2 img

Convert a string to a variable name in R function

15.07.2024

When writing our own R functions, sometimes we need to convert a string to a variable name to reduce the number of lines of code. The key to doing this is to pass the string with quotes (““) to the function, and then use the eval() and sym()/as.name() functions. Below is the R code to convert”anyI_new” and “all_blocks” to variable n...

348 sym R (505 sym/1 pcs)

SAS loop errors

22.06.2024

If we run the following loop in SAS (loop numbers 2,4,5,6,7,8,9, or any other specific strings), we will get strange SAS error message %macro loop_bmd; %local k j; %let k=1; %let visit="2:4:5:6:7:8:9"; %do %while (%scan(&visit, &k, %str(:)) ne); %let j= %scan(&visit, &k, :); %put &j; %let k = %eval(&k + 1); %end; %mend loop_bmd; %loop_bm...

559 sym

Notes for selection model and mixture pattern model

12.05.2024

Paper: Sensitivity analysis for clinical trials with missing continuous outcome data using controlled multiple imputation: A practical guide Method 1: equation (1) \[f(R_i|Y_i,X_I,\phi)f(Y_i|X_i,\theta)=f(Y_i,R_i|X_i,\theta,\phi)=f(Y_i|R_i,X_i,\theta)f(R_i|X_i,\phi)\tag{1}\] Prove \[f(R_i|Y_i,X_I,\phi)f(Y_i|X_i,\theta)=f(Y_i,R_i|X_i,\theta,\phi)...

2405 sym

Linear mixed models for repeated measurements in clinical trials

09.05.2024

1. Repeated measurement and clinical tiral Repeated measures are quite common in clinical trials. A repeated measures study involves measuring outcomes at different times; it does not necessarily mean that covariates or predictor variables were also measured repeatedly. For the design of repeated measures studies, general linear mixed models, g...

16176 sym R (6920 sym/10 pcs) 7 img

Regression analysis for cluster data

30.03.2024

Clustered data are quite common in epidemiological studies. For example, in repeated measures, individuals are clustered with themselves. In school surveys, students are clustered within schools and classes. In crossover designs, individuals are clustered with themselves, and in group-based randomized trials, individuals are clustered within t...

3080 sym R (6049 sym/18 pcs) 8 img

Delta method for predictive models

23.10.2023

The Delta method is very useful in predictive modeling, as it enables the calculation of 95% confidence intervals for predicted values in regression models. Interestingly, it can also be applied to determine a 95% confidence interval for probabilities. For instance, in a logistic regression model, the probability is a function of coefficients, ...

4280 sym

Weighted Least Square Regression

15.10.2023

For an ordinary least squares regression we assume that variance of the error term are constant, when this assumption is violated we can use a weighted least square regression method. This note is mainly from STAT 501 of the Pennsylvania State University. Obtain the data set Galton. galton<-read.table("https://online.stat.psu.edu/onlinecourses/s...

2567 sym R (3221 sym/10 pcs) 2 img

Multiplicative random effect model of meta-analysis

06.10.2023

For a random-effect model meta-analysis we usually assume that the random effects are additive. In a multiplicative random-effects model, the variant-specific estimates are assumed to be normally distributed with variance \(\phi^2v_i\) where \(\phi^2\) is an overdispersion parameter. The appropriate value of \(\phi\) can be established by runn...

995 sym

Confidence interval for ratios

04.10.2023

There are three methods to construct confidence intervals for ratio parameters, namely: (1) Delta method (2) Fieller’s method and (3) profile-likelihood based interval on generalized linear model (GLM) technique. Here is a very good note on Taylor Approximation and the Delta Method. Another one Refer to: 1.Beyene, Joseph, and Rahim Moineddin...

619 sym