Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/65.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 将泊松回归应用于库存量是否错误?_R_Regression_Poisson - Fatal编程技术网

R 将泊松回归应用于库存量是否错误?

R 将泊松回归应用于库存量是否错误?,r,regression,poisson,R,Regression,Poisson,我最近学习了泊松回归,我想把这种新的统计方法应用到现实世界的问题上。所以我考虑了一会儿,决定尝试根据随机抽样的公司财务信息预测《财富》500强的成交量 我遇到的问题是,虽然模型考虑了大量的方差,并且只包含显著的预测值,但当我尝试使用预测函数让泊松模型进行预测时,它返回的预测值几乎没有偏离实际值的方差 我正在使用的数据集没有完全填充,但我决定用小样本量在结果上取一个峰值。我这样做是因为我在网上读到一篇文章,认为泊松回归所需的幂对于大的数字要低一些,而股市成交量包括了一些大的数字。可在此处访问数据集

我最近学习了泊松回归,我想把这种新的统计方法应用到现实世界的问题上。所以我考虑了一会儿,决定尝试根据随机抽样的公司财务信息预测《财富》500强的成交量

我遇到的问题是,虽然模型考虑了大量的方差,并且只包含显著的预测值,但当我尝试使用预测函数让泊松模型进行预测时,它返回的预测值几乎没有偏离实际值的方差

我正在使用的数据集没有完全填充,但我决定用小样本量在结果上取一个峰值。我这样做是因为我在网上读到一篇文章,认为泊松回归所需的幂对于大的数字要低一些,而股市成交量包括了一些大的数字。可在此处访问数据集:

我使用的代码如下所示:

Stock<-read.csv("C:/FilePath/StockPrices.csv")
head(Stock)
summary(StockTest <- step(glm(formula = X2018.Volume ~ X2017.Stock.Price + X2017.Volume+Total.Revenue+Cost.of.Revenue+Research...Development+Selling.General...Administrative+Interest.Expense+Total.Other.Income...Expenses.Net+Income.Before.Tax+Income.Tax.Expense+Income.From.Continuing.Operation+Net.Income+Enviornment+Social+Governance, family = "poisson", data = Stock)))

1-StockTest$deviance/StockTest$null.deviance
predict(StockTest)

Stock首先,您需要阅读
predict.glm
的手册页:

predict(Stock.glm, type="response")
#          1          3          4          5          7          8          9 
#  5255867.7  3283450.0  3297945.2  1216812.4  3306021.9 11366695.1  8824739.9 
#         10         11         13         14         15         16         17 
#  6465084.7  6396289.7  3234293.9  2616649.3  5043601.7   174557.7  1030814.3 
#         18         19         20         21 
#  7503622.7  1592024.5  3837723.8  1021574.3 
Stock.glm$model$X2018.Volume
#  [1]  5160000  3310000  3310000  1200000  3310000 11400000  8830000  6380000  6410000
# [10]  3500000  2620000  4860000   199000   741000  7680000  1287769  3810000  1460000
由于缺少值,因此无法与原始数据进行比较。因此,分析中使用的数据中缺少4行原始数据

cor(Stock.glm$model$X2018.Volume, predict(Stock.glm, type="response"))
# [1] 0.9983086
您需要进行
预测(StockTest,type=“response”)
。看见此外,您应该过度考虑表中的
0
值,它们是真的
0
还是真的丢失了,即
NA