[FLR-list] Problems with fwd()
Luis Ridao
luridao at gmail.com
Fri Mar 23 13:17:27 CET 2012
Laurie could you just copy-paste/send the entire file "fsaisim_Laurie.r"
you are working on?
I get this:
target at trgtArray[3,"min",]<-c(TAC*(1.0-TAC.bound))
Error: subscript out of bounds
And in effect target at trgtArray is as follows:
> dim(target at trgtArray)
[1] 2 3 1000
Best,
Luis
On Thu, Mar 22, 2012 at 4:31 PM, Laurie <lauriekell at googlemail.com> wrote:
> Hi
>
> Main problem was that you called the iter dim iters. Use this
>
> ctrl<-fwdControl(data.frame(year=yr.TAC,val=mean(TAC),quantity="catch"))
>
> # and by iteration
> dms<-dimnames(ctrl at trgtArray)
> dms$iter<-1:nits
> ctrl at trgtArray<-array(NA,lapply(dms,length),dms)
> ctrl at trgtArray[1,"val",]<-TAC
>
> sr.resid[,ac(iyr+1)] <-
> exp(acf.*sr.deviates[,ac(iyr)]+sr.deviates[,ac(iyr+1)])
> OM <-fwd(OM,ctrl=ctrl,sr=fsaiSR,sr.residuals=sr.resid,maxF=2.0)
>
>
> I added (after discussion) an upper F bound (maxF), use this as it
> simplifies the code. This can be an FLQuant so you could specify bound by
> iter.
>
> I think trgtArray should become an FLPar in the next version, that way it
> can be validated more easily.
>
>
> Laurie
>
>
>
> On 03/22/2012 12:33 PM, Luis Ridao wrote:
>
> thanks Laurie ... the problem now is this line:
>
> print("OK to here3")
> ctrl<-fwdControl(data.frame(year=yr.TAC,max=c(NA,2),val=c(mean(TAC),NA),
> quantity=c("catch","f")))
>
> Year =2011
> [1] "OK to here1"
> [1] "OK to here2"
> === mean TAC 32935.08
> [1] "OK to here3"
> Error in `[<-`(`*tmp*`, 1, ac(min(ctrl at target[, "year"])), value = NA) :
> error in evaluating the argument 'j' in selecting a method for function
> '[<-': Error in Summary.factor(c(1L, 1L), na.rm = FALSE) :
> min not meaningful for factors
>
> Sorry for the inconvenience
>
> Best,
> Luis
>
>
> On Wed, Mar 21, 2012 at 5:06 PM, Laurie <lauriekell at googlemail.com> wrote:
>
>> This is wrong
>>
>> target
>> Target
>> year quantity min val max
>> 1 2011 f NA 0.4550558 NA
>> 2 2012 f NA 0.3200000 NA
>> 3 2012 catch 0 NA 40000
>> 4 2012 f NA 2.0000000 NA
>>
>>
>> min val max
>> 1 NA 0.45506 NA
>> 2 NA 0.32000 NA
>> 3 0.00000 NA 40000.00000
>> 4 NA NA 2.00000
>>
>>
>> Try this! I have added an argument to fwd maxF that sets the upper bound on F
>>
>> print("OK to here1")
>> ## project MP to TAC year with the HCR and geom mean recr.
>> c.=fwdControl(data.frame(val=c(rep(0.2,2),NA),min=c(NA,NA,0),max=c(NA,NA,40000),year=c(2011:2012,2012),quantity=c(rep("f",2),"catch")))
>> MP<-fwd(MP,ctrl=c.,sr=list(model="mean",params=FLPar(1)),sr.residuals=SRrs,maxF=2) ## HERE IS THE PROBLEM
>> print("OK to here2")
>>
>>
>>
>> Laureie
>>
>> On 03/21/2012 05:15 PM, Luis Ridao wrote:
>>
>> here it comes ... sorry about it
>>
>> best,
>> Luis
>>
>> On Wed, Mar 21, 2012 at 4:11 PM, Laurie <lauriekell at googlemail.com>wrote:
>>
>>> There is no funcs.R file
>>>
>>> Laurie
>>>
>>>
>>> On 03/20/2012 01:09 PM, Luis Ridao wrote:
>>>
>>>
>>> I have attached the input files and the script (the workspace is too
>>> large >60 MB)
>>>
>>>
>>> Best,
>>> Luis
>>>
>>> On Tue, Mar 20, 2012 at 11:57 AM, Laurie <lauriekell at googlemail.com>wrote:
>>>
>>>> Send me the objects and code and I will try and run it.
>>>>
>>>> Laurie
>>>>
>>>>
>>>> On 03/20/2012 12:21 PM, Luis Ridao wrote:
>>>>
>>>> FLR-help,
>>>>
>>>> I'm having problems with a MSE.
>>>> I copy-paste the line which gives the error:
>>>>
>>>> ...
>>>> ...
>>>> * print("OK to here1")*
>>>> * ## project MP to TAC year with the HCR and geom mean recr.*
>>>> *
>>>> MP<-fwd(MP,ctrl=target,sr=list(model="mean",params=FLPar(1)),sr.residuals=SRrs)
>>>> *
>>>> ...
>>>> ...
>>>>
>>>> Year =2011
>>>> [1] "OK to here1"
>>>> *Error in .local(object, ctrl, ...) : 6*
>>>>
>>>>
>>>> My target is :
>>>> > *target*
>>>>
>>>> Target
>>>> year min val max quantity season area unit spp fleet metier
>>>> rel.year
>>>> 1 2011 NA 0.4550558 NA f NA NA NA NA NA NA
>>>> NA
>>>> 2 2012 NA 0.3200000 NA f NA NA NA NA NA NA
>>>> NA
>>>> 3 2012 0 NA 40000 catch NA NA NA NA NA NA
>>>> NA
>>>> 4 2012 NA 2.0000000 NA f NA NA NA NA NA NA
>>>> NA
>>>> rel.season rel.area rel.unit
>>>> 1 NA NA NA
>>>> 2 NA NA NA
>>>> 3 NA NA NA
>>>> 4 NA NA NA
>>>>
>>>> min val max
>>>> 1 NA 4.5506e-01 NA
>>>> 2 NA 3.2000e-01 NA
>>>> 3 0.0000e+00 NA 4.0000e+04
>>>> 4 NA NA 2.0000e+00
>>>>
>>>> the '*sr*' object :
>>>>
>>>> > list(model="mean",params=FLPar(1))
>>>> $model
>>>> [1] "mean"
>>>>
>>>> $params
>>>> An object of class "FLPar"
>>>> params
>>>> a
>>>> 1
>>>> units: NA
>>>>
>>>> and the Sr residuals:
>>>>
>>>> > *SRrs*
>>>> An object of class "FLQuant"
>>>> iters: 1000
>>>>
>>>> , , unit = unique, season = all, area = unique
>>>>
>>>> year
>>>> quant 2011 2012 2013
>>>> all 27355(0) 27355(0) 27355(0)
>>>>
>>>> units: NA
>>>>
>>>> R version : R.2.14.2
>>>> FLash Version: 2.5.0
>>>> FLAdvice Version: 1.0
>>>> FLXSA Version: 2.5
>>>> FLAssess Version: 2.5
>>>> FLCore Version: 2.5
>>>>
>>>> Running on Ubuntu 10.04.04
>>>>
>>>> Thanks in advance
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> flr-list mailing listflr-list at flr-project.orghttps://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/flr-list
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> flr-list mailing list
>>>> flr-list at flr-project.org
>>>> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/flr-list
>>>>
>>>>
>>>
>>>
>>> _______________________________________________
>>> flr-list mailing listflr-list at flr-project.orghttps://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/flr-list
>>>
>>>
>>>
>>> _______________________________________________
>>> flr-list mailing list
>>> flr-list at flr-project.org
>>> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/flr-list
>>>
>>>
>>
>>
>> _______________________________________________
>> flr-list mailing listflr-list at flr-project.orghttps://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/flr-list
>>
>>
>>
>> _______________________________________________
>> flr-list mailing list
>> flr-list at flr-project.org
>> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/flr-list
>>
>>
>
>
> _______________________________________________
> flr-list mailing listflr-list at flr-project.orghttps://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/flr-list
>
>
>
> _______________________________________________
> flr-list mailing list
> flr-list at flr-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/flr-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/flr-list/attachments/20120323/5fdd7db6/attachment-0001.html>
More information about the flr-list
mailing list