Xuhong Zhu napsal(a):> Hello, Everyone,
>
> I want to use the smooth.Pspline to smooth my data but R give me the
> error message as follows:
>
> Error in smooth.Pspline(sort.e$time, sort.e$cuff, method = 3) :
> X not strictly increasing
>
> my data looks like the following:
>
> id cuff time patient
> ...
> 2783 13.229608 478 6
> 3472 20.904825 478 7
> 4155 15.033727 478 8
> 4845 19.342963 478 9
> 715 8.000000 479 3
> 1422 22.052385 479 4
> 2110 15.393063 479 5
> 2784 13.200922 479 6
> 3473 20.900132 479 7
> ...
>
> my R codes is:
>
> e <- rbind(patient.1,patient.2,patient.3,...)
> attach(e)
> sort.e <- e[order(time),]
> plot(sort.e$time, sort.e$cuff, xlab="Time",
ylab="Cuff",type="p", col=3,
> xlim=c(c[2],d[2]) , ylim=c(c[1], d[1]) , main="one Smooth Curve for 10
> Patients")
> fm <- smooth.Pspline(sort.e$time, sort.e$cuff, method=3)
> lines(fm$x, fm$y, lty=1,col=1)
>
>
> What I am doing here is to combine the data together and find a smooth
> curve. My question is if the smooth.Pspline could not be used in my
> data since the variable "time" has repeated values.
Quoted from your error message:
> Error in smooth.Pspline(sort.e$time, sort.e$cuff, method = 3) :
> X not strictly increasing
Quoted from help of smooth.Pspline (which, as you should have told us by
the way, is contained in package pspline):
Arguments:
x values of the predictor variable. These must be strictly increasing,
and there must be at least 2*norder + 1 of them.
sm.spline provides a simplified interface, in which the x values can be
unsorted, or a list with components "x" and "y" or a
two-column matrix
or a complex vector.
Strictly increasing = no repeated values...
Petr
>
> Xuhong
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>
--
Petr Klasterecky
Dept. of Probability and Statistics
Charles University in Prague
Czech Republic