Hello, I'm currently using the segmented package of M.R. Muggeo to fit a two-slope segmented regression. I would like to constrain a null-left-slope, but I cannot make it. I followed the explanations of the package (http://dssm.unipa.it/vmuggeo/segmentedRnews.pdf) to write the following code : fit.glm <- glm(y~x) fit.seg <- segmented(fit.glm, seg.Z=~x,psi=0.3) fit.glm <-update(fit.glm,.~.-x) fit.seg1 <-update(fit.seg) If I got well, the two last lines are supposed to constrain the slope, but it did not change anything. Could you help me with this ? By the way, I don't understand the ".-.-x" code in the update function. Thanks a lot by anticipation ! Pierre -- Pierre Hainaut Université Catholique de Louvain Earth and Life Institute Croix du Sud, 2 - bât. De Serres, B337 - bte L7.05.14 1348 Louvain-la-Neuve - Belgique +3210479326 [[alternative HTML version deleted]]
On 2013-03-12 03:55, Pierre Hainaut wrote:> Hello, > > I'm currently using the segmented package of M.R. Muggeo to fit a > two-slope segmented regression. I would like to constrain a > null-left-slope, but I cannot make it. I followed the explanations of > the package (http://dssm.unipa.it/vmuggeo/segmentedRnews.pdf) to write > the following code : > > fit.glm <- glm(y~x) > fit.seg <- segmented(fit.glm, seg.Z=~x,psi=0.3) > fit.glm <-update(fit.glm,.~.-x) > fit.seg1 <-update(fit.seg) > > If I got well, the two last lines are supposed to constrain the slope, > but it did not change anything. Could you help me with this ? > By the way, I don't understand the ".-.-x" code in the update function. > > Thanks a lot by anticipation ! > > Pierre >I can't help you with the segmented constraints, but the 'dot'-notation is very well and concisely documented: use ?update which will take you to a link for ?update.formula where you can read all about it. Peter Ehlers