0

https://dl.dropbox.com/u/53624395/11.csv

这是时间序列数据,我必须对表格进行对数回归y=a+b(log(x1))+c(log(x2)) 并找到 a、b、c,然后检查是否存在任何此类关系。我必须使用 R 工具来做到这一点。我已经在http://stats.stackexchange.com上发布了这个问题,但是因为它与 R 编程完全相关,所以它应该发布在 StackOverflow 上。请帮忙。

数据:

structure(list(x = c(433.66, 433, 230, 0, 251, 0, 424, 0, 439, 
0, 0, 0, 0, 85.15, 0, 0, 748, 0, 732, 0, 523.76, 0, 780, 0, 778, 
0, 635.64, 0, 600, 0), y = c(9.9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), 
z = c(43504.95, 49380, 50601, 0, 36064, 0, 47081, 0, 43775, 
0, 0, 0, 0, 85.15, 0, 0, 68502, 0, 66397, 0, 47565.35, 0, 
65695, 0, 69111, 0, 53213.86, 0, 118891, 0), x1 = c(1382.18, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1306, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), x2 = c(0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0, 1473.27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, 0, 0), x3 = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 
2, 3, 2.1, 2, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
0), x4 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 2L, 1L, 5L, 
43L, 11L, 2L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 
0L, 0L, 0L, 0L)), .Names = c("x", "y", "z", "x1", "x2", "x3", 
"x4"), class = "data.frame", row.names = c(NA, -30L))
4

1 回答 1

2

要求做什么是不可能的。但你可以靠近。

尝试这个:y = a + b(log(x1 + 1)) + c(log(x2 + 1))

命名数据框x

x <- read.csv('11.csv')

lm(y ~ 1 + log(x1+1) + log(x2+1), data=x)

## Call:
## lm(formula = y ~ 1 + log(x1 + 1) + log(x2 + 1), data = x)
##
## Coefficients:
## (Intercept)  log(x1 + 1)  log(x2 + 1)  
##  -1.202e-04    1.312e+00    1.648e-05  
于 2013-01-12T05:02:02.860 回答