Message-ID: <OF48D9FF8A.60E6CC6B-ONC1257A52.0036BE68-C1257A52.003728A6@precheza.cz>
Date: 2012-08-06T10:00:41Z
From: PIKAL Petr
Subject: Odp: Problem with segmented function
In-Reply-To: <1344193778614-4639227.post@n4.nabble.com>
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 at 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.