Displaying 20 results from an estimated 10000 matches similar to: "Piece-wise continuous regression with one knot"
2013 Jan 10
2
piece-wise linear regression nls function
windows 7, R 2.12
I am trying to run a piecewise linear regression with a single knot, i.e. a regression composed of two straight lines where the two lines intersect at an x value given by the variable knot. I wish to estimate the slope of both lines, the value of knot, the x value where the two lines intersect, and an intercept. I am using the nls code below, and get the following error
2017 Jun 23
1
Piecewise continuous logistic regression with one knot
How can I fit a piecewise continuous logistic regression with a single free knot (i.e. the knot is not specified; the model produce an estimate of the value of the knot).
Thank you,
John
John David Sorkin M.D., Ph.D.
Professor of Medicine
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology and Geriatric Medicine
Baltimore VA Medical Center
2011 Apr 23
3
Problem having tick marks aligned when plotting three graphs on top of one another.
R 2.10
Windows 7
I am trying to plot three graphs on top of each other. I need to have the axises perfectly aligned. For some reason the ticks on the y axes are slightly off so they do not perfectly align. Can someone tell me how I can get the to overlay each other perfectly? I thought the yaxp parameter would solve my problem, but it does not. My data and code follows:
>
2012 Dec 04
6
Help for a function
Hello all,
I need a help.
I am modeling a disease and a create a R function like that:
Lambda<-function (x,date1,r,h,a){
ndate1 <- as.Date(date1, "%d/%m/%Y")
t1 <- as.numeric(ndate1)
x[order(x$i),]
t <-x[,"t"]
i <-x[,"i"]
CONTAGIEUX <-x[,"CONTAGIEUX"]
while ( t1 < min(t) ){
for (i in 1:length(i) ){
{for (j in
2010 Sep 10
1
lme, groupedData, random intercept and slope
Windows Vista
R 2.10.1
Does the following use of groupedData and lme produce an analysis with both random intercept and slope, or only random slope?
zz<-groupedData(y~time | Subject,data=data.frame(data),
labels = list( x = "Time",
y = "y" ),
units = list( x = "(yr)", y = "(mm)")
)
plot(zz)
2024 Jul 26
1
Automatic Knot selection in Piecewise linear splines
dear all,
I apologize for my delay in replying you. Here my contribution, maybe
just for completeness:
Similar to "earth", "segmented" also fits piecewise linear relationships
with the number of breakpoints being selected by the AIC or BIC
(recommended).
#code (example and code from Martin Maechler previous email)
library(segmented)
o<-selgmented(y, ~x, Kmax=20,
2012 Mar 29
1
abline with xyplot does not work
I am trying to plot the results of a random effects model where each subject is allowed to have his, or her, own intercept. I use xyplot to plot the data, lme to compute the regression and then try to put a summary regression line on the xyplot. As can be seen by the output pasted below, I am getting an error message,
Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...) :
(list)
2024 Jul 16
2
Automatic Knot selection in Piecewise linear splines
>>>>> Anupam Tyagi
>>>>> on Tue, 9 Jul 2024 16:16:43 +0530 writes:
> How can I do automatic knot selection while fitting piecewise linear
> splines to two variables x and y? Which package to use to do it simply? I
> also want to visualize the splines (and the scatter plot) with a graph.
> Anupam
NB: linear splines, i.e. piecewise
2007 Aug 28
1
FW: How to fit an linear model withou intercept
Hi Mark,
I don't know wether you recived a sufficient reply or not, so here are
my comments to your problem.
Supressing the constant term in a regression model will probably lead to
a violation of the classical assumptions for this model.
From the OLS normal equations (in matrix notation)
(1) (X'X)b=X'y
and the definition of the OLS residuals
(2) e = y-Xb
you get - by
2007 Oct 01
4
data structure with coefficients, and call from lm()
Widows XP
R 2.3.1
I have been trying to make a data structure that will contain both the coefficients from a linear regression along with column and row titles AND the call, i.e.
myreg<-lm(y~x+y+z)
whatIwant<-cbind(c(summary(myreg)$call,"",""),summary(myreg)$coefficients)
Neither the statement above, nor any one of twenty variations I have tried work. I would appreciate
2011 Jan 04
5
Page eject and clearing the console
(1) I know that \n when used in cat, e.g. cat("\n") produces a line feed (i.e. skips to the next line). Is there any escape sequence that will go to the top of the next page?
(2) I know that control L will clear the console. Is there an equivalent function or other means that can be used in R code to clear the console?
Thanks,
John
John David Sorkin M.D., Ph.D.
Chief, Biostatistics
2013 Feb 05
3
Non linear programming: choose R that minimizes corr(y, x^R)
I am looking for a package that will allow me to choose R (a real number) that minimizes the correlation of y and x^R, i.e.
find R such that corr(y,x^R) is minimized. Any suggestions for packages I might look at would be helpful.
Thanks,
John
John David Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology
Baltimore VA
2016 Apr 07
0
using apply to a data frame
??I would like to apply a function, fract, to the columns of a
dataframe. I tried the following
apply(data5NonEventEpochs,2,fract)
but, no surprise it did not work as apply works on matrices not data
frames. How can I apply a fuction to the columns of a data frame? (I
can't covert data5NonEventsEpochs to a matrix as it contains character
data).
Thank you,
John
John David Sorkin M.D., Ph.D.
2010 Dec 29
6
icon for an R package
I'm looking for an icon to represent an R package. Perhaps something like
http://cdn2.iconfinder.com/data/icons/DarkGlass_Reworked/128x128/apps/package.png
but with the R logo rather than KDE.
--
Michael Friendly Email: friendly AT yorku DOT ca
Professor, Psychology Dept.
York University Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Street Web:
2017 Oct 23
2
Syntax for fit.contrast (from package gmodels)
David,
Again you have my thanks!.
You are correct. What I want is not technically a contrast. What I want is the estimate for "regional" and its SE. I don't mind if I get these on the log scale; I can get the anti-log. Can you suggest how I can get the point estimate and its SE for "regional"? The predict function will give the point estimate, but not (to my knowledge)
2010 Apr 26
4
concise syntax for selecting multiple rows
I would like to select rows if a row contains any one of several values. I can do the selection as follows:
result[,"Subject"]=="JEFF" | result[,"Subject"]=="BG"
But this is very unwieldily if one wishes to select many, many rows as one has to continuously repeat the source:
result[,"Subject"]=="JEFF" |
2006 Dec 09
7
Simulation with R
An apparatus exists whereby a collection of balls is displaced to the
top of a stack by suction. A top level (Level 1) each ball is shifted
1 unit to the left or 1 unit to the right at random with equal
probability. The ball then drops down to level 2. At Level 2, each
ball is again shifted 1 unit to the left or 1 unit to the right at
random. The process continues for 15 levels and the balls are
2007 Oct 01
3
3-dimensional graph
Windows XP
R 2.3.1
I have a funciton
fit1<-lm(y~x+z)
Is there a function that will produce a 3-dimensional plot of y,x,z?
I looked at the help files, but did not find a clean answer to my question.
Thanks,
John
John Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
2017 Oct 23
1
Syntax for fit.contrast (from package gmodels)
David,
predict.glm and se.fit were exactly what I was looking for.
Many thanks!
John
John David Sorkin M.D., Ph.D.
Professor of Medicine
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology and Geriatric Medicine
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax)
2018 Mar 22
3
How do I include a factor in a groupedData object? Meaning and use of inner and outer parameters
Windows 10 64-bit, R-Studio, R version 3.4.3
Several questions relating to groupedData:
(1) I am trying to create a groupedData object that can be used to run an analysis that I have been able to urn using lmer. When I include the interaction terms in the groupedData opbject I get an error message stating that + is not meaningful for factors. How do I include factors in my model? See code and