[R] Print std. Error separately from mle-class object

Aziz, Muhammad Fayez aziz4 at illinois.edu
Thu Apr 5 02:43:08 CEST 2012


Thank you Jeff for your input. I did realize just after posting the question that the summary fn returns an object whose "slots" can be read and that the slot containing the coefficient information is a matrix. Here is how I got the desired results through the following code in "mypanel" function of xyplot:

	tmp <- power.law.fit(y, xmin=1) 
	coefMatrix <- slot(summary(tmp), "coef")
	print(coefMatrix["alpha", "Estimate"]) # alpha:
	print(coefMatrix["alpha", "Std. Error"]) # Std. Error
	print(slot(summary(tmp), "m2logL")) # -2 log L:

Best,
Fayez
________________________________________
From: Jeff Newmiller [jdnewmil at dcn.davis.ca.us]
Sent: Wednesday, April 04, 2012 5:54 PM
To: Aziz, Muhammad Fayez; r-help at r-project.org
Subject: Re: [R] Print std. Error separately from mle-class object

Are you aware that the summary function normally returns a data value that you can extract values from and format to your hearts desire?
try
str(coef(summary(tmp)))
and read ?mle-class
(and try to provide a reproducible example next time)
---------------------------------------------------------------------------
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.

"Aziz, Muhammad Fayez" <aziz4 at illinois.edu> wrote:

>Hi,
>
>I am using power.law.fit to get an mle-class object in tmp and print
>summary(tmp), coef(tmp) and logLik(tmp). I wanted to print the std.
>error for alpha separately as I want to show these values concisely in
>a graph legend. coef(summary(tmp)) displays the alpha and std. error
>jointly, while I need to print them separately on two lines.
>
>Regards,
>Fayez
>______________________________________________
>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.




More information about the R-help mailing list