Displaying 1 result from an estimated 1 matches for "myiv".
Did you mean:
myip
2011 Nov 10
3
optim seems to be finding a local minimum
...returns a data frame column IV_transf:
transformIV = function(.alpha,.beta) {
IV_transf <- as.data.frame(1 - (1/exp((IV/.beta)^.alpha)))
return(IV_transf)
}
### Function "mysum" calculates the sum of absolute residuals after a
regression with a single predictor:
mysum<- function(myIV,myDV){
regr<-lm(myDV[[1]] ~ 0 + myIV[[1]])
mysum<-sum(abs(regr$resid))
return(mysum)
}
### Function to be optimized;
### param is a vector of 2 values (.alpha and .beta)
myfunc <- function(param){
myalpha<-param[1]
mybeta<-param[2]
IVtransf<-transformIV(myalpha, mybet...