Hi > > Hi, > > I appreciate your help with the segmented function. I am relatively new to > R. I followed the introduction of the 'segmented'-package by Vito Muggeo, > but still it does not work. > Here are the lines I wrote: > > data_test<-data.frame(x=c(1:10),y=c(1,1,1,1,1,2,3,4,5,6)) > lr_test<-lm(y~x,data_test) > seg_test<-segmented(lr_test,seg.Z~x,psi=1)
You did not read help page correctly. seg.Z is named parameter in which you specify formula without LHS. psi shall be x near the expected slope change. seg_test<-segmented(lr_test,seg.Z=~x,psi=5) works corretly Regards Petr > > > /error in segmented.lm(lr_test, seg.Z ~ x, psi = 1) : > A wrong number of terms in `seg.Z' or `psi'/ > > Thank you very much, > Stella > > > > -- > View this message in context: http://r.789695.n4.nabble.com/Problem-with- > segmented-function-tp4639227.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.