Re: [R] Specify a correct formula in R for Piecewise Linear Functions?

2008-01-02 Thread zhijie zhang
*example*( pmin ) is useful. I will use it from now on. Thanks a lot. On Jan 3, 2008 2:50 AM, Charles C. Berry <[EMAIL PROTECTED]> wrote: > On Thu, 3 Jan 2008, zhijie zhang wrote: > > > Some developments with confusions. I tried the spline method and dummy > > variable approach to do it. But th

Re: [R] Specify a correct formula in R for Piecewise Linear Functions?

2008-01-02 Thread Charles C. Berry
On Thu, 3 Jan 2008, zhijie zhang wrote: > Some developments with confusions. I tried the spline method and dummy > variable approach to do it. But their results are very different. See > following. > [volumes of output and gratuitous SAS code deleted] > Q1: Why are these two methods so differ

Re: [R] Specify a correct formula in R for Piecewise Linear Functions?

2008-01-02 Thread Greg Snow
Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of zhijie zhang > Sent: Tuesday, January 01, 2008 8:25 AM > To: [EMAIL PROTECTED] > Subject: [R] Specify a correct formula in R for Piecewise > Linear Functions? > > Dear all, >

Re: [R] Specify a correct formula in R for Piecewise Linear Functions?

2008-01-02 Thread zhijie zhang
Some developments with confusions. I tried the spline method and dummy variable approach to do it. But their results are very different. See following. library(splines) #Spline methods-Method1 m.glm<-glm(mark~x_trans+poly(elevation_trans,2)+bs(distance_trans, degree=1,knots=c(13,25))+bs(y_trans,

Re: [R] Specify a correct formula in R for Piecewise Linear Functions?

2008-01-02 Thread Thomas Lumley
On Tue, 1 Jan 2008, Charles C. Berry wrote: > On Tue, 1 Jan 2008, zhijie zhang wrote: > >> Dear all, >> I have two variables, y and x. It seems that the relationship between them >> is Piecewise Linear Functions. The cutpoint is 20. That is, when x<20, there >> is a linear relationship between y a

Re: [R] Specify a correct formula in R for Piecewise Linear Functions?

2008-01-02 Thread vmuggeo
> On Tue, 1 Jan 2008, zhijie zhang wrote: > >> Dear all, >> I have two variables, y and x. It seems that the relationship between >> them >> is Piecewise Linear Functions. The cutpoint is 20. Have a look to the package segmented if you don't know exactly the breakpoint and you are interested in e

Re: [R] Specify a correct formula in R for Piecewise Linear Functions?

2008-01-01 Thread Charles C. Berry
On Tue, 1 Jan 2008, zhijie zhang wrote: > Dear all, > I have two variables, y and x. It seems that the relationship between them > is Piecewise Linear Functions. The cutpoint is 20. That is, when x<20, there > is a linear relationship between y and x; while x>=20, there is another > different lin

[R] Specify a correct formula in R for Piecewise Linear Functions?

2008-01-01 Thread zhijie zhang
Dear all, I have two variables, y and x. It seems that the relationship between them is Piecewise Linear Functions. The cutpoint is 20. That is, when x<20, there is a linear relationship between y and x; while x>=20, there is another different linear relationship between them. How can i specify t