I realize this may be more of a math question. I have the following optim:

optim(c(0.0,1.0),logis.op,x=d1_all$SOA,y=as.numeric(md1[,i]))

which uses the following function:

logis.op <- function(p,x,y) {

  ypred <- 1.0 / (1.0 + exp((p[1] - x) / p[2]));

res <- sum((y-ypred)^2)

    return(res)

}

I would like to add weights to the optim. Do I have to alter the logis.op
function by adding an additional weights parameter? And if so, how would I
change the ypred formula? Would I just substitute x with x*w?

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

Reply via email to