{"id":50788,"date":"2022-03-23T00:00:00","date_gmt":"2022-03-23T07:00:00","guid":{"rendered":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/%e6%9c%aa%e5%88%86%e9%a1%9e\/modelling-sp-500-index-price-based-on-u-s-economic-indicators-using-python-and-griddb\/"},"modified":"2025-11-14T07:55:15","modified_gmt":"2025-11-14T15:55:15","slug":"modelling-sp-500-index-price-based-on-u-s-economic-indicators-using-python-and-griddb","status":"publish","type":"post","link":"https:\/\/griddb.net\/ja\/%e6%9c%aa%e5%88%86%e9%a1%9e\/modelling-sp-500-index-price-based-on-u-s-economic-indicators-using-python-and-griddb\/","title":{"rendered":"Python\u3068GridDB\u3092\u7528\u3044\u305f\u7c73\u56fd\u7d4c\u6e08\u6307\u6a19\u306b\u57fa\u3065\u304fS&#038;P500\u6307\u6570\u4fa1\u683c\u306e\u30e2\u30c7\u30eb\u5316"},"content":{"rendered":"<p>\u7d4c\u6e08\u6307\u6a19\u3068\u5e83\u304f\u77e5\u3089\u308c\u305f\u7d71\u8a08\u7684\u624b\u6cd5\u3092\u4f7f\u3063\u3066\u682a\u4fa1\u3092\u4e88\u6e2c\u3059\u308b\u6570\u591a\u304f\u306e\u7814\u7a76\u304c\u3053\u308c\u307e\u3067\u306b\u884c\u308f\u308c\u3066\u304d\u307e\u3057\u305f\u3002\u305d\u3057\u30662010\u5e74\u4ee5\u964d\u306e\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u306e\u6027\u80fd\u306e\u4e0a\u6607\u306b\u3088\u308a\u3001\u6a5f\u68b0\u5b66\u7fd2\u306b\u3088\u308b\u65b0\u3057\u3044\u624b\u6cd5\u304c\u958b\u767a\u3055\u308c\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3057\u305f\u3002\u305d\u308c\u3089\u306e\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u304c\u3001\u69d8\u3005\u306a\u6570\u5b66\u7684\u30fb\u7d71\u8a08\u7684\u624b\u6cd5\u3092\u7528\u3044\u3066\u682a\u5f0f\u5e02\u5834\u3092\u4e88\u6e2c\u3067\u304d\u308b\u304b\u3069\u3046\u304b\u3092\u767a\u898b\u3059\u308b\u3053\u3068\u306f\u3001\u8208\u5473\u6df1\u3044\u3053\u3068\u3067\u3059\u3002\u672c\u30d6\u30ed\u30b0\u306e\u76ee\u7684\u306f\u3001GridDB\u3092\u4f7f\u3063\u3066\u30c7\u30fc\u30bf\u3092\u62bd\u51fa\u3057\u3001\u6b21\u306b\u7d71\u8a08\u7684\u691c\u5b9a\u3092\u884c\u3044\u3001\u6700\u5f8c\u306b\u6a5f\u68b0\u5b66\u7fd2\u30e2\u30c7\u30eb\u3092\u69cb\u7bc9\u3057\u3066\u3001\u7c73\u56fd\u306e\u7d4c\u6e08\u6307\u6a19\u306b\u57fa\u3065\u304fS&amp;P500\u6307\u6570\u306e\u6708\u6b21\u4fa1\u683c\u3092\u30e2\u30c7\u30eb\u5316\u3059\u308b\u3053\u3068\u3067\u3059\u3002<\/p>\n<p>\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u306e\u6982\u8981\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<ol>\n<li>\u524d\u63d0\u6761\u4ef6\u3068\u74b0\u5883\u8a2d\u5b9a<\/li>\n<li>\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u6982\u8981<\/li>\n<li>\u5fc5\u8981\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u30a4\u30f3\u30dd\u30fc\u30c8<\/li>\n<li>\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u306e\u8aad\u307f\u8fbc\u307f<\/li>\n<li>\u63a2\u7d22\u7684\u30c7\u30fc\u30bf\u89e3\u6790\u3068\u7279\u5fb4\u91cf\u306e\u9078\u629e<\/li>\n<li>\u6a5f\u68b0\u5b66\u7fd2\u30e2\u30c7\u30eb\u306e\u69cb\u7bc9\u3068\u5b66\u7fd2<\/li>\n<li>\u307e\u3068\u3081<\/li>\n<\/ol>\n<h1>\u524d\u63d0\u6761\u4ef6\u3068\u74b0\u5883\u8a2d\u5b9a<\/h1>\n<p>\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u306f\u3001Windows \u30aa\u30da\u30ec\u30fc\u30c6\u30a3\u30f3\u30b0\u30b7\u30b9\u30c6\u30e0\u4e0a\u306e Anaconda Navigator (Python \u30d0\u30fc\u30b8\u30e7\u30f3 &#8211; 3.8.3) \u3067\u5b9f\u65bd\u3055\u308c\u307e\u3059\u3002\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3092\u7d9a\u3051\u308b\u524d\u306b\u3001\u4ee5\u4e0b\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<ol>\n<li>\n<p>Pandas<\/p>\n<\/li>\n<li>\n<p>NumPy<\/p>\n<\/li>\n<li>\n<p>Scikit-learn<\/p>\n<\/li>\n<li>\n<p>Matplotlib<\/p>\n<\/li>\n<li>\n<p>Statsmodels<\/p>\n<\/li>\n<li>\n<p>griddb_python<\/p>\n<\/li>\n<\/ol>\n<p>\u3053\u308c\u3089\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3092Conda\u306e\u4eee\u60f3\u74b0\u5883\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u306b\u306f\u3001<code>conda install package-name<\/code>\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\u30bf\u30fc\u30df\u30ca\u30eb\u3084\u30b3\u30de\u30f3\u30c9\u30d7\u30ed\u30f3\u30d7\u30c8\u304b\u3089\u76f4\u63a5Python\u3092\u4f7f\u7528\u3059\u308b\u5834\u5408\u306f\u3001 <code>pip install package-name<\/code> \u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u307e\u3059\u3002<\/p>\n<h3>GridDB\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h3>\n<p>\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3092\u30ed\u30fc\u30c9\u3059\u308b\u969b\u3001\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001GridDB \u3092\u4f7f\u7528\u3059\u308b\u65b9\u6cd5\u3068 Pandas \u3092\u4f7f\u7528\u3059\u308b\u65b9\u6cd5\u306e 2 \u3064\u3092\u53d6\u308a\u4e0a\u3052\u307e\u3059\u3002Python\u3092\u4f7f\u7528\u3057\u3066GridDB\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u305f\u3081\u306b\u306f\u3001\u4ee5\u4e0b\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3082\u4e88\u3081\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304a\u304f\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<ol>\n<li><a href=\"https:\/\/github.com\/griddb\/c_client\">GridDB C-client<\/a><\/li>\n<li>SWIG (Simplified Wrapper and Interface Generator)<\/li>\n<li><a href=\"https:\/\/github.com\/griddb\/python_client\">GridDB Python Client<\/a><\/li>\n<\/ol>\n<h1>1&#46; \u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u6982\u8981<\/h1>\n<p>\u4e00\u822c\u7684\u306b\u682a\u5f0f\u5e02\u5834\u306e\u30ea\u30bf\u30fc\u30f3\u3001\u7279\u306bS&amp;P500\u306b\u6700\u3082\u5927\u304d\u306a\u5f71\u97ff\u3092\u4e0e\u3048\u308b\u3068\u8a8d\u8b58\u3055\u308c\u3066\u3044\u308b\u6307\u6a19\u306f\u3001\u4ee5\u4e0b\u306e\u30ab\u30c6\u30b4\u30ea\u30fc\u306b\u5206\u985e\u3055\u308c\u307e\u3059\uff1a\u4e00\u822c\u7684\u306a\u30de\u30af\u30ed\u7d4c\u6e08\u6307\u6a19\u3001\u52b4\u50cd\u5e02\u5834\u6307\u6a19\uff08\u5931\u696d\u7387\u3084\u96c7\u7528\u7d71\u8a08\uff09\u3001\u4e0d\u52d5\u7523\u6307\u6a19\u3001\u4fe1\u7528\u5e02\u5834\u6307\u6a19\u3001\u91d1\u878d\u4f9b\u7d66\u6307\u6a19\u3001\u6d88\u8cbb\u8005\uff08\u5bb6\u8a08\uff09\u91d1\u878d\u884c\u52d5\u6307\u6a19\u3001\u5546\u54c1\u5e02\u5834\u6307\u6a19\u306a\u3069\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u30d6\u30ed\u30b0\u3067\u306f\u3001S&amp;P500\u6307\u6570\u306e\u7d42\u5024\u3092\u30e2\u30c7\u30eb\u5316\u3057\u307e\u3057\u305f\u3002\u3053\u3053\u3067\u306f\u3001Google Colab\u74b0\u5883\u3067\u3001\u591a\u304f\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u542b\u3080Python\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u8a00\u8a9e\u3092\u4f7f\u7528\u3057\u3066\u3044\u307e\u3059\u3002\u5206\u6790\u671f\u9593\u306f1970-01-01 \/ 2018-04-01\u3067\u3001S&amp;P500\u6307\u6570\u7d42\u5024\u3068\u7c73\u56fd\u7d4c\u6e08\u6307\u6a19\u30c7\u30fc\u30bf\u306e\u983b\u5ea6\u306f\u3044\u305a\u308c\u3082\u6708\u6b21\u3067\u3059\u3002<\/p>\n<p>\u7279\u5fb4\u306e\u8aac\u660e\uff1a<\/p>\n<p>1) <code>SP500<\/code> &#8211; \u5404\u6708\u306eS&amp;P500\u306e\u4fa1\u683c (\u5358\u4f4d\u306f\u7c73\u30c9\u30eb)<\/p>\n<p>2) <code>INTDSRUSM193N<\/code> &#8211; \u7c73\u56fd\u306e\u91d1\u5229\u3001\u5272\u5f15\u7387 (\u5358\u4f4d: \u30d1\u30fc\u30bb\u30f3\u30c8\/\u5e74)<\/p>\n<p>3) <code>BUSLOANS<\/code> &#8211; \u5546\u5de5\u696d\u30ed\u30fc\u30f3\u3001\u5168\u5546\u696d\u9280\u884c (\u5358\u4f4d: 10\u5104\u7c73\u30c9\u30eb)<\/p>\n<p>4) <code>MPRIME<\/code> &#8211; \u9280\u884c\u30d7\u30e9\u30a4\u30e0\u30ed\u30fc\u30f3\u91d1\u5229 (\u5358\u4f4d: \u30d1\u30fc\u30bb\u30f3\u30c8)<\/p>\n<p>5) <code>FEDFUNDS<\/code> &#8211; \u30d5\u30a7\u30c7\u30e9\u30eb\u30d5\u30a1\u30f3\u30c9\u5b9f\u52b9\u91d1\u5229 (\u30d5\u30a7\u30c7\u30e9\u30eb\u30d5\u30a1\u30f3\u30c9\u91d1\u5229\u3068\u306f\u3001\u9810\u91d1\u53d6\u6271\u6a5f\u95a2\u304c\u30d5\u30a7\u30c7\u30e9\u30eb\u30d5\u30a1\u30f3\u30c9\u3092\u591c\u9593\u306b\u53d6\u5f15\u3059\u308b\u969b\u306e\u91d1\u5229\u306e\u3053\u3068\u3002) (\u5358\u4f4d: \u30d1\u30fc\u30bb\u30f3\u30c8)<\/p>\n<p>6) <code>CURRCIR<\/code> &#8211; \u6d41\u901a\u901a\u8ca8 (\u5358\u4f4d: \u5104\u30c9\u30eb)<\/p>\n<p>7) <code>PSAVERT<\/code> &#8211; \u500b\u4eba\u8caf\u84c4\u7387 (\u53ef\u51e6\u5206\u500b\u4eba\u6240\u5f97(DPI)\u306b\u5bfe\u3059\u308b\u500b\u4eba\u8caf\u84c4\u306e\u5272\u5408\u3067\u3001\u3057\u3070\u3057\u3070\u300c\u500b\u4eba\u8caf\u84c4\u7387\u300d\u3068\u547c\u3070\u308c\u308b)(\u5358\u4f4d:\u767e\u5206\u7387)<\/p>\n<p>8) <code>PERMIT<\/code> &#8211; \u8a31\u53ef\u767a\u884c\u5730\u306b\u304a\u3051\u308b\u6c11\u9593\u65b0\u7bc9\u4f4f\u5b85\u8a31\u53ef\u6238\u6570: \u7dcf\u6238\u6570 (\u5358\u4f4d: \u5104\u30c9\u30eb)<\/p>\n<p>9) <code>INDPRO<\/code> &#8211; \u9271\u5de5\u696d\u751f\u7523\u3002\u5de5\u696d\u751f\u7523\u6307\u6570\uff08INDPRO\uff09\u306f\u3001\u7c73\u56fd\u306e\u88fd\u9020\u696d\u3001\u9271\u696d\u3001\u96fb\u6c17\u30fb\u30ac\u30b9\u4e8b\u696d\u8005\u306b\u7acb\u5730\u3059\u308b\u3059\u3079\u3066\u306e\u65bd\u8a2d\u306e\u5b9f\u8cea\u751f\u7523\u9ad8\u3092\u6e2c\u5b9a\u3059\u308b\u7d4c\u6e08\u6307\u6a19\uff09\uff08\u5358\u4f4d\uff1a\u6307\u65702017=100<\/p>\n<p>10) <code>PMSAVE<\/code> &#8211; \u500b\u4eba\u8caf\u84c4 (\u5358\u4f4d: \u5104\u30c9\u30eb)<\/p>\n<p>11) <code>DAUTOSAAR<\/code> &#8211; \u81ea\u52d5\u8eca\u5c0f\u58f2\u8ca9\u58f2\u53f0\u6570: \u56fd\u5185\u81ea\u52d5\u8eca\u8ca9\u58f2\u53f0\u6570 (\u5358\u4f4d: \u767e\u4e07\u53f0)<\/p>\n<p>12) <code>UNEMPLOY<\/code> &#8211; \u5931\u696d\u6c34\u6e96 (\u5358\u4f4d: \u5343\u4eba)<\/p>\n<p>13) <code>CPIAUCSL<\/code> &#8211; \u3059\u3079\u3066\u306e\u90fd\u5e02\u6d88\u8cbb\u8005\u5411\u3051\u6d88\u8cbb\u8005\u7269\u4fa1\u6307\u6570\u3002\u5168\u7c73\u90fd\u5e02\u5e73\u5747\u306e\u5168\u54c1\u76ee\uff08\u5358\u4f4d\uff1a\u6307\u6570 1982-1984=100\uff09\u3002<\/p>\n<p>\u3053\u306e\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u306f\u4e00\u822c\u306b\u516c\u958b\u3055\u308c\u3066\u304a\u308a\u3001<code>finance.yahoo.com<\/code> \u3068 <code>fred.stlouisfed.org<\/code> \u306e\u30a6\u30a7\u30d6\u30b5\u30a4\u30c8\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u5f97\u3089\u308c\u305f\u30c7\u30fc\u30bf\u306f1\u3064\u306e\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u306b\u307e\u3068\u3081\u3089\u308c\u3001\u6b20\u640d\u5024\u306b\u3064\u3044\u3066\u3082\u30c1\u30a7\u30c3\u30af\u6e08\u307f\u3067\u3059\u3002<\/p>\n<h1>2&#46; \u5fc5\u8981\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u30a4\u30f3\u30dd\u30fc\u30c8<\/h1>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\">import griddb_python as griddb\n\nimport numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\nimport datetime\n\nimport statsmodels.api as sm\nfrom statsmodels.stats.outliers_influence import variance_inflation_factor\n\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.linear_model import LinearRegression\nfrom sklearn.ensemble import RandomForestRegressor\nfrom sklearn.metrics import r2_score\nfrom sklearn.metrics import mean_squared_error\n\nimport warnings\nwarnings.filterwarnings('ignore')\n%matplotlib inline<\/code><\/pre>\n<\/div>\n<h1>3&#46; \u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u306e\u8aad\u307f\u8fbc\u307f<\/h1>\n<p>\u305d\u308c\u3067\u306f\u3001\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3092\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u306b\u8aad\u307f\u8fbc\u3093\u3067\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<h2>3&#46;a GridDB\u306e\u5229\u7528<\/h2>\n<p>\u6771\u829dGridDB\u2122\u306f\u3001IoT\u3084\u30d3\u30c3\u30b0\u30c7\u30fc\u30bf\u306b\u6700\u9069\u306a\u62e1\u5f35\u6027\u306e\u9ad8\u3044NoSQL\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3067\u3059\u3002GridDB\u306e\u7406\u5ff5\u306e\u6839\u5e79\u306f\u3001IoT\u306b\u6700\u9069\u5316\u3055\u308c\u305f\u6c4e\u7528\u6027\u306e\u9ad8\u3044\u30c7\u30fc\u30bf\u30b9\u30c8\u30a2\u306e\u63d0\u4f9b\u3001\u9ad8\u3044\u30b9\u30b1\u30fc\u30e9\u30d3\u30ea\u30c6\u30a3\u3001\u9ad8\u6027\u80fd\u306a\u30c1\u30e5\u30fc\u30cb\u30f3\u30b0\u3001\u9ad8\u3044\u4fe1\u983c\u6027\u306e\u78ba\u4fdd\u306b\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u3092\u4fdd\u5b58\u3059\u308b\u305f\u3081\u306b\u3001CSV\u30d5\u30a1\u30a4\u30eb\u306f\u9762\u5012\u3067\u3059\u3002GridDB\u306f\u3001\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u3067\u62e1\u5f35\u6027\u306e\u9ad8\u3044\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3067\u3042\u308b\u305f\u3081\u3001\u5b8c\u74a7\u306a\u4ee3\u66ff\u54c1\u3068\u3057\u3066\u6a5f\u80fd\u3057\u307e\u3059\u3002GridDB\u306f\u3001\u30b9\u30b1\u30fc\u30e9\u30d6\u30eb\u3067\u30a4\u30f3\u30e1\u30e2\u30ea\u306aNoSQL\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3067\u3042\u308a\u3001\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u3092\u7c21\u5358\u306b\u4fdd\u5b58\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002GridDB\u3092\u521d\u3081\u3066\u4f7f\u3046\u5834\u5408\u306f\u3001<a href=\"https:\/\/griddb.net\/ja\/blog\/using-pandas-dataframes-with-griddb\/\">\u3053\u3061\u3089\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb<\/a>\u304c\u53c2\u8003\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3059\u3067\u306b\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u304c\u5b8c\u4e86\u3057\u3066\u3044\u308b\u3068\u4eee\u5b9a\u3057\u3066\u3001\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3092\u30ed\u30fc\u30c9\u3059\u308b\u305f\u3081\u306eSQL\u30af\u30a8\u30ea\u3092python\u3067\u8a18\u8ff0\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\">sql_statement = ('SELECT * FROM us_economic_data')\ndataset = pd.read_sql_query(sql_statement, cont)<\/code><\/pre>\n<\/div>\n<p>\u5909\u6570 <code>cont<\/code> \u306b\u306f\u3001\u30c7\u30fc\u30bf\u304c\u683c\u7d0d\u3055\u308c\u3066\u3044\u308b\u30b3\u30f3\u30c6\u30ca\u60c5\u5831\u304c\u683c\u7d0d\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u306b\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002credit_card_dataset` \u3092\u30b3\u30f3\u30c6\u30ca\u306e\u540d\u524d\u306b\u7f6e\u304d\u63db\u3048\u3066\u304f\u3060\u3055\u3044\u3002\u8a73\u7d30\u306f\u3001\u3053\u3061\u3089\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb<a href=\"https:\/\/griddb.net\/ja\/blog\/using-pandas-dataframes-with-griddb\/\">GridDB\u3078\u306e\u8aad\u307f\u66f8\u304d<\/a>\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>IoT\u3084\u30d3\u30c3\u30b0\u30c7\u30fc\u30bf\u306e\u30e6\u30fc\u30b9\u30b1\u30fc\u30b9\u306b\u95a2\u3057\u3066\u8a00\u3048\u3070\u3001GridDB\u306f\u30ea\u30ec\u30fc\u30b7\u30e7\u30ca\u30eb\u3084NoSQL\u306e\u9818\u57df\u306e\u4ed6\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u4e2d\u3067\u660e\u3089\u304b\u306b\u969b\u7acb\u3063\u3066\u3044\u307e\u3059\u3002\u5168\u4f53\u3068\u3057\u3066\u3001GridDB\u306f\u9ad8\u53ef\u7528\u6027\u3068\u30c7\u30fc\u30bf\u4fdd\u6301\u3092\u5fc5\u8981\u3068\u3059\u308b\u30df\u30c3\u30b7\u30e7\u30f3\u30af\u30ea\u30c6\u30a3\u30ab\u30eb\u306a\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u305f\u3081\u306b\u3001\u8907\u6570\u306e\u4fe1\u983c\u6027\u6a5f\u80fd\u3092\u63d0\u4f9b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h2>3&#46;b Pandas\u306e\u5229\u7528<\/h2>\n<p>\u307e\u305f\u3001Pandas\u306e <code>read_csv<\/code> \u95a2\u6570\u3092\u4f7f\u7528\u3057\u3066\u30c7\u30fc\u30bf\u3092\u8aad\u307f\u8fbc\u3080\u3053\u3068\u3082\u3067\u304d\u307e\u3059\u3002\u4e0a\u8a18\u306e\u3069\u3061\u3089\u306e\u65b9\u6cd5\u3092\u4f7f\u3063\u3066\u3082\u3001\u30c7\u30fc\u30bf\u306fpandas\u306edataframe\u306e\u5f62\u3067\u8aad\u307f\u8fbc\u307e\u308c\u308b\u305f\u3081\u3001\u540c\u3058\u51fa\u529b\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\">us_economic_data = pd.read_csv('us_economic_data.csv')<\/code><\/pre>\n<\/div>\n<h1>4&#46; \u63a2\u7d22\u7684\u30c7\u30fc\u30bf\u89e3\u6790\u3068\u7279\u5fb4\u91cf\u306e\u9078\u629e<\/h1>\n<p>\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u304c\u8aad\u307f\u8fbc\u307e\u308c\u305f\u3089\u3001\u4eca\u5ea6\u306f\u305d\u306e\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3092\u63a2\u7d22\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002head()\u95a2\u6570\u3092\u4f7f\u3063\u3066\u3001\u3053\u306e\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u306e\u6700\u521d\u306e10\u884c\u3092\u8868\u793a\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\">us_economic_data.head()<\/code><\/pre>\n<\/div>\n<div style=\"overflow-y: hidden;white-space: nowrap\">\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }<\/p>\n<p>    .dataframe tbody tr th {\n        vertical-align: top;\n    }<\/p>\n<p>    .dataframe thead th {\n        text-align: right;\n    }\n  <\/style>\n<table border=\"1\" class=\"dataframe\">\n<thead>\n<tr style=\"text-align: right;\">\n<th>\n        <\/th>\n<th>\n          date\n        <\/th>\n<th>\n          SP500\n        <\/th>\n<th>\n          INTDSRUSM193N\n        <\/th>\n<th>\n          BUSLOANS\n        <\/th>\n<th>\n          MPRIME\n        <\/th>\n<th>\n          FEDFUNDS\n        <\/th>\n<th>\n          CURRCIR\n        <\/th>\n<th>\n          PSAVERT\n        <\/th>\n<th>\n          PMSAVE\n        <\/th>\n<th>\n          DAUTOSAAR\n        <\/th>\n<th>\n          UNEMPLOY\n        <\/th>\n<th>\n          INDPRO\n        <\/th>\n<th>\n          PERMIT\n        <\/th>\n<th>\n          CPIAUCSL\n        <\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<th>\n          0\n        <\/th>\n<td>\n          1970-07-01\n        <\/td>\n<td>\n          75.72\n        <\/td>\n<td>\n          6.00\n        <\/td>\n<td>\n          107.6770\n        <\/td>\n<td>\n          8.00\n        <\/td>\n<td>\n          7.21\n        <\/td>\n<td>\n          54.699\n        <\/td>\n<td>\n          13.5\n        <\/td>\n<td>\n          104.0\n        <\/td>\n<td>\n          7.720\n        <\/td>\n<td>\n          4175\n        <\/td>\n<td>\n          37.8753\n        <\/td>\n<td>\n          1324.0\n        <\/td>\n<td>\n          38.9\n        <\/td>\n<\/tr>\n<tr>\n<th>\n          1\n        <\/th>\n<td>\n          1970-08-01\n        <\/td>\n<td>\n          77.92\n        <\/td>\n<td>\n          6.00\n        <\/td>\n<td>\n          108.5407\n        <\/td>\n<td>\n          8.00\n        <\/td>\n<td>\n          6.62\n        <\/td>\n<td>\n          54.766\n        <\/td>\n<td>\n          13.4\n        <\/td>\n<td>\n          103.9\n        <\/td>\n<td>\n          7.595\n        <\/td>\n<td>\n          4256\n        <\/td>\n<td>\n          37.8077\n        <\/td>\n<td>\n          1394.0\n        <\/td>\n<td>\n          39.0\n        <\/td>\n<\/tr>\n<tr>\n<th>\n          2\n        <\/th>\n<td>\n          1970-09-01\n        <\/td>\n<td>\n          82.58\n        <\/td>\n<td>\n          6.00\n        <\/td>\n<td>\n          109.5289\n        <\/td>\n<td>\n          7.83\n        <\/td>\n<td>\n          6.29\n        <\/td>\n<td>\n          54.931\n        <\/td>\n<td>\n          12.9\n        <\/td>\n<td>\n          100.3\n        <\/td>\n<td>\n          7.763\n        <\/td>\n<td>\n          4456\n        <\/td>\n<td>\n          37.5471\n        <\/td>\n<td>\n          1426.0\n        <\/td>\n<td>\n          39.2\n        <\/td>\n<\/tr>\n<tr>\n<th>\n          3\n        <\/th>\n<td>\n          1970-10-01\n        <\/td>\n<td>\n          84.37\n        <\/td>\n<td>\n          6.00\n        <\/td>\n<td>\n          109.7740\n        <\/td>\n<td>\n          7.50\n        <\/td>\n<td>\n          6.20\n        <\/td>\n<td>\n          55.063\n        <\/td>\n<td>\n          13.1\n        <\/td>\n<td>\n          102.3\n        <\/td>\n<td>\n          5.981\n        <\/td>\n<td>\n          4591\n        <\/td>\n<td>\n          36.7960\n        <\/td>\n<td>\n          1564.0\n        <\/td>\n<td>\n          39.4\n        <\/td>\n<\/tr>\n<tr>\n<th>\n          4\n        <\/th>\n<td>\n          1970-11-01\n        <\/td>\n<td>\n          84.28\n        <\/td>\n<td>\n          5.85\n        <\/td>\n<td>\n          110.1744\n        <\/td>\n<td>\n          7.28\n        <\/td>\n<td>\n          5.60\n        <\/td>\n<td>\n          55.865\n        <\/td>\n<td>\n          13.6\n        <\/td>\n<td>\n          105.8\n        <\/td>\n<td>\n          4.944\n        <\/td>\n<td>\n          4898\n        <\/td>\n<td>\n          36.5732\n        <\/td>\n<td>\n          1502.0\n        <\/td>\n<td>\n          39.6\n        <\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\">df = us_economic_data<\/code><\/pre>\n<\/div>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\"># Changing the column name and then setting the date as an index od the dataframe\ndf.rename(columns = {'Unnamed: 0':'date'}, inplace = True)\ndf['date'] = pd.to_datetime(df['date'])\ndf = df.set_index('date')<\/code><\/pre>\n<\/div>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\">df.head()<\/code><\/pre>\n<\/div>\n<div style=\"overflow-y: hidden;white-space: nowrap\">\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }<\/p>\n<p>    .dataframe tbody tr th {\n        vertical-align: top;\n    }<\/p>\n<p>    .dataframe thead th {\n        text-align: right;\n    }\n  <\/style>\n<table border=\"1\" class=\"dataframe\">\n<thead>\n<tr style=\"text-align: right;\">\n<th>\n          date\n        <\/th>\n<th>\n          SP500\n        <\/th>\n<th>\n          INTDSRUSM193N\n        <\/th>\n<th>\n          BUSLOANS\n        <\/th>\n<th>\n          MPRIME\n        <\/th>\n<th>\n          FEDFUNDS\n        <\/th>\n<th>\n          CURRCIR\n        <\/th>\n<th>\n          PSAVERT\n        <\/th>\n<th>\n          PMSAVE\n        <\/th>\n<th>\n          DAUTOSAAR\n        <\/th>\n<th>\n          UNEMPLOY\n        <\/th>\n<th>\n          INDPRO\n        <\/th>\n<th>\n          PERMIT\n        <\/th>\n<th>\n          CPIAUCSL\n        <\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<th>\n          1970-07-01\n        <\/th>\n<td>\n          75.72\n        <\/td>\n<td>\n          6.00\n        <\/td>\n<td>\n          107.6770\n        <\/td>\n<td>\n          8.00\n        <\/td>\n<td>\n          7.21\n        <\/td>\n<td>\n          54.699\n        <\/td>\n<td>\n          13.5\n        <\/td>\n<td>\n          104.0\n        <\/td>\n<td>\n          7.720\n        <\/td>\n<td>\n          4175\n        <\/td>\n<td>\n          37.8753\n        <\/td>\n<td>\n          1324.0\n        <\/td>\n<td>\n          38.9\n        <\/td>\n<\/tr>\n<tr>\n<th>\n          1970-08-01\n        <\/th>\n<td>\n          77.92\n        <\/td>\n<td>\n          6.00\n        <\/td>\n<td>\n          108.5407\n        <\/td>\n<td>\n          8.00\n        <\/td>\n<td>\n          6.62\n        <\/td>\n<td>\n          54.766\n        <\/td>\n<td>\n          13.4\n        <\/td>\n<td>\n          103.9\n        <\/td>\n<td>\n          7.595\n        <\/td>\n<td>\n          4256\n        <\/td>\n<td>\n          37.8077\n        <\/td>\n<td>\n          1394.0\n        <\/td>\n<td>\n          39.0\n        <\/td>\n<\/tr>\n<tr>\n<th>\n          1970-09-01\n        <\/th>\n<td>\n          82.58\n        <\/td>\n<td>\n          6.00\n        <\/td>\n<td>\n          109.5289\n        <\/td>\n<td>\n          7.83\n        <\/td>\n<td>\n          6.29\n        <\/td>\n<td>\n          54.931\n        <\/td>\n<td>\n          12.9\n        <\/td>\n<td>\n          100.3\n        <\/td>\n<td>\n          7.763\n        <\/td>\n<td>\n          4456\n        <\/td>\n<td>\n          37.5471\n        <\/td>\n<td>\n          1426.0\n        <\/td>\n<td>\n          39.2\n        <\/td>\n<\/tr>\n<tr>\n<th>\n          1970-10-01\n        <\/th>\n<td>\n          84.37\n        <\/td>\n<td>\n          6.00\n        <\/td>\n<td>\n          109.7740\n        <\/td>\n<td>\n          7.50\n        <\/td>\n<td>\n          6.20\n        <\/td>\n<td>\n          55.063\n        <\/td>\n<td>\n          13.1\n        <\/td>\n<td>\n          102.3\n        <\/td>\n<td>\n          5.981\n        <\/td>\n<td>\n          4591\n        <\/td>\n<td>\n          36.7960\n        <\/td>\n<td>\n          1564.0\n        <\/td>\n<td>\n          39.4\n        <\/td>\n<\/tr>\n<tr>\n<th>\n          1970-11-01\n        <\/th>\n<td>\n          84.28\n        <\/td>\n<td>\n          5.85\n        <\/td>\n<td>\n          110.1744\n        <\/td>\n<td>\n          7.28\n        <\/td>\n<td>\n          5.60\n        <\/td>\n<td>\n          55.865\n        <\/td>\n<td>\n          13.6\n        <\/td>\n<td>\n          105.8\n        <\/td>\n<td>\n          4.944\n        <\/td>\n<td>\n          4898\n        <\/td>\n<td>\n          36.5732\n        <\/td>\n<td>\n          1502.0\n        <\/td>\n<td>\n          39.6\n        <\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>S&amp;P500\u306e\u7d42\u5024\u304c\u5b9a\u5e38\u5024\u3067\u3042\u308b\u304b\u3069\u3046\u304b\u3092\u5224\u65ad\u3059\u308b\u305f\u3081\u306bAugmented Dickey-Fuller\u3092\u5b9f\u884c\u3057\u307e\u3057\u305f\u3002\u305d\u306e\u5f8c\u3001\u7d42\u5024\u3068\u5404\u72ec\u7acb\u5909\u6570\u306e\u9593\u306e\u30c7\u30fc\u30bf\u3092\u53ef\u8996\u5316\u3057\u3001\u5909\u6570\u9593\u306b\u7dda\u5f62\u95a2\u4fc2\u304c\u3042\u308b\u304b\u3069\u3046\u304b\u3092\u5224\u65ad\u3057\u3001\u7dda\u5f62\u95a2\u4fc2\u304c\u3042\u308b\u5909\u6570\u306e\u307f\u3092\u9078\u629e\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u306e\u5f8c\u3001VIF \u691c\u5b9a\u3092\u7528\u3044\u3066\u3001\u72ec\u7acb\u5909\u6570\u304c\u4e92\u3044\u306b\u76f8\u95a2\u3057\u3066\u3044\u308b\u304b\u3069\u3046\u304b\u3092\u78ba\u8a8d\u3057\u307e\u3057\u305f\u3002\u6700\u5f8c\u306b\u3001\u6307\u6a19\u306f\u7570\u306a\u308b\u5c3a\u5ea6\u3067\u6e2c\u5b9a\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3001z \u30b9\u30b3\u30a2\u57fa\u6e96\u3067\u30c7\u30fc\u30bf\u3092\u6b63\u898f\u5316\u3057\u3001\u6b63\u78ba\u3067\u4fe1\u983c\u6027\u306e\u9ad8\u3044\u30e2\u30fc\u30c9\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\">def tsplot(y, figsize=(12, 7), syle='bmh'):\n    \n    if not isinstance(y, pd.Series):\n        y = pd.Series(y)\n        \n    with plt.style.context(style='bmh'):\n        fig = plt.figure(figsize=figsize)\n        layout = (2,1)\n        ts_ax = plt.subplot2grid(layout, (0,0), colspan=2)\n        y.plot(ax=ts_ax)\n        p_value = sm.tsa.stattools.adfuller(y)[1]\n        ts_ax.set_title('Time Series Analysis Plotsn Dickey-Fuller: p={0:.5f}'.format(p_value))\n\n        plt.tight_layout()\n        \ntsplot(df['SP500'])\n\ndata_diff = df['SP500'] - df['SP500'].shift(1)\n\ntsplot(data_diff[1:])<\/code><\/pre>\n<\/div>\n<p><a href=\"https:\/\/griddb.net\/wp-content\/uploads\/2022\/03\/output_25_0.png\"><img fetchpriority=\"high\" decoding=\"async\" src=\"https:\/\/griddb.net\/wp-content\/uploads\/2022\/03\/output_25_0.png\" alt=\"\" width=\"856\" height=\"282\" class=\"aligncenter size-full wp-image-28084\" srcset=\"\/wp-content\/uploads\/2022\/03\/output_25_0.png 856w, \/wp-content\/uploads\/2022\/03\/output_25_0-300x99.png 300w, \/wp-content\/uploads\/2022\/03\/output_25_0-768x253.png 768w, \/wp-content\/uploads\/2022\/03\/output_25_0-600x198.png 600w\" sizes=\"(max-width: 856px) 100vw, 856px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/griddb.net\/wp-content\/uploads\/2022\/03\/output_25_1.png\"><img decoding=\"async\" src=\"https:\/\/griddb.net\/wp-content\/uploads\/2022\/03\/output_25_1.png\" alt=\"\" width=\"856\" height=\"282\" class=\"aligncenter size-full wp-image-28084\" \/><\/a><\/p>\n<p>Dickey Fuller \u691c\u5b9a\u306e\u4eee\u8aac\u306e\u4fe1\u983c\u6c34\u6e96\u30925\uff05\u3068\u3059\u308b\u3068\uff0cp\u5024 \u306f0.05\u3088\u308a\u306f\u308b\u304b\u306b\u5927\u304d\u3044\u306e\u3067\uff0cS&amp;P 500\u306f\u5b9a\u5e38\u7684\u3067\u306f\u306a\u3044\u3053\u3068\u304c\u5206\u304b\u308a\u307e\u3059\u3002<\/p>\n<p>\u30c7\u30fc\u30bf\u3092\u5b9a\u5e38\u5316\u3059\u308b\u305f\u3081\u306b\u306f\u3001\u5f53\u6708\u4fa1\u683c\u304b\u3089\u524d\u6708\u4fa1\u683c\u3092\u5f15\u3044\u305f\u65b0\u3057\u3044\u5f93\u5c5e\u5909\u6570\u3092\u4f5c\u6210\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3057\u305f\u3002\u3053\u306e\u5834\u5408\u3001\u524d\u8ff0\u306e\u30c6\u30b9\u30c8\u304c\u518d\u8a08\u7b97\u3055\u308c\u3001pvalue\u304c0\u306b\u306a\u3063\u305f\u306e\u3067\u3001\u30c7\u30fc\u30bf\u306f\u5b9a\u5e38\u3067\u3042\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u6b21\u306e\u30b9\u30c6\u30c3\u30d7\u306f\u3001\u72ec\u7acb\u5909\u6570\u304c\u304a\u4e92\u3044\u306b\u76f8\u95a2\u3057\u3066\u3044\u306a\u3044\u304b\u3069\u3046\u304b\u3092\u898b\u3064\u3051\u308b\u3053\u3068\u3067\u3059\u3002\u3053\u306e\u76ee\u7684\u306e\u305f\u3081\u306b\u3001VIF \u691c\u5b9a\u304c\u9078\u3070\u308c\u307e\u3057\u305f\u3002Variance Inflating Factor (VIF) \u306f\u3001\u56de\u5e30\u30e2\u30c7\u30eb\u3067\u306e\u591a\u91cd\u5171\u7dda\u6027\u306e\u5b58\u5728\u3092\u691c\u5b9a\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3055\u308c\u307e\u3059\u3002<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\">df.columns<\/code><\/pre>\n<\/div>\n<pre><code>Index(['SP500', 'INTDSRUSM193N', 'BUSLOANS', 'MPRIME', 'FEDFUNDS', 'CURRCIR',\n       'PSAVERT', 'PMSAVE', 'DAUTOSAAR', 'UNEMPLOY', 'INDPRO', 'PERMIT',\n       'CPIAUCSL'],\n      dtype='object')\n<\/code><\/pre>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\"># the independent variables set\nX = df[['INTDSRUSM193N', 'BUSLOANS', 'MPRIME', 'FEDFUNDS', 'CURRCIR',\n       'PSAVERT', 'PMSAVE', 'DAUTOSAAR', 'UNEMPLOY', 'INDPRO', 'PERMIT',\n       'CPIAUCSL']]\n  \n# VIF dataframe\nvif_data = pd.DataFrame()\nvif_data[\"feature\"] = X.columns\n  \n# calculating VIF for each feature\nvif_data[\"VIF\"] = [variance_inflation_factor(X.values, i)\n                          for i in range(len(X.columns))]\n  \nprint(vif_data)<\/code><\/pre>\n<\/div>\n<pre><code>          feature         VIF\n0   INTDSRUSM193N  130.622837\n1        BUSLOANS  147.284028\n2          MPRIME  399.916868\n3        FEDFUNDS  145.507021\n4         CURRCIR  112.882897\n5         PSAVERT   63.436200\n6          PMSAVE   68.862740\n7       DAUTOSAAR   60.502647\n8        UNEMPLOY   54.757359\n9          INDPRO  464.500794\n10         PERMIT   34.696174\n11       CPIAUCSL  897.072035\n<\/code><\/pre>\n<p>\u8868\u304b\u3089\u3001\u5404\u5909\u6570\u306eVIF\u30c6\u30b9\u30c8\u5024\u304c10\u3092\u5927\u304d\u304f\u8d85\u3048\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002\u3053\u306e\u5834\u5408\u3001\u6700\u3082\u9ad8\u3044VIF\u5024\u3092\u6301\u3064\u6307\u6a19\u306f\u9664\u53bb\u3055\u308c\u3001\u30bb\u30c3\u30c8\u5168\u4f53\u304c\u518d\u8a08\u7b97\u3055\u308c\u307e\u3059\u3002\u3053\u308c\u306f\u300110\u3088\u308a\u5c0f\u3055\u3044\u5024\u3092\u6301\u3064\u3059\u3079\u3066\u306e\u5909\u6570\u304c\u6b8b\u3063\u3066\u3044\u308b\u9650\u308a\u3001\u884c\u308f\u308c\u307e\u3059\u3002<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\"># the independent variables set\nX = df[[  'FEDFUNDS', 'CURRCIR','PSAVERT', 'PERMIT',]]\n  \n# VIF dataframe\nvif_data = pd.DataFrame()\nvif_data[\"feature\"] = X.columns\n  \n# calculating VIF for each feature\nvif_data[\"VIF\"] = [variance_inflation_factor(X.values, i)\n                          for i in range(len(X.columns))]\n  \nprint(vif_data)<\/code><\/pre>\n<\/div>\n<pre><code>    feature       VIF\n0  FEDFUNDS  5.228717\n1   CURRCIR  2.532886\n2   PSAVERT  8.150866\n3    PERMIT  7.039288\n<\/code><\/pre>\n<p>\u305d\u306e\u7d50\u679c\u300111\u500b\u306f\u30c7\u30fc\u30bf\u304c\u7dda\u5f62\u3067\u3042\u308b\u3079\u304d\u3068\u3044\u3046\u7dda\u5f62\u56de\u5e30\u306e\u6cd5\u5247\u306b\u5408\u81f4\u3057\u306a\u3044\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u7b2c2\u6bb5\u968e\u306e\u6700\u5f8c\u306f\u3001\u3053\u308c\u3089\u306e3\u3064\u306e\u6307\u6a19\u3068S&amp;P500\u6307\u6570\u306e\u4fa1\u683c\u30c7\u30fc\u30bf\u3092\u4e00\u7dd2\u306b\u3057\u3066\u3001z score\u57fa\u6e96\u3067\u6b63\u898f\u5316\u3059\u308b\u3053\u3068\u3067\u3059\u3002<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\">df_new = df[['SP500','FEDFUNDS','CURRCIR','PSAVERT','PERMIT']]<\/code><\/pre>\n<\/div>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\">df_z_scaled = df_new.copy()\n  \n# apply normalization techniques\nfor column in df_z_scaled.columns:\n    df_z_scaled[column] = (df_z_scaled[column] -\n                           df_z_scaled[column].mean()) \/ df_z_scaled[column].std()    \n  \n# view normalized data   \ndf_z_scaled.head()<\/code><\/pre>\n<\/div>\n<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }<\/p>\n<p>    .dataframe tbody tr th {\n        vertical-align: top;\n    }<\/p>\n<p>    .dataframe thead th {\n        text-align: right;\n    }\n  <\/style>\n<table border=\"1\" class=\"dataframe\">\n<thead>\n<tr style=\"text-align: right;\">\n<th>\n          date\n        <\/th>\n<th>\n          SP500\n        <\/th>\n<th>\n          FEDFUNDS\n        <\/th>\n<th>\n          CURRCIR\n        <\/th>\n<th>\n          PSAVERT\n        <\/th>\n<th>\n          PERMIT\n        <\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<th>\n          1970-07-01\n        <\/th>\n<td>\n          -1.019219\n        <\/td>\n<td>\n          0.500923\n        <\/td>\n<td>\n          -1.065075\n        <\/td>\n<td>\n          1.792466\n        <\/td>\n<td>\n          -0.165538\n        <\/td>\n<\/tr>\n<tr>\n<th>\n          1970-08-01\n        <\/th>\n<td>\n          -1.015924\n        <\/td>\n<td>\n          0.351568\n        <\/td>\n<td>\n          -1.064918\n        <\/td>\n<td>\n          1.758546\n        <\/td>\n<td>\n          0.002858\n        <\/td>\n<\/tr>\n<tr>\n<th>\n          1970-09-01\n        <\/th>\n<td>\n          -1.008946\n        <\/td>\n<td>\n          0.268030\n        <\/td>\n<td>\n          -1.064531\n        <\/td>\n<td>\n          1.588943\n        <\/td>\n<td>\n          0.079839\n        <\/td>\n<\/tr>\n<tr>\n<th>\n          1970-10-01\n        <\/th>\n<td>\n          -1.006266\n        <\/td>\n<td>\n          0.245247\n        <\/td>\n<td>\n          -1.064222\n        <\/td>\n<td>\n          1.656784\n        <\/td>\n<td>\n          0.411821\n        <\/td>\n<\/tr>\n<tr>\n<th>\n          1970-11-01\n        <\/th>\n<td>\n          -1.006401\n        <\/td>\n<td>\n          0.093359\n        <\/td>\n<td>\n          -1.062341\n        <\/td>\n<td>\n          1.826387\n        <\/td>\n<td>\n          0.262670\n        <\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h1>5&#46; \u6a5f\u68b0\u5b66\u7fd2\u30e2\u30c7\u30eb\u306e\u69cb\u7bc9<\/h1>\n<p>\u305d\u308c\u3067\u306f\u3001\u30af\u30ec\u30b8\u30c3\u30c8\u30ab\u30fc\u30c9\u306e\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u306b\u5bfe\u3057\u3066\u3001\u6a5f\u68b0\u5b66\u7fd2\u30e2\u30c7\u30eb\u3092\u69cb\u7bc9\u3057\u3001\u8a55\u4fa1\u3059\u308b\u4f5c\u696d\u3092\u9032\u3081\u307e\u3057\u3087\u3046\u3002\u307e\u305a\u3001\u30e2\u30c7\u30eb\u306e\u300c\u7279\u5fb4\u300d\u3068\u300c\u30e9\u30d9\u30eb\u300d\u3092\u4f5c\u6210\u3057\u3001\u8a13\u7df4\u7528\u3068\u30c6\u30b9\u30c8\u7528\u306b\u30b5\u30f3\u30d7\u30eb\u3092\u5206\u5272\u3057\u307e\u3059\u3002\u30c6\u30b9\u30c8\u30b5\u30f3\u30d7\u30eb\u306f\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u5168\u4f53\u306e20%\u3068\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\">features = df_z_scaled.drop(columns = ['SP500'], axis = 1)\nlabels = df_z_scaled[['SP500']]\n\nX_train, X_test, y_train, y_test = train_test_split(features, labels, test_size = 0.2, random_state = 0)<\/code><\/pre>\n<\/div>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\">print(f\"Shape of training data: {X_train.shape}\")\nprint(f\"Shape of the training target data: {y_train.shape}\")\n\nprint(f\"Shape of test data: {X_test.shape}\")\nprint(f\"Shape of the test target data: {y_test.shape}\")<\/code><\/pre>\n<\/div>\n<pre><code>Shape of training data: (459, 4)\nShape of the training target data: (459, 1)\nShape of test data: (115, 4)\nShape of the test target data: (115, 1)\n<\/code><\/pre>\n<p>\u7b2c3\u6bb5\u968e\u3068\u3057\u3066\u3001\u30d9\u30fc\u30b9\u30e9\u30a4\u30f3\u3068\u306a\u308b\u7d71\u8a08\u7684\u7dda\u5f62\u56de\u5e30\u30e2\u30c7\u30eb\u3092\u69cb\u7bc9\u3059\u308b\u3068\u3053\u308d\u304b\u3089\u30b9\u30bf\u30fc\u30c8\u3057\u307e\u3057\u305f\u3002<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\">regr = LinearRegression()\n  \nregr.fit(X_train, y_train)\nprint(regr.score(X_test, y_test))<\/code><\/pre>\n<\/div>\n<pre><code>0.9351836569209164\n<\/code><\/pre>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\">coefficients = pd.concat([pd.DataFrame(X.columns),pd.DataFrame(np.transpose(regr.coef_))], axis = 1)\ncoefficients<\/code><\/pre>\n<\/div>\n<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }<\/p>\n<p>    .dataframe tbody tr th {\n        vertical-align: top;\n    }<\/p>\n<p>    .dataframe thead th {\n        text-align: right;\n    }\n  <\/style>\n<table border=\"1\" class=\"dataframe\">\n<thead>\n<tr style=\"text-align: right;\">\n<th>\n        <\/th>\n<th>\n          0\n        <\/th>\n<th>\n          0\n        <\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<th>\n          0\n        <\/th>\n<td>\n          FEDFUNDS\n        <\/td>\n<td>\n          0.083735\n        <\/td>\n<\/tr>\n<tr>\n<th>\n          1\n        <\/th>\n<td>\n          CURRCIR\n        <\/td>\n<td>\n          1.003270\n        <\/td>\n<\/tr>\n<tr>\n<th>\n          2\n        <\/th>\n<td>\n          PSAVERT\n        <\/td>\n<td>\n          -0.087568\n        <\/td>\n<\/tr>\n<tr>\n<th>\n          3\n        <\/th>\n<td>\n          PERMIT\n        <\/td>\n<td>\n          0.116120\n        <\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p><code>\u6d41\u901a\u8ca8\u5e63\u91cf<\/code>\u306f\u6700\u3082\u9ad8\u3044\u4fc2\u6570\u3092\u6301\u3061\u3001\u3053\u308c\u306f\u30e2\u30c7\u30eb\u3078\u306e\u5f71\u97ff\u304c\u5927\u304d\u3044\u3053\u3068\u3092\u610f\u5473\u3057\u307e\u3059\u3002<\/p>\n<p>\u5b66\u7fd2\u30c7\u30fc\u30bf\u306b\u5bfe\u3057\u3066\u30e2\u30c7\u30eb\u306e\u9069\u5408\u304c\u5b8c\u4e86\u3057\u305f\u3089\u3001\u30e2\u30c7\u30eb\u306e\u6027\u80fd\u3092\u8a55\u4fa1\u3059\u308b\u305f\u3081\u306b\u30c6\u30b9\u30c8\u30bb\u30c3\u30c8\u306b\u5bfe\u3057\u3066\u4e88\u6e2c\u3092\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4e88\u6e2c\u5024\u306f <code>predicted<\/code> \u306b\u683c\u7d0d\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><code>\u8a55\u4fa1\u6307\u6a19<\/code>:<br \/>\n1) \u6c7a\u5b9a\u4fc2\u6570(R^2)\u3002\u3053\u308c\u306f\u30c7\u30fc\u30bf\u306b\u5bfe\u3059\u308b\u30e2\u30c7\u30eb\u306e\u4fe1\u983c\u5ea6\u3092\u793a\u3059\u6700\u3082\u91cd\u8981\u306a\u6307\u6a19\u3067\u3042\u308a\u3001\u56de\u5e30\u30e2\u30c7\u30eb\u306e\u8aac\u660e\u306b\u306f\u5fc5\u305a\u5fc5\u8981\u3067\u3059\u3002<br \/>\n2) \u5e73\u5747\u4e8c\u4e57\u8aa4\u5dee(MSE)\u3002\u3053\u306e\u5024\u306f\u5b9f\u969b\u306e\u5024\u3068\u4e88\u6e2c\u5024\u306e\u9593\u306e\u4e8c\u4e57\u5e73\u5747\u5e73\u65b9\u6839\u8aa4\u5dee\u3092\u6e2c\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\">y_pred = regr.predict(X_test)\nmse = mean_squared_error(y_test, y_pred)\nprint(\"MSE: \", mse)\nprint(\"RMSE: \", mse*(1\/2.0)) \n\nr2 = r2_score(y_test, y_pred)\nprint('r2 score for Random Forest model is', r2)<\/code><\/pre>\n<\/div>\n<pre><code>MSE:  0.06275016232171571\nRMSE:  0.031375081160857854\nr2 score for Random Forest model is 0.9351836569209164\n<\/code><\/pre>\n<p><code>\u30e9\u30f3\u30c0\u30e0\u30d5\u30a9\u30ec\u30b9\u30c8\u56de\u5e30<\/code>\u306f\u3001\u6a39\u6728\u306e\u30a2\u30f3\u30b5\u30f3\u30d6\u30eb\u5b66\u7fd2\u306e\u624b\u6cd5\u3067\u3059\u3002\u6728\u306b\u57fa\u3065\u304f\u4e88\u6e2c\u306f\u591a\u304f\u306e\u4e88\u6e2c\u3092\u8003\u616e\u3059\u308b\u305f\u3081\u3088\u308a\u6b63\u78ba\u3067\u3059\u3002\u3053\u308c\u306f\u5e73\u5747\u5024\u3092\u7528\u3044\u308b\u305f\u3081\u3067\u3059\u3002\u3053\u308c\u3089\u306e\u30a2\u30eb\u30b4\u30ea\u30ba\u30e0\u306f\u3088\u308a\u5b89\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002\u306a\u305c\u306a\u3089\u3001\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u306b\u4f55\u3089\u304b\u306e\u5909\u66f4\u304c\u3042\u3063\u305f\u5834\u5408\u30011\u3064\u306e\u6728\u306b\u306f\u5f71\u97ff\u3092\u4e0e\u3048\u308b\u304c\u3001\u6728\u306e\u68ee\u306b\u306f\u5f71\u97ff\u3092\u4e0e\u3048\u306a\u3044\u304b\u3089\u3067\u3059\u3002<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\">rfr = RandomForestRegressor()\nrfr.fit(X_train, y_train)\n\nscore = rfr.score(X_train, y_train)\nprint(\"R-squared:\", score)<\/code><\/pre>\n<\/div>\n<pre><code>R-squared: 0.9993703842202256\n<\/code><\/pre>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\">ypred = rfr.predict(X_test)\n\nmse = mean_squared_error(y_test, ypred)\nprint(\"MSE: \", mse)\nprint(\"RMSE: \", mse*(1\/2.0)) \n\nr2 = r2_score(y_test, ypred)\nprint('r2 score for Random Forest model is', r2)<\/code><\/pre>\n<\/div>\n<pre><code>MSE:  0.0031918233911353254\nRMSE:  0.0015959116955676627\nr2 score for Random Forest model is 0.9967030791266005\n<\/code><\/pre>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\">plt.figure(figsize=(5,5))\nplt.scatter(y_test['SP500'].values, ypred, c='crimson')\n\np1 = max(max(ypred), max(y_test['SP500'].values))\np2 = min(min(ypred), min(y_test['SP500'].values))\nplt.plot([p1, p2], [p1, p2], 'b-')\nplt.xlabel('True Values', fontsize=15)\nplt.ylabel('Predictions', fontsize=15)\nplt.axis('equal')\nplt.show()<\/code><\/pre>\n<\/div>\n<p><a href=\"https:\/\/griddb.net\/wp-content\/uploads\/2022\/03\/output_47_0.png\"><img decoding=\"async\" src=\"https:\/\/griddb.net\/wp-content\/uploads\/2022\/03\/output_47_0.png\" alt=\"\" width=\"856\" height=\"282\" class=\"aligncenter size-full wp-image-28084\" \/><\/a><\/p>\n<h3>\u30d9\u30fc\u30b9\u30e9\u30a4\u30f3\u3068Random Forest\u30e2\u30c7\u30eb\u306e\u6bd4\u8f03<\/h3>\n<p>Random Forest\u30e2\u30c7\u30eb\u306f\u3001\u6700\u3082\u9ad8\u3044R2\u3068\u6700\u3082\u4f4e\u3044\u30a8\u30e9\u30fc\u30ec\u30fc\u30c8\u3092\u63d0\u4f9b\u3059\u308b\u305f\u3081\u3001\u3088\u308a\u512a\u308c\u305f\u6a5f\u68b0\u5b66\u7fd2\u30e2\u30c7\u30eb\u3067\u3042\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3057\u305f\u3002\u7d71\u8a08\u7684\u7dda\u5f62\u56de\u5e30\u30e2\u30c7\u30eb\u306f6 %\u6539\u5584\u3055\u308c\u3001\u30a8\u30e9\u30fc\u30ec\u30fc\u30c8\u306f20\u500d\u6e1b\u5c11\u3057\u307e\u3057\u305f\u3002<\/p>\n<h1>6&#46; \u307e\u3068\u3081<\/h1>\n<p>\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001\u682a\u5f0f\u5e02\u5834\u3001\u7279\u306bS&amp;P500\u6307\u6570\u306b\u6700\u3082\u5927\u304d\u306a\u5f71\u97ff\u3092\u4e0e\u3048\u308b\u53ef\u80fd\u6027\u306e\u3042\u308b13\u306e\u6307\u6a19\u3092\u7279\u5b9a\u3057\u307e\u3057\u305f\u3002\u30c7\u30fc\u30bf\u3092\u8aad\u307f\u8fbc\u3080\u65b9\u6cd5\u3068\u3057\u3066\u3001(1) GridDB \u3068 (2) Pandas \u306e2\u3064\u306e\u65b9\u6cd5\u3092\u691c\u8a0e\u3057\u307e\u3057\u305f\u3002GridDB\u306f\u3001\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u3067\u62e1\u5f35\u6027\u304c\u9ad8\u3044\u305f\u3081\u3001\u5927\u898f\u6a21\u306a\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u3092\u6271\u3046\u5834\u5408\u3001\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u306b\u30c7\u30fc\u30bf\u3092\u53d6\u308a\u8fbc\u3080\u305f\u3081\u306e\u512a\u308c\u305f\u4ee3\u66ff\u624b\u6bb5\u3068\u306a\u308a\u307e\u3059\u3002<a href=\"https:\/\/griddb.net\/ja\/downloads\/\">GridDB\u3092\u4eca\u3059\u3050\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9<\/a>\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7d4c\u6e08\u6307\u6a19\u3068\u5e83\u304f\u77e5\u3089\u308c\u305f\u7d71\u8a08\u7684\u624b\u6cd5\u3092\u4f7f\u3063\u3066\u682a\u4fa1\u3092\u4e88\u6e2c\u3059\u308b\u6570\u591a\u304f\u306e\u7814\u7a76\u304c\u3053\u308c\u307e\u3067\u306b\u884c\u308f\u308c\u3066\u304d\u307e\u3057\u305f\u3002\u305d\u3057\u30662010\u5e74\u4ee5\u964d\u306e\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u306e\u6027\u80fd\u306e\u4e0a\u6607\u306b\u3088\u308a\u3001\u6a5f\u68b0\u5b66\u7fd2\u306b\u3088\u308b\u65b0\u3057\u3044\u624b\u6cd5\u304c\u958b\u767a\u3055\u308c\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3057\u305f\u3002\u305d\u308c\u3089\u306e\u30a2\u30eb\u30b4\u30ea [&hellip;]<\/p>\n","protected":false},"author":41,"featured_media":49370,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1005],"tags":[],"class_list":["post-50788","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-1005"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Python\u3068GridDB\u3092\u7528\u3044\u305f\u7c73\u56fd\u7d4c\u6e08\u6307\u6a19\u306b\u57fa\u3065\u304fS&amp;P500\u6307\u6570\u4fa1\u683c\u306e\u30e2\u30c7\u30eb\u5316 | GridDB: Open Source Time Series Database for IoT<\/title>\n<meta name=\"description\" content=\"\u7d4c\u6e08\u6307\u6a19\u3068\u5e83\u304f\u77e5\u3089\u308c\u305f\u7d71\u8a08\u7684\u624b\u6cd5\u3092\u4f7f\u3063\u3066\u682a\u4fa1\u3092\u4e88\u6e2c\u3059\u308b\u6570\u591a\u304f\u306e\u7814\u7a76\u304c\u3053\u308c\u307e\u3067\u306b\u884c\u308f\u308c\u3066\u304d\u307e\u3057\u305f\u3002\u305d\u3057\u30662010\u5e74\u4ee5\u964d\u306e\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u306e\u6027\u80fd\u306e\u4e0a\u6607\u306b\u3088\u308a\u3001\u6a5f\u68b0\u5b66\u7fd2\u306b\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/griddb.net\/ja\/\u672a\u5206\u985e\/modelling-sp-500-index-price-based-on-u-s-economic-indicators-using-python-and-griddb\/\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python\u3068GridDB\u3092\u7528\u3044\u305f\u7c73\u56fd\u7d4c\u6e08\u6307\u6a19\u306b\u57fa\u3065\u304fS&amp;P500\u6307\u6570\u4fa1\u683c\u306e\u30e2\u30c7\u30eb\u5316 | GridDB: Open Source Time Series Database for IoT\" \/>\n<meta property=\"og:description\" content=\"\u7d4c\u6e08\u6307\u6a19\u3068\u5e83\u304f\u77e5\u3089\u308c\u305f\u7d71\u8a08\u7684\u624b\u6cd5\u3092\u4f7f\u3063\u3066\u682a\u4fa1\u3092\u4e88\u6e2c\u3059\u308b\u6570\u591a\u304f\u306e\u7814\u7a76\u304c\u3053\u308c\u307e\u3067\u306b\u884c\u308f\u308c\u3066\u304d\u307e\u3057\u305f\u3002\u305d\u3057\u30662010\u5e74\u4ee5\u964d\u306e\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u306e\u6027\u80fd\u306e\u4e0a\u6607\u306b\u3088\u308a\u3001\u6a5f\u68b0\u5b66\u7fd2\u306b\" \/>\n<meta property=\"og:url\" content=\"https:\/\/griddb.net\/ja\/\u672a\u5206\u985e\/modelling-sp-500-index-price-based-on-u-s-economic-indicators-using-python-and-griddb\/\" \/>\n<meta property=\"og:site_name\" content=\"GridDB: Open Source Time Series Database for IoT\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/griddbcommunity\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-03-23T07:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-11-14T15:55:15+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/griddb.net\/wp-content\/uploads\/2022\/03\/macbook-air-iphone-038-stocks-scaled.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"2560\" \/>\n\t<meta property=\"og:image:height\" content=\"1700\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"griddb-admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@GridDBCommunity\" \/>\n<meta name=\"twitter:site\" content=\"@GridDBCommunity\" \/>\n<meta name=\"twitter:label1\" content=\"\u57f7\u7b46\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"griddb-admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"5\u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/griddb.net\/ja\/%e6%9c%aa%e5%88%86%e9%a1%9e\/modelling-sp-500-index-price-based-on-u-s-economic-indicators-using-python-and-griddb\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/griddb.net\/ja\/%e6%9c%aa%e5%88%86%e9%a1%9e\/modelling-sp-500-index-price-based-on-u-s-economic-indicators-using-python-and-griddb\/\"},\"author\":{\"name\":\"griddb-admin\",\"@id\":\"https:\/\/griddb.net\/en\/#\/schema\/person\/4fe914ca9576878e82f5e8dd3ba52233\"},\"headline\":\"Python\u3068GridDB\u3092\u7528\u3044\u305f\u7c73\u56fd\u7d4c\u6e08\u6307\u6a19\u306b\u57fa\u3065\u304fS&#038;P500\u6307\u6570\u4fa1\u683c\u306e\u30e2\u30c7\u30eb\u5316\",\"datePublished\":\"2022-03-23T07:00:00+00:00\",\"dateModified\":\"2025-11-14T15:55:15+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/griddb.net\/ja\/%e6%9c%aa%e5%88%86%e9%a1%9e\/modelling-sp-500-index-price-based-on-u-s-economic-indicators-using-python-and-griddb\/\"},\"wordCount\":223,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/griddb.net\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/griddb.net\/ja\/%e6%9c%aa%e5%88%86%e9%a1%9e\/modelling-sp-500-index-price-based-on-u-s-economic-indicators-using-python-and-griddb\/#primaryimage\"},\"thumbnailUrl\":\"\/wp-content\/uploads\/2022\/03\/macbook-air-iphone-038-stocks-scaled.jpg\",\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/griddb.net\/ja\/%e6%9c%aa%e5%88%86%e9%a1%9e\/modelling-sp-500-index-price-based-on-u-s-economic-indicators-using-python-and-griddb\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/griddb.net\/ja\/%e6%9c%aa%e5%88%86%e9%a1%9e\/modelling-sp-500-index-price-based-on-u-s-economic-indicators-using-python-and-griddb\/\",\"url\":\"https:\/\/griddb.net\/ja\/%e6%9c%aa%e5%88%86%e9%a1%9e\/modelling-sp-500-index-price-based-on-u-s-economic-indicators-using-python-and-griddb\/\",\"name\":\"Python\u3068GridDB\u3092\u7528\u3044\u305f\u7c73\u56fd\u7d4c\u6e08\u6307\u6a19\u306b\u57fa\u3065\u304fS&P500\u6307\u6570\u4fa1\u683c\u306e\u30e2\u30c7\u30eb\u5316 | GridDB: Open Source Time Series Database for IoT\",\"isPartOf\":{\"@id\":\"https:\/\/griddb.net\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/griddb.net\/ja\/%e6%9c%aa%e5%88%86%e9%a1%9e\/modelling-sp-500-index-price-based-on-u-s-economic-indicators-using-python-and-griddb\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/griddb.net\/ja\/%e6%9c%aa%e5%88%86%e9%a1%9e\/modelling-sp-500-index-price-based-on-u-s-economic-indicators-using-python-and-griddb\/#primaryimage\"},\"thumbnailUrl\":\"\/wp-content\/uploads\/2022\/03\/macbook-air-iphone-038-stocks-scaled.jpg\",\"datePublished\":\"2022-03-23T07:00:00+00:00\",\"dateModified\":\"2025-11-14T15:55:15+00:00\",\"description\":\"\u7d4c\u6e08\u6307\u6a19\u3068\u5e83\u304f\u77e5\u3089\u308c\u305f\u7d71\u8a08\u7684\u624b\u6cd5\u3092\u4f7f\u3063\u3066\u682a\u4fa1\u3092\u4e88\u6e2c\u3059\u308b\u6570\u591a\u304f\u306e\u7814\u7a76\u304c\u3053\u308c\u307e\u3067\u306b\u884c\u308f\u308c\u3066\u304d\u307e\u3057\u305f\u3002\u305d\u3057\u30662010\u5e74\u4ee5\u964d\u306e\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u306e\u6027\u80fd\u306e\u4e0a\u6607\u306b\u3088\u308a\u3001\u6a5f\u68b0\u5b66\u7fd2\u306b\",\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/griddb.net\/ja\/%e6%9c%aa%e5%88%86%e9%a1%9e\/modelling-sp-500-index-price-based-on-u-s-economic-indicators-using-python-and-griddb\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/griddb.net\/ja\/%e6%9c%aa%e5%88%86%e9%a1%9e\/modelling-sp-500-index-price-based-on-u-s-economic-indicators-using-python-and-griddb\/#primaryimage\",\"url\":\"\/wp-content\/uploads\/2022\/03\/macbook-air-iphone-038-stocks-scaled.jpg\",\"contentUrl\":\"\/wp-content\/uploads\/2022\/03\/macbook-air-iphone-038-stocks-scaled.jpg\",\"width\":2560,\"height\":1700},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/griddb.net\/en\/#website\",\"url\":\"https:\/\/griddb.net\/en\/\",\"name\":\"GridDB: Open Source Time Series Database for IoT\",\"description\":\"GridDB is an open source time-series database with the performance of NoSQL and convenience of SQL\",\"publisher\":{\"@id\":\"https:\/\/griddb.net\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/griddb.net\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ja\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/griddb.net\/en\/#organization\",\"name\":\"Fixstars\",\"url\":\"https:\/\/griddb.net\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/griddb.net\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/griddb.net\/wp-content\/uploads\/2019\/04\/fixstars_logo_web_tagline.png\",\"contentUrl\":\"https:\/\/griddb.net\/wp-content\/uploads\/2019\/04\/fixstars_logo_web_tagline.png\",\"width\":200,\"height\":83,\"caption\":\"Fixstars\"},\"image\":{\"@id\":\"https:\/\/griddb.net\/en\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/griddbcommunity\/\",\"https:\/\/x.com\/GridDBCommunity\",\"https:\/\/www.linkedin.com\/company\/griddb-by-toshiba\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/griddb.net\/en\/#\/schema\/person\/4fe914ca9576878e82f5e8dd3ba52233\",\"name\":\"griddb-admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/griddb.net\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/5bceca1cafc06886a7ba873e2f0a28011a1176c4dea59709f735b63ae30d0342?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/5bceca1cafc06886a7ba873e2f0a28011a1176c4dea59709f735b63ae30d0342?s=96&d=mm&r=g\",\"caption\":\"griddb-admin\"},\"url\":\"https:\/\/griddb.net\/ja\/author\/griddb-admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python\u3068GridDB\u3092\u7528\u3044\u305f\u7c73\u56fd\u7d4c\u6e08\u6307\u6a19\u306b\u57fa\u3065\u304fS&P500\u6307\u6570\u4fa1\u683c\u306e\u30e2\u30c7\u30eb\u5316 | GridDB: Open Source Time Series Database for IoT","description":"\u7d4c\u6e08\u6307\u6a19\u3068\u5e83\u304f\u77e5\u3089\u308c\u305f\u7d71\u8a08\u7684\u624b\u6cd5\u3092\u4f7f\u3063\u3066\u682a\u4fa1\u3092\u4e88\u6e2c\u3059\u308b\u6570\u591a\u304f\u306e\u7814\u7a76\u304c\u3053\u308c\u307e\u3067\u306b\u884c\u308f\u308c\u3066\u304d\u307e\u3057\u305f\u3002\u305d\u3057\u30662010\u5e74\u4ee5\u964d\u306e\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u306e\u6027\u80fd\u306e\u4e0a\u6607\u306b\u3088\u308a\u3001\u6a5f\u68b0\u5b66\u7fd2\u306b","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:\/\/griddb.net\/ja\/\u672a\u5206\u985e\/modelling-sp-500-index-price-based-on-u-s-economic-indicators-using-python-and-griddb\/","og_locale":"ja_JP","og_type":"article","og_title":"Python\u3068GridDB\u3092\u7528\u3044\u305f\u7c73\u56fd\u7d4c\u6e08\u6307\u6a19\u306b\u57fa\u3065\u304fS&P500\u6307\u6570\u4fa1\u683c\u306e\u30e2\u30c7\u30eb\u5316 | GridDB: Open Source Time Series Database for IoT","og_description":"\u7d4c\u6e08\u6307\u6a19\u3068\u5e83\u304f\u77e5\u3089\u308c\u305f\u7d71\u8a08\u7684\u624b\u6cd5\u3092\u4f7f\u3063\u3066\u682a\u4fa1\u3092\u4e88\u6e2c\u3059\u308b\u6570\u591a\u304f\u306e\u7814\u7a76\u304c\u3053\u308c\u307e\u3067\u306b\u884c\u308f\u308c\u3066\u304d\u307e\u3057\u305f\u3002\u305d\u3057\u30662010\u5e74\u4ee5\u964d\u306e\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u306e\u6027\u80fd\u306e\u4e0a\u6607\u306b\u3088\u308a\u3001\u6a5f\u68b0\u5b66\u7fd2\u306b","og_url":"https:\/\/griddb.net\/ja\/\u672a\u5206\u985e\/modelling-sp-500-index-price-based-on-u-s-economic-indicators-using-python-and-griddb\/","og_site_name":"GridDB: Open Source Time Series Database for IoT","article_publisher":"https:\/\/www.facebook.com\/griddbcommunity\/","article_published_time":"2022-03-23T07:00:00+00:00","article_modified_time":"2025-11-14T15:55:15+00:00","og_image":[{"width":2560,"height":1700,"url":"https:\/\/griddb.net\/wp-content\/uploads\/2022\/03\/macbook-air-iphone-038-stocks-scaled.jpg","type":"image\/jpeg"}],"author":"griddb-admin","twitter_card":"summary_large_image","twitter_creator":"@GridDBCommunity","twitter_site":"@GridDBCommunity","twitter_misc":{"\u57f7\u7b46\u8005":"griddb-admin","\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593":"5\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/griddb.net\/ja\/%e6%9c%aa%e5%88%86%e9%a1%9e\/modelling-sp-500-index-price-based-on-u-s-economic-indicators-using-python-and-griddb\/#article","isPartOf":{"@id":"https:\/\/griddb.net\/ja\/%e6%9c%aa%e5%88%86%e9%a1%9e\/modelling-sp-500-index-price-based-on-u-s-economic-indicators-using-python-and-griddb\/"},"author":{"name":"griddb-admin","@id":"https:\/\/griddb.net\/en\/#\/schema\/person\/4fe914ca9576878e82f5e8dd3ba52233"},"headline":"Python\u3068GridDB\u3092\u7528\u3044\u305f\u7c73\u56fd\u7d4c\u6e08\u6307\u6a19\u306b\u57fa\u3065\u304fS&#038;P500\u6307\u6570\u4fa1\u683c\u306e\u30e2\u30c7\u30eb\u5316","datePublished":"2022-03-23T07:00:00+00:00","dateModified":"2025-11-14T15:55:15+00:00","mainEntityOfPage":{"@id":"https:\/\/griddb.net\/ja\/%e6%9c%aa%e5%88%86%e9%a1%9e\/modelling-sp-500-index-price-based-on-u-s-economic-indicators-using-python-and-griddb\/"},"wordCount":223,"commentCount":0,"publisher":{"@id":"https:\/\/griddb.net\/en\/#organization"},"image":{"@id":"https:\/\/griddb.net\/ja\/%e6%9c%aa%e5%88%86%e9%a1%9e\/modelling-sp-500-index-price-based-on-u-s-economic-indicators-using-python-and-griddb\/#primaryimage"},"thumbnailUrl":"\/wp-content\/uploads\/2022\/03\/macbook-air-iphone-038-stocks-scaled.jpg","inLanguage":"ja","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/griddb.net\/ja\/%e6%9c%aa%e5%88%86%e9%a1%9e\/modelling-sp-500-index-price-based-on-u-s-economic-indicators-using-python-and-griddb\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/griddb.net\/ja\/%e6%9c%aa%e5%88%86%e9%a1%9e\/modelling-sp-500-index-price-based-on-u-s-economic-indicators-using-python-and-griddb\/","url":"https:\/\/griddb.net\/ja\/%e6%9c%aa%e5%88%86%e9%a1%9e\/modelling-sp-500-index-price-based-on-u-s-economic-indicators-using-python-and-griddb\/","name":"Python\u3068GridDB\u3092\u7528\u3044\u305f\u7c73\u56fd\u7d4c\u6e08\u6307\u6a19\u306b\u57fa\u3065\u304fS&P500\u6307\u6570\u4fa1\u683c\u306e\u30e2\u30c7\u30eb\u5316 | GridDB: Open Source Time Series Database for IoT","isPartOf":{"@id":"https:\/\/griddb.net\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/griddb.net\/ja\/%e6%9c%aa%e5%88%86%e9%a1%9e\/modelling-sp-500-index-price-based-on-u-s-economic-indicators-using-python-and-griddb\/#primaryimage"},"image":{"@id":"https:\/\/griddb.net\/ja\/%e6%9c%aa%e5%88%86%e9%a1%9e\/modelling-sp-500-index-price-based-on-u-s-economic-indicators-using-python-and-griddb\/#primaryimage"},"thumbnailUrl":"\/wp-content\/uploads\/2022\/03\/macbook-air-iphone-038-stocks-scaled.jpg","datePublished":"2022-03-23T07:00:00+00:00","dateModified":"2025-11-14T15:55:15+00:00","description":"\u7d4c\u6e08\u6307\u6a19\u3068\u5e83\u304f\u77e5\u3089\u308c\u305f\u7d71\u8a08\u7684\u624b\u6cd5\u3092\u4f7f\u3063\u3066\u682a\u4fa1\u3092\u4e88\u6e2c\u3059\u308b\u6570\u591a\u304f\u306e\u7814\u7a76\u304c\u3053\u308c\u307e\u3067\u306b\u884c\u308f\u308c\u3066\u304d\u307e\u3057\u305f\u3002\u305d\u3057\u30662010\u5e74\u4ee5\u964d\u306e\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u306e\u6027\u80fd\u306e\u4e0a\u6607\u306b\u3088\u308a\u3001\u6a5f\u68b0\u5b66\u7fd2\u306b","inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/griddb.net\/ja\/%e6%9c%aa%e5%88%86%e9%a1%9e\/modelling-sp-500-index-price-based-on-u-s-economic-indicators-using-python-and-griddb\/"]}]},{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/griddb.net\/ja\/%e6%9c%aa%e5%88%86%e9%a1%9e\/modelling-sp-500-index-price-based-on-u-s-economic-indicators-using-python-and-griddb\/#primaryimage","url":"\/wp-content\/uploads\/2022\/03\/macbook-air-iphone-038-stocks-scaled.jpg","contentUrl":"\/wp-content\/uploads\/2022\/03\/macbook-air-iphone-038-stocks-scaled.jpg","width":2560,"height":1700},{"@type":"WebSite","@id":"https:\/\/griddb.net\/en\/#website","url":"https:\/\/griddb.net\/en\/","name":"GridDB: Open Source Time Series Database for IoT","description":"GridDB is an open source time-series database with the performance of NoSQL and convenience of SQL","publisher":{"@id":"https:\/\/griddb.net\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/griddb.net\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ja"},{"@type":"Organization","@id":"https:\/\/griddb.net\/en\/#organization","name":"Fixstars","url":"https:\/\/griddb.net\/en\/","logo":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/griddb.net\/en\/#\/schema\/logo\/image\/","url":"https:\/\/griddb.net\/wp-content\/uploads\/2019\/04\/fixstars_logo_web_tagline.png","contentUrl":"https:\/\/griddb.net\/wp-content\/uploads\/2019\/04\/fixstars_logo_web_tagline.png","width":200,"height":83,"caption":"Fixstars"},"image":{"@id":"https:\/\/griddb.net\/en\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/griddbcommunity\/","https:\/\/x.com\/GridDBCommunity","https:\/\/www.linkedin.com\/company\/griddb-by-toshiba"]},{"@type":"Person","@id":"https:\/\/griddb.net\/en\/#\/schema\/person\/4fe914ca9576878e82f5e8dd3ba52233","name":"griddb-admin","image":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/griddb.net\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/5bceca1cafc06886a7ba873e2f0a28011a1176c4dea59709f735b63ae30d0342?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5bceca1cafc06886a7ba873e2f0a28011a1176c4dea59709f735b63ae30d0342?s=96&d=mm&r=g","caption":"griddb-admin"},"url":"https:\/\/griddb.net\/ja\/author\/griddb-admin\/"}]}},"_links":{"self":[{"href":"https:\/\/griddb.net\/ja\/wp-json\/wp\/v2\/posts\/50788","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/griddb.net\/ja\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/griddb.net\/ja\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/griddb.net\/ja\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/griddb.net\/ja\/wp-json\/wp\/v2\/comments?post=50788"}],"version-history":[{"count":1,"href":"https:\/\/griddb.net\/ja\/wp-json\/wp\/v2\/posts\/50788\/revisions"}],"predecessor-version":[{"id":51621,"href":"https:\/\/griddb.net\/ja\/wp-json\/wp\/v2\/posts\/50788\/revisions\/51621"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/griddb.net\/ja\/wp-json\/wp\/v2\/media\/49370"}],"wp:attachment":[{"href":"https:\/\/griddb.net\/ja\/wp-json\/wp\/v2\/media?parent=50788"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/griddb.net\/ja\/wp-json\/wp\/v2\/categories?post=50788"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/griddb.net\/ja\/wp-json\/wp\/v2\/tags?post=50788"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}