[R] BY GROUP in evir R package

Peter Maclean pmaclean2011 at yahoo.com
Wed Jul 6 09:25:19 CEST 2011


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 
> 
> 



More information about the R-help mailing list