ILSE: installation and simulated example

Wei Liu

2022-01-06

Install the ILSE

This vignette provides an introduction to the R package ILSE, where the function ILSE implements the model ILSE, Linear Regression by Iterative Least Square Estimation (ILSE) When Covariates Include Missing Values. The package can be installed with the command from Github:

library(remotes)

remotes::install_github("feiyoung/ILSE")

or install from CRAN

install.packages("ILSE")

The package can be loaded with the command:

library("ILSE")

Fit linear model using simulated data

First, we generate the data with homogeneous normal variables.

  n <- 100
  p <- 6
  X <- MASS::mvrnorm(n, rep(0, p), cor.mat(p, rho=0.5))
  beta0 <- rep(c(1,-1), times=3)
  Y <- -2+ X %*% beta0 + rnorm(n, sd=1)

A special case: without missing values

Then, we fit the linear regression model without missing values based on ILSE.

We can also create a (data.frame) object as input for ILSE.

Check the significant variables by bootstratp.

Handle data with missing values

First, we randomly remove some entries in X.

Second, we use lm to fit linear regression model based on complete cases, i.e., CC analysis. We can not detect any siginificant covariates.

Third, we use ILSE to fit the linear regression model based on all data.

Fourth, Bootstrap is applied to evaluate the standard error and p-values of each coefficients estimated by ILSE. We observe four significant coefficients.

In ILSE package, we also provide Full Information Maximum Likelihood for Linear Regression fimlreg. We show how to use it to handle the above missing data.

We also use bootstrap to evaluate the standard error and p-values of each coefficients estimated by ILSE. We observe only one significant coefficients.

Visualization

We visualize the p-vaules of each methods , where red line denotes 0.05 in y-axis and blue line 0.1 in y-axis.

Session information

sessionInfo()
#> R version 4.0.3 (2020-10-10)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows 10 x64 (build 22000)
#> 
#> Matrix products: default
#> 
#> locale:
#> [1] LC_COLLATE=C                              
#> [2] LC_CTYPE=Chinese (Simplified)_China.936   
#> [3] LC_MONETARY=Chinese (Simplified)_China.936
#> [4] LC_NUMERIC=C                              
#> [5] LC_TIME=Chinese (Simplified)_China.936    
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] ILSE_1.1.6
#> 
#> loaded via a namespace (and not attached):
#>  [1] digest_0.6.28   R6_2.5.1        jsonlite_1.7.2  magrittr_2.0.1 
#>  [5] evaluate_0.14   rlang_0.4.11    stringi_1.7.5   jquerylib_0.1.4
#>  [9] bslib_0.3.1     rmarkdown_2.7   tools_4.0.3     stringr_1.4.0  
#> [13] xfun_0.28       yaml_2.2.1      fastmap_1.1.0   compiler_4.0.3 
#> [17] htmltools_0.5.2 knitr_1.36      sass_0.4.0