Hi r-users, I would like to use gev and my data (annual rainfall ) is as follows:> head(dat,20) A B C D E F G H I J1 45.1 41.5 58.5 50.1 46.0 49.1 37.7 49.1 59.8 54.0 2 50.3 39.8 49.4 56.4 49.4 48.8 42.1 49.8 49.4 58.3 3 41.7 39.3 44.6 39.1 35.7 41.5 40.8 40.8 38.5 45.6 4 50.7 33.9 48.4 28.2 35.5 39.1 61.4 17.0 30.7 38.3 5 39.3 30.6 46.9 23.8 25.8 17.1 37.9 40.1 35.4 30.1 6 50.2 43.6 55.5 26.7 36.6 20.6 35.2 46.0 52.2 30.5 7 46.0 37.0 55.3 36.3 51.9 50.6 43.2 44.9 38.2 45.4 8 46.0 15.4 35.7 27.3 40.2 21.2 41.1 65.7 35.7 28.7 9 52.0 36.5 49.6 55.0 38.3 32.0 43.8 43.8 50.3 36.5 10 57.5 51.0 47.0 63.0 43.0 46.5 41.5 82.8 50.5 38.5 11 71.0 48.0 59.5 48.5 47.0 57.5 55.8 64.5 60.0 43.4 12 57.5 52.5 58.5 42.0 62.0 44.0 47.5 59.5 45.0 51.5 13 47.0 38.0 49.9 50.5 55.0 57.5 51.5 54.5 45.0 49.7 14 66.5 44.4 60.0 99.5 54.5 41.3 57.0 69.5 33.0 58.4 15 61.5 43.6 68.5 50.7 48.0 50.5 50.5 58.8 53.2 47.0 16 55.5 58.5 55.5 45.8 48.0 57.0 52.0 48.5 58.5 437.5 17 96.7 96.7 96.7 45.5 65.1 46.5 51.0 96.7 61.3 310.5 18 71.5 55.5 63.0 52.5 59.0 55.5 55.5 51.1 47.0 49.5 19 71.5 42.5 64.0 56.5 61.0 54.0 46.5 53.7 43.0 44.0 20 57.5 51.5 51.3 34.0 55.0 61.0 55.5 51.3 51.3 44.5 When I apply the gev function, I have the following error message: out <- gev(dat, 20) Error in gev(dat, 20) : (list) object cannot be coerced to type 'double' Can anybody explain to me what does it means. I tried to read the package manual but could not understand about the block. Thank you so much for any help given. [[alternative HTML version deleted]]
Hello, You should say which package is gev() coming from. I believe it's from evir, and what follows assumes that. The problem is that 'dat' is a data.frame, a special type of list. It is a list of vectors and gev is expecting just one vector. You could try instead, to fit generalized extreme value distributions to each of the vectors in the data.frame, out.list <- lapply(dat, gev, block = 20) to get a list of 10 objects of class gev, like the help page says. Hope this helps, Rui Barradas Em 17-07-2013 10:33, Roslina Zakaria escreveu:> > Hi r-users, > > I would like to use gev and my data (annual rainfall ) is as follows: > >> head(dat,20) A B C D E F G H I J > 1 45.1 41.5 58.5 50.1 46.0 49.1 37.7 49.1 59.8 54.0 > 2 50.3 39.8 49.4 56.4 49.4 48.8 42.1 49.8 49.4 58.3 > 3 41.7 39.3 44.6 39.1 35.7 41.5 40.8 40.8 38.5 45.6 > 4 50.7 33.9 48.4 28.2 35.5 39.1 61.4 17.0 30.7 38.3 > 5 39.3 30.6 46.9 23.8 25.8 17.1 37.9 40.1 35.4 30.1 > 6 50.2 43.6 55.5 26.7 36.6 20.6 35.2 46.0 52.2 30.5 > 7 46.0 37.0 55.3 36.3 51.9 50.6 43.2 44.9 38.2 45.4 > 8 46.0 15.4 35.7 27.3 40.2 21.2 41.1 65.7 35.7 28.7 > 9 52.0 36.5 49.6 55.0 38.3 32.0 43.8 43.8 50.3 36.5 > 10 57.5 51.0 47.0 63.0 43.0 46.5 41.5 82.8 50.5 38.5 > 11 71.0 48.0 59.5 48.5 47.0 57.5 55.8 64.5 60.0 43.4 > 12 57.5 52.5 58.5 42.0 62.0 44.0 47.5 59.5 45.0 51.5 > 13 47.0 38.0 49.9 50.5 55.0 57.5 51.5 54.5 45.0 49.7 > 14 66.5 44.4 60.0 99.5 54.5 41.3 57.0 69.5 33.0 58.4 > 15 61.5 43.6 68.5 50.7 48.0 50.5 50.5 58.8 53.2 47.0 > 16 55.5 58.5 55.5 45.8 48.0 57.0 52.0 48.5 58.5 437.5 > 17 96.7 96.7 96.7 45.5 65.1 46.5 51.0 96.7 61.3 310.5 > 18 71.5 55.5 63.0 52.5 59.0 55.5 55.5 51.1 47.0 49.5 > 19 71.5 42.5 64.0 56.5 61.0 54.0 46.5 53.7 43.0 44.0 > 20 57.5 51.5 51.3 34.0 55.0 61.0 55.5 51.3 51.3 44.5 > > When I apply the gev function, I have the following error message: > > out <- gev(dat, 20) Error in gev(dat, 20) : (list) object cannot be coerced to type 'double' > > Can anybody explain to me what does it means. I tried to read the package manual but could not understand about the block. > > Thank you so much for any help given. > [[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. >
Hello, It's better if you Cc the list, the odds of getting more and better answers are greater. Have you tried with different block values? Rui Barradas Em 17-07-2013 13:33, Roslina Zakaria escreveu:> Hi Rui, > Yes, I am using gev from 'evir' > install.packages("evir") > library(evir) > I have tried your suggestion and follow are what I got. > >>out.list <- lapply(dat, gev, block = 20) > Error in optim(theta, negloglik, hessian = TRUE, ..., tmp = data) : > non-finite finite-difference value [1] > In addition:Warning messages: > 1: In FUN(X[[7L]], ...) : optimization may not have succeeded > 2: In FUN(X[[7L]], ...) : optimization may not have succeeded > 3: In sqrt(diag(varcov)) : NaNs produced > 4: In FUN(X[[7L]], ...) : optimization may not have succeeded > 5: In FUN(X[[7L]], ...) : optimization may not have succeeded > 6: In FUN(X[[7L]], ...) : optimization may not have succeeded > 7: In FUN(X[[7L]], ...) : optimization may not have succeeded > > > > Thank you. > > > *From:* Rui Barradas <ruipbarradas at sapo.pt> > *To:* Roslina Zakaria <zroslina at yahoo.com> > *Cc:* "r-help at r-project.org" <r-help at r-project.org> > *Sent:* Wednesday, July 17, 2013 5:51 PM > *Subject:* Re: [R] error message in gev > > Hello, > > You should say which package is gev() coming from. I believe it's from > evir, and what follows assumes that. > The problem is that 'dat' is a data.frame, a special type of list. It is > a list of vectors and gev is expecting just one vector. You could try > instead, to fit generalized extreme value distributions to each of the > vectors in the data.frame, > > out.list <- lapply(dat, gev, block = 20) > > > to get a list of 10 objects of class gev, like the help page says. > > Hope this helps, > > Rui Barradas > > Em 17-07-2013 10:33, Roslina Zakaria escreveu: > > > > Hi r-users, > > > > I would like to use gev and my data (annual rainfall ) is as follows: > > > >> head(dat,20) A B C D E F G H I J > > 1 45.1 41.5 58.5 50.1 46.0 49.1 37.7 49.1 59.8 54.0 > > 2 50.3 39.8 49.4 56.4 49.4 48.8 42.1 49.8 49.4 58.3 > > 3 41.7 39.3 44.6 39.1 35.7 41.5 40.8 40.8 38.5 45.6 > > 4 50.7 33.9 48.4 28.2 35.5 39.1 61.4 17.0 30.7 38.3 > > 5 39.3 30.6 46.9 23.8 25.8 17.1 37.9 40.1 35.4 30.1 > > 6 50.2 43.6 55.5 26.7 36.6 20.6 35.2 46.0 52.2 30.5 > > 7 46.0 37.0 55.3 36.3 51.9 50.6 43.2 44.9 38.2 45.4 > > 8 46.0 15.4 35.7 27.3 40.2 21.2 41.1 65.7 35.7 28.7 > > 9 52.0 36.5 49.6 55.0 38.3 32.0 43.8 43.8 50.3 36.5 > > 10 57.5 51.0 47.0 63.0 43.0 46.5 41.5 82.8 50.5 38.5 > > 11 71.0 48.0 59.5 48.5 47.0 57.5 55.8 64.5 60.0 43.4 > > 12 57.5 52.5 58.5 42.0 62.0 44.0 47.5 59.5 45.0 51.5 > > 13 47.0 38.0 49.9 50.5 55.0 57.5 51.5 54.5 45.0 49.7 > > 14 66.5 44.4 60.0 99.5 54.5 41.3 57.0 69.5 33.0 58.4 > > 15 61.5 43.6 68.5 50.7 48.0 50.5 50.5 58.8 53.2 47.0 > > 16 55.5 58.5 55.5 45.8 48.0 57.0 52.0 48.5 58.5 437.5 > > 17 96.7 96.7 96.7 45.5 65.1 46.5 51.0 96.7 61.3 310.5 > > 18 71.5 55.5 63.0 52.5 59.0 55.5 55.5 51.1 47.0 49.5 > > 19 71.5 42.5 64.0 56.5 61.0 54.0 46.5 53.7 43.0 44.0 > > 20 57.5 51.5 51.3 34.0 55.0 61.0 55.5 51.3 51.3 44.5 > > > > When I apply the gev function, I have the following error message: > > > > out <- gev(dat, 20) Error in gev(dat, 20) : (list) object cannot be > coerced to type 'double' > > > > Can anybody explain to me what does it means. I tried to read the > package manual but could not understand about the block. > > > > Thank you so much for any help given. > > [[alternative HTML version deleted]] > > > > > > > > ______________________________________________ > > R-help at r-project.org <mailto: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. > > > >