Developing a model to predict permeability (see Sect. 1.4) could save sig- nificant resources for a pharmaceutical company, while at the same time more rapidly identifying molecules that have a sufficient permeability to become a drug: (a) Start R and use these commands to load the data:
library(AppliedPredictiveModeling)
## Warning: package 'AppliedPredictiveModeling' was built under R version 4.3.3
library(caret)
## Warning: package 'caret' was built under R version 4.3.3
## Loading required package: ggplot2
## Warning: package 'ggplot2' was built under R version 4.3.3
## Loading required package: lattice
## Warning: package 'lattice' was built under R version 4.3.3
library(tidyverse)
## Warning: package 'tidyverse' was built under R version 4.3.3
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ lubridate 1.9.3 ✔ tibble 3.2.1
## ✔ purrr 1.0.2 ✔ tidyr 1.3.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ✖ purrr::lift() masks caret::lift()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(corrplot)
## Warning: package 'corrplot' was built under R version 4.3.3
## corrplot 0.95 loaded
data(permeability)
The matrix fingerprints contains the 1,107 binary molecular predic- tors for the 165 compounds, while permeability contains permeability response. (b) The fingerprint predictors indicate the presence or absence of substruc- tures of a molecule and are often sparse meaning that relatively few of the molecules contain each substructure. Filter out the predictors that have low frequencies using the nearZeroVar function from the caret package. How many predictors are left for modeling?
dim(fingerprints)
## [1] 165 1107
fingerprints <- fingerprints[, -nearZeroVar(fingerprints)]
dim(fingerprints)
## [1] 165 388
set.seed(592)
# index for training
index <- createDataPartition(permeability, p = .8, list = FALSE)
# train
train_perm <- permeability[index, ]
train_fp <- fingerprints[index, ]
# test
test_perm <- permeability[-index, ]
test_fp <- fingerprints [-index, ]
# 10-fold cross-validation to make reasonable estimates
ctrl <- trainControl(method = "cv", number = 10)
plsTune <- train(train_fp, train_perm, method = "pls", metric = "Rsquared",
tuneLength = 20, trControl = ctrl, preProc = c("center", "scale"))
plot(plsTune)
plsTune
## Partial Least Squares
##
## 133 samples
## 388 predictors
##
## Pre-processing: centered (388), scaled (388)
## Resampling: Cross-Validated (10 fold)
## Summary of sample sizes: 120, 120, 119, 120, 120, 121, ...
## Resampling results across tuning parameters:
##
## ncomp RMSE Rsquared MAE
## 1 12.33058 0.4424405 9.365597
## 2 11.31175 0.5242625 8.038638
## 3 11.27211 0.5255588 8.347281
## 4 11.48917 0.5224637 8.655959
## 5 11.49200 0.5418353 8.529147
## 6 11.35270 0.5504476 8.297723
## 7 11.06594 0.5568686 8.351121
## 8 10.95171 0.5569418 8.238622
## 9 10.64720 0.5610078 8.005456
## 10 10.91537 0.5508048 8.255200
## 11 11.24702 0.5371229 8.296499
## 12 11.48388 0.5240043 8.347462
## 13 11.56139 0.5197911 8.458959
## 14 11.58591 0.5186836 8.397137
## 15 11.58790 0.5168320 8.526060
## 16 11.88829 0.4975843 8.804110
## 17 11.98798 0.4940691 8.930184
## 18 12.24510 0.4747352 9.139258
## 19 12.30234 0.4722484 9.203387
## 20 12.64763 0.4598667 9.450129
##
## Rsquared was used to select the optimal model using the largest value.
## The final value used for the model was ncomp = 9.
plsPred <- predict(plsTune, test_fp)
postResample(plsPred, test_perm)
## RMSE Rsquared MAE
## 14.1023458 0.4048276 9.8870575
The test set estimate of R² is 0.4048276
set.seed(592)
# grid of penalties
enetGrid <- expand.grid(.lambda = c(0, 0.01, .1), .fraction = seq(.05, 1, length = 20))
# tuning penalized regression model
enetTune <- train(train_fp, train_perm, method = "enet",
tuneGrid = enetGrid, trControl = ctrl, preProc = c("center", "scale"))
## Warning: model fit failed for Fold03: lambda=0.00, fraction=1 Error in if (zmin < gamhat) { : missing value where TRUE/FALSE needed
## Warning: model fit failed for Fold04: lambda=0.00, fraction=1 Error in if (zmin < gamhat) { : missing value where TRUE/FALSE needed
## Warning: model fit failed for Fold07: lambda=0.00, fraction=1 Error in if (zmin < gamhat) { : missing value where TRUE/FALSE needed
## Warning in nominalTrainWorkflow(x = x, y = y, wts = weights, info = trainInfo,
## : There were missing values in resampled performance measures.
plot(enetTune)
enetTune
## Elasticnet
##
## 133 samples
## 388 predictors
##
## Pre-processing: centered (388), scaled (388)
## Resampling: Cross-Validated (10 fold)
## Summary of sample sizes: 120, 118, 121, 120, 119, 121, ...
## Resampling results across tuning parameters:
##
## lambda fraction RMSE Rsquared MAE
## 0.00 0.05 10.80374 0.5528177 7.753853
## 0.00 0.10 11.02681 0.5073675 7.812088
## 0.00 0.15 10.85555 0.5090184 7.807504
## 0.00 0.20 10.73671 0.5116213 7.733727
## 0.00 0.25 10.75574 0.5086893 7.696893
## 0.00 0.30 10.69486 0.5149101 7.723153
## 0.00 0.35 10.73328 0.5212248 7.805717
## 0.00 0.40 10.66594 0.5355390 7.778915
## 0.00 0.45 10.62488 0.5472202 7.786256
## 0.00 0.50 10.58067 0.5571182 7.854845
## 0.00 0.55 10.56051 0.5657778 7.951143
## 0.00 0.60 10.60898 0.5695579 8.051699
## 0.00 0.65 10.65827 0.5738909 8.092352
## 0.00 0.70 10.75403 0.5716296 8.165635
## 0.00 0.75 10.87648 0.5643456 8.214078
## 0.00 0.80 11.06324 0.5508205 8.293008
## 0.00 0.85 11.24779 0.5362506 8.415533
## 0.00 0.90 11.42378 0.5238603 8.527858
## 0.00 0.95 11.62296 0.5127116 8.637683
## 0.00 1.00 11.80232 0.5042186 8.698084
## 0.01 0.05 10.72791 0.5350014 7.664538
## 0.01 0.10 10.63780 0.5463793 7.586043
## 0.01 0.15 10.52453 0.5562582 7.570958
## 0.01 0.20 10.44880 0.5620679 7.572512
## 0.01 0.25 10.42996 0.5644807 7.565554
## 0.01 0.30 10.37485 0.5705395 7.547605
## 0.01 0.35 10.40500 0.5714867 7.600382
## 0.01 0.40 10.45539 0.5755718 7.630760
## 0.01 0.45 10.50396 0.5795252 7.651714
## 0.01 0.50 10.59134 0.5798656 7.693988
## 0.01 0.55 10.61637 0.5809774 7.711509
## 0.01 0.60 10.65933 0.5775876 7.757996
## 0.01 0.65 10.77113 0.5675097 7.833382
## 0.01 0.70 10.92030 0.5561996 7.940965
## 0.01 0.75 11.11700 0.5428376 8.071364
## 0.01 0.80 11.33357 0.5291923 8.234326
## 0.01 0.85 11.55536 0.5163383 8.416928
## 0.01 0.90 11.74196 0.5060916 8.605507
## 0.01 0.95 11.96243 0.4897083 8.796729
## 0.01 1.00 12.13559 0.4759847 8.943890
## 0.10 0.05 10.85121 0.5551156 8.193163
## 0.10 0.10 10.73612 0.5403347 7.506419
## 0.10 0.15 10.72748 0.5512195 7.515210
## 0.10 0.20 10.64085 0.5604106 7.564902
## 0.10 0.25 10.59360 0.5660253 7.563726
## 0.10 0.30 10.57090 0.5693516 7.594388
## 0.10 0.35 10.54943 0.5733198 7.593330
## 0.10 0.40 10.46134 0.5824857 7.507261
## 0.10 0.45 10.39850 0.5892812 7.456135
## 0.10 0.50 10.39005 0.5923649 7.466304
## 0.10 0.55 10.40915 0.5943946 7.499997
## 0.10 0.60 10.43949 0.5949247 7.513054
## 0.10 0.65 10.46613 0.5953452 7.530645
## 0.10 0.70 10.48401 0.5973614 7.547489
## 0.10 0.75 10.48867 0.5992872 7.568458
## 0.10 0.80 10.49740 0.6000952 7.588080
## 0.10 0.85 10.50972 0.6004722 7.615315
## 0.10 0.90 10.51922 0.6013623 7.652810
## 0.10 0.95 10.54043 0.6008199 7.685370
## 0.10 1.00 10.56345 0.6010499 7.710408
##
## RMSE was used to select the optimal model using the smallest value.
## The final values used for the model were fraction = 0.3 and lambda = 0.01.
enet_predict <- predict(enetTune, test_fp)
postResample(enet_predict, test_perm)
## RMSE Rsquared MAE
## 13.4134739 0.4433244 9.6164569
set.seed(592)
larsTune <- train(train_fp, train_perm, method = "lars", metric = "Rsquared",
tuneLength = 20, trControl = ctrl, preProc = c("center", "scale"))
plot(larsTune)
larsTune
## Least Angle Regression
##
## 133 samples
## 388 predictors
##
## Pre-processing: centered (388), scaled (388)
## Resampling: Cross-Validated (10 fold)
## Summary of sample sizes: 120, 118, 121, 120, 119, 121, ...
## Resampling results across tuning parameters:
##
## fraction RMSE Rsquared MAE
## 0.05 10.59930 0.5370665 7.606059
## 0.10 10.29009 0.5651728 7.408402
## 0.15 10.22954 0.5853204 7.343885
## 0.20 10.33848 0.5947261 7.388054
## 0.25 10.52381 0.5988096 7.524331
## 0.30 11.05822 0.5631154 7.895907
## 0.35 11.70633 0.5104349 8.322971
## 0.40 12.39750 0.4582664 8.825856
## 0.45 13.20472 0.4066318 9.417222
## 0.50 14.05108 0.3737328 10.004851
## 0.55 14.84065 0.3500100 10.524232
## 0.60 15.76314 0.3265175 10.947817
## 0.65 16.82304 0.3104784 11.322168
## 0.70 17.89367 0.2984973 11.882897
## 0.75 19.08189 0.2818582 12.408750
## 0.80 20.45666 0.2674000 12.984923
## 0.85 21.25522 0.2605947 13.389269
## 0.90 22.06683 0.2554236 13.860169
## 0.95 23.02977 0.2476655 14.377395
## 1.00 23.95955 0.2444586 14.925559
##
## Rsquared was used to select the optimal model using the largest value.
## The final value used for the model was fraction = 0.25.
lars_predict <- predict(larsTune, test_fp)
postResample(lars_predict, test_perm)
## RMSE Rsquared MAE
## 15.3423719 0.3187987 10.7603270
Looking at the R-squared values of the models, the Elastic Net model has the highest R-squared value of 0.4. This model is the best at predicting the permeability of the molecules.
I would recommend the Elastic Net model as it has the highest R-squared value of 0.68. This model is the best at predicting the permeability of the molecules.
#6.3.
A chemical manufacturing process for a pharmaceutical product was discussed in Sect. 1.4. In this problem, the objective is to understand the relationship between biological measurements of the raw materials (predictors),measurements of the manufacturing process (predictors), and the response of product yield. Biological predictors cannot be changed but can be used to assess the quality of the raw material before processing. On the other hand, manufacturing process predictors can be changed in the manufacturing process. Improving product yield by 1% will boost revenue by approximately one hundred thousand dollars per batch:
library(AppliedPredictiveModeling)
data(ChemicalManufacturingProcess)
The matrix processPredictors contains the 57 predictors (12 describing the input biological material and 45 describing the process predictors) for the 176 manufacturing runs. yield contains the percent yield for each run. (b) A small percentage of cells in the predictor set contain missing values. Use an imputation function to fill in these missing values (e.g., see Sect. 3.8).
sum(is.na(ChemicalManufacturingProcess))
## [1] 106
miss <- preProcess(ChemicalManufacturingProcess, method = "bagImpute")
Chemical <- predict(miss, ChemicalManufacturingProcess)
sum(is.na(Chemical))
## [1] 0
# filtering low frequencies
Chemical <- Chemical[, -nearZeroVar(Chemical)]
set.seed(592)
# index for training
index <- createDataPartition(Chemical$Yield, p = .8, list = FALSE)
# train
train_chem <- Chemical[index, ]
# test
test_chem <- Chemical[-index, ]
#lars
set.seed(592)
larsTune <- train(Yield ~ ., Chemical , method = "lars", metric = "Rsquared",
tuneLength = 20, trControl = ctrl, preProc = c("center", "scale"))
plot(larsTune)
larsTune
## Least Angle Regression
##
## 176 samples
## 56 predictor
##
## Pre-processing: centered (56), scaled (56)
## Resampling: Cross-Validated (10 fold)
## Summary of sample sizes: 159, 157, 159, 158, 158, 159, ...
## Resampling results across tuning parameters:
##
## fraction RMSE Rsquared MAE
## 0.05 1.289991 0.6223228 1.0483484
## 0.10 1.184608 0.6081172 0.9571170
## 0.15 1.205576 0.6075810 0.9380287
## 0.20 1.223074 0.6139487 0.9493962
## 0.25 1.301942 0.6086050 0.9755735
## 0.30 1.639677 0.5306434 1.0713251
## 0.35 1.962230 0.4916555 1.1555965
## 0.40 2.278486 0.4751408 1.2393329
## 0.45 2.434030 0.4775184 1.2844763
## 0.50 2.550001 0.4882494 1.3238565
## 0.55 2.634513 0.5005123 1.3518521
## 0.60 2.761244 0.5073760 1.3860990
## 0.65 2.959261 0.5036056 1.4387067
## 0.70 3.324020 0.4908108 1.5414238
## 0.75 3.717494 0.4686096 1.6480862
## 0.80 3.971504 0.4516136 1.7144532
## 0.85 4.179392 0.4403652 1.7670268
## 0.90 4.395202 0.4325702 1.8215617
## 0.95 4.628162 0.4273060 1.8814591
## 1.00 4.854860 0.4247182 1.9384895
##
## Rsquared was used to select the optimal model using the largest value.
## The final value used for the model was fraction = 0.05.
#pls
set.seed(592)
plsTune <- train(Yield ~ ., Chemical , method = "pls", metric = "Rsquared",
tuneLength = 20, trControl = ctrl, preProc = c("center", "scale"))
plot(plsTune)
plsTune
## Partial Least Squares
##
## 176 samples
## 56 predictor
##
## Pre-processing: centered (56), scaled (56)
## Resampling: Cross-Validated (10 fold)
## Summary of sample sizes: 159, 157, 159, 158, 158, 159, ...
## Resampling results across tuning parameters:
##
## ncomp RMSE Rsquared MAE
## 1 1.615461 0.3853274 1.219121
## 2 1.933237 0.4513997 1.218544
## 3 1.470738 0.5547549 1.075311
## 4 1.497685 0.5523171 1.098394
## 5 1.563264 0.5311108 1.111893
## 6 1.506725 0.5289574 1.088892
## 7 1.617486 0.5285470 1.110968
## 8 1.717400 0.5303242 1.130814
## 9 1.936958 0.5127765 1.191671
## 10 2.094016 0.5055298 1.230073
## 11 2.237847 0.5064734 1.265121
## 12 2.356245 0.4892637 1.305661
## 13 2.409387 0.4746975 1.330705
## 14 2.441003 0.4755687 1.325742
## 15 2.517403 0.4569530 1.350737
## 16 2.580176 0.4476190 1.368350
## 17 2.595537 0.4421503 1.364940
## 18 2.620857 0.4422267 1.365486
## 19 2.661760 0.4386974 1.371325
## 20 2.728891 0.4341772 1.390841
##
## Rsquared was used to select the optimal model using the largest value.
## The final value used for the model was ncomp = 3.
#enet
set.seed(592)
enetTune <- train(Yield ~ ., Chemical , method = "enet", metric = "Rsquared",
tuneLength = 20, trControl = ctrl, preProc = c("center", "scale"))
plot(enetTune)
enetTune
## Elasticnet
##
## 176 samples
## 56 predictor
##
## Pre-processing: centered (56), scaled (56)
## Resampling: Cross-Validated (10 fold)
## Summary of sample sizes: 159, 157, 159, 158, 158, 159, ...
## Resampling results across tuning parameters:
##
## lambda fraction RMSE Rsquared MAE
## 0.0000000000 0.05 1.256933 0.6203038 1.0236613
## 0.0000000000 0.10 1.225598 0.5981551 0.9679674
## 0.0000000000 0.15 1.212019 0.6067215 0.9406577
## 0.0000000000 0.20 1.479643 0.5652039 1.0195316
## 0.0000000000 0.25 1.928406 0.5105696 1.1341069
## 0.0000000000 0.30 2.372224 0.4808677 1.2568254
## 0.0000000000 0.35 2.675168 0.4717903 1.3433426
## 0.0000000000 0.40 2.802763 0.4815215 1.3859501
## 0.0000000000 0.45 3.039715 0.4932829 1.4522449
## 0.0000000000 0.50 3.496105 0.5070402 1.5668141
## 0.0000000000 0.55 3.900708 0.5064744 1.6635449
## 0.0000000000 0.60 4.128482 0.4984262 1.7303017
## 0.0000000000 0.65 4.415784 0.4764901 1.8100140
## 0.0000000000 0.70 4.601781 0.4608989 1.8592671
## 0.0000000000 0.75 4.660884 0.4485057 1.8777578
## 0.0000000000 0.80 4.734853 0.4393743 1.8989467
## 0.0000000000 0.85 4.810649 0.4326796 1.9204735
## 0.0000000000 0.90 4.843824 0.4291676 1.9315392
## 0.0000000000 0.95 4.849758 0.4268674 1.9358768
## 0.0000000000 1.00 4.854860 0.4247182 1.9384895
## 0.0001000000 0.05 1.305928 0.6213702 1.0633690
## 0.0001000000 0.10 1.185776 0.6072792 0.9593896
## 0.0001000000 0.15 1.202622 0.6073284 0.9375249
## 0.0001000000 0.20 1.219212 0.6121335 0.9435466
## 0.0001000000 0.25 1.215015 0.6277619 0.9529695
## 0.0001000000 0.30 1.556944 0.5447602 1.0476316
## 0.0001000000 0.35 1.873294 0.4989081 1.1318532
## 0.0001000000 0.40 2.185342 0.4792953 1.2146888
## 0.0001000000 0.45 2.425465 0.4706630 1.2795245
## 0.0001000000 0.50 2.538351 0.4780698 1.3178611
## 0.0001000000 0.55 2.634752 0.4869175 1.3509562
## 0.0001000000 0.60 2.738085 0.4979335 1.3845608
## 0.0001000000 0.65 2.822054 0.5058348 1.4076309
## 0.0001000000 0.70 3.140076 0.5028495 1.4836614
## 0.0001000000 0.75 3.472393 0.4964539 1.5746992
## 0.0001000000 0.80 3.739556 0.4780496 1.6509425
## 0.0001000000 0.85 3.946557 0.4615762 1.7068677
## 0.0001000000 0.90 4.163171 0.4483823 1.7637623
## 0.0001000000 0.95 4.384069 0.4389829 1.8210129
## 0.0001000000 1.00 4.615311 0.4332933 1.8807859
## 0.0001467799 0.05 1.312976 0.6207818 1.0696866
## 0.0001467799 0.10 1.186449 0.6068705 0.9605721
## 0.0001467799 0.15 1.201557 0.6071110 0.9379103
## 0.0001467799 0.20 1.219640 0.6113316 0.9438039
## 0.0001467799 0.25 1.189935 0.6338334 0.9443897
## 0.0001467799 0.30 1.526464 0.5497000 1.0392139
## 0.0001467799 0.35 1.834456 0.5025490 1.1217915
## 0.0001467799 0.40 2.146027 0.4810403 1.2041460
## 0.0001467799 0.45 2.406273 0.4702301 1.2738895
## 0.0001467799 0.50 2.538255 0.4739313 1.3165802
## 0.0001467799 0.55 2.634164 0.4832724 1.3496783
## 0.0001467799 0.60 2.733547 0.4917318 1.3834010
## 0.0001467799 0.65 2.780341 0.5024406 1.3995763
## 0.0001467799 0.70 3.059963 0.5051805 1.4637233
## 0.0001467799 0.75 3.376922 0.5013962 1.5448433
## 0.0001467799 0.80 3.643391 0.4895190 1.6221308
## 0.0001467799 0.85 3.846552 0.4729511 1.6793130
## 0.0001467799 0.90 4.061839 0.4578391 1.7368691
## 0.0001467799 0.95 4.281267 0.4462089 1.7943084
## 0.0001467799 1.00 4.506304 0.4388433 1.8528203
## 0.0002154435 0.05 1.322534 0.6198009 1.0778912
## 0.0002154435 0.10 1.187117 0.6064945 0.9614620
## 0.0002154435 0.15 1.200288 0.6068625 0.9388224
## 0.0002154435 0.20 1.220365 0.6101925 0.9438271
## 0.0002154435 0.25 1.167357 0.6388609 0.9330267
## 0.0002154435 0.30 1.474292 0.5604461 1.0248120
## 0.0002154435 0.35 1.780713 0.5082059 1.1079541
## 0.0002154435 0.40 2.090650 0.4839818 1.1891316
## 0.0002154435 0.45 2.355742 0.4726460 1.2599932
## 0.0002154435 0.50 2.535814 0.4698818 1.3140068
## 0.0002154435 0.55 2.630713 0.4784769 1.3471961
## 0.0002154435 0.60 2.726162 0.4846054 1.3804085
## 0.0002154435 0.65 2.776174 0.4951299 1.3990682
## 0.0002154435 0.70 2.970036 0.5033711 1.4468492
## 0.0002154435 0.75 3.260234 0.5036011 1.5140672
## 0.0002154435 0.80 3.526384 0.5002186 1.5836014
## 0.0002154435 0.85 3.720861 0.4879953 1.6424749
## 0.0002154435 0.90 3.924687 0.4727808 1.6991280
## 0.0002154435 0.95 4.139138 0.4587099 1.7565563
## 0.0002154435 1.00 4.356079 0.4487577 1.8134565
## 0.0003162278 0.05 1.334827 0.6187809 1.0882119
## 0.0003162278 0.10 1.186820 0.6068895 0.9638249
## 0.0003162278 0.15 1.198985 0.6065330 0.9402656
## 0.0003162278 0.20 1.221310 0.6087167 0.9445933
## 0.0003162278 0.25 1.160748 0.6379030 0.9290944
## 0.0003162278 0.30 1.379595 0.5841065 0.9980573
## 0.0003162278 0.35 1.722678 0.5140445 1.0929779
## 0.0003162278 0.40 2.018244 0.4885004 1.1693969
## 0.0003162278 0.45 2.291515 0.4754926 1.2424922
## 0.0003162278 0.50 2.527917 0.4664703 1.3094168
## 0.0003162278 0.55 2.628393 0.4714198 1.3443910
## 0.0003162278 0.60 2.711252 0.4786444 1.3739818
## 0.0003162278 0.65 2.783565 0.4848536 1.4002898
## 0.0003162278 0.70 2.871938 0.4946837 1.4250341
## 0.0003162278 0.75 3.131674 0.5016311 1.4891955
## 0.0003162278 0.80 3.389385 0.5031339 1.5494168
## 0.0003162278 0.85 3.575129 0.5003462 1.5956365
## 0.0003162278 0.90 3.754575 0.4919533 1.6490410
## 0.0003162278 0.95 3.953781 0.4784946 1.7052025
## 0.0003162278 1.00 4.159834 0.4661064 1.7605727
## 0.0004641589 0.05 1.350215 0.6178465 1.1003752
## 0.0004641589 0.10 1.186993 0.6075796 0.9678313
## 0.0004641589 0.15 1.198146 0.6057160 0.9421185
## 0.0004641589 0.20 1.220041 0.6076458 0.9444544
## 0.0004641589 0.25 1.169414 0.6299573 0.9253871
## 0.0004641589 0.30 1.281053 0.6141886 0.9686990
## 0.0004641589 0.35 1.670084 0.5190994 1.0786302
## 0.0004641589 0.40 1.928551 0.4958466 1.1454241
## 0.0004641589 0.45 2.212051 0.4793084 1.2208582
## 0.0004641589 0.50 2.457363 0.4694107 1.2894498
## 0.0004641589 0.55 2.618545 0.4657763 1.3389331
## 0.0004641589 0.60 2.706422 0.4713231 1.3693243
## 0.0004641589 0.65 2.767960 0.4766040 1.3933534
## 0.0004641589 0.70 2.764179 0.4823218 1.3983513
## 0.0004641589 0.75 2.996091 0.4906874 1.4577077
## 0.0004641589 0.80 3.234938 0.4974789 1.5176905
## 0.0004641589 0.85 3.419355 0.5023290 1.5614047
## 0.0004641589 0.90 3.573111 0.5028562 1.5942094
## 0.0004641589 0.95 3.742927 0.4994079 1.6406848
## 0.0004641589 1.00 3.925239 0.4906892 1.6940127
## 0.0006812921 0.05 1.368859 0.6165262 1.1151109
## 0.0006812921 0.10 1.188147 0.6090189 0.9725945
## 0.0006812921 0.15 1.197759 0.6046941 0.9448929
## 0.0006812921 0.20 1.215914 0.6072175 0.9424050
## 0.0006812921 0.25 1.201038 0.6186645 0.9358396
## 0.0006812921 0.30 1.186742 0.6463025 0.9353479
## 0.0006812921 0.35 1.558518 0.5390834 1.0473350
## 0.0006812921 0.40 1.849741 0.5009332 1.1246637
## 0.0006812921 0.45 2.115661 0.4850068 1.1944994
## 0.0006812921 0.50 2.363970 0.4735083 1.2635821
## 0.0006812921 0.55 2.569227 0.4650301 1.3224110
## 0.0006812921 0.60 2.693482 0.4645877 1.3622589
## 0.0006812921 0.65 2.767570 0.4689722 1.3892670
## 0.0006812921 0.70 2.762098 0.4730204 1.3945959
## 0.0006812921 0.75 2.851443 0.4771826 1.4211377
## 0.0006812921 0.80 3.063872 0.4842025 1.4760759
## 0.0006812921 0.85 3.252404 0.4913800 1.5240233
## 0.0006812921 0.90 3.397608 0.4982430 1.5597573
## 0.0006812921 0.95 3.537970 0.5028376 1.5932625
## 0.0006812921 1.00 3.686532 0.5054090 1.6270189
## 0.0010000000 0.05 1.390484 0.6146614 1.1321737
## 0.0010000000 0.10 1.191279 0.6114687 0.9781530
## 0.0010000000 0.15 1.196957 0.6042892 0.9483218
## 0.0010000000 0.20 1.210879 0.6070438 0.9395302
## 0.0010000000 0.25 1.220853 0.6117760 0.9428530
## 0.0010000000 0.30 1.128537 0.6585066 0.9112780
## 0.0010000000 0.35 1.404360 0.5744960 1.0047867
## 0.0010000000 0.40 1.746456 0.5107101 1.0975946
## 0.0010000000 0.45 2.007370 0.4900495 1.1652617
## 0.0010000000 0.50 2.246454 0.4789433 1.2315388
## 0.0010000000 0.55 2.467745 0.4694306 1.2936741
## 0.0010000000 0.60 2.640730 0.4624653 1.3447349
## 0.0010000000 0.65 2.747258 0.4626071 1.3790642
## 0.0010000000 0.70 2.771790 0.4660489 1.3924403
## 0.0010000000 0.75 2.726012 0.4688060 1.3868236
## 0.0010000000 0.80 2.882401 0.4712340 1.4291399
## 0.0010000000 0.85 3.066949 0.4762779 1.4775676
## 0.0010000000 0.90 3.219267 0.4825997 1.5170334
## 0.0010000000 0.95 3.340356 0.4895449 1.5481155
## 0.0010000000 1.00 3.468083 0.4958278 1.5804150
## 0.0014677993 0.05 1.414601 0.6120683 1.1512879
## 0.0014677993 0.10 1.194243 0.6181396 0.9812436
## 0.0014677993 0.15 1.196388 0.6039028 0.9510389
## 0.0014677993 0.20 1.205912 0.6066943 0.9385442
## 0.0014677993 0.25 1.222925 0.6083774 0.9462664
## 0.0014677993 0.30 1.141977 0.6428152 0.9145626
## 0.0014677993 0.35 1.259759 0.6204072 0.9604534
## 0.0014677993 0.40 1.590204 0.5377140 1.0552568
## 0.0014677993 0.45 1.871569 0.5001752 1.1295939
## 0.0014677993 0.50 2.134398 0.4831130 1.2007658
## 0.0014677993 0.55 2.352911 0.4733374 1.2622340
## 0.0014677993 0.60 2.527499 0.4665726 1.3118661
## 0.0014677993 0.65 2.684938 0.4606388 1.3583179
## 0.0014677993 0.70 2.778415 0.4606119 1.3887585
## 0.0014677993 0.75 2.740343 0.4629888 1.3849023
## 0.0014677993 0.80 2.685991 0.4648420 1.3768304
## 0.0014677993 0.85 2.855939 0.4663727 1.4223092
## 0.0014677993 0.90 3.012219 0.4692035 1.4637574
## 0.0014677993 0.95 3.142942 0.4739121 1.4982535
## 0.0014677993 1.00 3.251916 0.4794320 1.5270930
## 0.0021544347 0.05 1.440176 0.6085738 1.1713578
## 0.0021544347 0.10 1.203600 0.6241879 0.9884972
## 0.0021544347 0.15 1.195280 0.6032513 0.9530236
## 0.0021544347 0.20 1.204372 0.6044183 0.9417868
## 0.0021544347 0.25 1.221885 0.6060748 0.9459568
## 0.0021544347 0.30 1.187356 0.6212679 0.9322017
## 0.0021544347 0.35 1.165428 0.6502150 0.9173710
## 0.0021544347 0.40 1.426844 0.5741630 1.0093860
## 0.0021544347 0.45 1.707300 0.5213160 1.0864838
## 0.0021544347 0.50 1.940772 0.4958124 1.1481255
## 0.0021544347 0.55 2.216279 0.4788620 1.2250686
## 0.0021544347 0.60 2.413702 0.4696638 1.2807703
## 0.0021544347 0.65 2.568458 0.4631366 1.3249033
## 0.0021544347 0.70 2.711219 0.4585985 1.3662006
## 0.0021544347 0.75 2.775441 0.4582934 1.3881197
## 0.0021544347 0.80 2.701709 0.4602599 1.3745832
## 0.0021544347 0.85 2.646350 0.4616439 1.3659216
## 0.0021544347 0.90 2.780907 0.4626928 1.4027061
## 0.0021544347 0.95 2.918682 0.4644283 1.4397670
## 0.0021544347 1.00 3.036208 0.4673759 1.4713865
## 0.0031622777 0.05 1.464441 0.6041175 1.1901224
## 0.0031622777 0.10 1.221443 0.6238109 1.0026422
## 0.0031622777 0.15 1.193770 0.6027022 0.9577587
## 0.0031622777 0.20 1.202855 0.6031412 0.9456617
## 0.0031622777 0.25 1.215133 0.6062948 0.9431808
## 0.0031622777 0.30 1.224329 0.6087993 0.9465725
## 0.0031622777 0.35 1.140024 0.6471914 0.9172522
## 0.0031622777 0.40 1.284552 0.6151857 0.9658395
## 0.0031622777 0.45 1.552529 0.5495542 1.0449443
## 0.0031622777 0.50 1.807172 0.5091564 1.1133994
## 0.0031622777 0.55 2.018829 0.4901597 1.1729690
## 0.0031622777 0.60 2.278876 0.4750815 1.2447618
## 0.0031622777 0.65 2.448949 0.4667007 1.2930427
## 0.0031622777 0.70 2.592785 0.4607439 1.3337902
## 0.0031622777 0.75 2.721709 0.4563579 1.3700616
## 0.0031622777 0.80 2.727193 0.4561165 1.3760751
## 0.0031622777 0.85 2.669754 0.4569059 1.3662126
## 0.0031622777 0.90 2.617711 0.4580909 1.3579859
## 0.0031622777 0.95 2.714893 0.4588091 1.3856439
## 0.0031622777 1.00 2.831462 0.4598905 1.4175257
## 0.0046415888 0.05 1.487892 0.5991231 1.2079082
## 0.0046415888 0.10 1.243855 0.6214428 1.0185183
## 0.0046415888 0.15 1.196184 0.6006204 0.9663548
## 0.0046415888 0.20 1.200899 0.6032574 0.9484194
## 0.0046415888 0.25 1.209057 0.6060506 0.9417310
## 0.0046415888 0.30 1.223827 0.6063560 0.9478793
## 0.0046415888 0.35 1.172153 0.6260134 0.9285148
## 0.0046415888 0.40 1.193209 0.6416473 0.9278333
## 0.0046415888 0.45 1.410766 0.5826193 1.0053991
## 0.0046415888 0.50 1.644789 0.5336816 1.0718425
## 0.0046415888 0.55 1.857691 0.5046314 1.1304307
## 0.0046415888 0.60 2.064080 0.4863734 1.1890608
## 0.0046415888 0.65 2.301388 0.4723989 1.2541105
## 0.0046415888 0.70 2.461380 0.4646034 1.2994215
## 0.0046415888 0.75 2.596056 0.4591303 1.3373070
## 0.0046415888 0.80 2.701843 0.4558519 1.3674916
## 0.0046415888 0.85 2.673853 0.4553273 1.3629276
## 0.0046415888 0.90 2.634792 0.4553347 1.3568925
## 0.0046415888 0.95 2.592617 0.4558428 1.3507541
## 0.0046415888 1.00 2.646110 0.4560400 1.3676931
## 0.0068129207 0.05 1.510036 0.5936619 1.2251668
## 0.0068129207 0.10 1.268349 0.6201252 1.0375892
## 0.0068129207 0.15 1.198152 0.6006448 0.9752716
## 0.0068129207 0.20 1.198750 0.6032027 0.9508729
## 0.0068129207 0.25 1.205596 0.6047747 0.9422562
## 0.0068129207 0.30 1.219282 0.6060855 0.9463429
## 0.0068129207 0.35 1.226800 0.6078274 0.9484141
## 0.0068129207 0.40 1.160817 0.6392083 0.9288103
## 0.0068129207 0.45 1.285833 0.6192572 0.9658845
## 0.0068129207 0.50 1.501160 0.5638228 1.0333857
## 0.0068129207 0.55 1.725928 0.5205519 1.0972044
## 0.0068129207 0.60 1.879766 0.5038624 1.1408696
## 0.0068129207 0.65 2.058114 0.4862643 1.1918158
## 0.0068129207 0.70 2.240108 0.4727167 1.2426383
## 0.0068129207 0.75 2.374346 0.4648515 1.2809842
## 0.0068129207 0.80 2.502954 0.4594106 1.3165300
## 0.0068129207 0.85 2.591610 0.4568284 1.3420470
## 0.0068129207 0.90 2.554149 0.4560701 1.3348280
## 0.0068129207 0.95 2.520347 0.4556135 1.3290570
## 0.0068129207 1.00 2.481383 0.4555698 1.3222162
## 0.0100000000 0.05 1.531587 0.5871311 1.2421352
## 0.0100000000 0.10 1.294529 0.6190669 1.0574081
## 0.0100000000 0.15 1.196754 0.6061930 0.9801151
## 0.0100000000 0.20 1.198605 0.6023548 0.9535902
## 0.0100000000 0.25 1.204705 0.6033132 0.9462525
## 0.0100000000 0.30 1.212785 0.6059749 0.9435634
## 0.0100000000 0.35 1.223942 0.6064122 0.9486350
## 0.0100000000 0.40 1.180932 0.6220449 0.9336910
## 0.0100000000 0.45 1.212301 0.6338792 0.9402633
## 0.0100000000 0.50 1.379424 0.5983299 0.9977038
## 0.0100000000 0.55 1.572492 0.5495234 1.0568563
## 0.0100000000 0.60 1.762787 0.5163707 1.1115964
## 0.0100000000 0.65 1.875385 0.5079231 1.1432153
## 0.0100000000 0.70 2.022247 0.4903956 1.1862377
## 0.0100000000 0.75 2.149006 0.4773581 1.2232844
## 0.0100000000 0.80 2.262862 0.4690077 1.2553030
## 0.0100000000 0.85 2.351088 0.4638691 1.2804649
## 0.0100000000 0.90 2.392722 0.4612285 1.2939608
## 0.0100000000 0.95 2.359819 0.4599141 1.2878533
## 0.0100000000 1.00 2.332492 0.4589674 1.2836797
## 0.0146779927 0.05 1.553352 0.5791028 1.2593808
## 0.0146779927 0.10 1.323583 0.6184277 1.0791436
## 0.0146779927 0.15 1.199162 0.6164582 0.9855560
## 0.0146779927 0.20 1.197550 0.6008180 0.9603723
## 0.0146779927 0.25 1.202708 0.6036036 0.9493493
## 0.0146779927 0.30 1.206535 0.6058220 0.9420837
## 0.0146779927 0.35 1.217106 0.6066872 0.9465188
## 0.0146779927 0.40 1.226039 0.6073350 0.9493473
## 0.0146779927 0.45 1.191635 0.6229545 0.9452679
## 0.0146779927 0.50 1.271855 0.6258751 0.9584712
## 0.0146779927 0.55 1.438291 0.5825824 1.0201933
## 0.0146779927 0.60 1.620482 0.5390685 1.0746374
## 0.0146779927 0.65 1.752314 0.5218360 1.1119346
## 0.0146779927 0.70 1.825258 0.5260455 1.1314918
## 0.0146779927 0.75 1.955422 0.5027303 1.1708607
## 0.0146779927 0.80 2.054097 0.4894072 1.1999224
## 0.0146779927 0.85 2.138681 0.4795848 1.2248075
## 0.0146779927 0.90 2.194821 0.4742040 1.2421063
## 0.0146779927 0.95 2.218701 0.4705144 1.2505858
## 0.0146779927 1.00 2.193486 0.4682583 1.2462962
## 0.0215443469 0.05 1.574986 0.5693577 1.2763292
## 0.0215443469 0.10 1.355794 0.6170389 1.1039818
## 0.0215443469 0.15 1.216362 0.6230124 0.9972261
## 0.0215443469 0.20 1.203337 0.5969304 0.9705067
## 0.0215443469 0.25 1.200588 0.6035575 0.9517208
## 0.0215443469 0.30 1.205204 0.6046083 0.9463316
## 0.0215443469 0.35 1.209710 0.6067615 0.9439475
## 0.0215443469 0.40 1.219397 0.6072673 0.9477153
## 0.0215443469 0.45 1.212216 0.6116192 0.9469292
## 0.0215443469 0.50 1.227319 0.6175893 0.9569923
## 0.0215443469 0.55 1.327503 0.6124250 0.9846531
## 0.0215443469 0.60 1.476231 0.5722579 1.0361069
## 0.0215443469 0.65 1.633107 0.5368833 1.0824900
## 0.0215443469 0.70 1.708322 0.5385408 1.1017767
## 0.0215443469 0.75 1.788125 0.5380718 1.1217330
## 0.0215443469 0.80 1.878603 0.5216446 1.1507273
## 0.0215443469 0.85 1.955518 0.5084250 1.1745082
## 0.0215443469 0.90 2.011584 0.4991751 1.1921060
## 0.0215443469 0.95 2.056385 0.4927688 1.2063488
## 0.0215443469 1.00 2.062752 0.4880297 1.2102922
## 0.0316227766 0.05 1.595720 0.5576837 1.2923680
## 0.0316227766 0.10 1.388500 0.6149422 1.1300412
## 0.0316227766 0.15 1.245412 0.6201331 1.0203071
## 0.0316227766 0.20 1.201685 0.5995949 0.9789119
## 0.0316227766 0.25 1.201663 0.6015553 0.9562435
## 0.0316227766 0.30 1.202245 0.6047811 0.9491734
## 0.0316227766 0.35 1.203270 0.6069477 0.9428645
## 0.0316227766 0.40 1.211422 0.6077850 0.9453277
## 0.0316227766 0.45 1.219826 0.6085503 0.9477453
## 0.0316227766 0.50 1.228362 0.6068869 0.9596685
## 0.0316227766 0.55 1.259325 0.6145124 0.9712652
## 0.0316227766 0.60 1.359860 0.6052083 0.9990018
## 0.0316227766 0.65 1.489344 0.5702788 1.0437707
## 0.0316227766 0.70 1.601196 0.5510462 1.0764146
## 0.0316227766 0.75 1.666718 0.5562809 1.0894564
## 0.0316227766 0.80 1.737258 0.5502863 1.1068906
## 0.0316227766 0.85 1.805387 0.5400468 1.1296213
## 0.0316227766 0.90 1.856767 0.5317367 1.1464877
## 0.0316227766 0.95 1.897627 0.5248421 1.1601672
## 0.0316227766 1.00 1.946821 0.5182083 1.1761913
## 0.0464158883 0.05 1.615381 0.5438481 1.3076388
## 0.0464158883 0.10 1.420850 0.6120877 1.1557314
## 0.0464158883 0.15 1.277258 0.6185355 1.0447995
## 0.0464158883 0.20 1.201513 0.6085489 0.9868460
## 0.0464158883 0.25 1.204948 0.5975142 0.9657614
## 0.0464158883 0.30 1.199539 0.6051515 0.9501709
## 0.0464158883 0.35 1.200199 0.6070804 0.9464625
## 0.0464158883 0.40 1.203233 0.6082679 0.9417886
## 0.0464158883 0.45 1.220374 0.6072589 0.9483419
## 0.0464158883 0.50 1.232533 0.6077134 0.9514438
## 0.0464158883 0.55 1.251852 0.6017350 0.9694185
## 0.0464158883 0.60 1.287763 0.6101824 0.9847238
## 0.0464158883 0.65 1.372323 0.6038279 1.0034235
## 0.0464158883 0.70 1.473340 0.5804795 1.0407915
## 0.0464158883 0.75 1.563694 0.5686997 1.0659350
## 0.0464158883 0.80 1.630209 0.5631660 1.0802493
## 0.0464158883 0.85 1.692591 0.5538689 1.1015698
## 0.0464158883 0.90 1.740385 0.5483997 1.1136958
## 0.0464158883 0.95 1.795857 0.5432020 1.1278205
## 0.0464158883 1.00 1.856130 0.5386127 1.1447627
## 0.0681292069 0.05 1.633565 0.5282467 1.3219909
## 0.0681292069 0.10 1.452159 0.6083137 1.1801490
## 0.0681292069 0.15 1.310484 0.6169390 1.0694625
## 0.0681292069 0.20 1.215764 0.6204616 0.9971526
## 0.0681292069 0.25 1.202997 0.5980729 0.9737152
## 0.0681292069 0.30 1.199580 0.6029064 0.9545890
## 0.0681292069 0.35 1.196945 0.6071662 0.9480008
## 0.0681292069 0.40 1.203045 0.6073935 0.9459107
## 0.0681292069 0.45 1.219721 0.6053140 0.9470645
## 0.0681292069 0.50 1.233845 0.6062856 0.9521743
## 0.0681292069 0.55 1.251562 0.6048873 0.9614908
## 0.0681292069 0.60 1.268784 0.5994555 0.9761280
## 0.0681292069 0.65 1.306639 0.6051248 0.9945336
## 0.0681292069 0.70 1.372304 0.6025497 1.0127051
## 0.0681292069 0.75 1.452329 0.5892621 1.0352671
## 0.0681292069 0.80 1.528982 0.5766488 1.0569947
## 0.0681292069 0.85 1.593119 0.5649680 1.0808089
## 0.0681292069 0.90 1.663558 0.5518526 1.1051810
## 0.0681292069 0.95 1.730366 0.5463037 1.1241048
## 0.0681292069 1.00 1.787935 0.5422606 1.1397875
## 0.1000000000 0.05 1.649539 0.5118425 1.3345498
## 0.1000000000 0.10 1.480683 0.6038008 1.2023921
## 0.1000000000 0.15 1.342958 0.6150670 1.0938352
## 0.1000000000 0.20 1.244390 0.6195160 1.0184693
## 0.1000000000 0.25 1.198751 0.6054008 0.9827510
## 0.1000000000 0.30 1.202321 0.5991586 0.9622856
## 0.1000000000 0.35 1.194699 0.6066717 0.9493999
## 0.1000000000 0.40 1.203183 0.6067745 0.9473553
## 0.1000000000 0.45 1.221773 0.6040040 0.9497476
## 0.1000000000 0.50 1.236426 0.6038725 0.9525150
## 0.1000000000 0.55 1.249775 0.6050269 0.9576397
## 0.1000000000 0.60 1.267431 0.6016337 0.9717337
## 0.1000000000 0.65 1.281848 0.5981661 0.9845828
## 0.1000000000 0.70 1.324435 0.5992566 1.0060772
## 0.1000000000 0.75 1.374121 0.5978595 1.0223868
## 0.1000000000 0.80 1.438350 0.5900700 1.0402743
## 0.1000000000 0.85 1.505385 0.5787410 1.0607488
## 0.1000000000 0.90 1.587594 0.5643740 1.0899949
## 0.1000000000 0.95 1.666707 0.5509911 1.1156532
## 0.1000000000 1.00 1.733242 0.5423234 1.1354727
##
## Rsquared was used to select the optimal model using the largest value.
## The final values used for the model were fraction = 0.3 and lambda = 0.001.
#lm
set.seed(592)
lm_model <- lm(Yield ~ ., Chemical)
summary(lm_model)
##
## Call:
## lm(formula = Yield ~ ., data = Chemical)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2.18004 -0.50856 -0.02006 0.53016 2.03105
##
## Coefficients: (1 not defined because of singularities)
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -2.335e+01 8.387e+01 -0.278 0.78120
## BiologicalMaterial01 2.689e-01 3.281e-01 0.820 0.41410
## BiologicalMaterial02 -1.250e-01 1.268e-01 -0.986 0.32595
## BiologicalMaterial03 1.976e-01 2.324e-01 0.850 0.39690
## BiologicalMaterial04 -1.134e-01 5.210e-01 -0.218 0.82802
## BiologicalMaterial05 1.678e-01 1.048e-01 1.601 0.11208
## BiologicalMaterial06 -4.528e-02 2.965e-01 -0.153 0.87887
## BiologicalMaterial08 4.727e-01 6.227e-01 0.759 0.44930
## BiologicalMaterial09 -1.006e+00 1.340e+00 -0.751 0.45423
## BiologicalMaterial10 9.477e-02 1.360e+00 0.070 0.94455
## BiologicalMaterial11 -7.855e-02 8.155e-02 -0.963 0.33736
## BiologicalMaterial12 3.320e-01 6.311e-01 0.526 0.59980
## ManufacturingProcess01 6.977e-02 9.414e-02 0.741 0.46005
## ManufacturingProcess02 6.769e-03 4.440e-02 0.152 0.87909
## ManufacturingProcess03 -3.747e+00 5.126e+00 -0.731 0.46618
## ManufacturingProcess04 6.237e-02 2.917e-02 2.138 0.03450 *
## ManufacturingProcess05 9.223e-04 3.839e-03 0.240 0.81053
## ManufacturingProcess06 3.611e-02 4.286e-02 0.842 0.40127
## ManufacturingProcess07 -1.922e-01 2.103e-01 -0.914 0.36260
## ManufacturingProcess08 -5.701e-02 2.506e-01 -0.227 0.82045
## ManufacturingProcess09 2.924e-01 1.759e-01 1.663 0.09902 .
## ManufacturingProcess10 -3.600e-02 5.843e-01 -0.062 0.95097
## ManufacturingProcess11 4.341e-01 7.298e-01 0.595 0.55305
## ManufacturingProcess12 4.057e-05 1.008e-04 0.402 0.68813
## ManufacturingProcess13 -2.056e-01 3.765e-01 -0.546 0.58599
## ManufacturingProcess14 -1.270e-03 1.094e-02 -0.116 0.90778
## ManufacturingProcess15 4.215e-03 8.677e-03 0.486 0.62796
## ManufacturingProcess16 -1.154e-04 3.329e-04 -0.347 0.72946
## ManufacturingProcess17 -2.023e-01 2.948e-01 -0.686 0.49381
## ManufacturingProcess18 4.137e-03 4.443e-03 0.931 0.35360
## ManufacturingProcess19 8.201e-04 7.111e-03 0.115 0.90838
## ManufacturingProcess20 -4.379e-03 4.706e-03 -0.931 0.35398
## ManufacturingProcess21 NA NA NA NA
## ManufacturingProcess22 -1.744e-02 4.163e-02 -0.419 0.67605
## ManufacturingProcess23 -3.884e-02 8.229e-02 -0.472 0.63774
## ManufacturingProcess24 -2.120e-02 2.323e-02 -0.912 0.36340
## ManufacturingProcess25 3.935e-03 4.648e-03 0.847 0.39895
## ManufacturingProcess26 -8.256e-04 4.309e-03 -0.192 0.84839
## ManufacturingProcess27 -8.358e-03 7.696e-03 -1.086 0.27966
## ManufacturingProcess28 -8.158e-02 3.087e-02 -2.643 0.00932 **
## ManufacturingProcess29 1.241e+00 9.070e-01 1.369 0.17370
## ManufacturingProcess30 -3.612e-01 6.027e-01 -0.599 0.55015
## ManufacturingProcess31 4.805e-02 1.185e-01 0.405 0.68584
## ManufacturingProcess32 3.176e-01 6.854e-02 4.634 9.17e-06 ***
## ManufacturingProcess33 -3.801e-01 1.283e-01 -2.962 0.00369 **
## ManufacturingProcess34 -1.023e+00 2.744e+00 -0.373 0.70987
## ManufacturingProcess35 -1.762e-02 1.735e-02 -1.016 0.31191
## ManufacturingProcess36 2.644e+02 3.112e+02 0.850 0.39710
## ManufacturingProcess37 -7.519e-01 2.916e-01 -2.578 0.01113 *
## ManufacturingProcess38 -1.967e-01 2.400e-01 -0.820 0.41411
## ManufacturingProcess39 6.799e-02 1.304e-01 0.521 0.60305
## ManufacturingProcess40 8.184e-01 6.519e+00 0.126 0.90030
## ManufacturingProcess41 -1.360e-01 4.718e+00 -0.029 0.97706
## ManufacturingProcess42 3.471e-02 2.080e-01 0.167 0.86773
## ManufacturingProcess43 2.170e-01 1.167e-01 1.859 0.06547 .
## ManufacturingProcess44 -4.604e-01 1.174e+00 -0.392 0.69557
## ManufacturingProcess45 9.629e-01 5.407e-01 1.781 0.07748 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.035 on 120 degrees of freedom
## Multiple R-squared: 0.7844, Adjusted R-squared: 0.6856
## F-statistic: 7.939 on 55 and 120 DF, p-value: < 2.2e-16
#ridge
set.seed(592)
ridgeGrid <- data.frame(.lambda = seq(0, .1, length = 15))
ridgeTune <- train(Yield ~ ., Chemical , method = "ridge",
tuneGrid = ridgeGrid, trControl = ctrl, preProc = c("center", "scale"))
plot(ridgeTune)
ridgeTune
## Ridge Regression
##
## 176 samples
## 56 predictor
##
## Pre-processing: centered (56), scaled (56)
## Resampling: Cross-Validated (10 fold)
## Summary of sample sizes: 159, 157, 159, 158, 158, 159, ...
## Resampling results across tuning parameters:
##
## lambda RMSE Rsquared MAE
## 0.000000000 4.854860 0.4247182 1.938490
## 0.007142857 2.462312 0.4557586 1.317238
## 0.014285714 2.203049 0.4673244 1.248942
## 0.021428571 2.064511 0.4876592 1.210796
## 0.028571429 1.975362 0.5100773 1.185049
## 0.035714286 1.915069 0.5268589 1.165736
## 0.042857143 1.872764 0.5360998 1.150753
## 0.050000000 1.841519 0.5402261 1.142804
## 0.057142857 1.817141 0.5417727 1.141800
## 0.064285714 1.797263 0.5422145 1.140456
## 0.071428571 1.780550 0.5422548 1.139193
## 0.078571429 1.766216 0.5421993 1.137982
## 0.085714286 1.753763 0.5421701 1.136952
## 0.092857143 1.742853 0.5422090 1.136109
## 0.100000000 1.733242 0.5423234 1.135473
##
## RMSE was used to select the optimal model using the smallest value.
## The final value used for the model was lambda = 0.1.
lars_predict <- predict(larsTune, test_chem[ ,-1])
postResample(lars_predict, test_chem[ ,1])
## RMSE Rsquared MAE
## 1.5308474 0.4427036 1.2363040
The value of the performance metric is 0.62 for the lar model which had the highest R^2.
varImp(larsTune)
## loess r-squared variable importance
##
## only 20 most important variables shown (out of 56)
##
## Overall
## ManufacturingProcess32 100.00
## ManufacturingProcess13 90.03
## BiologicalMaterial06 84.57
## ManufacturingProcess36 75.65
## ManufacturingProcess17 74.89
## BiologicalMaterial03 73.54
## ManufacturingProcess09 70.38
## BiologicalMaterial12 67.99
## BiologicalMaterial02 65.34
## ManufacturingProcess06 58.18
## ManufacturingProcess33 49.89
## ManufacturingProcess31 48.98
## BiologicalMaterial11 48.13
## BiologicalMaterial04 47.15
## ManufacturingProcess11 42.40
## BiologicalMaterial08 41.90
## BiologicalMaterial01 39.16
## ManufacturingProcess12 33.25
## ManufacturingProcess30 32.96
## BiologicalMaterial09 32.44
The 5 most important variables used in the modeling are ManufacturingProcess32, ManufacturingProcess13, BiologicalMaterial06, ManufacturingProcess36, and ManufacturingProcess17.
top10 <- varImp(larsTune)$importance %>%
arrange(-Overall) %>%
head(10)
Chemical %>%
select(c("Yield", row.names(top10))) %>%
cor() %>%
corrplot()
The correlation plot indicates that ManufacturingProcess32 shows the
strongest positive correlation with Yield. Additionally, three of the
top ten variables exhibit a negative correlation with Yield. This
insight could be valuable for future manufacturing process runs, as
these predictors significantly influence yield. To maximize or enhance
their yield, they may consider refining their measurements of the
manufacturing process and the biological characteristics of the raw
materials.