5

I am trying to use nlmer with SSfpl to fit some data with a four-parameter logistic function. I can get a fine fit for the overall data using:

nm.fpl <- nlmer(meanFix ~ SSfpl(Time, A, B, xmid, scal) ~ (scal | Subject), 
          data = dataSubset, start = c(A = 0.2, B = 0.7, xmid = 600, scal = 100))

Now I want to add a fixed effect of Condition, which has 2 within-Subject levels. I would like to evaluate whether the two Conditions differ in terms of any of the 4 parameters (A, B, xmid, scal), but I don't know how to specify that in this formula. I can fit model separately to the two subsets (Condition A and Condition B) and then compare the parameters, but that doesn't seem like the right approach.

Dan M.
  • 1,526
  • 1
  • 12
  • 17
  • 1
    I encountered the same problem, so far with no success. My attempts are described at http://rpubs.com/bbolker/3363 – Ben Bolker Dec 31 '12 at 04:15
  • 3
    Update: see (revised material in) link above. I've had some success, at the moment the process is too complicated for me to replicate it in full here (but you're welcome to take my material there and boil it down to an answer here.) The bottom line is that you do have to build your own grouping variables/evaluation by hand (simply specifying an interaction formula as in @Thierry's answer won't work), but it can be done. – Ben Bolker Jan 05 '13 at 21:14
  • 2
    You might find my answer in http://stackoverflow.com/questions/15141952 useful. – Teemu Daniel Laajala Jun 01 '13 at 02:19

1 Answers1

0

Have you tried to add an interaction?

nm.fpl <- nlmer(meanFix ~ SSfpl(Time, A * Condition, B, xmid, scal) ~ (scal | Subject), 
          data = dataSubset, start = c(A = 0.2, B = 0.7, xmid = 600, scal = 100))
nm.fpl <- nlmer(meanFix ~ SSfpl(Time, A : Condition, B, xmid, scal) ~ (scal | Subject), 
          data = dataSubset, start = c(A = 0.2, B = 0.7, xmid = 600, scal = 100))
Thierry
  • 18,049
  • 5
  • 48
  • 66
  • 1
    That also produces an error: Error in nlmer(meanFix ~ SSfpl(Time, A, B, xmid * Condition, scal) ~ : gradient attribute of evaluated model must be a numeric matrix In addition: Warning message: In Ops.factor(xmid, Condition) : * not meaningful for factors – Dan M. Jun 16 '12 at 09:37