Displaying 20 results from an estimated 54 matches for "lmline".
2003 May 13
1
several regression lines in panel of xyplot (trellis graphics)
Dear r-help,
I need to draw xyplot() graphs with several regression lines:
one line for the whole range of x (the variable on the horizontal
axis) and two additional lines for subranges of x.
Is it possible to make first regression line (panel.lmline(x,y,...);)
to be drawn on the whole graph
and regression lines of the subsets to be drawn only over their subsets?
I have defined
plot.panel=function(x,y,...){
panel.xyplot(x,y,...);
panel.lmline(x,y,...);
panel.lmline(x[1:9],y[1:9],...);
panel.lmline(x[10:23],y[10:23],...);
panel....
2009 Jan 23
1
lattice: reverse order of panel.lmline, panel.smooth
Hi,
is it possible to reverse the order in which panel.lmline() or panel.smooth()
operation in xyplot() ? This type of situation might occur when plotting some
variable with depth, but the relation we want to describe is variable ~
depth, and not depth ~ variable, as the plotting formula would suggest.
# an example:
d <- 1:100
v <- d * rnorm(100)...
2007 Sep 10
1
lattice panel.lmline problem
...wanting to generate panels showing scatterplots with the linear
fitted line for two groups within each panel superimposed.
I have two conditioning factors, "variable" and "Group" and I want
separate panels for each level of "variable"
with different symbols and "lmline"s for each level of "Group". However
all observations for a group are missing for some variables so I would
still like the points and lmline for the observed group plotted for that
variable(panel).
My attempt is
print(xyplot(total.fat~x|variable,data=tmp1,subscripts=TRUE,...
2011 Jul 28
2
not working yet: Re: lattice overlay
...m as suggested, none work: I
am getting only single (pch = 16) not overlayed (pch =3) everytime.
*vs 1*
require(lattice)
xyplot(Sepal.Length ~ Sepal.Width | Species , data= iris,
panel= function(x, y, subscripts) {
panel.xyplot(x, y, pch=16, col = "green4", ylim = c(0, 10))
panel.lmline(x, y, lty=4, col = "green4")
panel.xyplot (iris$Petal.Length [subscripts],
iris$Petal.Width[subscripts], pch= 3, col = "red")
panel.lmline(iris$Petal.Length [subscripts], iris$Petal.Width
[subscripts], col = "red")
}, as.table=T, subscripts=T)
*vs 2*
require(latt...
2009 Sep 28
1
xyplot & lmline: error message.
Hi, I am trying to produce an xyplot with a regression line. The data should
be represented as log/log but when I fit the lmline I receive an error
message - the plot is fine without the log transformation, but the then the
plot is meaningless. I know it must be something simple, but I just can't
see it. Hope someone can help...
Thanks.
xyplot(log(Pk)~log(k),data=rwpk,cex=1,
panel=function(x,y){
panel.grid(h=-1, v=-1)...
2007 Jun 12
1
2 Trellis graphics question
...fit line of all the data, and
d) A best fit line of the "good" data.
I tried using xyplot and setting the "group" argument, but I'm having
trouble. Here is my code:
xyplot(y ~ x | status, data=data,groups=good,
+ panel=function(x,y,...){
+ panel.xyplot(x,y,...)
+ panel.lmline(x,y,col = "red")
+ panel.lmline(x[good],y[good],col = "blue")
+ }
+ )
a,groups=good,
data is a data frame containing names x, y and status.
good is logical variable labeling the "good" data.
Each panel of the trellis plot generated by this code includes
a) A scatterp...
2012 Oct 30
1
Is there an lm() equivalent of panel.lmline()?
panel.lmline returns intercept and slope of y ~ x subsetted to the
combination of conditioning factors given to xyplot in lattice.
for instance:
xyplot(Xvalues ~ log(Qvalues)|Tfac, data = df7, panel = panel.lmline)
I am looking to find the equivalent formulation for lm() proper. If I do
this:
lmcal <- l...
2005 Mar 15
1
help w/ xyplot and panel.lmline
Dear All,
I'm confortable with xyplot(...) and panel.lmline(...) statements (at least I
thought I did :). I've used the following code to plot the decline in
log-abundance of fish larvae (no.larvae) with age (age.cls, 4 to 27 days-old)
for specific dates of sampling (day, 9 dates). I further plotted data with
different colors and regression lines for ag...
2005 Mar 17
0
xyplot w/ panel.lmline "solution"
...e.cls|factor(day),data=mortal,
layout=c(7,1),aspect=5/3,
xlab="Age class (d)",ylab="Ln(Abundance)",
ylim=c(-2.5,6.5),xlim=c(0,30),
panel = function(x, y,panel.number) {
if(panel.number==2){
panel.xyplot(x, y,col=1)
panel.xyplot(x[6:11],y[6:11],pch=16,col=1)
panel.lmline(x[6:11],y[6:11])}
else{
panel.xyplot(x, y,col=1)
panel.xyplot(x[2:11],y[2:11],pch=16,col=1)
panel.lmline(x[2:11],y[2:11])}
if(panel.number>4){
panel.xyplot(x, y,col=1)
panel.xyplot(x[14:20],y[14:20],pch=16,col=2)
panel.lmline(x[14:20],y[14:20],lty=2)}
})
The resulting plot is herein (a...
2006 Jun 06
0
xYplot, lmline and abline
...nel plot where:
1) groups within panels receive distinct symbols;
2) a linear regression is fit to the entire panel, not the individual
groups;
3) a common abline is plotted in each panel.
Essentially I would like to merge the two plots below, but I can't seem
to figure out how to call both lmline and abline, and also retain the
grouping symbols.
In addition, I have not yet figured out how to place the 'Key()' in the
empty grid cell.
Please see the example code below. Note that I am running R2.2.1 on
windows.
Any help would be greatly appreciated.
Thanks for your time,
Dan...
2009 Jul 23
0
panel.lmline - are m, b, and r^2 accessible somehow?
Hi R Folks...
Are the results of a fit carried out by panel.lmline readily available for
use in a lattice plot? I¹d like to put r^2, m, and b on each panel. I can
certainly write something that does this manually and then use it with
panel.text, but if it¹s already available, that would be preferable,
especially as lattice permits condition and subsetting so rea...
2011 Oct 21
1
lattice::xyplot/ggplot2: plotting weighted data frames with lmline and smooth
...se I
could also use ggplot2, if I could do what
I want.
xyplot(child ~ parent|par+chl, data=PearsonLee, weights=frequency,
type=c("p", "r", "smooth"))
xyplot(child ~ parent|par+chl, data=PearsonLee, type=c("p", "r", "smooth"))
panel.lmline and panel.smooth don't have a weights= argument, though
lm() and loess() do.
# Try to control line colors: unsuccessfully -- only one value of
col.lin is used
xyplot(child ~ parent|par+chl, data=PearsonLee, type=c("p", "r",
"smooth"), col.line=c("red"...
2011 Sep 09
1
Adding groups to regression line panel function in Lattice
...ow(d)) # create dependent variable 'ba'
mypanel <- function(...){ # panel function
panel.lmline(d$cc, d$ba, groups = d$q) #
panel.xyplot(...)
}
xyplot(ba~cc,d,
groups=q,
panel = panel.superpose,
panel.groups=mypanel
)
Can anyone sug...
2004 Sep 17
2
lattice: bwplot and panel.lmline()
On Friday 17 September 2004 13:52, RenE J.V. Bertin wrote:
> Hello again,
>
> I am doing regressions (using panel.lmline() (and panel.abline(
> rlm(...))) ) inside a panel method which I pass to bwplot().
>
> What I would like to do is create a boxplot of categorised data
> (binned on the independent variable), and superpose a regression line
> which is calculated using the non-categorised, raw data. I...
2010 Oct 07
1
Lattice: Histogram in splom diagonals
...ct syntax, only
some tips in an old post in the list, but this comments help to plot only
density lines instead of histograms. I had some code, but it fails to plot
(I've commented the problematic lines):
splom(iris[,1:4], panel = function(x, y, ...) {
panel.xyplot(x, y, ...)
panel.lmline(x,y,...)
}
# , diag.panel=function(x,...){
# panel.histogram(x,...)
# }
)
Thanks a lot in advance!
Regards,
Alejo
[[alternative HTML version deleted]]
2012 Jun 28
1
the meaning of subscripts
...mples/alda/data/reading_pp.txt",
header=T, sep=",")
reading[reading$id %in% c(4, 27, 31, 33, 41, 49, 69, 77, 87), ]
xyplot(piat~age | id
, data=reading[reading$id %in% c(4, 27, 31, 33, 41, 49, 69, 77, 87),
],panel=function(x,y,*subscripts*){
panel.xyplot(x, y, pch=16)
panel.lmline(x,y, lty=4)
panel.xyplot(reading$agegrp*[subscripts]*, y, pch=3)
panel.lmline(reading$agegrp*[subscripts]*,y)
}
, ylim=c(0, 80), as.table=T, *subscripts*=T)
I just don't know what the subscripts for and the meaning of that.
Can someone kindly let me know how it works.
Thanks...
2004 May 17
0
adding a line to a single panel of a lattice plot
I'm struggling to find a way to add a line (abline, lline or lmline) to
a single panel of a lattice plot. In one panel, there is an outlier
and I'd like to include a second lmline fit to the data without this
point. I've looked through nine pages of the archives on lattice
and it wasn't obvious (to me) what additional search keyword to add
to hone in...
2005 Feb 10
1
xyplot() question
...ymbol",sps)
spl <- trellis.par.get("superpose.line")
ps$lty <- 1:7
trellis.par.set("superpose.line",spl)
xyplot(a~b|factor+treatment,
groups=external,data=ownframe,layout=c(2,2),
panel=function(x,y,subscripts,...){panel.superpose(x,y,subscripts,...);panel.lmline(x,y)})
Thank you very much for your help!
Regards
Christioph
2007 Jun 07
3
rlm results on trellis plot
How do I add to a trellis plot the best fit line from a robust fit? I
can use panel.lm to add a least squares fit, but there is no panel.rlm
function.
--
Alan S Barnett <asb at mail.nih.gov>
NIMH/CBDB
2010 Feb 08
3
What is the equivalent function in R to xyplot in S?
...uses the function xyplot. But I don't find it in R.
Is there a package that I should load to use xyplot. Or there is a
function with a different name in R that does the same thing as xyplot
in S.
xyplot(Gas ~ Temp | Insul, whiteside, panel =
function(x, y, ...) {
panel.xyplot(x, y, ...)
panel.lmline(x, y, ...)
}, xlab = "Average external temperature (deg. C)",
ylab = "Gas consumption (1000 cubic feet)", aspect = "xy",
strip = function(...) strip.default(..., style = 1))