[R] unused argument error

jim holtman jholtman at gmail.com
Sat Nov 27 03:14:43 CET 2010


?nlm

It does not seem to have a parameter 'data', so that is the cause of
your error message.

On Fri, Nov 26, 2010 at 4:36 PM, Mike Gibson <megalops31 at hotmail.com> wrote:
>
>
> I want to change my parameter g to maximize the sum of my model.  I keep getting an unused argument error and I don't know why.  Here are the details of my problem.
>
> g<-0.2                     #initial value for g
> Qt<-exp(-g*tagdat$t)   #model building
> PTT<-Qt*Qt          #model building
> PT<-2*Qt*(1-Qt)     #model building
> P0<-(1-Qt)^2          #model building
> pTT<-PTT/(1-P0)     #model building
> pT<-PT/(1-P0)       #model building
> lamda<-c(g=g)    #make a list of values for my g parameter.
> -sum(tagdat$N2*log(pTT)+tagdat$N1*log(pT))    #here is the sum of my model.  It works.
> f <- function(g) sum(tagdat$N2*log(pTT)+tagdat$N1*log(pT))    #now I name my model and make it a function called g
> tag.fit<-nlm(f,p=lamda, data=tagdat, hessian=T)               #this is where I am stuck.  I am running the nlm procedure but it keeps telling me I have the unused argument of data=list.  ???
>
> Any help would be greatly appreciated.
>
> Mike
>        [[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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?



More information about the R-help mailing list