Re: [R] Piecewise regression using segmented package plotted in xyplot

2015-08-28 Thread Duncan Mackay
Friday, 28 August 2015 14:12 To: r-help@r-project.org Subject: [R] Piecewise regression using segmented package plotted in xyplot Hi, xyplot(threshold ~ age |frequency.a, data=rage, groups=HL, cex=0.5, layout=c(7,4), par.strip.tex=list(cex=0.8), xlab="Age (years)", ylab=&

Re: [R] Piecewise regression using segmented package plotted in xyplot

2015-08-28 Thread S Ellison
I perhaps should have added a stronger warning here; note that the model fitting in my previous post (below) uses explicit initial breakpoints for segmented (specifically, c(30,60) at line 1 of the get.segments() ). if you know where yours are, substitute them there. Otherwise, you'd need to us

Re: [R] Piecewise regression using segmented package plotted in xyplot

2015-08-28 Thread S Ellison
There isn't an abline method for segmented, and even if there were you'd need segments() for a segmented line plot. You're going to have to roll your own. That will need a function to extract the break locations and predicted values at those points I don't have your data, so I can't do one spe

[R] Piecewise regression using segmented package plotted in xyplot

2015-08-27 Thread Sumitrajit Dhar
Hi, xyplot(threshold ~ age |frequency.a, data=rage, groups=HL, cex=0.5, layout=c(7,4), par.strip.tex=list(cex=0.8), xlab="Age (years)", ylab="Threshold (dB SPL)", na.rm="TRUE", panel=function(x,y,groups,...) { panel.superpose(x,y,groups=HL,...) # panel.abline(segmented(lm(threshold~age

Re: [R] piecewise regression and lm() question

2015-02-11 Thread Duncan Murdoch
On 11/02/2015 4:30 PM, Goldschneider, Jill wrote: > I was playing with some examples of piecewise regression using lm() and have > come across a behavior I'm uncertain about. > Below is simple 3-segment dataset. I compare predicted output of a model > created by one call to lm() to that of 3 mod

[R] piecewise regression and lm() question

2015-02-11 Thread Goldschneider, Jill
I was playing with some examples of piecewise regression using lm() and have come across a behavior I'm uncertain about. Below is simple 3-segment dataset. I compare predicted output of a model created by one call to lm() to that of 3 models created by 3 calls to lm(). In case A and B, the resul

Re: [R] piecewise regression

2011-01-15 Thread Achim Zeileis
On Sat, 15 Jan 2011, vito.muggeo wrote: dear all, The package segmented allows to estimate piecewise linear relationships (*connected* lines, i.e. a gradual change in the slope) with several breakpoints (known or unknown) within (generalized) linear models.. The package also includes some func

Re: [R] piecewise regression

2011-01-15 Thread Federico Bonofiglio
Thank u Doctor Muggeo, I was just getting familiar with your package this morning..i find it interesting 'cause so far is the only one that allows estimations for the single slope parameters between brakepoints, by the slope() function. Contrarily, supposing only one knot in a linear regression,I d

Re: [R] piecewise regression

2011-01-14 Thread vito.muggeo
dear all, The package segmented allows to estimate piecewise linear relationships (*connected* lines, i.e. a gradual change in the slope) with several breakpoints (known or unknown) within (generalized) linear models.. The package also includes some functions for plotting and testing.. Have a l

Re: [R] piecewise regression

2011-01-14 Thread John Sorkin
If you know the knot and want linear segments, lm (or any other "normal" regression software) can perform the analysis. For example if you want to regress y on x and have a knot a 20 the following code will work: x <- runif(500,0,40) plot(x) for (i in 1:500) { if (x[i] < 20) y[i] <- (-0.5*x[

Re: [R] piecewise regression

2011-01-14 Thread Bert Gunter
You failed to specify 2 crucial issues: Are the join points known (linear rgression, splines) or unknown (nonlinear regression)? And as several have already indicated, what are the smoothness constraints? -- Bert On Fri, Jan 14, 2011 at 6:42 AM, Federico Bonofiglio wrote: > Hello everybody >

Re: [R] piecewise regression

2011-01-14 Thread Gene Leynes
oh yes, and the structchange package. After a day of experimentation I couldn't figure out how to get the structchange package to work for my problems. Although it is probably user error on my part, the package seems to be specific to time series problems. Also, I think it needed regularly spaced

Re: [R] piecewise regression

2011-01-14 Thread Gene Leynes
I wish I had a better answer. There are two things that I know of that use a direct approach: The segmentation package seems to work well if you are doing a few fits, but I had problems when I tried running it on loads of data. It's a bit tricky to parametrize. When I tried investigating the in

Re: [R] piecewise regression

2011-01-14 Thread Spencer Graves
Hello: I just found 58 help pages in 32 contributed packages containing the terms "piecewise" and "regression", as follows: library(sos) pr <- ???'piecewise regression' # for "piecewise" with "regression" summary(pr) # 58 matches in 32 packages pr # view the 58 links sorted by package

Re: [R] piecewise regression

2011-01-14 Thread David Winsemius
Searching the archives would surely be a better way to assemble a list of candidate packages but the "segmented" package is surely in the list. On Jan 14, 2011, at 9:42 AM, Federico Bonofiglio wrote: Hello everybody Quick question, if you'd like to throw a little tip: does anyone knows a

[R] piecewise regression

2011-01-14 Thread Federico Bonofiglio
Hello everybody Quick question, if you'd like to throw a little tip: does anyone knows a function that runs piecewise regression models with coefficients estimation and inferences ? Thank you [[alternative HTML version deleted]] __ R-help

[R] Piecewise regression using lme()

2010-07-21 Thread goulvenS
Hi everyone, I'm trying to fit a of piecewise regression model on a time series. The idea is to divide the series into segments and then to apply linear regression models on each segment but in a "global way" and considering heteroskedasticity between the segments. For example, I build a time ser

[R] piecewise regression using nlme function

2010-01-07 Thread Carlson, Erik A (GE, Research)
Is a 95% CI on a breakpoint fixed effect legitimate when the nonlinear equation is continuous but not differentiable at the breakpoint? I used the nlme to generate a non-linear mixed-effects piecewise model with initial slope zero prior to an unknown breakpoint. It did give a 95% CI for the bre

Re: [R] Piecewise regression in lmer

2010-01-04 Thread Douglas Bates
On Mon, Jan 4, 2010 at 6:24 AM, Walmes Zeviani wrote: > AD Hayward wrote: >> >> Dear all, >> >> I'm attempting to use a piecewise regression to model the trajectory >> of reproductive traits with age in a longitudinal data set using a >> mixed model framework. The aim is to find three slopes and

Re: [R] Piecewise regression in lmer

2010-01-04 Thread Walmes Zeviani
AD Hayward wrote: > > Dear all, > > I'm attempting to use a piecewise regression to model the trajectory > of reproductive traits with age in a longitudinal data set using a > mixed model framework. The aim is to find three slopes and two points- > the slope from low performance in early

Re: [R] Piecewise regression in lmer

2010-01-04 Thread Dieter Menne
AD Hayward wrote: > > I'm attempting to use a piecewise regression to model the trajectory > of reproductive traits with age in a longitudinal data set using a > mixed model framework. > You might have a look a Alejandro Jara DPpackage which worked quite well for me in a similar case. Th

[R] Piecewise regression in lmer

2010-01-04 Thread AD Hayward
Dear all, I'm attempting to use a piecewise regression to model the trajectory of reproductive traits with age in a longitudinal data set using a mixed model framework. The aim is to find three slopes and two points- the slope from low performance in early age to a point of high performan