{"id":1163,"date":"2023-07-27T11:00:03","date_gmt":"2023-07-27T11:00:03","guid":{"rendered":"https:\/\/statorials.org\/cn\/r%e4%b8%ad%e7%9a%84%e7%ba%bf%e6%80%a7%e5%88%a4%e5%88%ab%e5%88%86%e6%9e%90\/"},"modified":"2023-07-27T11:00:03","modified_gmt":"2023-07-27T11:00:03","slug":"r%e4%b8%ad%e7%9a%84%e7%ba%bf%e6%80%a7%e5%88%a4%e5%88%ab%e5%88%86%e6%9e%90","status":"publish","type":"post","link":"https:\/\/statorials.org\/cn\/r%e4%b8%ad%e7%9a%84%e7%ba%bf%e6%80%a7%e5%88%a4%e5%88%ab%e5%88%86%e6%9e%90\/","title":{"rendered":"R \u4e2d\u7684\u7ebf\u6027\u5224\u522b\u5206\u6790\uff08\u9010\u6b65\uff09"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">\u5f53\u60a8\u6709\u4e00\u7ec4\u9884\u6d4b\u53d8\u91cf\u5e76\u5e0c\u671b\u5c06<a href=\"https:\/\/statorials.org\/cn\/\u53d8\u91cf\u89e3\u91ca\u6027\u53cd\u5e94\/\" target=\"_blank\" rel=\"noopener noreferrer\">\u54cd\u5e94\u53d8\u91cf<\/a>\u5206\u7c7b\u4e3a\u4e24\u4e2a\u6216\u591a\u4e2a\u7c7b\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528 <a href=\"https:\/\/statorials.org\/cn\/\u7ebf\u6027\u5224\u522b\u5206\u6790\/\" target=\"_blank\" rel=\"noopener noreferrer\">\u7ebf\u6027\u5224\u522b\u5206\u6790<\/a>\u65b9\u6cd5\u3002<\/span><\/p>\n<p><span style=\"color: #000000;\">\u672c\u6559\u7a0b\u63d0\u4f9b\u4e86\u5982\u4f55\u5728 R \u4e2d\u6267\u884c\u7ebf\u6027\u5224\u522b\u5206\u6790\u7684\u5206\u6b65\u793a\u4f8b\u3002<\/span><\/p>\n<h3><span style=\"color: #000000;\"><strong>\u7b2c 1 \u6b65\uff1a\u52a0\u8f7d\u5fc5\u8981\u7684\u5e93<\/strong><\/span><\/h3>\n<p><span style=\"color: #000000;\">\u9996\u5148\uff0c\u6211\u4eec\u5c06\u52a0\u8f7d\u6b64\u793a\u4f8b\u6240\u9700\u7684\u5e93\uff1a<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><b><span style=\"color: #993300;\">library<\/span> (MASS)\n<span style=\"color: #993300;\">library<\/span> (ggplot2)<\/b><\/span><\/pre>\n<h3><span style=\"color: #000000;\"><strong>\u7b2c2\u6b65\uff1a\u52a0\u8f7d\u6570\u636e<\/strong><\/span><\/h3>\n<p><span style=\"color: #000000;\">\u5728\u672c\u4f8b\u4e2d\uff0c\u6211\u4eec\u5c06\u4f7f\u7528 R \u4e2d\u5185\u7f6e\u7684<strong>iris<\/strong>\u6570\u636e\u96c6\u3002\u4ee5\u4e0b\u4ee3\u7801\u6f14\u793a\u4e86\u5982\u4f55\u52a0\u8f7d\u548c\u663e\u793a\u8be5\u6570\u636e\u96c6\uff1a<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#attach <em>iris<\/em> dataset to make it easy to work with<\/span>\nattach(iris)\n\n<span style=\"color: #008080;\">#view structure of dataset\n<\/span>str(iris)\n\n'data.frame': 150 obs. of 5 variables:\n $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ...\n $ Sepal.Width: num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ...\n $Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ...\n $Petal.Width: num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ...\n $ Species: Factor w\/ 3 levels \"setosa\",\"versicolor\",..: 1 1 1 1 1 1 1 ...\n<\/strong><\/pre>\n<p><span style=\"color: #000000;\">\u6211\u4eec\u53ef\u4ee5\u770b\u5230\u6570\u636e\u96c6\u603b\u5171\u5305\u542b 5 \u4e2a\u53d8\u91cf\u548c 150 \u4e2a\u89c2\u6d4b\u503c\u3002<\/span><\/p>\n<p><span style=\"color: #000000;\">\u5bf9\u4e8e\u8fd9\u4e2a\u4f8b\u5b50\uff0c\u6211\u4eec\u5c06\u6784\u5efa\u4e00\u4e2a\u7ebf\u6027\u5224\u522b\u5206\u6790\u6a21\u578b\u6765\u5bf9\u7ed9\u5b9a\u82b1\u6735\u6240\u5c5e\u7684\u7269\u79cd\u8fdb\u884c\u5206\u7c7b\u3002<\/span><\/p>\n<p><span style=\"color: #000000;\">\u6211\u4eec\u5c06\u5728\u6a21\u578b\u4e2d\u4f7f\u7528\u4ee5\u4e0b\u9884\u6d4b\u53d8\u91cf\uff1a<\/span><\/p>\n<ul>\n<li><span style=\"color: #000000;\">\u843c\u7247\u957f\u5ea6<\/span><\/li>\n<li><span style=\"color: #000000;\">\u843c\u7247\u5bbd\u5ea6<\/span><\/li>\n<li><span style=\"color: #000000;\">\u82b1\u74e3\u957f\u5ea6<\/span><\/li>\n<li><span style=\"color: #000000;\">\u82b1\u74e3\u5bbd\u5ea6<\/span><\/li>\n<\/ul>\n<p><span style=\"color: #000000;\">\u6211\u4eec\u5c06\u4f7f\u7528\u5b83\u4eec\u6765\u9884\u6d4b<em>\u7269\u79cd<\/em>\u54cd\u5e94\u53d8\u91cf\uff0c\u8be5\u53d8\u91cf\u652f\u6301\u4ee5\u4e0b\u4e09\u4e2a\u6f5c\u5728\u7c7b\u522b\uff1a<\/span><\/p>\n<ul>\n<li><span style=\"color: #000000;\">\u5c71\u6bdb\u6989<\/span><\/li>\n<li><span style=\"color: #000000;\">\u6742\u8272<\/span><\/li>\n<li><span style=\"color: #000000;\">\u5f17\u5409\u5c3c\u4e9a\u5dde<\/span><\/li>\n<\/ul>\n<h3><span style=\"color: #000000;\"><strong>\u7b2c 3 \u6b65\uff1a\u7f29\u653e\u6570\u636e<\/strong><\/span><\/h3>\n<p><span style=\"color: #000000;\">\u7ebf\u6027\u5224\u522b\u5206\u6790\u7684\u5173\u952e\u5047\u8bbe\u4e4b\u4e00\u662f\u6bcf\u4e2a\u9884\u6d4b\u53d8\u91cf\u5177\u6709\u76f8\u540c\u7684\u65b9\u5dee\u3002\u786e\u4fdd\u6ee1\u8db3\u6b64\u5047\u8bbe\u7684\u4e00\u4e2a\u7b80\u5355\u65b9\u6cd5\u662f\u7f29\u653e\u6bcf\u4e2a\u53d8\u91cf\uff0c\u4f7f\u5176\u5e73\u5747\u503c\u4e3a 0\uff0c\u6807\u51c6\u5dee\u4e3a 1\u3002<\/span><\/p>\n<p><span style=\"color: #000000;\">\u6211\u4eec\u53ef\u4ee5\u5728 R \u4e2d\u4f7f\u7528<strong>scale()<\/strong>\u51fd\u6570\u5feb\u901f\u505a\u5230\u8fd9\u4e00\u70b9\uff1a<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#scale each predictor variable (ie first 4 columns)\n<\/span>iris[1:4] &lt;- scale(iris[1:4])\n<\/strong><\/pre>\n<p><span style=\"color: #000000;\">\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528<a href=\"https:\/\/statorials.org\/cn\/\u5728-r-\u4e2d\u5e94\u7528-lapply-sapply-\u548c-tapply-\u7684\u6307\u5357\/\" target=\"_blank\" rel=\"noopener noreferrer\">apply() \u51fd\u6570<\/a>\u6765\u9a8c\u8bc1\u6bcf\u4e2a\u9884\u6d4b\u53d8\u91cf\u73b0\u5728\u7684\u5e73\u5747\u503c\u4e3a 0\uff0c<a href=\"https:\/\/statorials.org\/cn\/r-\u4e2d\u7684\u6807\u51c6\u5dee\/\" target=\"_blank\" rel=\"noopener noreferrer\">\u6807\u51c6\u5dee<\/a>\u4e3a 1\uff1a<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#find mean of each predictor variable\n<\/span>apply(iris[1:4], 2, mean)\n\n Sepal.Length Sepal.Width Petal.Length Petal.Width \n-4.484318e-16 2.034094e-16 -2.895326e-17 -3.663049e-17 \n\n<span style=\"color: #008080;\">#find standard deviation of each predictor variable\n<\/span>apply(iris[1:4], 2, sd) \n\nSepal.Length Sepal.Width Petal.Length Petal.Width \n           1 1 1 1\n<\/strong><\/pre>\n<h3><span style=\"color: #000000;\"><strong>\u7b2c 4 \u6b65\uff1a\u521b\u5efa\u8bad\u7ec3\u548c\u6d4b\u8bd5\u6837\u672c<\/strong><\/span><\/h3>\n<p><span style=\"color: #000000;\">\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u6570\u636e\u96c6\u5206\u4e3a\u7528\u4e8e\u8bad\u7ec3\u6a21\u578b\u7684\u8bad\u7ec3\u96c6\u548c\u7528\u4e8e\u6d4b\u8bd5\u6a21\u578b\u7684\u6d4b\u8bd5\u96c6\uff1a<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#make this example reproducible\n<\/span>set.seed(1)\n\n<span style=\"color: #008080;\">#Use 70% of dataset as training set and remaining 30% as testing set\n<\/span>sample &lt;- sample(c( <span style=\"color: #008000;\">TRUE<\/span> , <span style=\"color: #008000;\">FALSE<\/span> ), <span style=\"color: #3366ff;\">nrow<\/span> (iris), <span style=\"color: #3366ff;\">replace<\/span> = <span style=\"color: #008000;\">TRUE<\/span> , <span style=\"color: #3366ff;\">prob<\/span> =c(0.7,0.3))\ntrain &lt;- iris[sample, ]\ntest &lt;- iris[!sample, ] \n<\/strong><\/pre>\n<h3><span style=\"color: #000000;\"><strong>\u6b65\u9aa45\uff1a\u8c03\u6574LDA\u6a21\u578b<\/strong><\/span><\/h3>\n<p><span style=\"color: #000000;\">\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u4f7f\u7528<strong>MASS<\/strong>\u5305\u4e2d\u7684<a href=\"https:\/\/www.rdocumentation.org\/packages\/MASS\/versions\/7.3-53\/topics\/lda\" target=\"_blank\" rel=\"noopener noreferrer\">lda() \u51fd\u6570<\/a>\u6765\u4f7f LDA \u6a21\u578b\u9002\u5e94\u6211\u4eec\u7684\u6570\u636e\uff1a<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#fit LDA model\n<\/span>model &lt;- lda(Species~., data=train)\n\n<span style=\"color: #008080;\">#view model output<\/span>\nmodel\n\nCall:\nlda(Species ~ ., data = train)\n\nPrior probabilities of groups:\n    setosa versicolor virginica \n 0.3207547 0.3207547 0.3584906 \n\nGroup means:\n           Sepal.Length Sepal.Width Petal.Length Petal.Width\nsetosa -1.0397484 0.8131654 -1.2891006 -1.2570316\nversicolor 0.1820921 -0.6038909 0.3403524 0.2208153\nvirginica 0.9582674 -0.1919146 1.0389776 1.1229172\n\nCoefficients of linear discriminants:\n                    LD1 LD2\nSepal.Length 0.7922820 0.5294210\nSepal.Width 0.5710586 0.7130743\nPetal.Length -4.0762061 -2.7305131\nPetal.Width -2.0602181 2.6326229\n\nProportion of traces:\n   LD1 LD2 \n0.9921 0.0079 \n<\/strong><\/pre>\n<p><span style=\"color: #000000;\">\u4ee5\u4e0b\u662f\u89e3\u91ca\u6a21\u578b\u7ed3\u679c\u7684\u65b9\u6cd5\uff1a<\/span><\/p>\n<p><span style=\"color: #000000;\"><strong>\u7ec4\u5148\u9a8c\u6982\u7387\uff1a<\/strong>\u8fd9\u4e9b\u4ee3\u8868\u8bad\u7ec3\u96c6\u4e2d\u6bcf\u4e2a\u7269\u79cd\u7684\u6bd4\u4f8b\u3002\u4f8b\u5982\uff0c\u8bad\u7ec3\u96c6\u4e2d\u6240\u6709\u89c2\u6d4b\u503c\u7684 35.8% \u662f\u9488\u5bf9<em>virginica<\/em>\u7269\u79cd\u7684\u3002<\/span><\/p>\n<p><span style=\"color: #000000;\"><strong>\u7ec4\u5e73\u5747\u503c\uff1a<\/strong>\u663e\u793a\u6bcf\u4e2a\u7269\u79cd\u7684\u6bcf\u4e2a\u9884\u6d4b\u53d8\u91cf\u7684\u5e73\u5747\u503c\u3002<\/span><\/p>\n<p><span style=\"color: #000000;\"><strong>\u7ebf\u6027\u5224\u522b\u7cfb\u6570\uff1a<\/strong>\u8fd9\u4e9b\u663e\u793a\u7528\u4e8e\u8bad\u7ec3 LDA \u6a21\u578b\u51b3\u7b56\u89c4\u5219\u7684\u9884\u6d4b\u53d8\u91cf\u7684\u7ebf\u6027\u7ec4\u5408\u3002\u4f8b\u5982\uff1a<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\"><strong>LD1\uff1a<\/strong> 0.792 * \u843c\u7247\u957f\u5ea6 + 0.571 * \u843c\u7247\u5bbd\u5ea6 \u2013 4.076 * \u82b1\u74e3\u957f\u5ea6 \u2013 2.06 * \u82b1\u74e3\u5bbd\u5ea6<\/span><\/li>\n<li><span style=\"color: #000000;\"><strong>LD2\uff1a<\/strong> 0.529 * \u843c\u7247\u957f\u5ea6 + 0.713 * \u843c\u7247\u5bbd\u5ea6 \u2013 2.731 * \u82b1\u74e3\u957f\u5ea6 + 2.63 * \u82b1\u74e3\u5bbd\u5ea6<\/span><\/li>\n<\/ul>\n<p><span style=\"color: #000000;\"><strong>\u8ff9\u7ebf\u6bd4\u4f8b\uff1a<\/strong>\u663e\u793a\u6bcf\u4e2a\u7ebf\u6027\u5224\u522b\u51fd\u6570\u5b9e\u73b0\u7684\u5206\u79bb\u767e\u5206\u6bd4\u3002<\/span><\/p>\n<h3><span style=\"color: #000000;\"><strong>\u7b2c 6 \u6b65\uff1a\u4f7f\u7528\u6a21\u578b\u8fdb\u884c\u9884\u6d4b<\/strong><\/span><\/h3>\n<p><span style=\"color: #000000;\">\u4e00\u65e6\u6211\u4eec\u4f7f\u7528\u8bad\u7ec3\u6570\u636e\u62df\u5408\u4e86\u6a21\u578b\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u7528\u5b83\u6765\u5bf9\u6d4b\u8bd5\u6570\u636e\u8fdb\u884c\u9884\u6d4b\uff1a<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#use LDA model to make predictions on test data\n<\/span>predicted &lt;- <span style=\"color: #3366ff;\">predict<\/span> (model, test)\n\nnames(predicted)\n\n[1] \"class\" \"posterior\" \"x\"   \n<\/strong><\/pre>\n<p><span style=\"color: #000000;\">\u8fd9\u5c06\u8fd4\u56de\u4e00\u4e2a\u5305\u542b\u4e09\u4e2a\u53d8\u91cf\u7684\u5217\u8868\uff1a<\/span><\/p>\n<ul>\n<li><span style=\"color: #000000;\"><strong>\u7c7b\u522b\uff1a<\/strong>\u9884\u6d4b\u7c7b\u522b<\/span><\/li>\n<li><span style=\"color: #000000;\"><strong>\u540e\u9a8c\uff1a<\/strong>\u89c2\u5bdf\u7ed3\u679c\u5c5e\u4e8e\u6bcf\u4e2a\u7c7b\u522b\u7684<a href=\"https:\/\/statorials.org\/cn\/\u540e\u9a8c\u6982\u7387\/\" target=\"_blank\" rel=\"noopener noreferrer\">\u540e\u9a8c\u6982\u7387<\/a><\/span><\/li>\n<li><span style=\"color: #000000;\"><strong>x\uff1a<\/strong>\u7ebf\u6027\u5224\u522b\u5f0f<\/span><\/li>\n<\/ul>\n<p><span style=\"color: #000000;\">\u6211\u4eec\u53ef\u4ee5\u5feb\u901f\u53ef\u89c6\u5316\u6d4b\u8bd5\u6570\u636e\u96c6\u4e2d\u524d\u516d\u4e2a\u89c2\u5bdf\u7ed3\u679c\u7684\u6bcf\u4e00\u4e2a\u7ed3\u679c\uff1a<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#view predicted class for first six observations in test set\n<\/span>head(predicted$class)\n\n[1] setosa setosa setosa setosa setosa setosa\nLevels: setosa versicolor virginica\n\n<span style=\"color: #008080;\">#view posterior probabilities for first six observations in test set<\/span>\nhead(predicted$posterior)\n\n   setosa versicolor virginica\n4 1 2.425563e-17 1.341984e-35\n6 1 1.400976e-21 4.482684e-40\n7 1 3.345770e-19 1.511748e-37\n15 1 6.389105e-31 7.361660e-53\n17 1 1.193282e-25 2.238696e-45\n18 1 6.445594e-22 4.894053e-41\n\n<span style=\"color: #008080;\">#view linear discriminants for first six observations in test set\n<\/span>head(predicted$x)\n\n         LD1 LD2\n4 7.150360 -0.7177382\n6 7.961538 1.4839408\n7 7.504033 0.2731178\n15 10.170378 1.9859027\n17 8.885168 2.1026494\n18 8.113443 0.7563902\n<\/strong><\/pre>\n<p><span style=\"color: #000000;\">\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u4ee3\u7801\u6765\u67e5\u770b LDA \u6a21\u578b\u6b63\u786e\u9884\u6d4b\u7269\u79cd\u7684\u89c2\u6d4b\u767e\u5206\u6bd4\uff1a<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#find accuracy of model\n<\/span>mean(predicted$class==test$Species)\n\n[1] 1<\/strong><\/pre>\n<p><span style=\"color: #000000;\">\u4e8b\u5b9e\u8bc1\u660e\uff0c\u8be5\u6a21\u578b\u6b63\u786e\u9884\u6d4b\u4e86\u6d4b\u8bd5\u6570\u636e\u96c6\u4e2d<strong>100%<\/strong>\u7684\u89c2\u6d4b\u503c\u7684\u7269\u79cd\u3002<\/span><\/p>\n<p><span style=\"color: #000000;\">\u5728\u73b0\u5b9e\u4e16\u754c\u4e2d\uff0cLDA \u6a21\u578b\u5f88\u5c11\u80fd\u6b63\u786e\u9884\u6d4b\u6bcf\u4e2a\u7c7b\u522b\u7684\u7ed3\u679c\uff0c\u4f46\u8fd9\u4e2a\u8679\u819c\u6570\u636e\u96c6\u7684\u6784\u9020\u65b9\u5f0f\u5f88\u7b80\u5355\uff0c\u673a\u5668\u5b66\u4e60\u7b97\u6cd5\u5f80\u5f80\u8868\u73b0\u826f\u597d\u3002<\/span><\/p>\n<h3><span style=\"color: #000000;\"><strong>\u7b2c 7 \u6b65\uff1a\u53ef\u89c6\u5316\u7ed3\u679c<\/strong><\/span><\/h3>\n<p><span style=\"color: #000000;\">\u6700\u540e\uff0c\u6211\u4eec\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a LDA \u56fe\u6765\u53ef\u89c6\u5316\u6a21\u578b\u7684\u7ebf\u6027\u5224\u522b\u5f0f\uff0c\u5e76\u53ef\u89c6\u5316\u5b83\u5728\u6570\u636e\u96c6\u4e2d\u533a\u5206\u4e09\u4e2a\u4e0d\u540c\u7269\u79cd\u7684\u6548\u679c\uff1a<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#define data to plot\n<\/span>lda_plot &lt;- cbind(train, predict(model)$x)\n\n<span style=\"color: #008080;\">#createplot\n<\/span>ggplot(lda_plot, <span style=\"color: #3366ff;\">aes<\/span> (LD1, LD2)) +\n  geom_point( <span style=\"color: #3366ff;\">aes<\/span> (color=Species))\n<\/strong><\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-11639 \" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/lda_r1.png\" alt=\"R \u4e2d\u7684\u7ebf\u6027\u5224\u522b\u5206\u6790\" width=\"431\" height=\"427\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p><span style=\"color: #000000;\">\u60a8\u53ef\u4ee5<a href=\"https:\/\/github.com\/Statorials\/R-Guides\/blob\/main\/linear_discriminant_analysis\" target=\"_blank\" rel=\"noopener noreferrer\">\u5728\u6b64\u5904<\/a>\u627e\u5230\u672c\u6559\u7a0b\u4e2d\u4f7f\u7528\u7684\u5b8c\u6574 R \u4ee3\u7801\u3002<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f53\u60a8\u6709\u4e00\u7ec4\u9884\u6d4b\u53d8\u91cf\u5e76\u5e0c\u671b\u5c06\u54cd\u5e94\u53d8\u91cf\u5206\u7c7b\u4e3a\u4e24\u4e2a\u6216\u591a\u4e2a\u7c7b\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528 \u7ebf\u6027\u5224\u522b\u5206\u6790\u65b9\u6cd5\u3002 \u672c\u6559\u7a0b\u63d0\u4f9b\u4e86\u5982\u4f55\u5728 R  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-1163","post","type-post","status-publish","format-standard","hentry","category-11"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>R \u4e2d\u7684\u7ebf\u6027\u5224\u522b\u5206\u6790\uff08\u9010\u6b65\uff09<\/title>\n<meta name=\"description\" content=\"\u672c\u6559\u7a0b\u4ecb\u7ecd\u5982\u4f55\u5728 R \u4e2d\u6267\u884c\u7ebf\u6027\u5224\u522b\u5206\u6790\uff0c\u5305\u62ec\u5206\u6b65\u793a\u4f8b\u3002\" \/>\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\/cn\/r\u4e2d\u7684\u7ebf\u6027\u5224\u522b\u5206\u6790\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"R \u4e2d\u7684\u7ebf\u6027\u5224\u522b\u5206\u6790\uff08\u9010\u6b65\uff09\" \/>\n<meta property=\"og:description\" content=\"\u672c\u6559\u7a0b\u4ecb\u7ecd\u5982\u4f55\u5728 R \u4e2d\u6267\u884c\u7ebf\u6027\u5224\u522b\u5206\u6790\uff0c\u5305\u62ec\u5206\u6b65\u793a\u4f8b\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/cn\/r\u4e2d\u7684\u7ebf\u6027\u5224\u522b\u5206\u6790\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-27T11:00:03+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/lda_r1.png\" \/>\n<meta name=\"author\" content=\"\u672c\u6770\u660e\u00b7\u5b89\u5fb7\u68ee\u535a\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u672c\u6770\u660e\u00b7\u5b89\u5fb7\u68ee\u535a\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/cn\/r%e4%b8%ad%e7%9a%84%e7%ba%bf%e6%80%a7%e5%88%a4%e5%88%ab%e5%88%86%e6%9e%90\/\",\"url\":\"https:\/\/statorials.org\/cn\/r%e4%b8%ad%e7%9a%84%e7%ba%bf%e6%80%a7%e5%88%a4%e5%88%ab%e5%88%86%e6%9e%90\/\",\"name\":\"R \u4e2d\u7684\u7ebf\u6027\u5224\u522b\u5206\u6790\uff08\u9010\u6b65\uff09\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/cn\/#website\"},\"datePublished\":\"2023-07-27T11:00:03+00:00\",\"dateModified\":\"2023-07-27T11:00:03+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/cn\/#\/schema\/person\/124e4e5b7c9f8dc0f1f95cc8c1db3261\"},\"description\":\"\u672c\u6559\u7a0b\u4ecb\u7ecd\u5982\u4f55\u5728 R \u4e2d\u6267\u884c\u7ebf\u6027\u5224\u522b\u5206\u6790\uff0c\u5305\u62ec\u5206\u6b65\u793a\u4f8b\u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/cn\/r%e4%b8%ad%e7%9a%84%e7%ba%bf%e6%80%a7%e5%88%a4%e5%88%ab%e5%88%86%e6%9e%90\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/cn\/r%e4%b8%ad%e7%9a%84%e7%ba%bf%e6%80%a7%e5%88%a4%e5%88%ab%e5%88%86%e6%9e%90\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/cn\/r%e4%b8%ad%e7%9a%84%e7%ba%bf%e6%80%a7%e5%88%a4%e5%88%ab%e5%88%86%e6%9e%90\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u5bb6\",\"item\":\"https:\/\/statorials.org\/cn\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"R \u4e2d\u7684\u7ebf\u6027\u5224\u522b\u5206\u6790\uff08\u9010\u6b65\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/cn\/#website\",\"url\":\"https:\/\/statorials.org\/cn\/\",\"name\":\"Statorials\",\"description\":\"\u60a8\u7684\u7edf\u8ba1\u7d20\u517b\u6307\u5357\uff01\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/cn\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/cn\/#\/schema\/person\/124e4e5b7c9f8dc0f1f95cc8c1db3261\",\"name\":\"\u672c\u6770\u660e\u00b7\u5b89\u5fb7\u68ee\u535a\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/statorials.org\/cn\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/statorials.org\/cn\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"https:\/\/statorials.org\/cn\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"caption\":\"\u672c\u6770\u660e\u00b7\u5b89\u5fb7\u68ee\u535a\"},\"description\":\"\u5927\u5bb6\u597d\uff0c\u6211\u662f\u672c\u6770\u660e\uff0c\u4e00\u4f4d\u9000\u4f11\u7684\u7edf\u8ba1\u5b66\u6559\u6388\uff0c\u540e\u6765\u6210\u4e3a Statorials \u7684\u70ed\u5fc3\u6559\u5e08\u3002 \u51ed\u501f\u5728\u7edf\u8ba1\u9886\u57df\u7684\u4e30\u5bcc\u7ecf\u9a8c\u548c\u4e13\u4e1a\u77e5\u8bc6\uff0c\u6211\u6e34\u671b\u5206\u4eab\u6211\u7684\u77e5\u8bc6\uff0c\u901a\u8fc7 Statorials \u589e\u5f3a\u5b66\u751f\u7684\u80fd\u529b\u3002\u4e86\u89e3\u66f4\u591a\",\"sameAs\":[\"https:\/\/statorials.org\/cn\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"R \u4e2d\u7684\u7ebf\u6027\u5224\u522b\u5206\u6790\uff08\u9010\u6b65\uff09","description":"\u672c\u6559\u7a0b\u4ecb\u7ecd\u5982\u4f55\u5728 R \u4e2d\u6267\u884c\u7ebf\u6027\u5224\u522b\u5206\u6790\uff0c\u5305\u62ec\u5206\u6b65\u793a\u4f8b\u3002","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\/cn\/r\u4e2d\u7684\u7ebf\u6027\u5224\u522b\u5206\u6790\/","og_locale":"zh_CN","og_type":"article","og_title":"R \u4e2d\u7684\u7ebf\u6027\u5224\u522b\u5206\u6790\uff08\u9010\u6b65\uff09","og_description":"\u672c\u6559\u7a0b\u4ecb\u7ecd\u5982\u4f55\u5728 R \u4e2d\u6267\u884c\u7ebf\u6027\u5224\u522b\u5206\u6790\uff0c\u5305\u62ec\u5206\u6b65\u793a\u4f8b\u3002","og_url":"https:\/\/statorials.org\/cn\/r\u4e2d\u7684\u7ebf\u6027\u5224\u522b\u5206\u6790\/","og_site_name":"Statorials","article_published_time":"2023-07-27T11:00:03+00:00","og_image":[{"url":"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/lda_r1.png"}],"author":"\u672c\u6770\u660e\u00b7\u5b89\u5fb7\u68ee\u535a","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u672c\u6770\u660e\u00b7\u5b89\u5fb7\u68ee\u535a","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/cn\/r%e4%b8%ad%e7%9a%84%e7%ba%bf%e6%80%a7%e5%88%a4%e5%88%ab%e5%88%86%e6%9e%90\/","url":"https:\/\/statorials.org\/cn\/r%e4%b8%ad%e7%9a%84%e7%ba%bf%e6%80%a7%e5%88%a4%e5%88%ab%e5%88%86%e6%9e%90\/","name":"R \u4e2d\u7684\u7ebf\u6027\u5224\u522b\u5206\u6790\uff08\u9010\u6b65\uff09","isPartOf":{"@id":"https:\/\/statorials.org\/cn\/#website"},"datePublished":"2023-07-27T11:00:03+00:00","dateModified":"2023-07-27T11:00:03+00:00","author":{"@id":"https:\/\/statorials.org\/cn\/#\/schema\/person\/124e4e5b7c9f8dc0f1f95cc8c1db3261"},"description":"\u672c\u6559\u7a0b\u4ecb\u7ecd\u5982\u4f55\u5728 R \u4e2d\u6267\u884c\u7ebf\u6027\u5224\u522b\u5206\u6790\uff0c\u5305\u62ec\u5206\u6b65\u793a\u4f8b\u3002","breadcrumb":{"@id":"https:\/\/statorials.org\/cn\/r%e4%b8%ad%e7%9a%84%e7%ba%bf%e6%80%a7%e5%88%a4%e5%88%ab%e5%88%86%e6%9e%90\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/cn\/r%e4%b8%ad%e7%9a%84%e7%ba%bf%e6%80%a7%e5%88%a4%e5%88%ab%e5%88%86%e6%9e%90\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/cn\/r%e4%b8%ad%e7%9a%84%e7%ba%bf%e6%80%a7%e5%88%a4%e5%88%ab%e5%88%86%e6%9e%90\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u5bb6","item":"https:\/\/statorials.org\/cn\/"},{"@type":"ListItem","position":2,"name":"R \u4e2d\u7684\u7ebf\u6027\u5224\u522b\u5206\u6790\uff08\u9010\u6b65\uff09"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/cn\/#website","url":"https:\/\/statorials.org\/cn\/","name":"Statorials","description":"\u60a8\u7684\u7edf\u8ba1\u7d20\u517b\u6307\u5357\uff01","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/cn\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/statorials.org\/cn\/#\/schema\/person\/124e4e5b7c9f8dc0f1f95cc8c1db3261","name":"\u672c\u6770\u660e\u00b7\u5b89\u5fb7\u68ee\u535a","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/statorials.org\/cn\/#\/schema\/person\/image\/","url":"https:\/\/statorials.org\/cn\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","contentUrl":"https:\/\/statorials.org\/cn\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","caption":"\u672c\u6770\u660e\u00b7\u5b89\u5fb7\u68ee\u535a"},"description":"\u5927\u5bb6\u597d\uff0c\u6211\u662f\u672c\u6770\u660e\uff0c\u4e00\u4f4d\u9000\u4f11\u7684\u7edf\u8ba1\u5b66\u6559\u6388\uff0c\u540e\u6765\u6210\u4e3a Statorials \u7684\u70ed\u5fc3\u6559\u5e08\u3002 \u51ed\u501f\u5728\u7edf\u8ba1\u9886\u57df\u7684\u4e30\u5bcc\u7ecf\u9a8c\u548c\u4e13\u4e1a\u77e5\u8bc6\uff0c\u6211\u6e34\u671b\u5206\u4eab\u6211\u7684\u77e5\u8bc6\uff0c\u901a\u8fc7 Statorials \u589e\u5f3a\u5b66\u751f\u7684\u80fd\u529b\u3002\u4e86\u89e3\u66f4\u591a","sameAs":["https:\/\/statorials.org\/cn"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/cn\/wp-json\/wp\/v2\/posts\/1163","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/statorials.org\/cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/cn\/wp-json\/wp\/v2\/comments?post=1163"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/cn\/wp-json\/wp\/v2\/posts\/1163\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/cn\/wp-json\/wp\/v2\/media?parent=1163"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/cn\/wp-json\/wp\/v2\/categories?post=1163"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/cn\/wp-json\/wp\/v2\/tags?post=1163"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}