[R] Error with psi value for 'segmented' package for R
Vito Muggeo (UniPa)
vito.muggeo at unipa.it
Tue May 8 18:29:08 CEST 2012
dear Szymon,
what do you mean
"it does not work for others.. that fit within similar range"?
Each dataset has its own features and breakpoint estimation is not as
simple as estimation of linear models even if your data "fit within
similar range".
I will contact you out of the list for details,
best,
vito
Il 08/05/2012 16.44, Szymon Biskup ha scritto:
> Hi everyone,
>
> while trying to use 'segmented' (R i386 2.15.0 for Windows 32bit OS) to determine the breakpoint I got stuck with an error message and I can't find solution. It is connected with psi value, and the error says:
>
>
>
> Error in seg.glm.fit(y, XREG, Z, PSI, weights, offs, opz) :
> (Some) estimated psi out of its range
>
>
>
> This is the code I am using:
>
> library("segmented")
> curva<-read.table("lamintr1.txt", header=T)
> attach(curva)
> fit.glm<-glm(gpp~temp, weight=NULL, family=gaussian)
> plot(temp,gpp,xlab=expression("temp"),
> ylab="gpp",pch=15,cex=0.8,xlim=c(0,50), ylim=c(0,40))
> o1<-glm(gpp ~ temp, weight=NULL, family=gaussian)
> os1<-segmented(o1, seg.Z=~temp, psi=15, control=seg.control(n.boot=0,
> display=T, it.max=5))
> plot(os1, add=TRUE, res=TRUE, se=FALSE, show.gap=TRUE, linkinv = FALSE,
> res.col=1, rev.sgn=FALSE, const=0)
> summary(os1)
>
>
> And the most surprising fact is that it works for some of my data, eg:
>
> temp gpp
> 5 5.08050857592085
> 10 9.50809597873546
> 15 21.0206415558052
> 20 21.5340216521042
> 25 22.8455243983385
> 30 17.6106786978697
>
>
> but not for the others, that fit within similar range (in what case I tired to change the psi value but it didn't help), eg:
>
> temp gpp
> 5 10.1494724447878
> 10 9.64730588470101
> 15 19.3439579009423
> 20 20.6756229089911
> 25 13.7902544619339
> 30 21.9355758560751
>
>
> or
>
> temp gpp
> 5 8.64380785577685
> 10 9.47992535226006
> 15 16.7556554476544
> 20 14.5189937476639
> 25 20.6874556832793
> 30 17.5509059595314
>
>
> I saw post with similar questons but none of them had the answer I am looking for.
> Would there be anyone that could help me with this?
>
>
> Thanks a lot for your time and help.
>
>
> Best regards,
>
> Szymon
>
> ______________________________________________
> 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.
>
--
====================================
Vito M.R. Muggeo
Dip.to Sc Statist e Matem `Vianelli'
Università di Palermo
viale delle Scienze, edificio 13
90128 Palermo - ITALY
tel: 091 23895240
fax: 091 485726
http://dssm.unipa.it/vmuggeo
More information about the R-help
mailing list