Re: [R] BY GROUP in evir R package
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_pf...@fra.invesco.com To: Peter Maclean pmaclean2...@yahoo.com; Dr. Bernhard Pfaff bernh...@pfaffikus.de Cc: r-help@r-project.org r-help@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-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im Auftrag von Peter Maclean Gesendet: Mittwoch, 6. Juli 2011 09:25 An: Dr. Bernhard Pfaff Cc: r-help@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 bernh...@pfaffikus.de To: Peter Maclean pmaclean2...@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@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. * __ R-help@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.
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 bernh...@pfaffikus.de To: Peter Maclean pmaclean2...@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@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.
Re: [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-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im Auftrag von Peter Maclean Gesendet: Mittwoch, 6. Juli 2011 09:25 An: Dr. Bernhard Pfaff Cc: r-help@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 bernh...@pfaffikus.de To: Peter Maclean pmaclean2...@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@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 ...{{dropped:10}} __ R-help@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.
Re: [R] BY GROUP in evir R package
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_pf...@fra.invesco.com To: Peter Maclean pmaclean2...@yahoo.com; Dr. Bernhard Pfaff bernh...@pfaffikus.de Cc: r-help@r-project.org r-help@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-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im Auftrag von Peter Maclean Gesendet: Mittwoch, 6. Juli 2011 09:25 An: Dr. Bernhard Pfaff Cc: r-help@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 bernh...@pfaffikus.de To: Peter Maclean pmaclean2...@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@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. __ R-help@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.