Dear all,

I have a question concerning lme4 library and probit function fitting:

Would it be possible to write custom-defined sigmoid link functions to use in combination with lmer? Specifically, is it possbile to
write a sigmoid function (probit, for instance) that has 2 more parameters that control the lower and the upper asymptote?

Attached below is an example that generates a synthetic dataset and approaches the problem from the glm standpoint. I wonder whether
it is possible to do the same thing within the framework of lmer.

The question refers to the fact that in cognitive sciences we are often interest in modeling binary outcomes (for instance: YES/NO in
a computerized task); however, in many experimental designs, the observer's response at chance will not asymptote at 0. Similarly
the maximal performance is occasionally contaminated by errors (will not asymptote at 1). Therefore, it is necessary to model the
asymptotes along with the other parameters.


Thank you very much
best ragards
Giovanni Mancuso


# clear all
rm(list=ls(all=TRUE))


set.seed(2)

# ---------------------
# Parameters experiment
# ---------------------

Nsubj <- 3
NTrial <- 50
LengthCov <- 7 # length convariate
StimInt <- seq(-3,3,len=LengthCov ) # Covariate

# ---------------------------
# Parameters CDF distribution
# ---------------------------

Par.MU <- rnorm(Nsubj,0,0.01) # Center
Par.Sigma <- rnorm(Nsubj,1,0.01) # Scale
Lower.asymptote <- rep(0.5,Nsubj)
Upper.asymptote <- rep(0.01,Nsubj)

# ------------------------------
# Generates True Values and DATA
# ------------------------------

# reserve space
P.psychometric <- matrix(c(NA),nrow=Nsubj,ncol=LengthCov)
N.Yes <- matrix(c(NA),nrow=Nsubj,ncol=LengthCov)

for(i in 1:Nsubj)
{
    P.psychometric[i,] <- Lower.asymptote[i]+(1-Lower.asymptote[i]-Upper.asymptote[i])*pnorm(StimInt,mean=Par.MU[i],sd=Par.Sigma[i])
    N.Yes[i,] <- rbinom(LengthCov,NTrial,P.psychometric[i,])

}

data.set <- data.frame(StimInt = rep(StimInt,Nsubj),Pcorr=as.vector(t(N.Yes/NTrial)),CorrResp=as.vector(t(N.Yes)),WrongResp=as.vector(t(NTrial-N.Yes)),Subj = rep(1:Nsubj,each=LengthCov))

# -------------------------------------------------
# How this problem is approached within GLM
# -------------------------------------------------

library(psyphy)
model <- psyfun.2asym(cbind(data.set$CorrResp,data.set$WrongResp)~data.set$StimInt,link=probit.2asym,init.g=0.05,init.lam=0.025)
summary(model)

# The function 'psyfun.2asym', wrote by Dr Kenneth Knoblauch, estimates a best ?t to the data by alternating between calls to 'glm' for current best estimates of arguments to the link function and calls to optim to
# estimate the values of the lower and upper asymptote.
# 'psyfun.2asym' takes as a link function a user defined probit function with 4 free parameters (center and scale, and the upper and lower asymptote)




	[[alternative HTML version deleted]]

