Jhope
2012-May-19 01:34 UTC
[R] Q - scatterplot, plot function & trellis linear regressions???
Hi R-listers, Q1) What is the difference between the scatterplot and plot function? Q2) I am able to make a graph with the scatterplot function: scatterplot(DevelopIndex ~ Veg, + data = Turtle, + xlab = "Vegetation border (m)", + ylab = "Embryonic development index") And have been successful. But I do not know if the lines are for: linear, non-linear, mean, upper and lower limits or percentile? This shows side boxplots and 4 lines. Yet this plot only has one regression line and no side boxplots?: EDIHTL <- lm(DevelopIndex~ HTL, data=Turtle)> plot(DevelopIndex~HTL, data=Turtle, pch=16,xlab="High tide line (m)", ylab="Embryonic development index")> abline(EDIHTL)Q-3 I am trying to make a trellis of linear regressions. I want 3 windows displaying 3 events of linear regression (two-way interactions). I have been trying this: require(lattice)> library(lattice) > trellis.par.set(col.whitebg()) > scatterplot(DevelopIndex~Veg|Aeventexhumed,+ xlab = "Vegetation border", + ylab = "Embryonic development index") Error in eval(expr, envir, enclos) : object 'DevelopIndex' not found Please advise, many thanks. Jean -- View this message in context: http://r.789695.n4.nabble.com/Q-scatterplot-plot-function-trellis-linear-regressions-tp4630562.html Sent from the R help mailing list archive at Nabble.com.
Simon Knapp
2012-May-19 11:36 UTC
[R] Q - scatterplot, plot function & trellis linear regressions???
I presume you mean car::scatterplot A1) plot is a generic function for plotting 'things' and scatterplot is a specific tool provided by that library A2) from the documentation one infers that 1) the straight line is a regression line 2) the other lines are produced using loess a) the solid line is fitted to the data b) the dotted lines are created by: "a smoother is applied to the root-mean-square positive and negative residuals from the loess line to display conditional spread and asymmetry" A3) you forgot the data argument (at least). Cheers, Simon On Sat, May 19, 2012 at 11:34 AM, Jhope <jeanwaijang at gmail.com> wrote:> Hi R-listers, > > Q1) What is the difference between the scatterplot and plot function? > > Q2) I am able to make a graph with the scatterplot function: > > scatterplot(DevelopIndex ~ Veg, > + ? ? ? ? ? ? data = Turtle, > + ? ? ? ? ? ? xlab = "Vegetation border (m)", > + ? ? ? ? ? ? ylab = "Embryonic development index") > > And have been successful. But I do not know if the lines are for: linear, > non-linear, mean, upper and lower limits or percentile? This shows side > boxplots and 4 lines. > > Yet this plot only has one regression line and no side boxplots?: > > EDIHTL <- lm(DevelopIndex~ HTL, data=Turtle) >> plot(DevelopIndex~HTL, data=Turtle, pch=16, > ? ? ? xlab="High tide line (m)", ylab="Embryonic development index") >> abline(EDIHTL) > > Q-3 > I am trying to make a trellis of linear regressions. I want 3 windows > displaying 3 events of linear regression (two-way interactions). I have been > trying this: > > require(lattice) >> library(lattice) >> trellis.par.set(col.whitebg()) >> scatterplot(DevelopIndex~Veg|Aeventexhumed, > + ? ? ? ? ? ? xlab = "Vegetation border", > + ? ? ? ? ? ? ylab = "Embryonic development index") > Error in eval(expr, envir, enclos) : object 'DevelopIndex' not found > > ?Please advise, many thanks. > Jean > > -- > View this message in context: http://r.789695.n4.nabble.com/Q-scatterplot-plot-function-trellis-linear-regressions-tp4630562.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Jhope
2012-May-20 02:39 UTC
[R] Q - scatterplot, plot function & trellis linear regressions???
Thank you Simon, Yes this was in the library(car). There were no negative values in the scatterplot graph or negative limits displayed. Q-2 Are you sure the lines from the scatterplot are not this?: solid green line: linear regression solid red line: non-linear regression upper dashed red line: upper limits 75 percentile lower dashed red line: lower limits 25 percentile Q-3 I am trying to make a trellis of linear regressions but unsuccessful . I want 3 windows displaying 3 events of linear regression (two-way interactions). I have been trying this: require(lattice)> library(lattice) > trellis.par.set(col.whitebg()) > scatterplot(DevelopIndex~Veg|Aeventexhumed,+ xlab = "Distance to vegetation border", + ylab = "Embryonic development index") Error in eval(expr, envir, enclos) : object 'DevelopIndex' not found This error appears and I am not able to produce the trellis of 3 windows displaying 3 events of linear regressions. Please advise Thank you, Jean -- View this message in context: http://r.789695.n4.nabble.com/Q-scatterplot-plot-function-trellis-linear-regressions-tp4630562p4630643.html Sent from the R help mailing list archive at Nabble.com.
Jhope
2012-May-20 22:03 UTC
[R] Q - scatterplot, plot function & trellis linear regressions???
HI R-listers, Thanks for the replies I am convinced of Q 1 and 2. Q 3 - I am still unsuccessful. Aeventexhumed has three events A, B and C. I am unable to make 3 windows of scatterplot graphs side by side showing the difference in regression of each event. With and without lattice I have tried, but the only graph that is produced is one graph with all three events (A, B, and C) plotted in one window (R script below). I want to show the 3 Aeventexhumed events separately in 3 plots next to each other in one window. Previously, I have been able to make this is trellis.par.set with boxplots.>library(car) > library(lattice) > trellis.par.set(col.whitebg()) > par(mfrow=c(1,3)) > scatterplot(HSuccess~Veg|Aeventexhumed,+ data = data.to.analyze, + xlab ="Distance to vegetation border", + ylab = "Hatching success (%)") Please advise, Jean -- View this message in context: http://r.789695.n4.nabble.com/Q-scatterplot-plot-function-trellis-linear-regressions-tp4630562p4630686.html Sent from the R help mailing list archive at Nabble.com.