Displaying 20 results from an estimated 7000 matches similar to: "add a linear regression line to the plot"
2011 Apr 16
5
how to get the plot like this by R?
Dear R users,
I see a graph (shown athttps://cid-c486ebef16722625.photos.live.com/self.aspx/%e6%88%91%e5%96%9c%e6%ac%a2%e7%9a%84%e8%8a%b1/untitled.bmp) in a published paper, which is very informative and clear. But I don't know what type the graph is.
It looks like a sactter plot but has the points with the same y values are seperate..
I really aprreciate it if someone can tell
2011 Jan 18
1
plot continuous data vs clock time
Dear R users,
I have a question about ploting clock time, the example is as below:
y<-seq(from=1, to=30, by=5)
x<-c("0:01","1:20", "8:40", "9:25", "15:30", "21:23")
x<-as.POSIXct(strptime(paste(x),"%H:%M"))
plot(y~x, type="p")
I got the plot, but if I want to plot the x range from 1:20 to
2008 Aug 11
3
Peoblem with nls and try
Hello,
I can`t figure out how can increase the velocity of the fitting data by nls.
I have a long data .csv
I want to read evry time the first colunm to the other colunm and analisy with thata tools
setwd("C:/dati")
a<-read.table("Normalizzazione.csv", sep=",", dec=".", header=F)
for (i in 1:dim(a[[2]]]) {
#preparazione dati da analizzare
2000 Aug 29
1
Newbie question: Linear regression with error bars.
Hello guys,
I am a total newbie on R, having downloaded it, read the documentation and
started playing with it right now.
My general question is what 'lr' model can be used for doing a linear
regression on points that have a variance associated with them (ie. Monte
Carlo simulation results).
Actually my Data sets look like:
Timestep Energy Variance_of_the_Energy
0.0005 -14.876840
2011 Mar 19
1
strange PREDICTIONS from a PIECEWISE LINEAR (mixed) MODEL
Hi Dears,
When I introduce an interaciton in a piecewise model I obtain some quite
unusual results.
If that would't take u such a problem I'd really appreciate an advise from
you.
I've reproduced an example below...
Many thanks
x<-rnorm(1000)
y<-exp(-x)+rnorm(1000)
plot(x,y)
abline(v=-1,col=2,lty=2)
mod<-lm(y~x+x*(x>-1))
summary(mod)
yy<-predict(mod)
2024 Jul 09
1
Automatic Knot selection in Piecewise linear splines
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
[[alternative HTML version deleted]]
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
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
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,
2009 Nov 08
2
linear trend line and a quadratic trend line.
Dear list users
How is it possible to visualise both a linear trend line and a quadratic trend line on a plot
of two variables?
Here my almost working exsample.
data(Duncan)
attach(Duncan)
plot(prestige ~ income)
abline(lm(prestige ~ income), col=2, lwd=2)
Now I would like to add yet another trend line, but this time a quadratic one. So I have two
trend lines. One linear trend line
2010 Aug 13
1
subsetting data points within confidence limit
Dear R-list
Suppose I have a data set stored in hmet, for which I did get confidence
limit on a linear regression as shown below.
My question is how I can subset only data points which are within the
confidence limit.
Thank you.
Keun-Hyung
---------------------------------------------------------------
Al=rnorm(100, 3)
Cd=rnorm(100, 0.2)
hmet=data.frame(Al=Al, Cd=Cd)
plot(Al,
2007 Jan 17
1
add non-linear line
I am trying to plot a non-linear trend line along with my data. I am
sure the solution is simple; any help greatly appreciated.
Recent and historic attempts:
fit = nls((sd~a+b*exp(-c/time)+d*geology), start=list(a=1, b=1, c=10,
d=-1), model=TRUE)
plot(time, sd, col=3, main = "Regression", sub=formula(fit))
lines(time, fitted.values(fit), lwd=2)
#tt = seq(from=0, to=200, by=10)
2009 Mar 07
2
piecewise linear regression
Hi - I'd like to construct and plot the percents by year in a small data set
(d) that has values between 1988 and 2007. I'd like to have a breakpoint
(buy no discontinuity) at 1996. Is there a better way to do this than in
the code below?
> d
year percent se
1 1988 30.6 0.32
2 1989 31.5 0.31
3 1990 30.9 0.30
4 1991 30.6 0.28
5 1992 29.3 0.25
6 1994 30.3
2007 Jun 19
1
help w/ nonlinear regression
Dear All,
I'd like to fit a "kind" of logistic model to small data-set using nonlinear least-squares regression. A transcript of R-script are reproduced below. Estimated B and T (the model's coeff, herein B=-8,50 and T=5,46) seem appropriate (at least visually) but are quite diff from those obtained w/ SPSS (Levenberg-Marquardt): B=-19,56 and T=2,37. Am I doing something wrong in
2010 Jun 11
3
Calculation of r squared from a linear regression
Hi,
I'm trying to verify the calculation of coefficient of determination (r squared) for linear regression. I've done the calculation manually with a simple test case and using the definition of r squared outlined in summary(lm) help. There seems to be a discrepancy between the what R produced and the manual calculation. Does anyone know why this is so? What does the multiple r squared
2009 Jul 09
2
X-axis labels not displayed when changing ylim
Dear R users,
I am encountering a x axis labeling problem on quite basic plots...
I use the following code which displays the labels on the x-axis with a
45 degrees angle:
p <- plot(myobject1, type="b", col="red",cex=1, lwd=2, axes=FALSE,
ann=FALSE, ylim=c(0,70))
title(main="title", font.main=4)
axis(side=1, lab=F)
text(axTicks(1), par("usr")[3] - 2,
2006 Aug 24
5
xyplot tick marks and line thickness
Hello,
A made a xyplot using the lattice library in R (latest version).
The publisher of our paper has requested:
1. all tick marks should point inwards instead of outwards.
2. All lines should be thicker (lines, axes, boxes, etc. Everything). Lines is easy...I used: lwd=1.5 but what about the lines of the axes, and the lines that build up the plot itself?....?
Any
2008 Jul 09
1
outlining symbol in legend with blackline
# I would like to outline the squares in the legend with a black line. Does
anyone know how to do this?
x.t <- structure(c(5987.387, 4354.516, 3685.789, 6478.592, 5924.315,
NA, 8386, 5559.468, NA, 4651.273, 3967.5, NA, 4339.167, 5053.56,
NA, 4631.978, 4808.694, NA, 5217.306, 4017.632, NA, 5846.903,
3969.883, NA, 3867.825, 3910.236, NA, 3886.434, 3782.094, NA,
3959.668, 3961.286, NA, 3848.853,
2017 Dec 31
0
Draw Overlapping Circles with shaded tracks
Another solution:
library("HelpersMG") plot(0:10,type="n",axes=FALSE,xlab="",ylab="",
asp=1) ellipse(center.x = 3, center.y = 5, radius.x = 5, radius.y = 5,
lwd=10, col=NA, border=rgb(red = 1, green = 0, blue=0, alpha = 0.5))
ellipse(center.x = 8, center.y = 5, radius.x = 5, radius.y = 5, lwd=10,
col=NA, border=rgb(red = 0, green = 1, blue=0, alpha =
2017 Dec 31
1
Draw Overlapping Circles with shaded tracks
Dear All:
Thank you very much for all of you.
I just have one more thing. Is there a way to fill the borders with small
dots, may be different sizes.
I tried to do it, but it looks ugly.
Here what I tried:
library(plotrix)
plot(0:10, 0:10, type="n",axes=FALSE,xlab="",ylab="") #### 0:5,
draw.circle(4,5,radius=3,border="#ff0000aa", lwd=75)