[R] Package ‘orcutt’ bug?
David Winsemius
dwinsemius at comcast.net
Thu Sep 27 06:44:19 CEST 2012
Shouldn't you be sending this to the maintainer?
--
David.
On Sep 26, 2012, at 9:03 PM, 王柏元 wrote:
> Hello~
>
> Did any one have used the package 'orcutt' ?
>
> I find that it can not work smoothly in a single variable regression. I use the example following, it function very well.
>
> But when I regress "cons" on "price" (use the "reg1<-lm(cons~price+income+temp)") , then use "reg11<-cochrane.orcutt(reg1)
> ". There is an error message “Error in X[, -1] %*% regCO$coeff[-1] : non-conformable arguments”.
>
> Is this a bug for this function?
>
>> price<-c( 0.27, 0.28, 0.28, 0.28, 0.27, 0.26, 0.28 ,0.27 ,0.26 ,0.28, 0.28 ,0.27, 0.27, 0.29, 0.28,0.29, 0.28, 0.28, 0.28, 0.28, 0.29, 0.29, 0.28, 0.28, 0.28, 0.26, 0.26 ,0.26, 0.27 ,0.26)
>> cons<-c(0.39, 0.37, 0.39, 0.42, 0.41, 0.34, 0.33, 0.29, 0.27, 0.26, 0.29 ,0.30, 0.33, 0.32, 0.38,0.38, 0.47, 0.44, 0.39, 0.34, 0.32, 0.31, 0.28, 0.33, 0.31, 0.36, 0.38 ,0.42, 0.44 ,0.55)
>> income<-c(78, 79, 81, 80 ,76 ,78, 82, 79, 76, 79, 82, 85, 86, 83, 84, 82, 80, 78, 84, 86, 85, 87, 94, 92, 95, 96, 94, 96, 91, 90)
>> temp<-c(41,56,63,68,69,65,61,47,32,24,28,26,32,40,55,63,72,72,67,60,44,40,32,27,28,33,41,52,64,71)
>> reg<-lm(cons~price+income+temp)
>> library(orcutt)
> Warning message:
> package ‘orcutt’ was built under R version 2.14.2
>> reg2<-cochrane.orcutt(reg)
>> reg2
> $Cochrane.Orcutt
> Call:
> lm(formula = YB ~ XB - 1)
> Residuals:
> Min 1Q Median 3Q Max
> -0.072610 -0.012760 0.000906 0.015209 0.077841
> Coefficients:
> Estimate Std. Error t value Pr(>|t|)
> XB(Intercept) 0.2424113 0.2531469 0.958 0.3474
> XBprice -1.1927018 0.6873988 -1.735 0.0950 .
> XBincome 0.0031820 0.0014969 2.126 0.0436 *
> XBtemp 0.0035572 0.0005339 6.662 5.56e-07 ***
> ---
> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> Residual standard error: 0.0317 on 25 degrees of freedom
> Multiple R-squared: 0.9837, Adjusted R-squared: 0.9811
> F-statistic: 378.3 on 4 and 25 DF, p-value: < 2.2e-16
>
> $rho
> [1] 0.3788941
> $number.interaction
> [1] 12
>
>> reg1<-lm(cons~price)
>> reg11<-cochrane.orcutt(reg1)
> Error in X[, -1] %*% regCO$coeff[-1] : non-conformable arguments
>
> Paul Wang
> pywang61 at yahoo.com.tw
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
David Winsemius, MD
Alameda, CA, USA
More information about the R-help
mailing list