Can someone point me to the appropriate functions for fitting multiple statistical models that are coupled to each other. The data are measurements of salinity s and temperature t at stations id and pressures at p as well as surface elevations h at stations id. The problem is, for any new station, to estimate s at all p, given t at all p and given h. If h is ignored, the for each p, there would be an independent model like rlm(s~t+I(t^2)). No problem. (I have been using a loop, but I think they can be computed simultaneously using lm(s~as.factor(p)/(t+I(t^2))-1). However, rlm(s~as.factor(p)/(t+I(t^2))-1) does not converge!) The h data couple the models. Surface elevation reflects the water's specific volume at each depth (pressure). The volume vp (p to indicate pressure) depends on s,t, and p, and h is essentially a sum over the volume at each p. When the individual models are computed, coefficients should be chosen so that this is satisfied. How to do this in R? Without the coupling the least-squares formulation would seek coefficients a_p and b_p to minimize: sum_p(sum_p((s_id,p - a_p t_id,p + b_k)^2)). Minimization at each p is independent. With coupling, there would be an additional term: sum_id((sum_p(vp)-h_id)^2) where vp is a function of a_p t_id,p + b_k and of t_id. The functions for vp are nonlinear, but if necessary with some work it should be possible to get a linear function that is good enough. Also, not all stations have values at all pressures. Thanks, Carlisle -- William Carlisle Thacker Atlantic Oceanographic and Meteorological Laboratory 4301 Rickenbacker Causeway, Miami, Florida 33149 USA Office: (305) 361-4323 Fax: (305) 361-4392 "Too many have dispensed with generosity in order to practice charity." Albert Camus