toxic_chems = names(wqs_data)[1:34]
set.seed(1234)
rws <- sample(1:500, 150)
results = gwqs(yLBX ~ wqs, mix_name = toxic_chems, data = wqs_data[-rws,], q = 4, validation = 0.6,
b = 2, b1_pos = TRUE, b_constr = FALSE, family = gaussian)
# to test the significance of the covariates
summary(results)
# extract regression coefficients
coef(results)
# estimate variance-covariance matrix
vcov(results)
# estimate fitted values
fitted(results)
# estimate regression residuals
residuals(results)
# estimate predicted values on the left part of wqs_data
pred_res <- predict(results, wqs_data[rws,])
pred_res$df_pred
Run the code above in your browser using DataLab