search for: dv_pred

Displaying 2 results from an estimated 2 matches for "dv_pred".

2011 Mar 07
1
More appropriate optimization routine?
...self at time t-1, of "pred" at time t, and of 2 scalars - a and b. I have to find optimal a and b that would ensure the best fit between the observed DV and the predicted DV. Below is the function I have to optimize: my.function <- function(param){ a<-param[1] b<-param[2] DV_pred <- rep(0,length(pred)) for(i in 2:length(pred)){ DV_pred[i] <- 1 - ( (1 - DV_pred[i-1] * a) / (exp(pred[i] * b)) ) } DV_pred[1]<-DV[1] correl <- cor(DV,DV_pred) return(correl) } a has to be between 0.001 and 0.75 b has to be positive. I apologize if it's a simple questi...
2011 Mar 30
3
optim and optimize are not finding the right parameter
Dear all, I have a function that predicts DV based on one predictor pred: pred<-c(0,3000000,7800000,15600000,23400000,131200000) DV<-c(0,500,1000,1400,1700,1900) ## I define Function 1 that computes the predicted value based on pred values and parameters a and b: calc_DV_pred <- function(a,b) { DV_pred <- rep(0,(length(pred))) for(i in 1:length(DV_pred)){ DV_pred[i] <- a * (1- exp( (0-b)*pred[i] )) } return(DV_pred) } ## I define Function 2 that computes the sum of squared deviations for predicted DV from actual DV: my.function <- function(param){...