# [R] constraints again

Mark Span mspan at swets.nl
Tue Oct 22 11:54:47 CEST 2002

```I would like to fit the following function on my data.

out.nls<-nls(z ~ p1+

(p2*dat)+(p3*dat^2)+(p4*dat^3)+(p5*AgeS)+(p6*AgeS^2)+(p7*AgeS^3)+
(p8*(dat*AgeS))+(p9*(dat^2*AgeS))+(p10*(dat^3*AgeS))+

(p11*(dat*AgeS^2))+(p12*(dat*AgeS^3))+(p13*(dat^2*AgeS^2))+
(p14*(dat^2*AgeS^3))+(p15*(dat^3*AgeS^3)),

start=list(p1=0,p2=0,p3=0,p4=0,p5=0,p6=0,p7=0,p8=0,p9=0,p10=0,p11=0,p12=0,p1
3=0,p14=0,p15=0),trace=trace,
control=control)

which relates the z-score on a IQ subtest to Age (AgeS) and Raw Score (dat).
Allthough the dataset is quite large, older subjects usually do not provide
large 'raw scores', and young subjects do not provide low scores. This leads
to incorrect fits for large raw scores for older subjects and low raw scores
for young subjects. I would like to constrain the fit so, that the 'link'
between raw score and z-score for all ages is monotonical. Can anybody

Looking through FAQ and list, I realize that there is no 'easy way'. So
presumably I am looking for directions...

Mark M. Span

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```