Displaying 20 results from an estimated 1000 matches similar to: "Problem with segmented function"
2013 Jan 04
1
Predicting New Data -
I am having trouble predicting new data with a model created from package
mboost:
> mb1<-glmboost(as.formula(formula1),data=data_train,control=boost_control(mstop=400,nu=.1))
> f.predict<-predict(mb1,newdata=data_train)
Error in scale.default(X, center = cm, scale = FALSE) :
length of 'center' must equal the number of columns of 'x'
Ultimately I want to predict
2005 Feb 03
1
Memory Cap
Hi all
I am trying to use R for some data editing using the "array" function to
write binary data to a text file. I realise that R was not designed for
this purpose but I am no C programmer and would prefer to use R (as I
know how to do it and hate c). Basically I get the following error.
Error: cannot allocate vector of size 1634069 kb
It seems that R is not keen on allocating
2012 Jan 10
1
Problem with segmented
Hi everyone.
I'm trying to use the segmented function with the following data:
For instance, I use segmented package as follow:
myreg2 = lm(xy$y ~ xy$x)
mysegmented = segmented(myreg2, seg.Z=~x, psi=c(245000), control =
seg.control(display=FALSE))
Which get me to the following error :
As a break point, a starting guess of 245000 seems fair.
Anyone has an idea why I'm getting such
2008 Jul 08
1
package segmented problem
Hi, while using package "segmented" (version 0.2-4) by Vita Muggeo to
investigate a possible change point (around time = 222) in admissions
for a specific medical condition I had the following error message:
fit2.seg<-segmented(fit2, seg.Z=~time,psi=222)
Error in segmented.lm(fit2, seg.Z = ~time, psi = 222) :
(Some) estimated psi out of its range
"fit2" is a simple
2012 May 25
1
Breakpoint in logistic GLM with 'segmented' package - error: replacement length zero
Hello all,
I've been having trouble with assessing a breakpoint in a logistic GLM
with two explanatory variables. For this analysis I've been using the
'segmented' package version 0.2-9.1. But I keep getting an error and I
don't see where I would be going awry. The situation is the following:
Two explanatory variables:
bedekking - a variable with possible values between 0 and
2012 May 02
2
How can a function in R handle different types of input?
Hi,
How can a function in R handle different types of input?
I have written a function, which should calculate the slope from several
3-time-point measurements by linear regression
4 three-time-point-measurements:
x<-cbind(c(1,2,3,4),c(2,3,4,5),c(3,4,5,6))
time points:
time<-c(1,3,9)
function for calculating the slope by linear regression:
fit<-function(xx,t){slope <-
2012 Mar 12
1
Get a subset
Hi,
I have a list of names (alphanumeric characters) and each row by itself
contains a different number of names seperated by a semicolon (";"). There
are also rows with no entry. I would like to have the name before the first
semicolon in each row, if there is any entry. Does anyone have an idea how
to solve this in R?
Thank you!
Stella
--
View this message in context:
2006 Jan 18
1
Breakpoints for multiple variables using Segmented
Hi all,
I am using the package ?Segmented? to estimate logistic regression models
with unknown breakpoints (see Muggeo 2003 Statistics in Medicine
22:3055-3071). In the documentation it suggests that it might be possible to
include several variables with breakpoints in the same model: ?Z = a vector
or a matrix meaning the (continuous) explanatory variable(s) having
segmented relationships with
2012 Mar 22
3
How to get the input of a function right?
Hi,
I wrote a function with three inputs fun(x,y,z).
x is a matrix of three vectors combined with cbind. e.g.
x1<-(1,2,3,4)
x2<-(2,3,4,5)
x3<-(3,4,5,6)
x<-cbind(x1,x2,x3)
y is a vector e.g
y<-c(7,8,9)
z is a real number e.g.
z<-2.5
If a give the function an input like this, I get 'NA' in return. If I give
the function a vector e.g c(1,2,3) instead of 'x'
2008 Oct 03
1
NA's in segmented
I am trying to fit a very simple broken stick model using the package
"segmented" but I have hit a roadblock.
> str(data)
'data.frame': 18 obs. of 2 variables:
$ Bin : num 0.25 0.75 1.25 1.75 2.25 2.75 3.25 3.75 4.25 4.75 ...
$ LnFREQ: num 5.06 4.23 3.50 3.47 2.83 ...
I fit the lm easily:
> fit.lm<-lm(LnFREQ~Bin, data=id07)
But I keep getting an error
2012 May 08
1
Error with psi value for 'segmented' package for R
Hi everyone,
while trying to use 'segmented' (R i386 2.15.0 for Windows 32bit OS) to determine the breakpoint I got stuck with an error message and I can't find solution. It is connected with psi value, and the error says:
Error in seg.glm.fit(y, XREG, Z, PSI, weights, offs, opz) :
(Some) estimated psi out of its range
This is the code I am using:
2009 Sep 04
1
predicting from segmented regression
Hello
I'm having trouble figuring out how to use the output of "segmented()"
with a new set of predictor values.
Using the example of the help file:
??set.seed(12)
xx<-1:100
zz<-runif(100)
yy<-2+1.5*pmax(xx-35,0)-1.5*pmax(xx-70,0)+15*pmax(zz-.5,0)+rnorm(100,0,2)
dati<-data.frame(x=xx,y=yy,z=zz)
out.lm<-lm(y~x,data=dati)
o<-## S3
2013 Jan 11
1
problems with package 'segmented'
Dear R-users,
I am trying to understand how the 'segmented'-package works to determine
breakpoints and slopes of regression lines in broken-line regression models.
However, I am not able to repeat the example on the "plant"-dataset,
which was reported in the accompanying paper of the package. (V.M.R
Muggeo, "Segmented: an R package to fit regression models with
2007 Dec 06
2
Segmented regression
Hello all,
I have 3 time series (tt) that I've fitted segmented regression models
to, with 3 breakpoints that are common to all, using code below
(requires segmented package). However I wish to specifiy a zero
coefficient, a priori, for the last segment of the KW series (green)
only. Is this possible to do with segmented? If not, could someone point
in a direction?
The final goal is to
2012 Nov 16
1
Interpretation of davies.test() in segmented package
My data:
I have raw data points that form a logit style curve as if they were a time
series. Which is to say they form 3 distinct lines with 3 distinct slopes
in backwards z pattern. A certain class of my data looks essentially flat
to the eye with marginal oscillation. What is important to me is the x
value at which the state change is occurring, in other words, the break
point
Use of
2012 Mar 01
2
Help with segmented package
Hi everyone.
I'm using segmented package to find break point in a bi-linear relationship.
In a particular case, I find 1 pointcut (so 2 slopes).
I would like to know if it is possible to retrieve information in the
segmented object that could let me to plot 1 particular segment with a
different color.
For example, in that folowing example, I would like to plot the second
segment in red.
2012 Sep 28
1
Annotate a segmented linear regression plot
Hello,
I have produced some segmented regressions with the segmented package by
Viggo Mutteo. I have some example data and code below. I want to annotate
the individual segments with the slope parameter (actually it would be
nicer to annotate with 1000*slope and add some small amount of text as
well). How can I do it? Reading the docs for segmented I can access all of
the slope parameters via a
2012 May 03
1
Error with the 'segmented' package for R
Hi everyone,
I have encountered this problem while using 'segmented' plugin for R i386 2.15.0 (for Windows 32bit OS) and I just cannot find neither explanation nor solution for it.
I am trying to run this data
gpp temp
1.661 5
5.028 10
9.772 15
8.692 20
5.693 25
6.293 30
7.757 5
4.604 10
8.763 15
8.134 20
4.616 25
8.417 30
3.483 5
5.046 10
8.306 15
9.142 20
4.686 25
7.301 30
and with
2013 Mar 12
1
Constrain slope in segmented package
Hello,
I'm currently using the segmented package of M.R. Muggeo to fit a
two-slope segmented regression. I would like to constrain a
null-left-slope, but I cannot make it. I followed the explanations of
the package (http://dssm.unipa.it/vmuggeo/segmentedRnews.pdf) to write
the following code :
fit.glm <- glm(y~x)
fit.seg <- segmented(fit.glm, seg.Z=~x,psi=0.3)
fit.glm
2013 Feb 05
1
Predictions from the Segmented Package
Hi,
I would like to calculate the area under segmented regression lines (single breakpoints). I had thought that I could do this using the predict() function to ascertain some key x y values in order to determine the dimensions for two trapezoids (under each segment of my regression). However, I've not had any success with this and have just read online that the predict function does not work