The following is an official example of the use of the 'cs' function in GAMLSS framework(http://127.0.0.1:11212/library/gamlss/html/cs.html):
# cubic splines example
data(aids)
# fitting a smoothing cubic spline with 7 degrees of freedom
# plus the a quarterly effect
aids1<-gamlss(y~cs(x,df=7)+qrt,data=aids,family=PO) #
But it gives such an error message:
variable lengths differ (found for 'cs(aids$x, df = 7)')
Please help me. Thank you all