Re: [R] Fitting a Triangular Distribution to Bivariate Data

2010-12-23 Thread David L Lorenz
/23/2010 07:53 AM Subject: Re: [R] Fitting a Triangular Distribution to Bivariate Data Sent by: r-help-boun...@r-project.org On 2010-12-23 2:19, David Bapst wrote: > Hello, > I have some xy data which clearly shows a non-monotonic, peaked > triangular trend. You can get an idea of what

Re: [R] Fitting a Triangular Distribution to Bivariate Data

2010-12-23 Thread Jinsong Zhao
On 2010-12-23 2:19, David Bapst wrote: Hello, I have some xy data which clearly shows a non-monotonic, peaked triangular trend. You can get an idea of what it looks like with: x<-1:20 y<-c(2*x[1:10]+1,-2*x[11:20]+42) I've tried fitting a quadratic, but it just doesn't the data-structure with th

Re: [R] Fitting a Triangular Distribution to Bivariate Data

2010-12-23 Thread Jonathan P Daily
I don't know if any specific package has a triangular distribution, but I know you can fit a model using first degree b-splines with a single knot. library(splines) ?bs x <- 1:100 y <- rnorm(100, ifelse(x <50, x, 100-x), 15) fit <- lm(y ~ bs(x, knots = 50, degree = 1)) --