[R] Question about the smooth.Pspline

Xuhong Zhu zhuxuhong2000 at gmail.com
Tue Mar 6 19:40:56 CET 2007


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.

Again, thanks for your time and kindly help!

Xuhong



More information about the R-help mailing list