Re: [R] acf function

2010-09-26 Thread Theresa Csar

Hi Andre,

try acf.data$acf

regards,
Theresa

andre bedon wrote:

Hi,

 


Im new to R so this question is quite fundamental.

Im trying to compare some autocorrelations generated by the acf function to 
some theoretical correlations. How can I have acces to just the 
autocorrelations, for computation?

This is some of my code:

 

  

acf.data-c(acf(x))
acf.data



 


This is the R output:

 


$acf
, , 1

  [,1]
 [1,]  1.0
 [2,]  0.746183669
 [3,]  0.551217818
 [4,]  0.414995408
 [5,]  0.313840795
 [6,]  0.232915721
 [7,]  0.173752145
 [8,]  0.130249718
 [9,]  0.089901832
[10,]  0.057342951
[11,]  0.030612095
[12,]  0.000951186
[13,] -0.021288467
[14,] -0.042727988
[15,] -0.055278855
[16,] -0.064782705
[17,] -0.067162534


$type
[1] correlation

$n.used
[1] 50

$lag
, , 1

  [,1]
 [1,]0
 [2,]1
 [3,]2
 [4,]3
 [5,]4
 [6,]5
 [7,]6
 [8,]7
 [9,]8
[10,]9
[11,]   10
[12,]   11
[13,]   12
[14,]   13
[15,]   14
[16,]   15
[17,]   16


$series
[1] x

$snames
NULL

 


I need just the $acf values. How do I access them? I would really appreciate 
any advice. Thankyou.

 


Regards,

 


Andre


 

 
 		 	   		  
	[[alternative HTML version deleted]]


__
R-help@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.




__
R-help@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.


Re: [R] Changing x-axis on boxplot

2010-09-26 Thread Theresa Csar

Hi,

to hide the axis generated by bxp you have to set axes=FALSE and 
frame.plot=FALSE and then you can plot the x-axis by using the axis() 
function


example:

boxplot(len ~ dose, data = ToothGrowth,
   frame.plot=FALSE,axes=FALSE,
   boxwex = 0.25, at = 1:3 - 0.2,
   subset = supp == VC, col = yellow,
   main = Guinea Pigs' Tooth Growth,
   xlab = Vitamin C dose mg,
   ylab = tooth length,
   xlim = c(0.5, 3.5), ylim = c(0, 35))
boxplot(len ~ dose, data = ToothGrowth, add = TRUE,
   frame.plot=FALSE,axes=FALSE,
   boxwex = 0.25, at = 1:3 + 0.2,
   subset = supp == OJ, col = orange)
axis(1,at=0:4)
axis(2,at=(0:17)*2)
legend(2, 9, c(Ascorbic acid, Orange juice),
  fill = c(yellow, orange))

Theresa


Tim Clark wrote:

Dear List,
 
I am creating a boxplot with two subsets, very similar to the example by Roger 
Bivand at ?boxplot (reproduced below).  I am trying to change the labels on the 
x-axis to have one number to cover both subsets.  I can do this in other plots 
by using axis=FALSE followed by a separate axis() command.  I have also tried 
variations in the names= argument but can't get it to work.  Ideally I would 
like tickmarks on either side of each factor with the number for the level 
centered between the two tick marks.  Any suggestions?
 
Thanks,
 Tim 


Example:

boxplot(len ~ dose, data = ToothGrowth,
boxwex = 0.25, at = 1:3 - 0.2,
subset = supp == VC, col = yellow,
main = Guinea Pigs' Tooth Growth,
xlab = Vitamin C dose mg,
ylab = tooth length,
xlim = c(0.5, 3.5), ylim = c(0, 35), yaxs = i)
boxplot(len ~ dose, data = ToothGrowth, add = TRUE,
boxwex = 0.25, at = 1:3 + 0.2,
subset = supp == OJ, col = orange)
legend(2, 9, c(Ascorbic acid, Orange juice),
   fill = c(yellow, orange))


 Tim Clark

Marine Ecologist
National Park of American Samoa


 
__

R-help@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.




__
R-help@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.