spencer graves
[EMAIL PROTECTED] wrote:
# I need to generate some data. I'm modeling some time series that follow a # negative exponential decay (mostly). I have 20 samples that can easily be fit with cubic splines. # What I want to do is generate many thousands of similar samples using the parameters from the splines
# For instance one data sample looks not unlike this:
foo.curve <- 1 * exp(-0.01 * 1:500) + 0.5 ts.plot(foo.curve, lwd = 2)
# Another sample looks not unlike this:
foo.curve2 <- 0.9 * exp(-0.02 * 1:500) + 0.5 ts.plot(foo.curve2, lwd = 2)
# They can be fit with splines easily like so:
ts.plot(foo.curve, lwd = 2) spline.model <- smooth.spline(foo.curve)
fits4foo <- predict(spline.model)$y spline4foo <- spline(1:500, fits4foo) lines(spline4foo$x, spline4foo$y, col = "red", lwd = 2, lty = "dashed")
# I originally generated the data I needed by using a nls model and # adding some noise to the mean of the coefficents from those fits.
# However, I've been told to try and do this using splines for arcane
reasons.
# So, if you had 20 splines like spline.model above and wanted to generate some similar data what would you do? # Thanks in advance.
Promote security and make money with the Hushmail Affiliate Program:
______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
