This package provides adaptive model averaging (MA) with both linear and nonparamatric methods. It also allows the use of other averaging methods such as smoothed information criteria and Mallow's MA.
Li Wen <wlwendy1008@163.com>
, Zhihao Zhao <zhzhao@cueb.edu.cn>
, Yuhong Yang <yyang@stat.umn.edu>
.
To install this package in R, run the following commands:
library(devtools)
devtools::install_github("zhzhao07/UMA")
Below is an example of using the function gma, uarm, and uma.predict: ```#generate simulation data library(UMA) n <- 50 p <- 8 beta <- c(3,1.5,0,0,2,0,0,0) b0 <- 1 x <- matrix(rnorm(np,0,1),nrow=n,ncol=p) e <- rnorm(n,0,3) y <- x%%beta+b0+e
l1armbetahat <- gma(x, y, factorID = NULL, method= 'L1-ARM', candi_models = 2)$wbetahat mmabetahat <- gma(x, y, factorID = NULL, method= 'MMA' , candi_models = 2)$wbetahat sficbetahat <- gma(x, y, factorID = NULL, method= 'SFIC' , candi_models = 2)$wbetahat
l1uarm <- uarm(x, y, factorID = NULL, candi_models = 2, n_train = ceiling(n/2), no_rep=50, psi=0.1, method = 'L1-UARM', prior = TRUE, p0 = 0.5) l1uarmw <- LC$weight l1uarmse <- LC$weight_se
uarm <- uarm(x, y, factorID = NULL, candi_models = 2, n_train = ceiling(n/2), no_rep=50, psi=0.1, method = 'UARM' , prior = TRUE, p0 = 0.5) uarmw <- LC2$weight uarmse <- LC2$weight_se
mmaw <- gma(x, y, factorID = NULL, method = 'MMA' , candi_models = 2)$weight sficw <- gma(x, y, factorID = NULL, method = 'SFIC', candi_models = 2)$weight
l1uarm.predict <- uma.predict(x, y, factorID = NULL, newdata = x, candi_models = 2, weight = l1uarmw, method = 'L1-UARM', dim = 'L')$pre_out mma.predict <- uma.predict(x, y, factorID = NULL, newdata = x, candi_models = 2, weight = mmaw , method = 'MMA' , dim = 'L')$pre_out sfic.predict <- uma.predict(x, y, factorID = NULL, newdata = x, candi_models = 2, weight = sficw , method = 'SFIC' , dim = 'L')$pre_out
bma.predict <- uma.predict(x, y, factorID = NULL, newdata = x, candi_models = 2, method = 'BMA',dim = 'L')$pre_out
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.