aic.ED.locfit {EffectiveDose} | R Documentation |
The function aic.ED.locfit
returns the Akaike's information criterion for the effective dose level, where the locfit
function is used for computing the estimate for the probability function.
The definition of AIC used here is -2*log-likelihood + pen*(fitted d.f.), where the fitted d.f. is used from the local linear fit, where the influence values define the degrees of freedom. To construct the log-likelihood basically the residual sum of squares is used.
The argument "pen"
specifies the penalty for the degrees of freedom term. Default value is 2.
This function is geared to the function aic
from the locfit package. Basically the AIC value is computed in the same way. To compute the log-likelihood value for the ED
estimate the residual sum of squares is used, i.e. log-likelihood=-1/2*RSS as in the locfit
package. The degrees of freedom are inherited from the locfit object.
aic.ED.locfit
gives a numeric vector with 5 entries: df
(degrees of freedom), lk LL
(log-likelihood value of the locfit object), lk ED
(likelihood value of the ED estimate), AIC LL
(AIC score for the locfit object), AIC ED
(AIC score for the ED estimate).
ED
, which is constructed using the locfit
function. #Function to generate data for a binary response model. The response variable has a success probability pnorm(x, mean=0.5, sd=0.5). ybin=function(x){ n=length(x) y=numeric(n) p=pnorm(x, mean=0.5, sd=0.5) for(i in 1:n){ y[i]=rbinom(1,1,prob=p[i]) } return(y) } x=seq(0,1,length.out=50) #the variable x presents the different dose levels y=ybin(x) #y is the binary response simulated by the above function fit=locfit(y~lp(x,deg=1, h=0.1, nn=0)) #fits a local linear estimate for the success probability using the locfit function aic(fit) res=ED(list(x,y), alpha=seq(0.2,0.8, length.out=40)) #a list is used and internally the function locfit res2=ED(fit, alpha=seq(0.2,0.8, length.out=40)) #the function ED is applied to a personally adjusted this-is-escaped-codenormal-bracket31bracket-normal object aic.ED.locfit(res) aic.ED.locfit(res2)