安装市场单位销售S曲线与R

时间:2014-12-31 13:18:41

标签: r statistics

我的任务是根据宏观经济数据使用几个自变量拟合一些市场销售曲线;我有14年的历史。样本数据将是:

UnitSales,GDP,GDPPerCap,CPI,PropInvIndex,DispIncTopDecile,TransCommSecDecile,CivilVehOwn,Urban,AutoFin
" 2,833 ",1198243.4,949,81.62,4984,10643,618,1609,36.22,0
" 7,607 ",1324337.8,1042,81.38,6344,14219,782,1802,37.66,0
" 10,098 ",1453827.558,1135,80.8,7790.9223,18995.9,991.2,2053.17,39.08978381,0
" 18,649 ",1640958.735,1274,81.83,10153.8009,21837.3,1106,2382.93,40.53022975,0
" 14,525 ",1931644.33,1409,85.02,13158.2516,25377.2,1274.2,2693.71,41.76000862,0
" 19,149 ",2256902.591,1731,86.56,15909.2471,28773.1,1590.3,3160,42.98999663,0
" 22,474 ",2712950.885,2069,87.83,19422.9174,31967.3,1801,3697.3531,44.34301016,0
" 32,573 ",3494055.942,2651,92.02,25288.8373,36784.5,2467.7,4358.355,45.8892446,0.1
" 42,186 ",4521827.271,3414,97.45,31203.1942,43613.8,2632.9,5099.6094,46.98950317,0.12
" 52,765 ",4990233.519,3749,96.76,36241.808,46826.1,3181.9,6280.6086,48.34170101,0.14
" 140,855 ",5930502.27,4433,100,48259.403,51431.6,3630.6,7801.8259,49.94966105,0.16
" 88,873 ",7321891.955,5447,105.45,61796.8858,58841.9,3963,9356.3163,51.27027127,0.18
" 161,082 ",8229490.03,6093,108.22,71803.7869,63824.2,4304.1,10933.0912,52.57008656,0.22
" 149,197 ",9240270.452,6807,111.07,86013.3826,68874.37491,4748.669569,12670.1435,53.73,0.26

在我所拥有的宏观经济变量中,如果自由度成为一个问题,我只能使用一个子集。由于数据是遵循生命周期并具有市场饱和效应的产品,因此曲线应为S曲线或S形。在我对R的尝试中,我只能拟合指数(J曲线)曲线;我尝试过tslm(来自fpp包)以适应模型。

我目前的R代码是

# rm(list=ls())
ds <- read.csv(file='c:/RCode/Output/PremM.csv', header=T, sep=',')
tsdata <-ts(ds, s=2000)
results<- tslm(UnitSales~GDP+GPDPerCap+CPI+trend, data=tsdata)

write.csv(coef(results), file = "c:/Rcode/Output/CoefPremM.csv")

sink('C:/RCode/Output/PremMSummary2.txt',append=F,type="output")
summary(results)
sink(NULL)

tslm套餐不起作用。我处于我的能力的最前沿,并且只为这个项目学过R,所以我是新手。如果有人能指出我适当的R包和示例代码,我会永远感激不尽。我已经看到的例子都是二进制数据的逻辑曲线,这对我的任务来说似乎不合适。

您的帮助将在年底结束。

0 个答案:

没有答案