Displaying 20 results from an estimated 40000 matches similar to: "Small typo in abline.R"
2012 Dec 13
2
abline of an lm fit not correct
Hello fellow
R-users,
I’m stuck
with something i think is pretty stupid, but i can’t find out where i’m wrong,
and it’s turning me crazy!
I am doing
a very simple linear regression with Northing/Easting data, then I plot the
data as well as the regression line :
> plot(x=Dataset$EASTING,
y=Dataset$NORTHING)
> fit <- lm(formula = NORTHING ~ EASTING,
data = Dataset)
> abline(fit)
2006 Jan 20
3
abline() or predict.lm() when log="x"
Hello,
I'm trying to plot a fitted lm() line on a plot when the one
explanatory variable is log transformed and log="x". I get different
lines using abline and predict.lm().
#Example
x <- 1:100
y <- rnorm(100)
plot(y ~ x, log="x")
abline(lm(y ~ log(x)))
lines(x, predict(lm(y ~ log(x))), lwd=2)
I'm sure I'm missing something but could someone tell me which
2005 Aug 03
1
abline and linearity over groups
Dear R users, please can you help me understand the behaviour of abline using function lm.
I'm trying to learn linearity over groups. So I make three groups with 10 values each:
test=data.frame(cbind(
l=c(rnorm(10,0,30),rnorm(10,100,30),rnorm(10,200,30)),
t = c(rep(0,10), rep(1,10), rep(2,10))
))
when I do:
plot(test$l~test$t)
abline(lm(test$l~test$t))
the abline is a straight line
2010 Mar 22
2
problem with abline and lines
Dear R users,
I need to plot to perpendicular straight lines. However, although I set the coefficients
so that the lines are perpendicular, they do not look to be so in the plot. Here is a minimal working example:
plot(x=c(-1, 1), y=c(-1, 1)); abline(a=0, b=1/sqrt(2)); abline(a=0, b=-1/sqrt(2))
Please tell me if the same problem is valid by you. I am running R-2.10.1 on Linux.
Is there a way
2010 Dec 22
1
problems with abline in a time line scatterplot
Hello R-Users
i'm stuck with the following problem:
i want to add a trend line to a scatterplot. the x axis is a time line.
well it doesnt work, it seems that the function abline is not able
to handle the fact, that i used the column Date as a factor.
this is the script:
data<-read.table('DO_hapa_all_morning.txt',header=T,as.is=2)
attach(data)
names(data)
2009 Jan 22
2
plot: abline() - define line length
Hi,
is there a way to define, that a line drawn via abline() should only
go from for example -2 to 1 on the x-axis (with something working
similiar to xlim()) ?
thanks for any help!
2010 Dec 09
4
[lattice xyplot] Help needed in help in customizing the panel.abline() function
Hi folks,
I need some help in customizing the abline() function to be used in a
lattice plot. I have attached a reproducible example below.
I need help in the following snippet:
disc <- xyplot(cnt_gt50pct_disc ~ week_num|sku_num, data=DF,type =
"h",lwd=2,panel = function(...) {
panel.abline(v = 8, lty = 2)
panel.xyplot(...)
})
Is there a way I can give
2006 Dec 09
1
abline for intercept-only simple lm models (with and without offset)
The abline function can be used to draw the
regression line when one passes the lm object
as an argument.
However, if it's an intercept-only model,
it appears to use the intercept
as the slope of the abline:
mod <- lm(dist ~ 1, data = cars)
plot(dist ~ speed, data = cars)
abline(reg = mod) # nothing appears
This behaves as documented, but might catch
someone. Would it be an improvement
2006 Jun 08
1
panel.abline and xyplot
Dear All,
I am wondering on how to use the abline.xyplot with xyplot such that I will have different vertical lines for each panel. More sepcifically, suppose that the xyplot generates 4 panels defined by the combination of two binary variables: X_1 and X_2. i.e.
xyplot(Y ~ Z | X_1*X_2, data = df)
I want something like:
abline(v = 5) if X_1=0 and X_2 = 0
abline(v =
2009 Mar 24
2
Properly labeling abline with text?
The result of the code shown below is posted at the following URL:
http://n2.nabble.com/Trying-to-properly-label-abline-td2524629.html
I would like to figure out a better way to label the horizontal abline.
I tried multiplying the text y position by a scale, but this didn't always put the text in a useful position. I guess I am curious if there is a preferred procedure for labeling the
2007 Jun 21
2
abline plots at wrong abscissae after boxplot
Hi folks,
I'm using R 2.5.0 under ESS under Windows XP. (This also happens using
the Rgui application.)
I'm trying to add lines to a plot originally made with "boxplot", but
the lines appear in the wrong place. Below is a script that
illustrates the problem
# boxablinetest.R - script to show problem with abline on box plot
x <- c( 2, 2, 2, 3, 3, 3, 4, 4, 4)
y
2009 Jul 28
2
xyplot, panel.abline, from, to
All,
I'm trying to truncate some lines that are added to an xyplot via
panel.abline to allow additional space for inserted text. According to
?panel.abline it seems like "from" and "to" will do the trick but it does
not work for the sample code below. Any hints much appreciated.
Cheers,
David
x = seq(1,8)
y.1 = .6*x + 3.5 + rnorm(8, 0, .5); y.2 = .4*x + 1 + rnorm(8,0,
2013 Oct 04
2
abline is not plotting
Hello there,
I have some data I want to plot together with a best-fit line. (see MWE
below)
The points from the first plot does appear as expected, but the abline does
not appear, no matter what I change. I removed the log parameter before, but
the abline is a very steep line around the origin. I really want to keep the
logarithmic scale, plus a working abline.
Can someone help me with that?
2004 Nov 28
1
Modifications to an abline
Dear List:
I am working to generate graphs for individual students that will be created through a series of loops in Sweave. Before doing so, I am still trying to design the graph. The code for creating the barplot is below with some sample datapoints just made up for now.
Ultimately, this chart will take data from an lme object using longitudinal student data. So, the dots represent the
2011 Mar 29
1
Typo in tools:::format.check_Rd_metadata()
Hi,
With R version 2.13.0 alpha (2011-03-24 r55004), 'R CMD check' will
produce the following output on some packages:
* checking Rd metadata ... WARNING
Error in is.function(FUN) : 'FUN' is missing
Calls: print ... format.check_Rd_metadata -> unlist -> lapply ->
match.fun
Execution halted
This is happening on packages that contain duplicated \name or
2013 Nov 19
2
como agrego una linea dibujada con abline() en la leyenda de un grafico ?
Eric
Recordé un ejemplo rápido
## Setup up coordinate system (with x == y aspect ratio):
plot(c(-2,3), c(-1,5), type = "n", xlab = "x", ylab = "y", asp = 1)
## the x- and y-axis, and an integer grid
abline(h = 0, v = 0, col = "gray60")
text(1,0, "abline( h = 0 )", col = "gray60", adj = c(0, -.1))
abline(h = -1:5, v = -2:3, col =
2006 Sep 04
1
abline and plot(augPred) help
Dear all
as I did not get any response on my post about abline and
plot(augPred)) I try again. I hope I do not break some posting guide
rules. I would try to contact package maintainer directly but there
is stated to be R-core people, so I feel R-help list shall be OK.
I need to draw straight lines through augPred plotted panels
(vertical or horizontal) at specified point. I know I shall
2010 May 15
3
abline limit constrain x-range how?
Hello,
I managed to "linearize" my LDA decision boundaries now I would like to call abline three times but be able to specify the exact x range. I was reading the doc but it doesn't seem to support this use-case? are there alternatives. The reason why I use abline is because I first call plot to plot all the three datasets and then call abline to "append" these decision
2010 May 12
3
what the problem could be if i am suddenly unable to add abline to the scatter plot?
I am doing very regular stuff like the following:
attach(wtana)
fm<- lm(Body.Wt.on.SD1~Heart.Wt, data=wtana)
#fm<- lm(wtana$Body.Wt.on.SD1~wtana$Heart.Wt)
lrf<- loess(Body.Wt.on.SD1~Heart.Wt, wtana)
#lrf<- loess(wtana$Body.Wt.on.SD1~wtana$Heart.Wt)
plot(Body.Wt.on.SD1,Heart.Wt)
#plot(wtana$Body.Wt.on.SD1,wtana$Heart.Wt)
#lines(spline(Heart.Wt,fitted(lrf)), col=2)
abline(fm, col=4)
2005 Apr 12
2
abline() with xyplot()
Hello all,
I'm a new user on R, and I used the abline function to draw a line on my graph but it doesn't work with xyplot(). With the plot function, abline() is ok but with plot it doesn't make what I want. Maybe it's a little thing to change in plot() but I don't find what!
With xyplot I write this :
Xyplot(m~ordered(l,levels=1),