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@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.