rl269
2012-May-16 19:57 UTC
[R] error code trying to extract second column from coeftest output
I want to use the standard error values in the summary that is produced using coeftest, but I am getting an error code- any ideas?> library(lmtest) > coeftest(lmodT_WBHO)t test of coefficients: Estimate Std. Error t value Pr(>|t|) t1W 5.94819 0.17072 34.8410 < 2.2e-16 *** t2W 6.56216 0.17438 37.6322 < 2.2e-16 *** t3W 6.08252 0.16525 36.8082 < 2.2e-16 *** t4W 6.18041 0.17028 36.2949 < 2.2e-16 *** t1B 5.50000 0.50566 10.8768 < 2.2e-16 *** t2B 5.65000 0.53034 10.6535 < 2.2e-16 *** t3B 4.52381 0.51756 8.7406 < 2.2e-16 *** t4B 4.38095 0.51756 8.4646 < 2.2e-16 *** t1H 5.05000 0.53034 9.5221 < 2.2e-16 *** t2H 4.77778 0.55903 8.5465 < 2.2e-16 *** t3H 5.52632 0.54412 10.1564 < 2.2e-16 *** t4H 4.71429 0.63388 7.4372 2.236e-13 *** t1O 5.17647 0.57524 8.9988 < 2.2e-16 *** t2O 5.81818 0.50566 11.5060 < 2.2e-16 *** t3O 6.50000 0.63388 10.2543 < 2.2e-16 *** t4O 5.71429 0.63388 9.0147 < 2.2e-16 *** --- Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1> se1 <- coeftest(lmodT_WBHO)$coef[,2]Error in coeftest(lmodT_WBHO)$coef : $ operator is invalid for atomic vectors>-- View this message in context: http://r.789695.n4.nabble.com/error-code-trying-to-extract-second-column-from-coeftest-output-tp4630298.html Sent from the R help mailing list archive at Nabble.com.
Jeff Newmiller
2012-May-16 22:14 UTC
[R] error code trying to extract second column from coeftest output
I recommend that you troubleshoot your own problem using the str function... for example, str( coeftest(lmodT_WBHO)). The error message is not a "code"... it is perfectly readable English, and it is telling you that the result of calling coeftest is not a list with parts that can be pulled out using the $ operator. --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity. rl269 <rlisi at acad.umass.edu> wrote:>I want to use the standard error values in the summary that is produced >using >coeftest, but I am getting an error code- any ideas? > >> library(lmtest) >> coeftest(lmodT_WBHO) > >t test of coefficients: > > Estimate Std. Error t value Pr(>|t|) >t1W 5.94819 0.17072 34.8410 < 2.2e-16 *** >t2W 6.56216 0.17438 37.6322 < 2.2e-16 *** >t3W 6.08252 0.16525 36.8082 < 2.2e-16 *** >t4W 6.18041 0.17028 36.2949 < 2.2e-16 *** >t1B 5.50000 0.50566 10.8768 < 2.2e-16 *** >t2B 5.65000 0.53034 10.6535 < 2.2e-16 *** >t3B 4.52381 0.51756 8.7406 < 2.2e-16 *** >t4B 4.38095 0.51756 8.4646 < 2.2e-16 *** >t1H 5.05000 0.53034 9.5221 < 2.2e-16 *** >t2H 4.77778 0.55903 8.5465 < 2.2e-16 *** >t3H 5.52632 0.54412 10.1564 < 2.2e-16 *** >t4H 4.71429 0.63388 7.4372 2.236e-13 *** >t1O 5.17647 0.57524 8.9988 < 2.2e-16 *** >t2O 5.81818 0.50566 11.5060 < 2.2e-16 *** >t3O 6.50000 0.63388 10.2543 < 2.2e-16 *** >t4O 5.71429 0.63388 9.0147 < 2.2e-16 *** >--- >Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1 > >> se1 <- coeftest(lmodT_WBHO)$coef[,2] >Error in coeftest(lmodT_WBHO)$coef : > $ operator is invalid for atomic vectors >> > > >-- >View this message in context: >http://r.789695.n4.nabble.com/error-code-trying-to-extract-second-column-from-coeftest-output-tp4630298.html >Sent from the R help mailing list archive at Nabble.com. > >______________________________________________ >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.
Petr PIKAL
2012-May-17 13:28 UTC
[R] error code trying to extract second column from coeftest output
Hi> > I want to use the standard error values in the summary that is producedusing> coeftest, but I am getting an error code- any ideas?See what is structure of coeftest object by str(coeftest(lmodT_WBHO)) and from this you shall deduct how to select second column. Regards Petr> > > library(lmtest) > > coeftest(lmodT_WBHO) > > t test of coefficients: > > Estimate Std. Error t value Pr(>|t|) > t1W 5.94819 0.17072 34.8410 < 2.2e-16 *** > t2W 6.56216 0.17438 37.6322 < 2.2e-16 *** > t3W 6.08252 0.16525 36.8082 < 2.2e-16 *** > t4W 6.18041 0.17028 36.2949 < 2.2e-16 *** > t1B 5.50000 0.50566 10.8768 < 2.2e-16 *** > t2B 5.65000 0.53034 10.6535 < 2.2e-16 *** > t3B 4.52381 0.51756 8.7406 < 2.2e-16 *** > t4B 4.38095 0.51756 8.4646 < 2.2e-16 *** > t1H 5.05000 0.53034 9.5221 < 2.2e-16 *** > t2H 4.77778 0.55903 8.5465 < 2.2e-16 *** > t3H 5.52632 0.54412 10.1564 < 2.2e-16 *** > t4H 4.71429 0.63388 7.4372 2.236e-13 *** > t1O 5.17647 0.57524 8.9988 < 2.2e-16 *** > t2O 5.81818 0.50566 11.5060 < 2.2e-16 *** > t3O 6.50000 0.63388 10.2543 < 2.2e-16 *** > t4O 5.71429 0.63388 9.0147 < 2.2e-16 *** > --- > Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1 > > > se1 <- coeftest(lmodT_WBHO)$coef[,2] > Error in coeftest(lmodT_WBHO)$coef : > $ operator is invalid for atomic vectors > > > > > -- > View this message in context: http://r.789695.n4.nabble.com/error-code- > trying-to-extract-second-column-from-coeftest-output-tp4630298.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.