[R] Error with Segmented package
David Winsemius
dwinsemius at comcast.net
Thu Oct 8 04:33:49 CEST 2015
On Oct 7, 2015, at 6:10 PM, andrew haywood wrote:
> Thanks David,
>
> I apologies for not posting the versions.
>
> I am running
>
> R version 3.2.2 (2015-08-14)
> Platform: x86_64-w64-mingw32/x64 (64-bit)
> Running under: Windows 7 x64 (build 7601) Service Pack 1
>
> locale:
> [1] LC_COLLATE=English_United Kingdom.1252
> [2] LC_CTYPE=English_United Kingdom.1252
> [3] LC_MONETARY=English_United Kingdom.1252
> [4] LC_NUMERIC=C
> [5] LC_TIME=English_United Kingdom.1252
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
> other attached packages:
> [1] segmented_0.5-1.2
>
> And I still get the error. What is the best way to debug the error?
The first thing I do is run traceback() immediately after the error. If that fails to illuminate the problem, my next step is falling back to:
options(error="browser")
# which should allow you to examine the system-state at the time of the error.
And at that point I start considering sending an email to the maintainer with my reproducible example, especially so since it fails with a more recent version. It may be that the maintainer has the same OS as you have.
--
David.
>
> Kind regards teht
> Andrew
>
>
> On Thu, Oct 8, 2015 at 7:11 AM, David Winsemius <dwinsemius at comcast.net> wrote:
>
> On Oct 7, 2015, at 6:50 AM, andrew haywood wrote:
>
> > Dear List,
> >
> > I am trying to run a simple pieewise regression using the segmented package.
> >
> > When running the following code
> >
> > library(segmented)
> > data = data.frame(x=c(50,60,70,80,90,100,110) , y=
> > c(703.786,705.857,708.153,711.056,709.257, 707.4, 705.6))
> >
> > model.lm = segmented(lm(y~x,data = data),seg.Z = ~x, psi = NA, control =
> > seg.control(K=1))
> >
> > I get the following error.
> >
> > Error in if (psi == Inf) psi <- median(XREGseg) :
> > missing value where TRUE/FALSE needed
>
> I don't get any error, despite being a bit behind the times. You need to specify the versions (OS, R, segmented) and prepare for some debugging efforts. Easiest way to do this is with the output of sessionInfo().
>
> R version 3.2.1 (2015-06-18) -- "World-Famous Astronaut"
> Copyright (C) 2015 The R Foundation for Statistical Computing
> Platform: x86_64-apple-darwin10.8.0 (64-bit)
>
> I also have an embarrassing number of packages loaded.
>
> other attached packages:
> [1] segmented_0.5-1.1 boot_1.3-17 sqldf_0.4-10
>
> (remaining 48 are omitted)
>
>
> > [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > 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.
>
> David Winsemius
> Alameda, CA, USA
>
>
David Winsemius
Alameda, CA, USA
More information about the R-help
mailing list