[R] Reading Data from mle into excel?
Greg Snow
Greg.Snow at imail.org
Tue May 31 18:27:13 CEST 2011
I did not see any code above, but you could write a simple function that does the mle fit (is this mle from the stats4 package?) then extracts the information that you want and puts it into a vector, something like:
out <- c( coef(fit), sqrt(diag(vcov(fit))), ll=logLik(fit) )
And returns the vector of the pieces that you want. Then you can use the sapply function to run the fits and return a matrix with the coefficients, etc. You can then use write.csv to create a csv file of the results that your advisor can open in excel (or there are several ways to transfer the contents of a matrix to excel).
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Bazman76
> Sent: Tuesday, May 31, 2011 9:40 AM
> To: r-help at r-project.org
> Subject: Re: [R] Reading Data from mle into excel?
>
>
> Hi Greg,
>
> I have about 40 time series each of which I have to run a seperate MLE
> on. I will be experimenting with different starting values for the
> parameters etc, so some way to automate the process will be useful.
> I think I can just about do this part (if you see the code above) but
> as I can't do the second part I can't check it properly.
>
> The second part I simply want to take the results of all the MLE
> calculation: the parameter estimates, there standard errors and the
> actual value of the likilihood ratio so that I can compare them and
> present them to my supervisor.
> The last part must be done in excel as my supervisor has not been
> converted to R yet.
>
> Kind Regards
>
> Hugh
>
>
>
>
> Date: Tue, 31 May 2011 08:24:08 -0700
> From: ml-node+3563453-1045326083-236929 at n4.nabble.com
> To: h_a_patience at hotmail.com
> Subject: Re: Reading Data from mle into excel?
>
> The sink function will write to a file what normally shows up on the
> screen after running some code. So while it is possible to use it to
> capture the output of the mle command and read the results into excel,
> I don't see anything useful that you could then do with it in excel.
>
> If you can tell us more about what your ultimate goal is, what you want
> to do with the results, then we can give better advice on either how to
> get the pieces you want into excel, or probably better, how do
> accomplish what you want in R without needing to involve excel at all.
>
> --
> Gregory (Greg) L. Snow Ph.D.
> Statistical Data Center
> Intermountain Healthcare
> [hidden email]
> 801.408.8111
>
>
>
> > -----Original Message-----
> > From: [hidden email] [mailto:r-help-bounces at r-
> > project.org] On Behalf Of Bazman76
> > Sent: Tuesday, May 31, 2011 9:04 AM
> > To: [hidden email]
> > Subject: Re: [R] Reading Data from mle into excel?
> >
> > Can I use sink() to transfer the MLE results which are a S4 type
> object
> > to a
> > text file?
> >
> > Can someone show me how to do this?
> >
> >
> > --
> > View this message in context: http://r.789695.n4.nabble.com/Reading-
> > Data-from-mle-into-excel-tp3545569p3563385.html
> > Sent from the R help mailing list archive at Nabble.com.
> >
> > ______________________________________________
> > [hidden email] 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.
> ______________________________________________
> [hidden email] 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.
>
>
>
>
>
>
> If you reply to this email, your message will be added to the
> discussion below:http://r.789695.n4.nabble.com/Reading-Data-from-mle-
> into-excel-tp3545569p3563453.html
> To unsubscribe from Reading Data from mle into excel?, click here.
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Reading-
> Data-from-mle-into-excel-tp3545569p3563495.html
> Sent from the R help mailing list archive at Nabble.com.
> [[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.
More information about the R-help
mailing list