{"id":1198,"date":"2023-07-27T07:56:18","date_gmt":"2023-07-27T07:56:18","guid":{"rendered":"https:\/\/statorials.org\/my\/r-%e1%80%90%e1%80%bd%e1%80%84%e1%80%ba-lasso-%e1%80%86%e1%80%af%e1%80%90%e1%80%ba%e1%80%9a%e1%80%af%e1%80%90%e1%80%ba%e1%80%99%e1%80%be%e1%80%af\/"},"modified":"2023-07-27T07:56:18","modified_gmt":"2023-07-27T07:56:18","slug":"r-%e1%80%90%e1%80%bd%e1%80%84%e1%80%ba-lasso-%e1%80%86%e1%80%af%e1%80%90%e1%80%ba%e1%80%9a%e1%80%af%e1%80%90%e1%80%ba%e1%80%99%e1%80%be%e1%80%af","status":"publish","type":"post","link":"https:\/\/statorials.org\/my\/r-%e1%80%90%e1%80%bd%e1%80%84%e1%80%ba-lasso-%e1%80%86%e1%80%af%e1%80%90%e1%80%ba%e1%80%9a%e1%80%af%e1%80%90%e1%80%ba%e1%80%99%e1%80%be%e1%80%af\/","title":{"rendered":"R in lasso regression (\u1010\u1005\u103a\u1006\u1004\u1037\u103a\u1015\u103c\u102e\u1038\u1010\u1005\u103a\u1006\u1004\u1037\u103a)"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\"><a href=\"https:\/\/statorials.org\/my\/lasso-\u1006\u102f\u1010\u103a\u101a\u102f\u1010\u103a\u1019\u103e\u102f\/\" target=\"_blank\" rel=\"noopener noreferrer\">Lasso regression<\/a> \u101e\u100a\u103a data \u1010\u103d\u1004\u103a <a href=\"https:\/\/statorials.org\/my\/multicollinearity-\u1006\u102f\u1010\u103a\u101a\u102f\u1010\u103a\u1019\u103e\u102f\/\" target=\"_blank\" rel=\"noopener noreferrer\">multicollinearity<\/a> \u101b\u103e\u102d\u1014\u1031\u101e\u1031\u102c\u1021\u1001\u102b\u1010\u103d\u1004\u103a regression model \u1010\u1005\u103a\u1001\u102f\u1014\u103e\u1004\u1037\u103a\u1000\u102d\u102f\u1000\u103a\u100a\u102e\u101b\u1014\u103a\u1000\u103b\u103d\u1014\u103a\u102f\u1015\u103a\u1010\u102d\u102f\u1037\u1021\u101e\u102f\u1036\u1038\u1015\u103c\u102f\u1014\u102d\u102f\u1004\u103a\u101e\u1031\u102c\u1014\u100a\u103a\u1038\u101c\u1019\u103a\u1038\u1010\u1005\u103a\u1001\u102f\u1016\u103c\u1005\u103a\u101e\u100a\u103a\u104b<\/span><\/p>\n<p> <span style=\"color: #000000;\">\u1021\u1010\u102d\u102f\u1001\u103b\u102f\u1015\u103a\u1021\u102c\u1038\u1016\u103c\u1004\u1037\u103a\u104a \u1021\u1014\u100a\u103a\u1038 \u1006\u102f\u1036\u1038 \u1005\u1010\u102f\u101b\u1014\u103a\u1038\u1006\u102f\u1010\u103a\u101a\u102f\u1010\u103a\u1019\u103e\u102f \u101e\u100a\u103a \u1000\u103b\u1014\u103a\u101b\u103e\u102d\u101e\u1031\u102c \u1005\u1010\u102f\u101b\u1014\u103a\u1038 \u1015\u1031\u102b\u1004\u103a\u1038\u101c\u1012\u103a (RSS) \u1000\u102d\u102f \u1021\u1014\u100a\u103a\u1038\u1006\u102f\u1036\u1038 \u101c\u103b\u103e\u1031\u102c\u1037\u1001\u103b\u1014\u102d\u102f\u1004\u103a\u101e\u1031\u102c \u1000\u102d\u1014\u103a\u1038\u1000\u102d\u1014\u103a\u1038 \u1001\u1014\u1037\u103a\u1019\u103e\u1014\u103a\u1038\u1001\u103b\u1000\u103a\u1019\u103b\u102c\u1038\u1000\u102d\u102f \u101b\u103e\u102c\u1016\u103d\u1031\u101b\u1014\u103a \u1000\u103c\u102d\u102f\u1038\u1015\u1019\u103a\u1038\u101e\u100a\u103a \u104b<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>RSS = \u03a3(y <sub>i<\/sub> \u2013 \u0177 <sub>i<\/sub> )\u1042<\/strong><\/span><\/p>\n<p> <span style=\"color: #000000;\">\u101b\u103d\u103e\u1031-<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\"><strong>\u2211<\/strong> : <em>\u1015\u1031\u102b\u1004\u103a\u1038\u101c\u1012\u103a<\/em> \u101f\u102f \u1021\u1013\u102d\u1015\u1039\u1015\u102c\u101a\u103a\u101b\u101e\u1031\u102c \u1002\u101b\u102d\u101e\u1004\u103a\u1039\u1000\u1031\u1010<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>y <sub>i<\/sub><\/strong> : <sup>\u1021\u102d\u102f\u1004\u103a\u1010\u102e<\/sup> \u101c\u1031\u1037\u101c\u102c\u1001\u103c\u1004\u103a\u1038\u1021\u1010\u103d\u1000\u103a \u1021\u1019\u103e\u1014\u103a\u1010\u1000\u101a\u103a \u1010\u102f\u1036\u1037\u1015\u103c\u1014\u103a\u1019\u103e\u102f\u1010\u1014\u103a\u1016\u102d\u102f\u1038<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>\u0177 <sub>i<\/sub><\/strong> : Multiple linear regression model \u1000\u102d\u102f \u1021\u1001\u103c\u1031\u1001\u1036\u104d \u1001\u1014\u1037\u103a\u1019\u103e\u1014\u103a\u1038\u1011\u102c\u1038\u101e\u1031\u102c \u1010\u102f\u1036\u1037\u1015\u103c\u1014\u103a\u1019\u103e\u102f\u1010\u1014\u103a\u1016\u102d\u102f\u1038<\/span><\/li>\n<\/ul>\n<p> <span style=\"color: #000000;\">\u1021\u1015\u103c\u1014\u103a\u1021\u101c\u103e\u1014\u103a\u1021\u102c\u1038\u1016\u103c\u1004\u1037\u103a lasso regression \u101e\u100a\u103a \u1021\u1031\u102c\u1000\u103a\u1015\u102b\u1010\u102d\u102f\u1037\u1000\u102d\u102f \u101c\u103b\u103e\u1031\u102c\u1037\u1001\u103b\u101b\u1014\u103a \u1000\u103c\u102d\u102f\u1038\u1015\u1019\u103a\u1038\u101e\u100a\u103a \u104b<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>RSS + \u03bb\u03a3|\u03b2 <sub>j<\/sub> |<\/strong><\/span><\/p>\n<p> <span style=\"color: #000000;\"><em>j \u101e\u100a\u103a<\/em> 1 \u1019\u103e <em>p<\/em> \u1000\u103c\u102d\u102f\u1010\u1004\u103a\u1001\u1014\u1037\u103a\u1019\u103e\u1014\u103a\u1038\u1000\u102d\u1014\u103a\u1038\u101b\u103e\u1004\u103a\u1019\u103b\u102c\u1038\u1014\u103e\u1004\u1037\u103a \u03bb \u2265 0 \u101b\u103e\u102d\u101b\u102c\u101e\u102d\u102f\u1037 \u101e\u103d\u102c\u1038\u1015\u102b\u101e\u100a\u103a\u104b<\/span><\/p>\n<p> <span style=\"color: #000000;\">\u100a\u102e\u1019\u103b\u103e\u1001\u103c\u1004\u103a\u1038\u1010\u103d\u1004\u103a \u1024\u1012\u102f\u1010\u102d\u101a\u1021\u1001\u1031\u102b\u103a\u1021\u101d\u1031\u102b\u103a\u1000\u102d\u102f <em>\u101b\u102f\u1015\u103a\u101e\u102d\u1019\u103a\u1038\u1015\u103c\u1005\u103a\u1012\u100f\u103a<\/em> \u101f\u102f \u1001\u1031\u102b\u103a\u101e\u100a\u103a\u104b lasso regression \u1010\u103d\u1004\u103a\u104a \u1016\u103c\u1005\u103a\u1014\u102d\u102f\u1004\u103a\u1001\u103c\u1031\u1021\u1014\u100a\u103a\u1038\u1006\u102f\u1036\u1038 MSE (mean square error) test \u1000\u102d\u102f\u1011\u102f\u1010\u103a\u1015\u1031\u1038\u101e\u100a\u1037\u103a \u03bb \u1021\u1010\u103d\u1000\u103a \u1010\u1014\u103a\u1016\u102d\u102f\u1038\u1010\u1005\u103a\u1001\u102f\u1000\u102d\u102f \u101b\u103d\u1031\u1038\u1015\u102b\u101e\u100a\u103a\u104b<\/span><\/p>\n<p> <span style=\"color: #000000;\">\u1024\u101e\u1004\u103a\u1001\u1014\u103a\u1038\u1005\u102c\u101e\u100a\u103a R \u1010\u103d\u1004\u103a lasso regression \u101c\u102f\u1015\u103a\u1006\u1031\u102c\u1004\u103a\u1015\u102f\u1036\u1021\u1006\u1004\u1037\u103a\u1006\u1004\u1037\u103a\u1000\u102d\u102f \u1025\u1015\u1019\u102c\u1015\u1031\u1038\u1011\u102c\u1038\u101e\u100a\u103a\u104b<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>\u1021\u1006\u1004\u1037\u103a 1: \u1012\u1031\u1010\u102c\u1000\u102d\u102f \u1010\u1004\u103a\u1015\u102b\u104b<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">\u1024\u1025\u1015\u1019\u102c\u1021\u1010\u103d\u1000\u103a\u104a \u1000\u103b\u103d\u1014\u103a\u102f\u1015\u103a\u1010\u102d\u102f\u1037\u101e\u100a\u103a <strong>mtcars<\/strong> \u101f\u102f\u1001\u1031\u102b\u103a\u101e\u1031\u102c R \u104f built-in \u1012\u1031\u1010\u102c\u1021\u1010\u103d\u1032\u1000\u102d\u102f \u1021\u101e\u102f\u1036\u1038\u1015\u103c\u102f\u1015\u102b\u1019\u100a\u103a\u104b \u1000\u103b\u103d\u1014\u103a\u102f\u1015\u103a\u1010\u102d\u102f\u1037\u101e\u100a\u103a \u1010\u102f\u1036\u1037\u1015\u103c\u1014\u103a\u1019\u103e\u102f variable \u1021\u1016\u103c\u1005\u103a <strong>hp \u1000\u102d\u102f<\/strong> \u1021\u101e\u102f\u1036\u1038\u1015\u103c\u102f\u1015\u103c\u102e\u1038 \u1021\u1031\u102c\u1000\u103a\u1015\u102b variable \u1019\u103b\u102c\u1038\u1000\u102d\u102f \u1000\u103c\u102d\u102f\u1010\u1004\u103a\u1001\u1014\u1037\u103a\u1019\u103e\u1014\u103a\u1038\u101e\u1030\u1019\u103b\u102c\u1038\u1021\u1016\u103c\u1005\u103a \u1021\u101e\u102f\u1036\u1038\u1015\u103c\u102f\u1015\u102b\u1019\u100a\u103a\u104b<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\">\u1005\u102d\u102f\u1004\u103a\u1038\u1005\u102d\u102f\u1004\u103a\u1038\u1001\u1019\u103a\u1038\u101c\u103e\u102d\u102f\u1004\u103a<\/span><\/li>\n<li> <span style=\"color: #000000;\">\u1000\u102d\u102f\u101a\u103a\u1021\u101c\u1031\u1038\u1001\u103b\u102d\u1014\u103a<\/span><\/li>\n<li> <span style=\"color: #000000;\">\u1015\u103c\u1031\u102c\u101b\u1019\u103e\u102c\u1015\u102b\u104b<\/span><\/li>\n<li> <span style=\"color: #000000;\">qsec<\/span><\/li>\n<\/ul>\n<p> <span style=\"color: #000000;\">lasso regression \u101c\u102f\u1015\u103a\u1006\u1031\u102c\u1004\u103a\u101b\u1014\u103a\u104a \u1000\u103b\u103d\u1014\u103a\u102f\u1015\u103a\u1010\u102d\u102f\u1037\u101e\u100a\u103a <strong>glmnet<\/strong> \u1015\u1000\u103a\u1000\u1031\u1037\u1001\u103a\u103b\u1019\u103e \u101c\u102f\u1015\u103a\u1006\u1031\u102c\u1004\u103a\u1001\u103b\u1000\u103a\u1019\u103b\u102c\u1038\u1000\u102d\u102f \u1021\u101e\u102f\u1036\u1038\u1015\u103c\u102f\u1015\u102b\u1019\u100a\u103a\u104b \u1024\u1015\u1000\u103a\u1000\u1031\u1037\u1002\u103b\u103a\u1010\u103d\u1004\u103a <a href=\"https:\/\/statorials.org\/my\/\u1015\u103c\u1031\u102c\u1004\u103a\u1038\u101c\u1032\u1014\u102d\u102f\u1004\u103a\u101e\u1031\u102c-\u101b\u103e\u1004\u103a\u1038\u101c\u1004\u103a\u1038\u1001\u103b\u1000\u103a-\u1010\u102f\u1036\u1037\u1015\u103c\u1014\u103a\u1019\u103e\u102f\u1019\u103b\u102c\u1038\/\" target=\"_blank\" rel=\"noopener noreferrer\">\u1010\u102f\u1036\u1037\u1015\u103c\u1014\u103a\u1019\u103e\u102f\u1000\u102d\u1014\u103a\u1038\u101b\u103e\u1004\u103a\u101e\u100a\u103a<\/a> vector \u1016\u103c\u1005\u103a\u101b\u1014\u103a\u1014\u103e\u1004\u1037\u103a \u1000\u103c\u102d\u102f\u1010\u1004\u103a\u1001\u1014\u1037\u103a\u1019\u103e\u1014\u103a\u1038\u1014\u102d\u102f\u1004\u103a\u101e\u1031\u102c\u1000\u102d\u1014\u103a\u1038\u101b\u103e\u1004\u103a\u1021\u1005\u102f\u1021\u1005\u102f\u101e\u100a\u103a <strong>data.matrix<\/strong> \u1021\u1010\u1014\u103a\u1038\u1021\u1005\u102c\u1038\u1016\u103c\u1005\u103a\u101b\u1014\u103a \u101c\u102d\u102f\u1021\u1015\u103a\u101e\u100a\u103a\u104b<\/span><\/p>\n<p> <span style=\"color: #000000;\">\u1021\u1031\u102c\u1000\u103a\u1016\u1031\u102c\u103a\u1015\u103c\u1015\u102b \u1000\u102f\u1012\u103a\u101e\u100a\u103a \u1000\u103b\u103d\u1014\u103a\u102f\u1015\u103a\u1010\u102d\u102f\u1037\u104f\u1012\u1031\u1010\u102c\u1000\u102d\u102f \u101e\u1010\u103a\u1019\u103e\u1010\u103a\u1015\u102f\u1036\u1016\u1031\u102c\u103a\u1015\u103c\u101e\u100a\u103a-<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #008080;\">#define response variable<\/span>\ny &lt;- mtcars$hp\n\n<span style=\"color: #008080;\">#define matrix of predictor variables\n<\/span>x &lt;- data.matrix(mtcars[, c('mpg', 'wt', 'drat', 'qsec')])\n<\/strong><\/span><\/pre>\n<h3> <span style=\"color: #000000;\"><strong>\u1021\u1006\u1004\u1037\u103a 2- Lasso Regression Model \u1000\u102d\u102f \u1021\u1036\u1000\u102d\u102f\u1000\u103a\u101c\u102f\u1015\u103a\u1015\u102b\u104b<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">\u1011\u102d\u102f\u1037\u1014\u1031\u102c\u1000\u103a\u104a \u1000\u103b\u103d\u1014\u103a\u102f\u1015\u103a\u1010\u102d\u102f\u1037\u101e\u100a\u103a lasso \u1006\u102f\u1010\u103a\u101a\u102f\u1010\u103a\u1019\u103e\u102f\u1015\u102f\u1036\u1005\u1036\u1014\u103e\u1004\u1037\u103a \u1000\u102d\u102f\u1000\u103a\u100a\u102e\u101b\u1014\u103a <strong>glmnet()<\/strong> \u101c\u102f\u1015\u103a\u1006\u1031\u102c\u1004\u103a\u1001\u103b\u1000\u103a\u1000\u102d\u102f \u1021\u101e\u102f\u1036\u1038\u1015\u103c\u102f\u1015\u103c\u102e\u1038 <strong>alpha=1<\/strong> \u1000\u102d\u102f \u101e\u1010\u103a\u1019\u103e\u1010\u103a\u1015\u1031\u1038\u1015\u102b\u1019\u100a\u103a\u104b<\/span><\/p>\n<p> <span style=\"color: #000000;\">0 \u1014\u103e\u1004\u1037\u103a \u100a\u102e\u1019\u103b\u103e\u101e\u1031\u102c alpha \u1000\u102d\u102f\u101e\u1010\u103a\u1019\u103e\u1010\u103a\u1001\u103c\u1004\u103a\u1038\u101e\u100a\u103a <a href=\"https:\/\/statorials.org\/my\/r-\u1010\u103d\u1004\u103a-crest-regression\/\" target=\"_blank\" rel=\"noopener noreferrer\">ridge regression<\/a> \u1000\u102d\u102f\u1021\u101e\u102f\u1036\u1038\u1015\u103c\u102f\u1001\u103c\u1004\u103a\u1038\u1014\u103e\u1004\u1037\u103a \u100a\u102e\u1019\u103b\u103e\u1015\u103c\u102e\u1038 0 \u1014\u103e\u1004\u1037\u103a 1 \u1000\u103c\u102c\u1038\u1010\u1014\u103a\u1016\u102d\u102f\u1038\u1010\u1005\u103a\u1001\u102f\u101e\u102d\u102f\u1037 \u1021\u101a\u103a\u101c\u103a\u1016\u102c\u101e\u1010\u103a\u1019\u103e\u1010\u103a\u1001\u103c\u1004\u103a\u1038\u101e\u100a\u103a elastic net \u1000\u102d\u102f\u1021\u101e\u102f\u1036\u1038\u1015\u103c\u102f\u1001\u103c\u1004\u103a\u1038\u1014\u103e\u1004\u1037\u103a \u100a\u102e\u1019\u103b\u103e\u1000\u103c\u1031\u102c\u1004\u103a\u1038 \u101e\u1010\u102d\u1015\u103c\u102f\u1015\u102b\u104b<\/span> <span style=\"color: #000000;\"><strong>&nbsp;<\/strong><\/span><\/p>\n<p> <span style=\"color: #000000;\">lambda \u1021\u1010\u103d\u1000\u103a \u1019\u100a\u103a\u101e\u100a\u1037\u103a\u1010\u1014\u103a\u1016\u102d\u102f\u1038\u1000\u102d\u102f \u1021\u101e\u102f\u1036\u1038\u1015\u103c\u102f\u101b\u1019\u100a\u103a\u1000\u102d\u102f \u1006\u102f\u1036\u1038\u1016\u103c\u1010\u103a\u101b\u1014\u103a\u104a \u1000\u103b\u103d\u1014\u103a\u102f\u1015\u103a\u1010\u102d\u102f\u1037\u101e\u100a\u103a <a href=\"https:\/\/statorials.org\/my\/k-cross-validation-\u1000\u102d\u102f-\u1001\u1031\u102b\u1000\u103a\u1015\u102b\u104b\/\" target=\"_blank\" rel=\"noopener noreferrer\">k-fold cross-validation \u1000\u102d\u102f<\/a> \u101c\u102f\u1015\u103a\u1006\u1031\u102c\u1004\u103a\u1015\u103c\u102e\u1038 \u1021\u1014\u102d\u1019\u1037\u103a\u1006\u102f\u1036\u1038 test mean squared error (MSE) \u1000\u102d\u102f\u1011\u102f\u1010\u103a\u1015\u1031\u1038\u101e\u100a\u1037\u103a lambda \u1010\u1014\u103a\u1016\u102d\u102f\u1038\u1000\u102d\u102f \u1001\u103d\u1032\u1001\u103c\u102c\u1038\u101e\u1010\u103a\u1019\u103e\u1010\u103a\u1015\u102b\u1019\u100a\u103a\u104b<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>cv.glmnet()<\/strong> \u101c\u102f\u1015\u103a\u1006\u1031\u102c\u1004\u103a\u1001\u103b\u1000\u103a\u101e\u100a\u103a k = 10 \u1000\u103c\u102d\u1019\u103a\u1000\u102d\u102f \u1021\u101e\u102f\u1036\u1038\u1015\u103c\u102f\u104d k-fold cross-validation \u1021\u101c\u102d\u102f\u1021\u101c\u103b\u1031\u102c\u1000\u103a \u101c\u102f\u1015\u103a\u1006\u1031\u102c\u1004\u103a\u1000\u103c\u1031\u102c\u1004\u103a\u1038 \u101e\u1010\u102d\u1015\u103c\u102f\u1015\u102b\u104b<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #008080;\"><span style=\"color: #000000;\"><span style=\"color: #993300;\">library<\/span> (glmnet)<\/span>\n\n#perform k-fold cross-validation to find optimal lambda value\n<\/span>cv_model &lt;- cv. <span style=\"color: #3366ff;\">glmnet<\/span> (x, y, alpha = <span style=\"color: #008000;\">1<\/span> )\n\n<span style=\"color: #008080;\">#find optimal lambda value that minimizes test MSE\n<\/span>best_lambda &lt;- cv_model$ <span style=\"color: #3366ff;\">lambda<\/span> . <span style=\"color: #3366ff;\">min<\/span>\nbest_lambda\n\n[1] 5.616345\n\n<span style=\"color: #008080;\">#produce plot of test MSE by lambda value<\/span>\nplot(cv_model) \n<\/strong><\/span><\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-11896 \" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/lassor1.png\" alt=\"R in lasso regression \u1021\u1010\u103d\u1000\u103a MSE \u1000\u102d\u102f \u1005\u1019\u103a\u1038\u101e\u1015\u103a\u1001\u103c\u1004\u103a\u1038\u104b\" width=\"419\" height=\"407\" srcset=\"\" sizes=\"\"><\/p>\n<p> <span style=\"color: #000000;\">MSE \u1005\u1019\u103a\u1038\u101e\u1015\u103a\u1019\u103e\u102f\u1000\u102d\u102f \u101c\u103b\u103e\u1031\u102c\u1037\u1001\u103b\u1015\u1031\u1038\u101e\u100a\u1037\u103a lambda \u1010\u1014\u103a\u1016\u102d\u102f\u1038\u101e\u100a\u103a <strong>5.616345<\/strong> \u1016\u103c\u1005\u103a\u101e\u103d\u102c\u1038\u101e\u100a\u103a\u104b<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>\u1021\u1006\u1004\u1037\u103a 3- \u1014\u1031\u102c\u1000\u103a\u1006\u102f\u1036\u1038\u1015\u102f\u1036\u1005\u1036\u1000\u102d\u102f \u1015\u102d\u102f\u1004\u103a\u1038\u1001\u103c\u102c\u1038\u1005\u102d\u1010\u103a\u1016\u103c\u102c\u1015\u102b\u104b<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">\u1014\u1031\u102c\u1000\u103a\u1006\u102f\u1036\u1038\u1010\u103d\u1004\u103a\u104a \u1021\u1000\u1031\u102c\u1004\u103a\u1038\u1006\u102f\u1036\u1038\u101e\u1031\u102c lambda \u1010\u1014\u103a\u1016\u102d\u102f\u1038\u1016\u103c\u1004\u1037\u103a \u1011\u102f\u1010\u103a\u101c\u102f\u1015\u103a\u1011\u102c\u1038\u101e\u1031\u102c \u1014\u1031\u102c\u1000\u103a\u1006\u102f\u1036\u1038\u1019\u1031\u102c\u103a\u1012\u101a\u103a\u1000\u102d\u102f \u1015\u102d\u102f\u1004\u103a\u1038\u1001\u103c\u102c\u1038\u1005\u102d\u1010\u103a\u1016\u103c\u102c\u1014\u102d\u102f\u1004\u103a\u1015\u102b\u101e\u100a\u103a\u104b<\/span><\/p>\n<p> <span style=\"color: #000000;\">\u1024\u1019\u1031\u102c\u103a\u1012\u101a\u103a\u1021\u1010\u103d\u1000\u103a \u1000\u102d\u1014\u103a\u1038\u1002\u100f\u1014\u103a\u1038 \u1001\u1014\u1037\u103a\u1019\u103e\u1014\u103a\u1038\u1001\u103b\u1000\u103a\u1019\u103b\u102c\u1038\u1000\u102d\u102f \u101b\u101a\u1030\u101b\u1014\u103a \u1021\u1031\u102c\u1000\u103a\u1015\u102b\u1000\u102f\u1012\u103a\u1000\u102d\u102f \u1021\u101e\u102f\u1036\u1038\u1015\u103c\u102f\u1014\u102d\u102f\u1004\u103a\u1015\u102b\u101e\u100a\u103a\u104b<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #008080;\">#find coefficients of best model\n<\/span>best_model &lt;- glmnet(x, y, alpha = <span style=\"color: #008000;\">1<\/span> , lambda = best_lambda)\ncoef(best_model)\n\n5 x 1 sparse Matrix of class \"dgCMatrix\"\n                   s0\n(Intercept) 484.20742\nmpg -2.95796\nwt 21.37988\ndrat.      \nqsec -19.43425<\/strong><\/span><\/pre>\n<p> <span style=\"color: #000000;\">lasso regression \u101e\u100a\u103a coefficient \u1000\u102d\u102f \u101e\u102f\u100a\u101e\u102d\u102f\u1037 \u101c\u103b\u103e\u1031\u102c\u1037\u1001\u103b\u1015\u1031\u1038\u101e\u1031\u102c\u1000\u103c\u1031\u102c\u1004\u1037\u103a <strong>drat<\/strong> \u1001\u1014\u1037\u103a\u1019\u103e\u1014\u103a\u1038\u101e\u1030\u1021\u1010\u103d\u1000\u103a coefficient \u1019\u1015\u103c\u1015\u102b\u104b \u1006\u102d\u102f\u101c\u102d\u102f\u101e\u100a\u103a\u1019\u103e\u102c \u101e\u1030\u1037\u1010\u103d\u1004\u103a \u101c\u102f\u1036\u101c\u1031\u102c\u1000\u103a\u101e\u1031\u102c \u101c\u103d\u103e\u1019\u103a\u1038\u1019\u102d\u102f\u1038\u1019\u103e\u102f \u1019\u101b\u103e\u102d\u101e\u1031\u102c\u1000\u103c\u1031\u102c\u1004\u1037\u103a \u1019\u1031\u102c\u103a\u1012\u101a\u103a\u1019\u103e \u101c\u102f\u1036\u1038\u101d \u1016\u101a\u103a\u101b\u103e\u102c\u1038\u1001\u1036\u1001\u1032\u1037\u101b\u1001\u103c\u1004\u103a\u1038 \u1016\u103c\u1005\u103a\u101e\u100a\u103a\u104b<\/span><\/p>\n<p> <span style=\"color: #000000;\">\u1024\u101e\u100a\u103a\u1019\u103e\u102c <a href=\"https:\/\/statorials.org\/my\/\u1010\u1031\u102c\u1004\u103a\u1000\u103c\u1031\u102c\u104f\u1006\u102f\u1010\u103a\u101a\u102f\u1010\u103a\u1019\u103e\u102f\/\" target=\"_blank\" rel=\"noopener noreferrer\">\u1010\u1031\u102c\u1004\u103a\u1000\u103c\u1031\u102c\u1006\u102f\u1010\u103a\u101a\u102f\u1010\u103a\u1019\u103e\u102f<\/a> \u1014\u103e\u1004\u1037\u103a <a href=\"https:\/\/statorials.org\/my\/lasso-\u1006\u102f\u1010\u103a\u101a\u102f\u1010\u103a\u1019\u103e\u102f\/\" target=\"_blank\" rel=\"noopener noreferrer\">lasso \u1006\u102f\u1010\u103a\u101a\u102f\u1010\u103a\u1019\u103e\u102f<\/a> \u1000\u103c\u102c\u1038 \u1021\u1013\u102d\u1000\u1000\u103d\u102c\u1001\u103c\u102c\u1038\u1001\u103b\u1000\u103a\u1000\u102d\u102f \u101e\u1010\u102d\u1015\u103c\u102f\u1015\u102b\u104b Ridge regression \u101e\u100a\u103a \u101e\u102f\u100a <em>\u1006\u102e\u101e\u102d\u102f\u1037<\/em> coefficients \u1021\u102c\u1038\u101c\u102f\u1036\u1038\u1000\u102d\u102f \u101c\u103b\u103e\u1031\u102c\u1037\u1001\u103b\u1015\u1031\u1038\u101e\u100a\u103a\u104a \u101e\u102d\u102f\u1037\u101e\u1031\u102c\u103a lasso regression \u101e\u100a\u103a coefficients \u1000\u102d\u102f <em>\u101e\u102f\u100a<\/em> \u1021\u1011\u102d \u101c\u103b\u103e\u1031\u102c\u1037\u1001\u103b\u1001\u103c\u1004\u103a\u1038\u1016\u103c\u1004\u1037\u103a \u1019\u1031\u102c\u103a\u1012\u101a\u103a\u1019\u103e \u1001\u1014\u1037\u103a\u1019\u103e\u1014\u103a\u1038\u101e\u1030\u1019\u103b\u102c\u1038\u1000\u102d\u102f \u1016\u101a\u103a\u101b\u103e\u102c\u1038\u101b\u1014\u103a \u1021\u101c\u102c\u1038\u1021\u101c\u102c\u101b\u103e\u102d\u1015\u102b\u101e\u100a\u103a\u104b<\/span><\/p>\n<p> <span style=\"color: #000000;\">\u101c\u1031\u1037\u101c\u102c\u1010\u103d\u1031\u1037\u101b\u103e\u102d\u1001\u103b\u1000\u103a\u1021\u101e\u1005\u103a\u1019\u103b\u102c\u1038\u1014\u103e\u1004\u1037\u103a\u1015\u1010\u103a\u101e\u1000\u103a\u104d \u1001\u1014\u1037\u103a\u1019\u103e\u1014\u103a\u1038\u1001\u103b\u1000\u103a\u1019\u103b\u102c\u1038\u1015\u103c\u102f\u101c\u102f\u1015\u103a\u101b\u1014\u103a \u1014\u1031\u102c\u1000\u103a\u1006\u102f\u1036\u1038 lasso \u1006\u102f\u1010\u103a\u101a\u102f\u1010\u103a\u1019\u103e\u102f\u1015\u102f\u1036\u1005\u1036\u1000\u102d\u102f\u101c\u100a\u103a\u1038 \u1000\u103b\u103d\u1014\u103a\u102f\u1015\u103a\u1010\u102d\u102f\u1037\u1021\u101e\u102f\u1036\u1038\u1015\u103c\u102f\u1014\u102d\u102f\u1004\u103a\u1015\u102b\u101e\u100a\u103a\u104b \u1025\u1015\u1019\u102c\u1021\u102c\u1038\u1016\u103c\u1004\u1037\u103a\u104a \u1000\u103b\u103d\u1014\u103a\u102f\u1015\u103a\u1010\u102d\u102f\u1037\u1010\u103d\u1004\u103a \u1021\u1031\u102c\u1000\u103a\u1015\u102b\u1021\u101b\u100a\u103a\u1021\u1001\u103b\u1004\u103a\u1038\u1019\u103b\u102c\u1038\u101b\u103e\u102d\u101e\u1031\u102c \u1000\u102c\u1038\u1021\u101e\u1005\u103a\u1010\u1005\u103a\u1005\u102e\u1038\u101b\u103e\u102d\u101e\u100a\u103a\u1006\u102d\u102f\u1015\u102b\u1005\u102d\u102f\u1037\u104b<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\">\u1005\u102d\u102f\u1004\u103a\u1038\u1005\u102d\u102f\u1004\u103a\u1038\u1001\u1019\u103a\u1038\u101c\u103e\u102d\u102f\u1004\u103a : \u1042\u1044<\/span><\/li>\n<li> <span style=\"color: #000000;\">\u1021\u101c\u1031\u1038\u1001\u103b\u102d\u1014\u103a: 2.5<\/span><\/li>\n<li> <span style=\"color: #000000;\">\u1005\u103b\u1031\u1038\u1014\u103e\u102f\u1014\u103a\u1038: 3.5<\/span><\/li>\n<li> <span style=\"color: #000000;\">qsec: 18.5<\/span><\/li>\n<\/ul>\n<p> <span style=\"color: #000000;\">\u1021\u1031\u102c\u1000\u103a\u1015\u102b\u1000\u102f\u1012\u103a\u101e\u100a\u103a \u1024\u101c\u1031\u1037\u101c\u102c\u1010\u103d\u1031\u1037\u101b\u103e\u102d\u1001\u103b\u1000\u103a\u1021\u101e\u1005\u103a\u104f <em>hp<\/em> \u1010\u1014\u103a\u1016\u102d\u102f\u1038\u1000\u102d\u102f \u1001\u1014\u1037\u103a\u1019\u103e\u1014\u103a\u1038\u101b\u1014\u103a \u1010\u1015\u103a\u1006\u1004\u103a\u1011\u102c\u1038\u101e\u1031\u102c lasso \u1006\u102f\u1010\u103a\u101a\u102f\u1010\u103a\u1019\u103e\u102f\u1015\u102f\u1036\u1005\u1036\u1000\u102d\u102f \u1019\u100a\u103a\u101e\u102d\u102f\u1037\u1021\u101e\u102f\u1036\u1038\u1015\u103c\u102f\u101b\u1019\u100a\u103a\u1000\u102d\u102f \u1015\u103c\u101e\u101e\u100a\u103a-<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #008080;\">#define new observation\n<\/span>new = matrix(c(24, 2.5, 3.5, 18.5), nrow= <span style=\"color: #008000;\">1<\/span> , ncol= <span style=\"color: #008000;\">4<\/span> ) \n\n<span style=\"color: #008080;\">#use lasso regression model to predict response value\n<\/span>predict(best_model, s = best_lambda, newx = new)\n\n[1,] 109.0842<\/strong><\/span><\/pre>\n<p> <span style=\"color: #000000;\">\u1011\u100a\u1037\u103a\u101e\u103d\u1004\u103a\u1038\u1011\u102c\u1038\u101e\u1031\u102c\u1010\u1014\u103a\u1016\u102d\u102f\u1038\u1019\u103b\u102c\u1038\u1015\u1031\u102b\u103a\u1019\u1030\u1010\u100a\u103a\u104d \u1024\u1000\u102c\u1038\u101e\u100a\u103a <em>\u1019\u103c\u1004\u103a\u1038\u1000\u1031\u102c\u1004\u103a\u101b\u1031<\/em> \u1010\u1014\u103a\u1016\u102d\u102f\u1038 <strong>109.0842<\/strong> \u101b\u103e\u102d\u1019\u100a\u103a\u101f\u102f \u1019\u1031\u102c\u103a\u1012\u101a\u103a\u1000 \u1001\u1014\u1037\u103a\u1019\u103e\u1014\u103a\u1038\u101e\u100a\u103a\u104b<\/span><\/p>\n<p> <span style=\"color: #000000;\">\u1014\u1031\u102c\u1000\u103a\u1006\u102f\u1036\u1038\u1010\u103d\u1004\u103a\u104a \u101e\u1004\u103a\u1010\u1014\u103a\u1038\u1012\u1031\u1010\u102c\u1010\u103d\u1004\u103a <a href=\"https:\/\/statorials.org\/my\/r-\u1014\u103e\u1005\u103a\u1011\u1015\u103a\u1000\u102d\u1014\u103a\u1038\u1010\u1014\u103a\u1016\u102d\u102f\u1038\u1000\u1031\u102c\u1004\u103a\u1038\u101e\u100a\u103a\u104b\/\" target=\"_blank\" rel=\"noopener noreferrer\">\u1019\u1031\u102c\u103a\u1012\u101a\u103a\u104f R-squared \u1000\u102d\u102f<\/a> \u1010\u103d\u1000\u103a\u1001\u103b\u1000\u103a\u1014\u102d\u102f\u1004\u103a\u101e\u100a\u103a-<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #008080;\">#use fitted best model to make predictions\n<\/span>y_predicted &lt;- <span style=\"color: #3366ff;\">predict<\/span> (best_model, s = best_lambda, newx = x)\n\n<span style=\"color: #008080;\">#find OHS and SSE<\/span>\nsst &lt;- <span style=\"color: #3366ff;\">sum<\/span> ((y - <span style=\"color: #3366ff;\">mean<\/span> (y))^2)\nsse &lt;- <span style=\"color: #3366ff;\">sum<\/span> ((y_predicted - y)^2)\n\n<span style=\"color: #008080;\">#find R-Squared\n<\/span>rsq &lt;- 1 - sse\/sst\nrsq\n\n[1] 0.8047064\n<\/strong><\/span><\/pre>\n<p> <span style=\"color: #000000;\">R \u1014\u103e\u1005\u103a\u1011\u1015\u103a\u1000\u102d\u1014\u103a\u1038\u101e\u100a\u103a <strong>0.8047064<\/strong> \u1016\u103c\u1005\u103a\u101e\u103d\u102c\u1038\u101e\u100a\u103a\u104b \u1006\u102d\u102f\u101c\u102d\u102f\u101e\u100a\u103a\u1019\u103e\u102c\u104a \u1021\u1000\u1031\u102c\u1004\u103a\u1038\u1006\u102f\u1036\u1038\u1019\u1031\u102c\u103a\u1012\u101a\u103a\u101e\u100a\u103a \u101c\u1031\u1037\u1000\u103b\u1004\u1037\u103a\u101b\u1031\u1038\u1012\u1031\u1010\u102c\u104f \u1010\u102f\u1036\u1037\u1015\u103c\u1014\u103a\u1019\u103e\u102f\u1010\u1014\u103a\u1016\u102d\u102f\u1038\u1019\u103b\u102c\u1038\u1000\u103d\u1032\u101c\u103d\u1032\u1019\u103e\u102f <strong>80.47%<\/strong> \u1000\u102d\u102f \u101b\u103e\u1004\u103a\u1038\u1015\u103c\u1014\u102d\u102f\u1004\u103a\u1001\u1032\u1037\u101e\u100a\u103a\u104b<\/span><\/p>\n<p> <span style=\"color: #000000;\">\u1024\u1025\u1015\u1019\u102c\u1010\u103d\u1004\u103a\u1021\u101e\u102f\u1036\u1038\u1015\u103c\u102f\u1011\u102c\u1038\u101e\u1031\u102c R \u1000\u102f\u1012\u103a\u1021\u1015\u103c\u100a\u1037\u103a\u1021\u1005\u102f\u1036\u1000\u102d\u102f <a href=\"https:\/\/github.com\/Statorials\/R-Guides\/blob\/main\/lasso_regression.R\" target=\"_blank\" rel=\"noopener noreferrer\">\u1024\u1014\u1031\u101b\u102c\u1010\u103d\u1004\u103a<\/a> \u101b\u103e\u102c\u1010\u103d\u1031\u1037\u1014\u102d\u102f\u1004\u103a\u1015\u102b\u101e\u100a\u103a\u104b<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Lasso regression \u101e\u100a\u103a data \u1010\u103d\u1004\u103a multicollinearity \u101b\u103e\u102d\u1014\u1031\u101e\u1031\u102c\u1021\u1001\u102b\u1010\u103d\u1004\u103a regression model \u1010\u1005\u103a\u1001\u102f\u1014\u103e\u1004\u1037\u103a\u1000\u102d\u102f\u1000\u103a\u100a\u102e\u101b\u1014\u103a\u1000\u103b\u103d\u1014\u103a\u102f\u1015\u103a\u1010\u102d\u102f\u1037\u1021\u101e\u102f\u1036\u1038\u1015\u103c\u102f\u1014\u102d\u102f\u1004\u103a\u101e\u1031\u102c\u1014\u100a\u103a\u1038\u101c\u1019\u103a\u1038\u1010\u1005\u103a\u1001\u102f\u1016\u103c\u1005\u103a\u101e\u100a\u103a\u104b \u1021\u1010\u102d\u102f\u1001\u103b\u102f\u1015\u103a\u1021\u102c\u1038\u1016\u103c\u1004\u1037\u103a\u104a \u1021\u1014\u100a\u103a\u1038 \u1006\u102f\u1036\u1038 \u1005\u1010\u102f\u101b\u1014\u103a\u1038\u1006\u102f\u1010\u103a\u101a\u102f\u1010\u103a\u1019\u103e\u102f \u101e\u100a\u103a \u1000\u103b\u1014\u103a\u101b\u103e\u102d\u101e\u1031\u102c \u1005\u1010\u102f\u101b\u1014\u103a\u1038 \u1015\u1031\u102b\u1004\u103a\u1038\u101c\u1012\u103a (RSS) \u1000\u102d\u102f \u1021\u1014\u100a\u103a\u1038\u1006\u102f\u1036\u1038 \u101c\u103b\u103e\u1031\u102c\u1037\u1001\u103b\u1014\u102d\u102f\u1004\u103a\u101e\u1031\u102c \u1000\u102d\u1014\u103a\u1038\u1000\u102d\u1014\u103a\u1038 \u1001\u1014\u1037\u103a\u1019\u103e\u1014\u103a\u1038\u1001\u103b\u1000\u103a\u1019\u103b\u102c\u1038\u1000\u102d\u102f \u101b\u103e\u102c\u1016\u103d\u1031\u101b\u1014\u103a \u1000\u103c\u102d\u102f\u1038\u1015\u1019\u103a\u1038\u101e\u100a\u103a \u104b RSS = \u03a3(y i \u2013 \u0177 i )\u1042 \u101b\u103d\u103e\u1031- \u2211 : \u1015\u1031\u102b\u1004\u103a\u1038\u101c\u1012\u103a \u101f\u102f \u1021\u1013\u102d\u1015\u1039\u1015\u102c\u101a\u103a\u101b\u101e\u1031\u102c \u1002\u101b\u102d\u101e\u1004\u103a\u1039\u1000\u1031\u1010 y i : \u1021\u102d\u102f\u1004\u103a\u1010\u102e \u101c\u1031\u1037\u101c\u102c\u1001\u103c\u1004\u103a\u1038\u1021\u1010\u103d\u1000\u103a \u1021\u1019\u103e\u1014\u103a\u1010\u1000\u101a\u103a \u1010\u102f\u1036\u1037\u1015\u103c\u1014\u103a\u1019\u103e\u102f\u1010\u1014\u103a\u1016\u102d\u102f\u1038 \u0177 i : Multiple linear regression [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>R in Lasso Regression (\u1010\u1005\u103a\u1006\u1004\u1037\u103a\u1015\u103c\u102e\u1038\u1010\u1005\u103a\u1006\u1004\u1037\u103a)<\/title>\n<meta name=\"description\" content=\"\u1024\u101e\u1004\u103a\u1001\u1014\u103a\u1038\u1005\u102c\u1010\u103d\u1004\u103a \u1021\u1006\u1004\u1037\u103a\u1006\u1004\u1037\u103a\u1025\u1015\u1019\u102c\u1010\u1005\u103a\u1001\u102f\u1021\u1015\u102b\u1021\u101d\u1004\u103a R \u1010\u103d\u1004\u103a lasso \u1006\u102f\u1010\u103a\u101a\u102f\u1010\u103a\u1019\u103e\u102f\u1000\u102d\u102f \u1019\u100a\u103a\u101e\u102d\u102f\u1037\u101c\u102f\u1015\u103a\u1006\u1031\u102c\u1004\u103a\u101b\u1019\u100a\u103a\u1000\u102d\u102f \u101b\u103e\u1004\u103a\u1038\u1015\u103c\u1011\u102c\u1038\u101e\u100a\u103a\u104b\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/statorials.org\/my\/r-\u1010\u103d\u1004\u103a-lasso-\u1006\u102f\u1010\u103a\u101a\u102f\u1010\u103a\u1019\u103e\u102f\/\" \/>\n<meta property=\"og:locale\" content=\"my_MM\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"R in Lasso Regression (\u1010\u1005\u103a\u1006\u1004\u1037\u103a\u1015\u103c\u102e\u1038\u1010\u1005\u103a\u1006\u1004\u1037\u103a)\" \/>\n<meta property=\"og:description\" content=\"\u1024\u101e\u1004\u103a\u1001\u1014\u103a\u1038\u1005\u102c\u1010\u103d\u1004\u103a \u1021\u1006\u1004\u1037\u103a\u1006\u1004\u1037\u103a\u1025\u1015\u1019\u102c\u1010\u1005\u103a\u1001\u102f\u1021\u1015\u102b\u1021\u101d\u1004\u103a R \u1010\u103d\u1004\u103a lasso \u1006\u102f\u1010\u103a\u101a\u102f\u1010\u103a\u1019\u103e\u102f\u1000\u102d\u102f \u1019\u100a\u103a\u101e\u102d\u102f\u1037\u101c\u102f\u1015\u103a\u1006\u1031\u102c\u1004\u103a\u101b\u1019\u100a\u103a\u1000\u102d\u102f \u101b\u103e\u1004\u103a\u1038\u1015\u103c\u1011\u102c\u1038\u101e\u100a\u103a\u104b\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/my\/r-\u1010\u103d\u1004\u103a-lasso-\u1006\u102f\u1010\u103a\u101a\u102f\u1010\u103a\u1019\u103e\u102f\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-27T07:56:18+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/lassor1.png\" \/>\n<meta name=\"author\" content=\"Benjamin Anderson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Benjamin Anderson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/my\/r-%e1%80%90%e1%80%bd%e1%80%84%e1%80%ba-lasso-%e1%80%86%e1%80%af%e1%80%90%e1%80%ba%e1%80%9a%e1%80%af%e1%80%90%e1%80%ba%e1%80%99%e1%80%be%e1%80%af\/\",\"url\":\"https:\/\/statorials.org\/my\/r-%e1%80%90%e1%80%bd%e1%80%84%e1%80%ba-lasso-%e1%80%86%e1%80%af%e1%80%90%e1%80%ba%e1%80%9a%e1%80%af%e1%80%90%e1%80%ba%e1%80%99%e1%80%be%e1%80%af\/\",\"name\":\"R in Lasso Regression (\u1010\u1005\u103a\u1006\u1004\u1037\u103a\u1015\u103c\u102e\u1038\u1010\u1005\u103a\u1006\u1004\u1037\u103a)\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/my\/#website\"},\"datePublished\":\"2023-07-27T07:56:18+00:00\",\"dateModified\":\"2023-07-27T07:56:18+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/my\/#\/schema\/person\/e47470981684a202f7ed4c0cb1e10097\"},\"description\":\"\u1024\u101e\u1004\u103a\u1001\u1014\u103a\u1038\u1005\u102c\u1010\u103d\u1004\u103a \u1021\u1006\u1004\u1037\u103a\u1006\u1004\u1037\u103a\u1025\u1015\u1019\u102c\u1010\u1005\u103a\u1001\u102f\u1021\u1015\u102b\u1021\u101d\u1004\u103a R \u1010\u103d\u1004\u103a lasso \u1006\u102f\u1010\u103a\u101a\u102f\u1010\u103a\u1019\u103e\u102f\u1000\u102d\u102f \u1019\u100a\u103a\u101e\u102d\u102f\u1037\u101c\u102f\u1015\u103a\u1006\u1031\u102c\u1004\u103a\u101b\u1019\u100a\u103a\u1000\u102d\u102f \u101b\u103e\u1004\u103a\u1038\u1015\u103c\u1011\u102c\u1038\u101e\u100a\u103a\u104b\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/my\/r-%e1%80%90%e1%80%bd%e1%80%84%e1%80%ba-lasso-%e1%80%86%e1%80%af%e1%80%90%e1%80%ba%e1%80%9a%e1%80%af%e1%80%90%e1%80%ba%e1%80%99%e1%80%be%e1%80%af\/#breadcrumb\"},\"inLanguage\":\"my-MM\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/my\/r-%e1%80%90%e1%80%bd%e1%80%84%e1%80%ba-lasso-%e1%80%86%e1%80%af%e1%80%90%e1%80%ba%e1%80%9a%e1%80%af%e1%80%90%e1%80%ba%e1%80%99%e1%80%be%e1%80%af\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/my\/r-%e1%80%90%e1%80%bd%e1%80%84%e1%80%ba-lasso-%e1%80%86%e1%80%af%e1%80%90%e1%80%ba%e1%80%9a%e1%80%af%e1%80%90%e1%80%ba%e1%80%99%e1%80%be%e1%80%af\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u1021\u102d\u1019\u103a\",\"item\":\"https:\/\/statorials.org\/my\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"R in lasso regression (\u1010\u1005\u103a\u1006\u1004\u1037\u103a\u1015\u103c\u102e\u1038\u1010\u1005\u103a\u1006\u1004\u1037\u103a)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/my\/#website\",\"url\":\"https:\/\/statorials.org\/my\/\",\"name\":\"Statorials\",\"description\":\"\u1005\u102c\u101b\u1004\u103a\u1038\u1021\u1004\u103a\u1038\u1006\u102d\u102f\u1004\u103a\u101b\u102c \u1021\u101b\u100a\u103a\u1021\u1001\u103b\u1004\u103a\u1038\u1021\u1010\u103d\u1000\u103a \u101e\u1004\u1037\u103a\u101c\u1019\u103a\u1038\u100a\u103d\u103e\u1014\u103a\u1001\u103b\u1000\u103a\u104b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/my\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"my-MM\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/my\/#\/schema\/person\/e47470981684a202f7ed4c0cb1e10097\",\"name\":\"Benjamin Anderson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"my-MM\",\"@id\":\"https:\/\/statorials.org\/my\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/statorials.org\/my\/wp-content\/uploads\/2023\/11\/Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"https:\/\/statorials.org\/my\/wp-content\/uploads\/2023\/11\/Benjamin-Anderson-96x96.jpg\",\"caption\":\"Benjamin Anderson\"},\"description\":\"\u1019\u1004\u103a\u1039\u1002\u101c\u102c\u1015\u102b\u104a \u1000\u103b\u103d\u1014\u103a\u102f\u1015\u103a\u101e\u100a\u103a \u1021\u1004\u103c\u102d\u1019\u103a\u1038\u1005\u102c\u1038 \u1005\u102c\u101b\u1004\u103a\u1038\u1021\u1004\u103a\u1038 \u1015\u102b\u1019\u1031\u102c\u1000\u1039\u1001 \u1018\u1004\u103a\u1002\u103b\u1019\u1004\u103a\u1016\u103c\u1005\u103a\u1015\u103c\u102e\u1038 \u101e\u102e\u1038\u101e\u1014\u1037\u103a Statorials \u1006\u101b\u102c\u1021\u1016\u103c\u1005\u103a \u101c\u103e\u100a\u1037\u103a\u1015\u1010\u103a\u1015\u102b\u101e\u100a\u103a\u104b \u1005\u102c\u101b\u1004\u103a\u1038\u1007\u101a\u102c\u1038\u1014\u101a\u103a\u1015\u101a\u103a\u1010\u103d\u1004\u103a \u1000\u103b\u101a\u103a\u1015\u103c\u1014\u1037\u103a\u101e\u1031\u102c\u1021\u1010\u103d\u1031\u1037\u1021\u1000\u103c\u102f\u1036\u1014\u103e\u1004\u1037\u103a \u1000\u103b\u103d\u1019\u103a\u1038\u1000\u103b\u1004\u103a\u1019\u103e\u102f\u1014\u103e\u1004\u1037\u103a\u1021\u1010\u1030\u104a Statorials \u1019\u103e\u1010\u1005\u103a\u1006\u1004\u1037\u103a \u1000\u103b\u1031\u102c\u1004\u103a\u1038\u101e\u102c\u1038\u1019\u103b\u102c\u1038\u1000\u102d\u102f \u1001\u103d\u1014\u103a\u1021\u102c\u1038\u1016\u103c\u1005\u103a\u1005\u1031\u101b\u1014\u103a\u1021\u1010\u103d\u1000\u103a \u1000\u103b\u103d\u1014\u103a\u102f\u1015\u103a\u104f\u1021\u101e\u102d\u1015\u100a\u102c\u1000\u102d\u102f \u1019\u103b\u103e\u101d\u1031\u101c\u102d\u102f\u1015\u102b\u101e\u100a\u103a\u104b \u1015\u102d\u102f\u101e\u102d\u1010\u101a\u103a\u104b\",\"sameAs\":[\"https:\/\/statorials.org\/my\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"R in Lasso Regression (\u1010\u1005\u103a\u1006\u1004\u1037\u103a\u1015\u103c\u102e\u1038\u1010\u1005\u103a\u1006\u1004\u1037\u103a)","description":"\u1024\u101e\u1004\u103a\u1001\u1014\u103a\u1038\u1005\u102c\u1010\u103d\u1004\u103a \u1021\u1006\u1004\u1037\u103a\u1006\u1004\u1037\u103a\u1025\u1015\u1019\u102c\u1010\u1005\u103a\u1001\u102f\u1021\u1015\u102b\u1021\u101d\u1004\u103a R \u1010\u103d\u1004\u103a lasso \u1006\u102f\u1010\u103a\u101a\u102f\u1010\u103a\u1019\u103e\u102f\u1000\u102d\u102f \u1019\u100a\u103a\u101e\u102d\u102f\u1037\u101c\u102f\u1015\u103a\u1006\u1031\u102c\u1004\u103a\u101b\u1019\u100a\u103a\u1000\u102d\u102f \u101b\u103e\u1004\u103a\u1038\u1015\u103c\u1011\u102c\u1038\u101e\u100a\u103a\u104b","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/statorials.org\/my\/r-\u1010\u103d\u1004\u103a-lasso-\u1006\u102f\u1010\u103a\u101a\u102f\u1010\u103a\u1019\u103e\u102f\/","og_locale":"my_MM","og_type":"article","og_title":"R in Lasso Regression (\u1010\u1005\u103a\u1006\u1004\u1037\u103a\u1015\u103c\u102e\u1038\u1010\u1005\u103a\u1006\u1004\u1037\u103a)","og_description":"\u1024\u101e\u1004\u103a\u1001\u1014\u103a\u1038\u1005\u102c\u1010\u103d\u1004\u103a \u1021\u1006\u1004\u1037\u103a\u1006\u1004\u1037\u103a\u1025\u1015\u1019\u102c\u1010\u1005\u103a\u1001\u102f\u1021\u1015\u102b\u1021\u101d\u1004\u103a R \u1010\u103d\u1004\u103a lasso \u1006\u102f\u1010\u103a\u101a\u102f\u1010\u103a\u1019\u103e\u102f\u1000\u102d\u102f \u1019\u100a\u103a\u101e\u102d\u102f\u1037\u101c\u102f\u1015\u103a\u1006\u1031\u102c\u1004\u103a\u101b\u1019\u100a\u103a\u1000\u102d\u102f \u101b\u103e\u1004\u103a\u1038\u1015\u103c\u1011\u102c\u1038\u101e\u100a\u103a\u104b","og_url":"https:\/\/statorials.org\/my\/r-\u1010\u103d\u1004\u103a-lasso-\u1006\u102f\u1010\u103a\u101a\u102f\u1010\u103a\u1019\u103e\u102f\/","og_site_name":"Statorials","article_published_time":"2023-07-27T07:56:18+00:00","og_image":[{"url":"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/lassor1.png"}],"author":"Benjamin Anderson","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Benjamin Anderson","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/my\/r-%e1%80%90%e1%80%bd%e1%80%84%e1%80%ba-lasso-%e1%80%86%e1%80%af%e1%80%90%e1%80%ba%e1%80%9a%e1%80%af%e1%80%90%e1%80%ba%e1%80%99%e1%80%be%e1%80%af\/","url":"https:\/\/statorials.org\/my\/r-%e1%80%90%e1%80%bd%e1%80%84%e1%80%ba-lasso-%e1%80%86%e1%80%af%e1%80%90%e1%80%ba%e1%80%9a%e1%80%af%e1%80%90%e1%80%ba%e1%80%99%e1%80%be%e1%80%af\/","name":"R in Lasso Regression (\u1010\u1005\u103a\u1006\u1004\u1037\u103a\u1015\u103c\u102e\u1038\u1010\u1005\u103a\u1006\u1004\u1037\u103a)","isPartOf":{"@id":"https:\/\/statorials.org\/my\/#website"},"datePublished":"2023-07-27T07:56:18+00:00","dateModified":"2023-07-27T07:56:18+00:00","author":{"@id":"https:\/\/statorials.org\/my\/#\/schema\/person\/e47470981684a202f7ed4c0cb1e10097"},"description":"\u1024\u101e\u1004\u103a\u1001\u1014\u103a\u1038\u1005\u102c\u1010\u103d\u1004\u103a \u1021\u1006\u1004\u1037\u103a\u1006\u1004\u1037\u103a\u1025\u1015\u1019\u102c\u1010\u1005\u103a\u1001\u102f\u1021\u1015\u102b\u1021\u101d\u1004\u103a R \u1010\u103d\u1004\u103a lasso \u1006\u102f\u1010\u103a\u101a\u102f\u1010\u103a\u1019\u103e\u102f\u1000\u102d\u102f \u1019\u100a\u103a\u101e\u102d\u102f\u1037\u101c\u102f\u1015\u103a\u1006\u1031\u102c\u1004\u103a\u101b\u1019\u100a\u103a\u1000\u102d\u102f \u101b\u103e\u1004\u103a\u1038\u1015\u103c\u1011\u102c\u1038\u101e\u100a\u103a\u104b","breadcrumb":{"@id":"https:\/\/statorials.org\/my\/r-%e1%80%90%e1%80%bd%e1%80%84%e1%80%ba-lasso-%e1%80%86%e1%80%af%e1%80%90%e1%80%ba%e1%80%9a%e1%80%af%e1%80%90%e1%80%ba%e1%80%99%e1%80%be%e1%80%af\/#breadcrumb"},"inLanguage":"my-MM","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/my\/r-%e1%80%90%e1%80%bd%e1%80%84%e1%80%ba-lasso-%e1%80%86%e1%80%af%e1%80%90%e1%80%ba%e1%80%9a%e1%80%af%e1%80%90%e1%80%ba%e1%80%99%e1%80%be%e1%80%af\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/my\/r-%e1%80%90%e1%80%bd%e1%80%84%e1%80%ba-lasso-%e1%80%86%e1%80%af%e1%80%90%e1%80%ba%e1%80%9a%e1%80%af%e1%80%90%e1%80%ba%e1%80%99%e1%80%be%e1%80%af\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u1021\u102d\u1019\u103a","item":"https:\/\/statorials.org\/my\/"},{"@type":"ListItem","position":2,"name":"R in lasso regression (\u1010\u1005\u103a\u1006\u1004\u1037\u103a\u1015\u103c\u102e\u1038\u1010\u1005\u103a\u1006\u1004\u1037\u103a)"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/my\/#website","url":"https:\/\/statorials.org\/my\/","name":"Statorials","description":"\u1005\u102c\u101b\u1004\u103a\u1038\u1021\u1004\u103a\u1038\u1006\u102d\u102f\u1004\u103a\u101b\u102c \u1021\u101b\u100a\u103a\u1021\u1001\u103b\u1004\u103a\u1038\u1021\u1010\u103d\u1000\u103a \u101e\u1004\u1037\u103a\u101c\u1019\u103a\u1038\u100a\u103d\u103e\u1014\u103a\u1001\u103b\u1000\u103a\u104b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/my\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"my-MM"},{"@type":"Person","@id":"https:\/\/statorials.org\/my\/#\/schema\/person\/e47470981684a202f7ed4c0cb1e10097","name":"Benjamin Anderson","image":{"@type":"ImageObject","inLanguage":"my-MM","@id":"https:\/\/statorials.org\/my\/#\/schema\/person\/image\/","url":"https:\/\/statorials.org\/my\/wp-content\/uploads\/2023\/11\/Benjamin-Anderson-96x96.jpg","contentUrl":"https:\/\/statorials.org\/my\/wp-content\/uploads\/2023\/11\/Benjamin-Anderson-96x96.jpg","caption":"Benjamin Anderson"},"description":"\u1019\u1004\u103a\u1039\u1002\u101c\u102c\u1015\u102b\u104a \u1000\u103b\u103d\u1014\u103a\u102f\u1015\u103a\u101e\u100a\u103a \u1021\u1004\u103c\u102d\u1019\u103a\u1038\u1005\u102c\u1038 \u1005\u102c\u101b\u1004\u103a\u1038\u1021\u1004\u103a\u1038 \u1015\u102b\u1019\u1031\u102c\u1000\u1039\u1001 \u1018\u1004\u103a\u1002\u103b\u1019\u1004\u103a\u1016\u103c\u1005\u103a\u1015\u103c\u102e\u1038 \u101e\u102e\u1038\u101e\u1014\u1037\u103a Statorials \u1006\u101b\u102c\u1021\u1016\u103c\u1005\u103a \u101c\u103e\u100a\u1037\u103a\u1015\u1010\u103a\u1015\u102b\u101e\u100a\u103a\u104b \u1005\u102c\u101b\u1004\u103a\u1038\u1007\u101a\u102c\u1038\u1014\u101a\u103a\u1015\u101a\u103a\u1010\u103d\u1004\u103a \u1000\u103b\u101a\u103a\u1015\u103c\u1014\u1037\u103a\u101e\u1031\u102c\u1021\u1010\u103d\u1031\u1037\u1021\u1000\u103c\u102f\u1036\u1014\u103e\u1004\u1037\u103a \u1000\u103b\u103d\u1019\u103a\u1038\u1000\u103b\u1004\u103a\u1019\u103e\u102f\u1014\u103e\u1004\u1037\u103a\u1021\u1010\u1030\u104a Statorials \u1019\u103e\u1010\u1005\u103a\u1006\u1004\u1037\u103a \u1000\u103b\u1031\u102c\u1004\u103a\u1038\u101e\u102c\u1038\u1019\u103b\u102c\u1038\u1000\u102d\u102f \u1001\u103d\u1014\u103a\u1021\u102c\u1038\u1016\u103c\u1005\u103a\u1005\u1031\u101b\u1014\u103a\u1021\u1010\u103d\u1000\u103a \u1000\u103b\u103d\u1014\u103a\u102f\u1015\u103a\u104f\u1021\u101e\u102d\u1015\u100a\u102c\u1000\u102d\u102f \u1019\u103b\u103e\u101d\u1031\u101c\u102d\u102f\u1015\u102b\u101e\u100a\u103a\u104b \u1015\u102d\u102f\u101e\u102d\u1010\u101a\u103a\u104b","sameAs":["https:\/\/statorials.org\/my"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/my\/wp-json\/wp\/v2\/posts\/1198"}],"collection":[{"href":"https:\/\/statorials.org\/my\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/my\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/my\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/my\/wp-json\/wp\/v2\/comments?post=1198"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/my\/wp-json\/wp\/v2\/posts\/1198\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/my\/wp-json\/wp\/v2\/media?parent=1198"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/my\/wp-json\/wp\/v2\/categories?post=1198"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/my\/wp-json\/wp\/v2\/tags?post=1198"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}