[R] BY GROUP in evir R package
Pfaff, Bernhard Dr.
Bernhard_Pfaff at fra.invesco.com
Thu Jul 7 12:13:21 CEST 2011
lapply(rg2, function(x) x$par.ests)
there is no slot residuals! The function gev() does return a S3-object with class attribute 'gev', see ?gev.
>
> Dr. Pfaff:
>
> After using str; can you give an example on data extration
> (e.g. for $par.ests and @residuals)
>
>
>
> ----- Original Message ----
> From: "Pfaff, Bernhard Dr." <Bernhard_Pfaff at fra.invesco.com>
> To: Peter Maclean <pmaclean2011 at yahoo.com>; Dr. Bernhard Pfaff
> <bernhard at pfaffikus.de>
> Cc: "r-help at r-project.org" <r-help at r-project.org>
> Sent: Wed, July 6, 2011 8:17:12 AM
> Subject: AW: [R] BY GROUP in evir R package
>
> Hello Peter,
>
> str(rg2)
>
> us quite revealing for this; by() returns a list and hence
> lapply() can be
> employed, e.g.:
> lapply(rg2, rlevel.gev, k.blocks = 5)
>
> By the same token, you can extract the relevant bits and
> pieces and put them
> together in a data.frame.
>
> Best,
> Bernhard
>
> > -----Ursprüngliche Nachricht-----
> > Von: r-help-bounces at r-project.org
> > [mailto:r-help-bounces at r-project.org] Im Auftrag von Peter Maclean
> > Gesendet: Mittwoch, 6. Juli 2011 09:25
> > An: Dr. Bernhard Pfaff
> > Cc: r-help at r-project.org
> > Betreff: Re: [R] BY GROUP in evir R package
> >
> > Dr. Pfaff:
> > How do we pass the "by" results to "rlevel.gev" function to
> > get the return level and also save the results (both
> > rg2(par.ests and $par.ses) and rl) as.data.frame?
> >
> > #Grouped vector
> > Gdata <- data.frame(n = rep(c(1,2,3), each = 100), y = rnorm(300))
> > library(evir)
> > require(plyr)
> >
> > #Model for Grouped
> > rg2<- by(Gdata,Gdata[,"n"], function(x) gev(x$y, 5, method =
> > "BFGS", control =list(maxit = 500))) # rl <- rlevel.gev(rg2,
> > k.blocks = 5, add = TRUE)
> >
> >
> >
> >
> > ----- Original Message ----
> > From: Dr. Bernhard Pfaff <bernhard at pfaffikus.de>
> > To: Peter Maclean <pmaclean2011 at yahoo.com>
> > Sent: Fri, June 3, 2011 2:45:28 PM
> > Subject: Re: BY GROUP in evir R package
> >
> > Hello Peter,
> >
> > many thanks for your email. Well, as you might have guessed,
> > there is also a
> > function by() in R that does the same job. See help("by") for
> > more information.
> >
> > Best,
> > Bernhard
> >
> > Peter Maclean schrieb:
> > > Hi,
> > > I am new in R and I want to use your package for data
> > analysis. I usually use
> > >SAS. I have rainfall data for different points. Each point
> > has 120 observations.
> > >The rainfall data is in the first column (RAIN) and the
> > categorical variable
> > >that group the data is in the second column (GROUP). The
> > data frame is
> > >rain.data. How can I use the gev function to estimate all
> > three parameters by
> > >GROUP variable group? In SAS there is a by() function that
> > estimate the model by
> > >group. However, I would like to move to R.
> > > With thanks,
> > > Peter Maclean
> > > Department of Economics
> > > University of Dar -es- Salaam, Tanzania
> > >
> > >
> >
> > ______________________________________________
> > 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.
> >
> *****************************************************************
> Confidentiality Note: The information contained in this message,
> and any attachments, may contain confidential and/or privileged
> material. It is intended solely for the person(s) or entity to
> which it is addressed. Any review, retransmission, dissemination,
> or taking of any action in reliance upon this information by
> persons or entities other than the intended recipient(s) is
> prohibited. If you received this in error, please contact the
> sender and delete the material from any computer.
> *****************************************************************
>
More information about the R-help
mailing list