FMH | 25 Feb 17:01
Picon
Favicon

How to add a title to represent four different plot in lm function

Dear All,

A linear regression model could be fitted by using lm function and the plot function can be used to check the
assumptions of the model. The example is as followed.

require(graphics)
## Annette Dobson (1990) "An Introduction to Generalized Linear Models".
## Page 9: Plant Weight Data.
ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
group <- gl(2,10,20, labels=c("Ctl","Trt"))
weight <- c(ctl, trt)
anova(lm.D9 <- lm(weight ~ group))
opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
plot(lm.D9, las = 1)     

Could someone advice me the way to add a single title either at the above or bottom of these 4 plots, entitled
"The verification of model assumtion via four different plots" ?

Thanks
Fir
Greg Snow | 25 Feb 21:43

Re: How to add a title to represent four different plot in lm function

Try something like:

> par(oma=c(0,0,3,0))
<your plotting commands here>
> mtext("your text here", outer=TRUE

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow <at> imail.org
801.408.8111

> -----Original Message-----
> From: r-help-bounces <at> r-project.org [mailto:r-help-bounces <at> r-
> project.org] On Behalf Of FMH
> Sent: Thursday, February 25, 2010 9:01 AM
> To: r-help <at> r-project.org
> Cc: r-sig-gr <at> stat.math.ethz.ch
> Subject: [R] How to add a title to represent four different plot in lm
> function
> 
> Dear All,
> 
> A linear regression model could be fitted by using lm function and the
> plot function can be used to check the assumptions of the model. The
> example is as followed.
> 
(Continue reading)

Tal Galili | 25 Feb 22:33
Picon
Gravatar

Re: How to add a title to represent four different plot in lm function

Hi there,

Try this:

par(mfrow=c(2,2))
for( i in 1:4 ) plot(1:10)
mtext("Title",side=3,outer=TRUE,padj=3)

----------------Contact
Details:-------------------------------------------------------
Contact me: Tal.Galili <at> gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
----------------------------------------------------------------------------------------------

On Thu, Feb 25, 2010 at 10:43 PM, Greg Snow <Greg.Snow <at> imail.org> wrote:

> Try something like:
>
> > par(oma=c(0,0,3,0))
> <your plotting commands here>
> > mtext("your text here", outer=TRUE
>
> Hope this helps,
>
> --
> Gregory (Greg) L. Snow Ph.D.
> Statistical Data Center
> Intermountain Healthcare
> greg.snow <at> imail.org
(Continue reading)

FMH | 1 Mar 22:17
Picon
Favicon

Changepoints estimation in a data series

Dear All,

I'm trying to find changepoints in a data series  which only consist of  11 measurements of
altitude(x) and temperature(y), respectively, in which the data are as followed:

y = 16.3, 16.2, 16.1, 15.6, 14.2, 10, 8.2,  8.0, 7.5, 7.3, 7.2
x = 1,  2,  5, 10, 15, 20, 25, 30, 40, 50, 60

From the above series, i reckon there is more than one changepoint and  presuming there is a package in R
which might enable the estimation on such changepoints.

Could someone please advice me on this matter by using R?

Cheers,
FMH

Bert Gunter | 1 Mar 22:41

Re: Changepoints estimation in a data series


RSiteSearch("segmented regression")

Bert Gunter
Genentech Nonclinical Biostatistics

 
-----Original Message-----
From: r-help-bounces <at> r-project.org [mailto:r-help-bounces <at> r-project.org] On
Behalf Of FMH
Sent: Monday, March 01, 2010 1:17 PM
To: r-help <at> r-project.org
Subject: [R] Changepoints estimation in a data series

Dear All,

I'm trying to find changepoints in a data series  which only consist of  11
measurements of altitude(x) and temperature(y), respectively, in which the
data are as followed:

y = 16.3, 16.2, 16.1, 15.6, 14.2, 10, 8.2,  8.0, 7.5, 7.3, 7.2
x = 1,  2,  5, 10, 15, 20, 25, 30, 40, 50, 60

>From the above series, i reckon there is more than one changepoint and 
presuming there is a package in R which might enable the estimation on such
changepoints.

Could someone please advice me on this matter by using R?

Cheers,
(Continue reading)

Achim Zeileis | 2 Mar 10:05
Picon
Favicon

Re: Changepoints estimation in a data series

On Mon, 1 Mar 2010, FMH wrote:

> Dear All,
>
> I'm trying to find changepoints in a data series  which only consist of  11 measurements of
altitude(x) and temperature(y), respectively, in which the data are as followed:
>
> y = 16.3, 16.2, 16.1, 15.6, 14.2, 10, 8.2,  8.0, 7.5, 7.3, 7.2
> x = 1,  2,  5, 10, 15, 20, 25, 30, 40, 50, 60
>
> From the above series, i reckon there is more than one changepoint and  
> presuming there is a package in R which might enable the estimation on 
> such changepoints.

It depends what exactly you mean by changepoint, especially because the 
curve looks more sigmoidal than with a clear-cut change. Maybe these have 
been averaged already.

In any case, some useful methods might include:
   o maxstat_test() in package "coin" for changepoint estimation via
     maximally selected statistics
   o breakpoints() in package "strucchange" for OLS estimation of two
     separate constant means
   o segmented() in package "segmented" for OLS estimation of a broken
     line trend

If you are looking for two separate constant means, I would probably 
employ the maximally selected statistics in this situation:

## data
(Continue reading)


Gmane