楼主: szc412247754
9316 0

[学习分享] R语言dwTest用法 [推广有奖]

  • 0关注
  • 4粉丝

已卖:2份资源

硕士生

86%

还不是VIP/贵宾

-

威望
0
论坛币
881 个
通用积分
26.4274
学术水平
16 点
热心指数
23 点
信用等级
12 点
经验
431 点
帖子
235
精华
0
在线时间
148 小时
注册时间
2011-5-25
最后登录
2024-9-25

楼主
szc412247754 发表于 2011-9-10 21:57:11 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币

dwtest

{lmtest}

Description

Performsthe Durbin-Watson test for autocorrelation of disturbances.

Usage

dwtest(formula,order.by = NULL, alternative = c("greater", "two.sided","less"),       iterations = 15,exact = NULL, tol = 1e-10, data = list())

Arguments

formula  a symbolicdescription for the model to be tested (or a fitted "lm" object).

order.by        Either avector z or a formula with a single explanatory variable like ~ z. Theobservations in the model are ordered by the size of z. If set to NULL (thedefault) the observations are assumed to be ordered (e.g., a time series).

alternative    a characterstring specifying the alternative hypothesis.

iterations      an integer specifying the number ofiterations when calculating the p-value with the "pan" algorithm.

exact      logical.If set to FALSE a normal approximation will be used to compute the p value, ifTRUE the "pan" algorithm is used. The default is to use"pan" if the sample size is < 100.

tol    tolerance. Eigenvalues computed have tobe greater than tol to be treated as non-zero.

data       an optional data frame containing thevariables in the model. By default the variables are taken from the environmentwhich dwtest is called from.

Details

TheDurbin-Watson test has the null hypothesis that the autocorrelation of thedisturbances is 0. It is possible to test against the alternative that it isgreater than, not equal to, or less than 0, respectively. This can be specifiedby the alternative argument.

Underthe assumption of normally distributed disturbances, the null distribution ofthe Durbin-Watson statistic is the distribution of a linear combination ofchi-squared variables. The p-value is computed using a Fortran version of theApplied Statistics Algorithm AS 153 by Farebrother (1980, 1984). This algorithmis called "pan" or "gradsol". For large sample sizes thealgorithm might fail to compute the p value; in that case a warning is printedand an approximate p value will be given; this p value is computed using anormal approximation with mean and variance of the Durbin-Watson teststatistic.

Examplescan not only be found on this page, but also on the help pages of the data setsbondyield, currencysubstitution, growthofmoney, moneydemand, unemployment,wages.

Foran overview on R and econometrics see Racine & Hyndman (2002).

Value

Anobject of class "htest" containing: statistic  the test statistic.

p.value   the corresponding p-value.

method  a characterstring with the method used.

data.name    a character string with the data name.

See Also

LmExamples

## generate two AR(1) error terms withparameter

## rho = 0 (white noise) and rho = 0.9respectively

err1<- rnorm(100)

## generate regressor and dependentvariable

x<- rep(c(-1,1), 50)

y1<- 1 + x + err1

## perform Durbin-Watson test

dwtest(y1~ x)

err2<- filter(err1, 0.9, method="recursive")

y2<- 1 + x + err2

dwtest(y2~ x)

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:test Est R语言 Disturbances respectively single tested

已有 1 人评分论坛币 收起 理由
yahoocom + 20 奖励积极上传好的资料

总评分: 论坛币 + 20   查看全部评分

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-7 22:01