Skip to content
Back to formatted view

Raw Message

Message-ID: <1309378997.47325.YahooMailRC@web121702.mail.ne1.yahoo.com>
Date: 2011-06-29T20:23:17Z
From: Peter Maclean
Subject: BY GROUP IN GEV
In-Reply-To: <BANLkTi=QSmfno4DpEGq7Xw7wZ7mr7Abmug@mail.gmail.com>

Dennis:
It walks for small datset.

?Peter Maclean
Department of Economics
UDSM 



----- Original Message ----
From: Dennis Murphy <djmuser at gmail.com>
To: Peter Maclean <pmaclean2011 at yahoo.com>
Cc: r-help at r-project.org
Sent: Mon, June 27, 2011 8:37:00 PM
Subject: Re: [R] BY GROUP IN GEV

HI:

Since you didn't provide a reproducible example (in particular, what
does str(MA) return?), it's hard to verify what specifically causes
the error, but a look at the gev() function's help page indicates that
the first argument is supposed to be a (numeric) vector, apparently
atomic.

One problem with this code,
CP? <- lapply(MAS, function(x){gev(MAS$CP1, 100, method = "BFGS", control =
list(maxit = 500))})

is that there is no 'x' in the body of the function. Perhaps you need
to generate a numeric vector for CP1 before feeding it to gev(), but
without a reproducible example this is nothing more than speculation.
Perhaps something like:

CP? <- lapply(MAS, function(x){
? ? ? ? ? ? y <- as.numeric(x$CP1)
? ? ? ? ? ? gev(y, 100, method = "BFGS", control = list(maxit = 500))
? ? ? ? })

Obviously untested for the reason stated above. A perusal of the
Posting Guide might be beneficial.

Dennis

On Mon, Jun 27, 2011 at 3:19 PM, Peter Maclean <pmaclean2011 at yahoo.com> wrote:
> Hi Dennis:
> I tried your suggestions and I am getting the following errors:
>
> Error in x$CP1 : $ operator is invalid for atomic vectors
> In addition: Warning message:
> In sqrt(diag(varcov)) : NaNs produced
>
> ?Peter Maclean
> Department of Economics
> UDSM
>
>
>
> ----- Original Message ----
> From: Dennis Murphy <djmuser at gmail.com>
> To: Peter Maclean <pmaclean2011 at yahoo.com>
> Sent: Wed, June 22, 2011 11:37:02 PM
> Subject: Re: [R] BY GROUP IN GEV
>
> Hi:
>
> I think you need
>
> CP ?<- lapply(MAS, function(x){gev(x$CP1, 100, method = "BFGS", control =
> ? ? ? ? ? ? ? ? ? ? list(maxit = 500))})
>
> See if that works out.
>
> HTH,
> Dennis
>
> On Wed, Jun 22, 2011 at 4:06 PM, Peter Maclean <pmaclean2011 at yahoo.com> wrote:
>> I am trying to run gev (general extreme value) function in ?evir? package. My
>> data is divided by state. I am using the following codes but it is not
> working.
>> I will appreciate any help.
>>
>> #Split data
>> MAS <- split(MA, MA$states)
>>
>> CP ?<- lapply(MAS, function(x){gev(MAS$CP1, 100, method = "BFGS", control =
>> list(maxit = 500))})
>>
>> the Error message is:
>>
>> Error in tapply(data, grouping, max) : arguments must have same length
>>
>> I know there are also ?by? function,? but I could not figure it out how to 
use
>> it.
>>
>> ______________________________________________
>> 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.
>>
>
>