Re: [R] Ternary plot and filled contour

2013-12-19 Thread Francesco Nutini
Nice job Nicholas!thanks for the e-mail.
Regards,
Francesco
---
Francesco Nutini
CNR-IREA
 Institute for Electromagnetic Sensing of the Environment
 Via Bassini 15, 20133 Milano (Italy) 
 Tel: +39-02 23699 297  
 www.irea.cnr.it 
 nutin...@irea.cnr.it
Skype: ui...@hotmail.it
Faculty of Agriculture of the University of Milan (UniMI)
 Di.Pro.Ve. - Department of Plant Production
 Univ. mail: 
francesco.nut...@unimi.it---

Date: Thu, 19 Dec 2013 06:45:04 -0800
From: nicholasehamil...@gmail.com
To: r-help-arch...@googlegroups.com
CC: r-help@r-project.org; nutini.france...@gmail.com
Subject: Re: [R] Ternary plot and filled contour

Dear Francesco, 

I wanted to mention that I have just published on CRAN, a package for R, for 
the plotting of ternary diagrams. 

It is based off ggplot2, which is highly regarded, and, my website can be 
viewed at www.ggtern.com, including many examples, specifically including a 
case study at the following address: 

http://ggtern.com/case-study-zirconia-alumina-silica/ 

Hope you find it of value. 

Best Regards, 

Nicholas Hamilton 
School of Materials Science and Engineering 
Univesity of New South Wales 
Sydney Australia 
-- 
www.ggtern.com 

On Monday, June 4, 2012 10:52:10 PM UTC+10, Francesco Nutini wrote:

Dear R-Users, I'd like to have some tips for a ternaryplot (vcd).

I have this dataframe:

a- c (0.1, 0.5, 0.5, 0.6, 0.2,0, 0, 0.00417, 0.45) b- c 
(0.75,0.5,0,0.1,0.2,0.951612903,0.918103448,0.7875,0.45)c- c 
(0.15,0,0.5,0.3,0.6,0.048387097,0.081896552,0.20833,0.1) d- c 
(500,2324.90,2551.44,1244.50, 551.22,-644.20,-377.17,-100, 2493.04) df- 
data.frame (a, b, c, d)

and I'm building a ternary plot:

ternaryplot(df[,1:3], df$d)

How can I map the continue variable d, obtaining a result similar to this 
one? [see the link]

 http://www.pmel.noaa.gov/maillists/tmap/ferret_users/fu_2007/jpgCqrZqdDwYG.jpg

Many thanks!



   

[[alternative HTML version deleted]]



__

r-h...@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.

  
[[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.


Re: [R] vectors comparison

2012-10-22 Thread Francesco Nutini

Dear Simon  R-Users.I have applied your solution also for larger buffer 
window,and it's working well.
But I'm getting the problem harder.I have two vectors: x- 
c(0,0,0,0,1,0,0,0,0,1,0,0,0) y- c(0,-10,0,-10,0,0,0,0,-10,0,0,0,0)
And I want to know where the value -1 in x have at least 2 values -10 in 
y.Considering a buffer of three position before x.
i.e. in this example only the figure 1 in position x[5] satisfies the 
criteria,because y has the values -10 in position y[2] and y[4].
I tried in this way, but I don't know how to sayat least 2 on three conditions 
on y must be true:
which(x==1  (c(0,y[1:12])==-10 |c(0,0, y[1:11])==-10|
c(0,0,0, y[1:10])==-10))
thank in advance for you help,
Francesco
 Date: Wed, 17 Oct 2012 10:36:46 +1100
 Subject: Re: [R] vectors comparison
 From: sleepingw...@gmail.com
 To: nutini.france...@gmail.com
 CC: r-help@r-project.org
 
 Your question does not seem to make sense - there is no value of -500
 in Y (did you mean -10?). Anyway, I think this might work:
 
 which(y==-10  (x==1 | c(0, x[-length(x)]) == 1 | c(x[-1], 0) == 1))
 
 ... though one would think there is a more elegant way
 
 
 On Wed, Oct 17, 2012 at 10:07 AM, Francesco Nutini
 nutini.france...@gmail.com wrote:
 
  Dear R-Users,
  I'd like to have your help on this problem:
  I have two vectors:x- c(0,1,0,0,0,0,0,0,0,0,0,1,0)y- 
  c(0,0,-10,0,0,-10,0,-10,0,0,0,0,0)
  And I want to know where the value -500 in y have a correspondence value 1 
  in x.Considering a buffer of one position before and after in x.i.e. in 
  this example only the -10 in position y[3] satisfies the criteria, because 
  x has in position x[2]the figure 1.
  Thank in advance for you help,Francesco
 
 
 
 
 
 
  [[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.
  
[[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.


Re: [R] vectors comparison

2012-10-17 Thread Francesco Nutini

Dear Simon Knapp,
sorry the -500 is a typo.Nice job, your code works perfectly!Thanks a lot!

 Date: Wed, 17 Oct 2012 10:36:46 +1100
 Subject: Re: [R] vectors comparison
 From: sleepingw...@gmail.com
 To: nutini.france...@gmail.com
 CC: r-help@r-project.org
 
 Your question does not seem to make sense - there is no value of -500
 in Y (did you mean -10?). Anyway, I think this might work:
 
 which(y==-10  (x==1 | c(0, x[-length(x)]) == 1 | c(x[-1], 0) == 1))
 
 ... though one would think there is a more elegant way
 
 
 On Wed, Oct 17, 2012 at 10:07 AM, Francesco Nutini
 nutini.france...@gmail.com wrote:
 
  Dear R-Users,
  I'd like to have your help on this problem:
  I have two vectors:x- c(0,1,0,0,0,0,0,0,0,0,0,1,0)y- 
  c(0,0,-10,0,0,-10,0,-10,0,0,0,0,0)
  And I want to know where the value -500 in y have a correspondence value 1 
  in x.Considering a buffer of one position before and after in x.i.e. in 
  this example only the -10 in position y[3] satisfies the criteria, because 
  x has in position x[2]the figure 1.
  Thank in advance for you help,Francesco
 
 
 
 
 
 
  [[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.
  
[[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] vectors comparison

2012-10-16 Thread Francesco Nutini

Dear R-Users,
I'd like to have your help on this problem:
I have two vectors:x- c(0,1,0,0,0,0,0,0,0,0,0,1,0)y- 
c(0,0,-10,0,0,-10,0,-10,0,0,0,0,0)
And I want to know where the value -500 in y have a correspondence value 1 in 
x.Considering a buffer of one position before and after in x.i.e. in this 
example only the -10 in position y[3] satisfies the criteria, because x has in 
position x[2]the figure 1.
Thank in advance for you help,Francesco





  
[[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.


Re: [R] [r] par and complex graph

2012-06-07 Thread Francesco Nutini

Oh thank you Carlos!I wasted a lot of time formatting my xyplot by 
powerpoint.Did you used a similar tips for ternaryplot (vcd)?
Many thanks.Regards,Francesco



Date: Wed, 6 Jun 2012 17:08:39 +0200
Subject: Re: [R] [r] par and complex graph
From: c...@qualityexcellence.es
To: nutini.france...@gmail.com

Hi,
Sorry, layout is a parameter you should use when plotting several charts of the 
same nature.
If you want to combien different lattice charts you should use print() which 
is a function that has methods to consider trellis objects. Check help details 
for print.tellis o consider this example:

p11 - histogram( ~ height | voice.part, data = singer, xlab=Height)p12 - 
densityplot( ~ height | voice.part, data = singer, xlab = Height)
p2 - histogram( ~ height, data = singer, xlab = Height)


## simple positioning by splitprint(p11, split=c(1,1,1,2), more=TRUE)print(p2, 
split=c(1,2,1,2))

## Combining split and position:print(p11, position = c(0,0,.75,.75), 
split=c(1,1,1,2), more=TRUE)
print(p12, position = c(0,0,.75,.75), split=c(1,2,1,2), more=TRUE)print(p2, 
position = c(.5,.75,1,1), more=FALSE)

Regards,Carlos Ortegawww.qualityexcellence.es



2012/6/6 Carlos Ortega c...@qualityexcellence.es

Hi Francesco,
The parameter in the lattice package that you can use to arrange several plots 
in the same page is layout:


xyplot(Sepal.Length + Sepal.Width ~ Petal.Length + Petal.Width | Species,   
data = iris, scales = free, layout = c(2, 2),

   auto.key = list(x = .6, y = .7, corner = c(0, 0)))
Regards,

Carlos Ortegawww.qualityexcellence.es



2012/6/6 Francesco Nutini nutini.france...@gmail.com




Thank you Brian! So, that's why sometimes I can't use the par()

Now I'm using the ternaryplot in [vcd]. Then, I have to read the vcd help to 
looking for a function similar to par().

Many thanks.

Francesco







 Date: Tue, 5 Jun 2012 19:01:25 +0100

 From: rip...@stats.ox.ac.uk

 To: nutini.france...@gmail.com

 CC: r-help@r-project.org

 Subject: Re: [R] [r] par and complex graph



 On 05/06/2012 11:17, Francesco Nutini wrote:

 

  Dear R-Users, I'd like to have some tips about printing graph.

  I use the command par to print more graphs in one window:par(mfrow=c(6,1)); 
  par(oma=c(2.5, 2.5, 2.5, 2.5));  par(mar=c(0.5,4, 0.5, 0.5))

 

  But this command doesn't run with complex graphic command (i.e. xyplot, 
  ternaryplot).How can I print more than one graph per page, when I work with 
  this elaborated graph?Many thanks!Francesco





 xyplot does lattice (hence grid) plots: you need to read ?print.trellis

 to find out how to lay those out. par() applies only to base graphics.



 As for ternaryplot: it depends which package you got it from (and there

 is more than one on CRAN).



 

  [[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.



 That does mean you, too.



 --

 Brian D. Ripley,  rip...@stats.ox.ac.uk

 Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/

 University of Oxford, Tel:  +44 1865 272861 (self)

 1 South Parks Road, +44 1865 272866 (PA)

 Oxford OX1 3TG, UKFax:  +44 1865 272595



[[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.



-- 
Saludos,

Carlos Ortega
www.qualityexcellence.es




-- 
Saludos,
Carlos Ortega
www.qualityexcellence.es

  
[[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.


Re: [R] [r] par and complex graph

2012-06-06 Thread Francesco Nutini

Thank you Brian! So, that's why sometimes I can't use the par()
Now I'm using the ternaryplot in [vcd]. Then, I have to read the vcd help to 
looking for a function similar to par().
Many thanks.
Francesco



 Date: Tue, 5 Jun 2012 19:01:25 +0100
 From: rip...@stats.ox.ac.uk
 To: nutini.france...@gmail.com
 CC: r-help@r-project.org
 Subject: Re: [R] [r] par and complex graph
 
 On 05/06/2012 11:17, Francesco Nutini wrote:
 
  Dear R-Users, I'd like to have some tips about printing graph.
  I use the command par to print more graphs in one window:par(mfrow=c(6,1)); 
  par(oma=c(2.5, 2.5, 2.5, 2.5));  par(mar=c(0.5,4, 0.5, 0.5))
 
  But this command doesn't run with complex graphic command (i.e. xyplot, 
  ternaryplot).How can I print more than one graph per page, when I work with 
  this elaborated graph?Many thanks!Francesco
 
 xyplot does lattice (hence grid) plots: you need to read ?print.trellis 
 to find out how to lay those out. par() applies only to base graphics.
 
 As for ternaryplot: it depends which package you got it from (and there 
 is more than one on CRAN).
 
  
  [[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.
 
 That does mean you, too.
 
 -- 
 Brian D. Ripley,  rip...@stats.ox.ac.uk
 Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
 University of Oxford, Tel:  +44 1865 272861 (self)
 1 South Parks Road, +44 1865 272866 (PA)
 Oxford OX1 3TG, UKFax:  +44 1865 272595
  
[[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] [r] par and complex graph

2012-06-05 Thread Francesco Nutini

Dear R-Users, I'd like to have some tips about printing graph. 
I use the command par to print more graphs in one window:par(mfrow=c(6,1)); 
par(oma=c(2.5, 2.5, 2.5, 2.5));  par(mar=c(0.5,4, 0.5, 0.5))

But this command doesn't run with complex graphic command (i.e. xyplot, 
ternaryplot).How can I print more than one graph per page, when I work with 
this elaborated graph?Many thanks!Francesco

  
[[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] Ternary plot and filled contour

2012-06-04 Thread Francesco Nutini

Dear R-Users, I'd like to have some tips for a ternaryplot (vcd).
I have this dataframe:
a- c (0.1, 0.5, 0.5, 0.6, 0.2, 0, 0, 0.00417, 0.45) b- c 
(0.75,0.5,0,0.1,0.2,0.951612903,0.918103448,0.7875,0.45)c- c 
(0.15,0,0.5,0.3,0.6,0.048387097,0.081896552,0.20833,0.1) d- c 
(500,2324.90,2551.44,1244.50, 551.22,-644.20,-377.17,-100, 2493.04) df- 
data.frame (a, b, c, d)
and I'm building a ternary plot:
ternaryplot(df[,1:3], df$d)
How can I map the continue variable d, obtaining a result similar to this 
one? [see the link]
 http://www.pmel.noaa.gov/maillists/tmap/ferret_users/fu_2007/jpgCqrZqdDwYG.jpg
Many thanks!

  
[[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] [r] histogram with mean for every break

2011-08-23 Thread Francesco Nutini

Dear R-users,

I need to produce a histogram where for every breaks there are the mean of the 
data. 
I tried tu use the function hist(x, break=20 ... ) but this return the 
numerosity for every breaks, not the mean.
Any hint?

Thanks in advance,

francesco

---
Francesco Nutini
CNR-IREA
 Ist. per il Rilevamento Elettromagnetico dell'Ambiente
 Via Bassini 15, 20133 Milano (Italy) 
 Tel: +39-02 23699 297  
 http://www.irea.cnr.it 
 nutin...@irea.cnr.it
Skype: ui...@hotmail.it
Univ. mail: francesco.nut...@unimi.it
---
  
[[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.


Re: [R] [r] histogram with mean for every break

2011-08-23 Thread Francesco Nutini

fantastic Michael! The code V = sort(unique(ave(x,cut(x,HistOut$breaks 
works good. I got what I need! that is 20 mean values. I calculate the first 
value in excel, it's the same (79.61429).

  HistOut= hist(data$ DMP_m3.jaso..10, freq=F, breaks =20, 
  xlim=c(0,3000),col=grey26, main=DMP_niger, plot=T)
V = sort(unique(ave(data$ DMP_m3.jaso..10,cut(data$ 
DMP_m3.jaso..10,HistOut$breaks
 write(V, , sep =  )
79.61429 149.9792 257.4969 347.8211 449.2063
552.9694 647.5132 749.23 859.0167 945.4912
1046.917 1147.703 1249.375 1359.794 1447.518
1553.838 1649.231 1735.217 1850.617 1957.85
2031.329 2156.8 2247.55 2340.6 2822.1

Thank you very much.

francesco

From: michael.weyla...@gmail.com
Date: Tue, 23 Aug 2011 11:27:13 -0400
Subject: Re: [R] [r] histogram with mean for every break
To: nutini.france...@gmail.com
CC: r-help@r-project.org

I do not believe your code (minimal as it is) would work: the correct argument 
is breaks. More generally, do you really mean to say that hist(x, breaks = 
20) immediately returns the bin counts? It doesn't on my machine and if you 
knew how to get the counts, you should be able to get the midpoints as well.



Try this

x = rnorm(5000)
HistOut = hist(x, breaks = 20)
HistOut$mids # will give midpoints for each bin of this histogram

If you need proper means, rather than midpoints: 

# I *think* this works -- no guarantees: it assigns x to bins based on the 
histogram breaks, averages those by bin, and then we pull out just the unique 
values and sort them


V = sort(unique(ave(x,cut(x,HistOut$breaks

It does seem to be a somewhat strange task to use histogram breaks to get means 
though: if I were you, I'd spend a minute or two contemplating if this really 
makes the most sense, rather than just doing the breaks in some way yourself 
directly. 



There may well be a more elegant way but I think this gets the job done.

Hope it helps, 

Michael

On Tue, Aug 23, 2011 at 9:46 AM, Francesco Nutini nutini.france...@gmail.com 
wrote:




Dear R-users,



I need to produce a histogram where for every breaks there are the mean of the 
data.

I tried tu use the function hist(x, break=20 ... ) but this return the 
numerosity for every breaks, not the mean.

Any hint?



Thanks in advance,



francesco



---

Francesco Nutini

CNR-IREA

 Ist. per il Rilevamento Elettromagnetico dell'Ambiente

 Via Bassini 15, 20133 Milano (Italy)

 Tel: +39-02 23699 297

 http://www.irea.cnr.it

 nutin...@irea.cnr.it

Skype: ui...@hotmail.it

Univ. mail: francesco.nut...@unimi.it

---



[[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.


  
[[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.


Re: [R] [r] regression coefficient for different factors

2011-05-23 Thread Francesco Nutini

In fact temp.data$ is not necessary, but the command still not run.
Thanks for your response, I'm also tring other point of view (suggested by 
r-helpers).
For example ?ddply and ?lmList.
If you are interested I will keep you updated.

Francesco


 Date: Fri, 20 May 2011 13:04:41 -0400
 Subject: Re: [R] [r] regression coefficient for different factors
 From: dimitri.liakhovit...@gmail.com
 To: nutini.france...@gmail.com
 CC: rb...@atsu.edu; r-help@r-project.org
 
 I think you don't need to write temp.data$a ~ temp.data$b just a ~ b
 
 On Fri, May 20, 2011 at 11:45 AM, Francesco Nutini
 nutini.france...@gmail.com wrote:
  Please forgive me for all these questions Dimitri...
 
  I'm running these input:
 
  mylist-NULL #in order to hold my input
   for(i in levels(mydataset$c)) { temp.data-mydataset [mydataset$c %in% i]
   mylist[[i]]- lm(temp.data$a ~ temp.data$b , data=temp.data) }
 
 
  That's the erros returns
  Error in `[.data.frame`(mydataset, niger$site %in% i) :
  undefined columns selected
 
 
 
  Date: Fri, 20 May 2011 10:01:39 -0400
  Subject: Re: [R] [r] regression coefficient for different factors
  From: dimitri.liakhovit...@gmail.com
  To: nutini.france...@gmail.com
  CC: rb...@atsu.edu; r-help@r-project.org
 
  First you have to create something (e.g., a list) that holds your output:
 
  mylist-NULL
 
  Then you loop through the levels of c and run a regression of a onto b
  (no need to include c anymore because c will have zero variance within
  each level of c):
  for(i in levels(c)){
  temp.data-mydataset[mydataset$c %in% i]
  mylist[[i]]-lm(a ~ b, data=temp.data)
  }
 
  Once you are done - you can write another loop (this time across all
  elements of mylist - that will have as many elements as there are
  levels in c) and extract the coefficients.
  Dimitri
 
 
  On Fri, May 20, 2011 at 9:57 AM, Francesco Nutini
  nutini.france...@gmail.com wrote:
   Yes Dimitri that's what I mean!
   Something like this?
  
   for(i in levels(c)) { lm(a ~  b *  c , data=mydataset)}
  
   And what about to see the output?
  
   Thanks!
  
   Date: Fri, 20 May 2011 09:46:08 -0400
   Subject: Re: [R] [r] regression coefficient for different factors
   From: dimitri.liakhovit...@gmail.com
   To: nutini.france...@gmail.com
   CC: rb...@atsu.edu; r-help@r-project.org
  
   Francesco, do you just want a separate regression for each level of
   your factor c?
   You could write a loop - looping through levels of c:
  
   for(i in levels(c)){
   select your data here and write a regression formula
   }
  
   On Fri, May 20, 2011 at 9:39 AM, Francesco Nutini
   nutini.france...@gmail.com wrote:
   
Thanks for your reply,
   
?summary produce a  multiple r2.
My dataset il similar to this one:
   
   a b   c
1 -1.4805676 0.9729927 x
2  1.5771695 0.2172974 x
3 -0.9567445 0.5205087 x
4 -0.9200052 0.8279428 z
5 -1.9976421 0.9641110 z
6 -0.2722960 0.6318801 y
   
So, I would like to know the r2 for a~b for every factors levels.
Off course I can made the regression separately for every factors,
but
my dataset have 68 factors...
   
--
Francesco Nutini
PhD student
CNR-IREA (Institute for Electromagnetic Sensing of the Environment)
Milano, Italy
   
  From: rb...@atsu.edu
To: nutini.france...@gmail.com; r-help@r-project.org
Subject: Re: [R] [r] regression coefficient for different factors
Date: Fri, 20 May 2011 08:07:59 -0500
   
?summary
   
produces r^2 in 2nd to last line, as in,
 set.seed(12); a=rnorm(100); b = runif(100); c = factor(rep(c('No',
 'Yes'),50)); df = data.frame(a,b,c)
 head(df)
   a b   c
1 -1.4805676 0.9729927  No
2  1.5771695 0.2172974 Yes
3 -0.9567445 0.5205087  No
4 -0.9200052 0.8279428 Yes
5 -1.9976421 0.9641110  No
6 -0.2722960 0.6318801 Yes
 mod = lm(a ~ b*c)
 summary(mod)
   
Call:
lm(formula = a ~ b * c)
   
Residuals:
Min  1Q  Median  3Q Max
-1.8196 -0.4754 -0.0246  0.5585  2.0941
   
Coefficients:
Estimate Std. Error t value Pr(|t|)
(Intercept)   0.2293 0.2314   0.9910.324
b-0.4226 0.3885  -1.0880.280
cYes  0.1578 0.3202   0.4930.623
b:cYes   -0.5878 0.5621  -1.0460.298
   
Residual standard error: 0.8455 on 96 degrees of freedom
Multiple R-squared: 0.07385,  Adjusted R-squared: 0.04491
F-statistic: 2.552 on 3 and 96 DF,  p-value: 0.0601
   
--
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A. T. Still University of Health Sciences
800 W. Jefferson St.
Kirksville, MO 63501
660-626-2322
FAX 660-626-2965
   
   
--
From: Francesco Nutini nutini.france...@gmail.com
Sent: Friday, May 20, 2011 4:17

[R] [r] regression coefficient for different factors

2011-05-20 Thread Francesco Nutini

Dear R-helpers,

In my dataset I have two continuous variable (A and B) and one factor.
I'm investigating the regression between the two variables usign the command 
lm(A ~ B, ...)
but now I want to know the regression coefficient (r2) of A vs. B for every 
factors.
I know that I can obtain this information with excel, but the factor have 68 
levels...maybe [r] have a useful command.

Thanks,

Francesco Nutini
  
[[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.


Re: [R] [r] regression coefficient for different factors

2011-05-20 Thread Francesco Nutini

Thanks for your reply,

?summary produce a  multiple r2.
My dataset il similar to this one:

a b   c
 1 -1.4805676 0.9729927 x
 2  1.5771695 0.2172974 x
 3 -0.9567445 0.5205087 x
 4 -0.9200052 0.8279428 z
 5 -1.9976421 0.9641110 z
 6 -0.2722960 0.6318801 y

So, I would like to know the r2 for a~b for every factors levels.
Off course I can made the regression separately for every factors, but my 
dataset have 68 factors...

--
Francesco Nutini
PhD student
CNR-IREA (Institute for Electromagnetic Sensing of the Environment) 
Milano, Italy

  From: rb...@atsu.edu
 To: nutini.france...@gmail.com; r-help@r-project.org
 Subject: Re: [R] [r] regression coefficient for different factors
 Date: Fri, 20 May 2011 08:07:59 -0500
 
 ?summary
 
 produces r^2 in 2nd to last line, as in,
  set.seed(12); a=rnorm(100); b = runif(100); c = factor(rep(c('No', 
  'Yes'),50)); df = data.frame(a,b,c)
  head(df)
a b   c
 1 -1.4805676 0.9729927  No
 2  1.5771695 0.2172974 Yes
 3 -0.9567445 0.5205087  No
 4 -0.9200052 0.8279428 Yes
 5 -1.9976421 0.9641110  No
 6 -0.2722960 0.6318801 Yes
  mod = lm(a ~ b*c)
  summary(mod)
 
 Call:
 lm(formula = a ~ b * c)
 
 Residuals:
 Min  1Q  Median  3Q Max
 -1.8196 -0.4754 -0.0246  0.5585  2.0941
 
 Coefficients:
 Estimate Std. Error t value Pr(|t|)
 (Intercept)   0.2293 0.2314   0.9910.324
 b-0.4226 0.3885  -1.0880.280
 cYes  0.1578 0.3202   0.4930.623
 b:cYes   -0.5878 0.5621  -1.0460.298
 
 Residual standard error: 0.8455 on 96 degrees of freedom
 Multiple R-squared: 0.07385,  Adjusted R-squared: 0.04491
 F-statistic: 2.552 on 3 and 96 DF,  p-value: 0.0601
 
 --
 Robert W. Baer, Ph.D.
 Professor of Physiology
 Kirksville College of Osteopathic Medicine
 A. T. Still University of Health Sciences
 800 W. Jefferson St.
 Kirksville, MO 63501
 660-626-2322
 FAX 660-626-2965
 
 
 --
 From: Francesco Nutini nutini.france...@gmail.com
 Sent: Friday, May 20, 2011 4:17 AM
 To: [R] help r-help@r-project.org
 Subject: [R] [r] regression coefficient for different factors
 
 
  Dear R-helpers,
 
  In my dataset I have two continuous variable (A and B) and one factor.
  I'm investigating the regression between the two variables usign the 
  command
  lm(A ~ B, ...)
  but now I want to know the regression coefficient (r2) of A vs. B for 
  every factors.
  I know that I can obtain this information with excel, but the factor have 
  68 levels...maybe [r] have a useful command.
 
  Thanks,
 
  Francesco Nutini
 
  [[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.
  
  
[[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.


Re: [R] regression coefficient for different factors

2011-05-20 Thread Francesco Nutini











Yes Dimitri that's what I mean!
Something like this?

for(i in levels(c)) { lm(a ~  b *  c , data=mydataset)}

And what about to see the output?

Thanks!

 Date: Fri, 20 May 2011 09:46:08 -0400
 Subject: Re: [R] [r] regression coefficient for different factors
 From: dimitri.liakhovit...@gmail.com
 To: nutini.france...@gmail.com
 CC: rb...@atsu.edu; r-help@r-project.org
 
 Francesco, do you just want a separate regression for each level of
 your factor c?
 You could write a loop - looping through levels of c:
 
 for(i in levels(c)){
select your data here and write a regression formula
 }
 
 On Fri, May 20, 2011 at 9:39 AM, Francesco Nutini
 nutini.france...@gmail.com wrote:
 
  Thanks for your reply,
 
  ?summary produce a  multiple r2.
  My dataset il similar to this one:
 
 a b   c
  1 -1.4805676 0.9729927 x
  2  1.5771695 0.2172974 x
  3 -0.9567445 0.5205087 x
  4 -0.9200052 0.8279428 z
  5 -1.9976421 0.9641110 z
  6 -0.2722960 0.6318801 y
 
  So, I would like to know the r2 for a~b for every factors levels.
  Off course I can made the regression separately for every factors, but my 
  dataset have 68 factors...
 
  --
  Francesco Nutini
  PhD student
  CNR-IREA (Institute for Electromagnetic Sensing of the Environment)
  Milano, Italy
 
From: rb...@atsu.edu
  To: nutini.france...@gmail.com; r-help@r-project.org
  Subject: Re: [R] [r] regression coefficient for different factors
  Date: Fri, 20 May 2011 08:07:59 -0500
 
  ?summary
 
  produces r^2 in 2nd to last line, as in,
   set.seed(12); a=rnorm(100); b = runif(100); c = factor(rep(c('No',
   'Yes'),50)); df = data.frame(a,b,c)
   head(df)
 a b   c
  1 -1.4805676 0.9729927  No
  2  1.5771695 0.2172974 Yes
  3 -0.9567445 0.5205087  No
  4 -0.9200052 0.8279428 Yes
  5 -1.9976421 0.9641110  No
  6 -0.2722960 0.6318801 Yes
   mod = lm(a ~ b*c)
   summary(mod)
 
  Call:
  lm(formula = a ~ b * c)
 
  Residuals:
  Min  1Q  Median  3Q Max
  -1.8196 -0.4754 -0.0246  0.5585  2.0941
 
  Coefficients:
  Estimate Std. Error t value Pr(|t|)
  (Intercept)   0.2293 0.2314   0.9910.324
  b-0.4226 0.3885  -1.0880.280
  cYes  0.1578 0.3202   0.4930.623
  b:cYes   -0.5878 0.5621  -1.0460.298
 
  Residual standard error: 0.8455 on 96 degrees of freedom
  Multiple R-squared: 0.07385,  Adjusted R-squared: 0.04491
  F-statistic: 2.552 on 3 and 96 DF,  p-value: 0.0601
 
  --
  Robert W. Baer, Ph.D.
  Professor of Physiology
  Kirksville College of Osteopathic Medicine
  A. T. Still University of Health Sciences
  800 W. Jefferson St.
  Kirksville, MO 63501
  660-626-2322
  FAX 660-626-2965
 
 
  --
  From: Francesco Nutini nutini.france...@gmail.com
  Sent: Friday, May 20, 2011 4:17 AM
  To: [R] help r-help@r-project.org
  Subject: [R] [r] regression coefficient for different factors
 
  
   Dear R-helpers,
  
   In my dataset I have two continuous variable (A and B) and one factor.
   I'm investigating the regression between the two variables usign the
   command
   lm(A ~ B, ...)
   but now I want to know the regression coefficient (r2) of A vs. B for
   every factors.
   I know that I can obtain this information with excel, but the factor have
   68 levels...maybe [r] have a useful command.
  
   Thanks,
  
   Francesco Nutini
  
   [[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.
  
 
 [[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.
 
 
 
 
 -- 
 Dimitri Liakhovitski
 Ninah Consulting
 www.ninah.com
  
[[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.


Re: [R] [r] regression coefficient for different factors

2011-05-20 Thread Francesco Nutini

Please forgive me for all these questions Dimitri...

I'm running these input:

mylist-NULL #in order to hold my input
 for(i in levels(mydataset$c)) { temp.data-mydataset [mydataset$c %in% i] 
 mylist[[i]]- lm(temp.data$a ~ temp.data$b , data=temp.data) }


That's the erros returns
Error in `[.data.frame`(mydataset, niger$site %in% i) : 
undefined columns selected



 Date: Fri, 20 May 2011 10:01:39 -0400
 Subject: Re: [R] [r] regression coefficient for different factors
 From: dimitri.liakhovit...@gmail.com
 To: nutini.france...@gmail.com
 CC: rb...@atsu.edu; r-help@r-project.org
 
 First you have to create something (e.g., a list) that holds your output:
 
 mylist-NULL
 
 Then you loop through the levels of c and run a regression of a onto b
 (no need to include c anymore because c will have zero variance within
 each level of c):
 for(i in levels(c)){
   temp.data-mydataset[mydataset$c %in% i]
   mylist[[i]]-lm(a ~  b, data=temp.data)
 }
 
 Once you are done - you can write another loop (this time across all
 elements of mylist - that will have as many elements as there are
 levels in c) and extract the coefficients.
 Dimitri
 
 
 On Fri, May 20, 2011 at 9:57 AM, Francesco Nutini
 nutini.france...@gmail.com wrote:
  Yes Dimitri that's what I mean!
  Something like this?
 
  for(i in levels(c)) { lm(a ~  b *  c , data=mydataset)}
 
  And what about to see the output?
 
  Thanks!
 
  Date: Fri, 20 May 2011 09:46:08 -0400
  Subject: Re: [R] [r] regression coefficient for different factors
  From: dimitri.liakhovit...@gmail.com
  To: nutini.france...@gmail.com
  CC: rb...@atsu.edu; r-help@r-project.org
 
  Francesco, do you just want a separate regression for each level of
  your factor c?
  You could write a loop - looping through levels of c:
 
  for(i in levels(c)){
  select your data here and write a regression formula
  }
 
  On Fri, May 20, 2011 at 9:39 AM, Francesco Nutini
  nutini.france...@gmail.com wrote:
  
   Thanks for your reply,
  
   ?summary produce a  multiple r2.
   My dataset il similar to this one:
  
  a b   c
   1 -1.4805676 0.9729927 x
   2  1.5771695 0.2172974 x
   3 -0.9567445 0.5205087 x
   4 -0.9200052 0.8279428 z
   5 -1.9976421 0.9641110 z
   6 -0.2722960 0.6318801 y
  
   So, I would like to know the r2 for a~b for every factors levels.
   Off course I can made the regression separately for every factors, but
   my dataset have 68 factors...
  
   --
   Francesco Nutini
   PhD student
   CNR-IREA (Institute for Electromagnetic Sensing of the Environment)
   Milano, Italy
  
 From: rb...@atsu.edu
   To: nutini.france...@gmail.com; r-help@r-project.org
   Subject: Re: [R] [r] regression coefficient for different factors
   Date: Fri, 20 May 2011 08:07:59 -0500
  
   ?summary
  
   produces r^2 in 2nd to last line, as in,
set.seed(12); a=rnorm(100); b = runif(100); c = factor(rep(c('No',
'Yes'),50)); df = data.frame(a,b,c)
head(df)
  a b   c
   1 -1.4805676 0.9729927  No
   2  1.5771695 0.2172974 Yes
   3 -0.9567445 0.5205087  No
   4 -0.9200052 0.8279428 Yes
   5 -1.9976421 0.9641110  No
   6 -0.2722960 0.6318801 Yes
mod = lm(a ~ b*c)
summary(mod)
  
   Call:
   lm(formula = a ~ b * c)
  
   Residuals:
   Min  1Q  Median  3Q Max
   -1.8196 -0.4754 -0.0246  0.5585  2.0941
  
   Coefficients:
   Estimate Std. Error t value Pr(|t|)
   (Intercept)   0.2293 0.2314   0.9910.324
   b-0.4226 0.3885  -1.0880.280
   cYes  0.1578 0.3202   0.4930.623
   b:cYes   -0.5878 0.5621  -1.0460.298
  
   Residual standard error: 0.8455 on 96 degrees of freedom
   Multiple R-squared: 0.07385,  Adjusted R-squared: 0.04491
   F-statistic: 2.552 on 3 and 96 DF,  p-value: 0.0601
  
   --
   Robert W. Baer, Ph.D.
   Professor of Physiology
   Kirksville College of Osteopathic Medicine
   A. T. Still University of Health Sciences
   800 W. Jefferson St.
   Kirksville, MO 63501
   660-626-2322
   FAX 660-626-2965
  
  
   --
   From: Francesco Nutini nutini.france...@gmail.com
   Sent: Friday, May 20, 2011 4:17 AM
   To: [R] help r-help@r-project.org
   Subject: [R] [r] regression coefficient for different factors
  
   
Dear R-helpers,
   
In my dataset I have two continuous variable (A and B) and one
factor.
I'm investigating the regression between the two variables usign the
command
lm(A ~ B, ...)
but now I want to know the regression coefficient (r2) of A vs. B for
every factors.
I know that I can obtain this information with excel, but the factor
have
68 levels...maybe [r] have a useful command.
   
Thanks,
   
Francesco Nutini
   
[[alternative HTML version deleted]]
   
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r

Re: [R] how to enclose two xyplot

2011-04-15 Thread Francesco Nutini









Sorry, my previous mail was incomplete.

I mean, one of my xyplot is build with the command doubleYScale (in order to 
overlap two line with different Y-axis).
But  doubleYScale  doesn't run with the nice command that you have suggested:

first plot:




a-xyplot(NDVI_P10~dek_num
| Year, type=a, data=data, xlim=c(1,37),  ylim=c(0.1,0.8), as.table = TRUE, 
layout =
c(13,1), aspect = 2, col=darkgrey, 
col.axis=black, lwd=3, grid=T, par.settings =
list(strip.background = list(col = c(gray90
second plot:


 b-xyplot(AVG_NDVI_P10~dek_num | Year,
type=a, data=data, xlim=c(1,37), 
ylim=c(0.1,0.8), as.table = TRUE, layout = c(13,1), aspect = 2,  col=black,
col.axis=black, lwd=2)
overlap first and second:


double- update(doubleYScale(a,
b, add.ylab2 = TRUE), par.settings = simpleTheme(col =
c(black,black)))
third plot:


z- xyplot(z_NDVI_P10
~dek_num | Year, type=h, data=data, xlim=c(1,37),  ylim=c(-2.5,2.5), as.table 
= TRUE, layout =
c(13,1), aspect = 2, col=black, 
col.axis=black, lwd=3, grid=T, par.settings =
list(strip.background = list(col = c(gray90
enclose (?c.trellis):




c( z,double, x.same = TRUE, y.same = T, layout = c(13,2))

Maybe there is no solution but, anyway, thanks for help!
francesco








From: nutini.france...@gmail.com
To: baptiste.aug...@googlemail.com
CC: r-help@r-project.org
Subject: RE: [R]  how to enclose two xyplot
Date: Thu, 14 Apr 2011 15:31:12 +








ok ?c.trellis works well.
But I still have a problem. 

One of my plot is a combination of two xyplot on different scales:



a-xyplot(NDVI_P10~dek_num
| Year, type=a, data=data, xlim=c(1,37),  ylim=c(0.1,0.8), as.table = TRUE, 
layout =
c(13,1), aspect = 2, col=darkgrey, 
col.axis=black, lwd=3, grid=T, par.settings =
list(strip.background = list(col = c(gray90

b-xyplot(AVG_NDVI_P10~dek_num | Year,
type=a, data=data, xlim=c(1,37), 
ylim=c(0.1,0.8), as.table = TRUE, layout = c(13,1), aspect = 2,  col=black,
col.axis=black, lwd=2)

update(doubleYScale(a, b, add.ylab2 =
TRUE), par.settings = simpleTheme(col =
c(black,black)))





From: nutini.france...@gmail.com
To: baptiste.aug...@googlemail.com
CC: r-help@r-project.org
Subject: RE: [R] FW: [r] how to enclose two xyplot
Date: Thu, 14 Apr 2011 07:46:31 +








Did you mean this?
http://rgm2.lab.nig.ac.jp/RGM2/func.php?rd_id=latticeExtra:c.trellis

In fact I'm already using latticeExtra package because my xyplot is little bit 
complicated...
So, I'm tring, thanks fro tricks baptiste!

Francesco


 Date: Thu, 14 Apr 2011 08:52:45 +1200
 Subject: Re: [R] FW: [r] how to enclose two xyplot
 From: baptiste.aug...@googlemail.com
 To: nutini.france...@gmail.com
 CC: r-help@r-project.org
 
 Hi,
 
 Have you tried ?c.trellis in the latticeExtra package?
 
 HTH,
 
 baptiste
 
 On 13 April 2011 23:36, Francesco Nutini nutini.france...@gmail.com wrote:
 
   Dear R-users,
 
  I have to plot two xyplot, and I wish to enclose this two graphs with just 
  one headline, the same x scale, the same grid etc.
  These parameters should tie in, in order to obtain, visually, a unique 
  graph formed by two xyplot.
 
  I try to give an idea:
 
  xyplot1: |_|_|_|
 
 
 
  xyplot2: |_|_|_|
 
 
 
  what i want: |  |  | |
 
|_|_|_|
 
 
  I tried to use the command par, but it's doesn't work with xyplot. The 
  two plot have, by default, the same x-axis scale.
  I know it's just a visual solution, but it could be nice for a paper!
 
  Thanks a lot,
 
  Francesco Nutini
  PhD student
 
 
 
 
 
 [[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.
 
  
[[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.


Re: [R] FW: [r] how to enclose two xyplot

2011-04-14 Thread Francesco Nutini

Did you mean this?
http://rgm2.lab.nig.ac.jp/RGM2/func.php?rd_id=latticeExtra:c.trellis

In fact I'm already using latticeExtra package because my xyplot is little bit 
complicated...
So, I'm tring, thanks fro tricks baptiste!

Francesco


 Date: Thu, 14 Apr 2011 08:52:45 +1200
 Subject: Re: [R] FW: [r] how to enclose two xyplot
 From: baptiste.aug...@googlemail.com
 To: nutini.france...@gmail.com
 CC: r-help@r-project.org
 
 Hi,
 
 Have you tried ?c.trellis in the latticeExtra package?
 
 HTH,
 
 baptiste
 
 On 13 April 2011 23:36, Francesco Nutini nutini.france...@gmail.com wrote:
 
   Dear R-users,
 
  I have to plot two xyplot, and I wish to enclose this two graphs with just 
  one headline, the same x scale, the same grid etc.
  These parameters should tie in, in order to obtain, visually, a unique 
  graph formed by two xyplot.
 
  I try to give an idea:
 
  xyplot1: |_|_|_|
 
 
 
  xyplot2: |_|_|_|
 
 
 
  what i want: |  |  | |
 
|_|_|_|
 
 
  I tried to use the command par, but it's doesn't work with xyplot. The 
  two plot have, by default, the same x-axis scale.
  I know it's just a visual solution, but it could be nice for a paper!
 
  Thanks a lot,
 
  Francesco Nutini
  PhD student
 
 
 
 
 
 [[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.
 
  
[[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.


Re: [R] how to enclose two xyplot

2011-04-14 Thread Francesco Nutini

ok ?c.trellis works well.
But I still have a problem. 

One of my plot is a combination of two xyplot on different scales:



a-xyplot(NDVI_P10~dek_num
| Year, type=a, data=data, xlim=c(1,37),  ylim=c(0.1,0.8), as.table = TRUE, 
layout =
c(13,1), aspect = 2, col=darkgrey, 
col.axis=black, lwd=3, grid=T, par.settings =
list(strip.background = list(col = c(gray90

b-xyplot(AVG_NDVI_P10~dek_num | Year,
type=a, data=data, xlim=c(1,37), 
ylim=c(0.1,0.8), as.table = TRUE, layout = c(13,1), aspect = 2,  col=black,
col.axis=black, lwd=2)

update(doubleYScale(a, b, add.ylab2 =
TRUE), par.settings = simpleTheme(col =
c(black,black)))





From: nutini.france...@gmail.com
To: baptiste.aug...@googlemail.com
CC: r-help@r-project.org
Subject: RE: [R] FW: [r] how to enclose two xyplot
Date: Thu, 14 Apr 2011 07:46:31 +








Did you mean this?
http://rgm2.lab.nig.ac.jp/RGM2/func.php?rd_id=latticeExtra:c.trellis

In fact I'm already using latticeExtra package because my xyplot is little bit 
complicated...
So, I'm tring, thanks fro tricks baptiste!

Francesco


 Date: Thu, 14 Apr 2011 08:52:45 +1200
 Subject: Re: [R] FW: [r] how to enclose two xyplot
 From: baptiste.aug...@googlemail.com
 To: nutini.france...@gmail.com
 CC: r-help@r-project.org
 
 Hi,
 
 Have you tried ?c.trellis in the latticeExtra package?
 
 HTH,
 
 baptiste
 
 On 13 April 2011 23:36, Francesco Nutini nutini.france...@gmail.com wrote:
 
   Dear R-users,
 
  I have to plot two xyplot, and I wish to enclose this two graphs with just 
  one headline, the same x scale, the same grid etc.
  These parameters should tie in, in order to obtain, visually, a unique 
  graph formed by two xyplot.
 
  I try to give an idea:
 
  xyplot1: |_|_|_|
 
 
 
  xyplot2: |_|_|_|
 
 
 
  what i want: |  |  | |
 
|_|_|_|
 
 
  I tried to use the command par, but it's doesn't work with xyplot. The 
  two plot have, by default, the same x-axis scale.
  I know it's just a visual solution, but it could be nice for a paper!
 
  Thanks a lot,
 
  Francesco Nutini
  PhD student
 
 
 
 
 
 [[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.
 
  
[[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] FW: [r] how to enclose two xyplot

2011-04-13 Thread Francesco Nutini

 Dear R-users,

I have to plot two xyplot, and I wish to enclose this two graphs with just one 
headline, the same x scale, the same grid etc.
These parameters should tie in, in order to obtain, visually, a unique graph 
formed by two xyplot. 

I try to give an idea:
 
xyplot1: |_|_|_|



xyplot2: |_|_|_|



what i want: |  |  | |

   |_|_|_|


I tried to use the command par, but it's doesn't work with xyplot. The two 
plot have, by default, the same x-axis scale.
I know it's just a visual solution, but it could be nice for a paper!

Thanks a lot,

Francesco Nutini
PhD student




  
[[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.


Re: [R] [r] align xyplot

2011-02-22 Thread Francesco Nutini

Hi Dennis and [R]users!
as I said last week, I need more info about xyplot. 

Is it possible to change the color of the intestation of xyplot? By default is 
pale-pink, but light-gray is better for a paper.

Thanks,

Francesco

From: nutini.france...@gmail.com
To: djmu...@gmail.com
CC: r-help@r-project.org
Subject: RE: [R] [r] align xyplot
Date: Thu, 3 Feb 2011 10:58:35 +








Thanks Dennis,
I have used the codes  as.table = TRUE and  aspect = 1 to obtain what i needed.
Maybe I'll ask you more about xyplot, is very powerfull tool!

Cheers,
Francesco

Date: Mon, 31 Jan 2011 04:33:27 -0800
Subject: Re: [R] [r] align xyplot
From: djmu...@gmail.com
To: nutini.france...@gmail.com
CC: r-help@r-project.org

Hi:

Look at as.table = TRUE and (perhaps) the skip = options in xyplot(). as.table 
= TRUE will put 1998 in the upper left corner and proceed row-wise.

Here's an example using the singer data:

histogram( ~ height | voice.part, data = singer, nint = 17,

   endpoints = c(59.5, 76.5), layout = c(2,4), aspect = 1,
   xlab = Height (inches))
histogram( ~ height | voice.part, data = singer, nint = 17, as.table = TRUE,
   endpoints = c(59.5, 76.5), layout = c(2,4), aspect = 1,

   xlab = Height (inches))

The '2' voices are lower than the '1' voices, so the ordering is correct.

HTH,
Dennis


On Mon, Jan 31, 2011 at 2:44 AM, Francesco Nutini nutini.france...@gmail.com 
wrote:



Dear R users,

I'm using xyplot to obtain a graph about a correlation x~y for different years 
(a categoric variable).

The program dispose automatically the graphs in this way:



2010

2007 2008 2009

2004 2005 2006

2001 2002 2003

1998 1999 2000



Which code should I use to obtain this sequance of graphs?



1998 1999 2000 2001 2002 2003 2004 2005 2006  2007 2008 2009 2010





I have tried with par code but it's doesn't work.



Thanks for help,



Francesco Nutini









[[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.


  
[[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.


Re: [R] [r] align xyplot

2011-02-22 Thread Francesco Nutini



From: ui...@hotmail.it
To: djmu...@gmail.com
CC: r-help@r-project.org
Subject: RE: [R] [r] align xyplot
Date: Tue, 22 Feb 2011 12:23:55 +








Hi Dennis and [R]users!
as I said last week, I need more info about xyplot. 

Is it possible to change the color of the intestation of xyplot? By default is 
pale-pink, but light-gray is better for a paper.

Thanks,

Francesco

From: nutini.france...@gmail.com
To: djmu...@gmail.com
CC: r-help@r-project.org
Subject: RE: [R] [r] align xyplot
Date: Thu, 3 Feb 2011 10:58:35 +








Thanks Dennis,
I have used the codes  as.table = TRUE and  aspect = 1 to obtain what i needed.
Maybe I'll ask you more about xyplot, is very powerfull tool!

Cheers,
Francesco

Date: Mon, 31 Jan 2011 04:33:27 -0800
Subject: Re: [R] [r] align xyplot
From: djmu...@gmail.com
To: nutini.france...@gmail.com
CC: r-help@r-project.org

Hi:

Look at as.table = TRUE and (perhaps) the skip = options in xyplot(). as.table 
= TRUE will put 1998 in the upper left corner and proceed row-wise.

Here's an example using the singer data:

histogram( ~ height | voice.part, data = singer, nint = 17,

   endpoints = c(59.5, 76.5), layout = c(2,4), aspect = 1,
   xlab = Height (inches))
histogram( ~ height | voice.part, data = singer, nint = 17, as.table = TRUE,
   endpoints = c(59.5, 76.5), layout = c(2,4), aspect = 1,

   xlab = Height (inches))

The '2' voices are lower than the '1' voices, so the ordering is correct.

HTH,
Dennis


On Mon, Jan 31, 2011 at 2:44 AM, Francesco Nutini nutini.france...@gmail.com 
wrote:



Dear R users,

I'm using xyplot to obtain a graph about a correlation x~y for different years 
(a categoric variable).

The program dispose automatically the graphs in this way:



2010

2007 2008 2009

2004 2005 2006

2001 2002 2003

1998 1999 2000



Which code should I use to obtain this sequance of graphs?



1998 1999 2000 2001 2002 2003 2004 2005 2006  2007 2008 2009 2010





I have tried with par code but it's doesn't work.



Thanks for help,



Francesco Nutini









[[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.


  
[[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.


Re: [R] [r] align xyplot

2011-02-22 Thread Francesco Nutini

Sorry, I mean heading.
Thanks for the tip.

Francesco

 CC: djmu...@gmail.com; r-help@r-project.org
 From: dwinsem...@comcast.net
 To: ui...@hotmail.it
 Subject: Re: [R] [r] align xyplot
 Date: Tue, 22 Feb 2011 08:33:07 -0500
 
 I don't know the term intestation, but from context it appears you  
 might need:
 
 ?trellis.par.set
 
 
 -- 
 David.
 On Feb 22, 2011, at 7:23 AM, Francesco Nutini wrote:
 
 
  Hi Dennis and [R]users!
  as I said last week, I need more info about xyplot.
 
  Is it possible to change the color of the intestation of xyplot? By  
  default is pale-pink, but light-gray is better for a paper.
 
  Thanks,
 
  Francesco
 
  From: nutini.france...@gmail.com
  To: djmu...@gmail.com
  CC: r-help@r-project.org
  Subject: RE: [R] [r] align xyplot
  Date: Thu, 3 Feb 2011 10:58:35 +
 
 
  Thanks Dennis,
  I have used the codes  as.table = TRUE and  aspect = 1 to obtain  
  what i needed.
  Maybe I'll ask you more about xyplot, is very powerfull tool!
 
  Cheers,
  Francesco
 
  Date: Mon, 31 Jan 2011 04:33:27 -0800
  Subject: Re: [R] [r] align xyplot
  From: djmu...@gmail.com
  To: nutini.france...@gmail.com
  CC: r-help@r-project.org
 
  Hi:
 
  Look at as.table = TRUE and (perhaps) the skip = options in  
  xyplot(). as.table = TRUE will put 1998 in the upper left corner and  
  proceed row-wise.
 
  Here's an example using the singer data:
 
  histogram( ~ height | voice.part, data = singer, nint = 17,
 
endpoints = c(59.5, 76.5), layout = c(2,4), aspect = 1,
xlab = Height (inches))
  histogram( ~ height | voice.part, data = singer, nint = 17, as.table  
  = TRUE,
endpoints = c(59.5, 76.5), layout = c(2,4), aspect = 1,
 
xlab = Height (inches))
 
  The '2' voices are lower than the '1' voices, so the ordering is  
  correct.
 
  HTH,
  Dennis
 
 
  On Mon, Jan 31, 2011 at 2:44 AM, Francesco Nutini 
  nutini.france...@gmail.com 
   wrote:
 
 
 
  Dear R users,
 
  I'm using xyplot to obtain a graph about a correlation x~y for  
  different years (a categoric variable).
 
  The program dispose automatically the graphs in this way:
 
 
 
  2010
 
  2007 2008 2009
 
  2004 2005 2006
 
  2001 2002 2003
 
  1998 1999 2000
 
 
 
  Which code should I use to obtain this sequance of graphs?
 
 
 
  1998 1999 2000 2001 2002 2003 2004 2005 2006  2007 2008 2009 2010
 
 
 
 
 
  I have tried with par code but it's doesn't work.
 
 
 
  Thanks for help,
 
 
 
  Francesco Nutini
 
 
 
 
 
 
 
 
 
 [[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.
 
 
  
  [[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.
 
 David Winsemius, MD
 West Hartford, CT
 
  
[[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.


Re: [R] [r] align xyplot

2011-02-03 Thread Francesco Nutini

Thanks Dennis,
I have used the codes  as.table = TRUE and  aspect = 1 to obtain what i needed.
Maybe I'll ask you more about xyplot, is very powerfull tool!

Cheers,
Francesco

Date: Mon, 31 Jan 2011 04:33:27 -0800
Subject: Re: [R] [r] align xyplot
From: djmu...@gmail.com
To: nutini.france...@gmail.com
CC: r-help@r-project.org

Hi:

Look at as.table = TRUE and (perhaps) the skip = options in xyplot(). as.table 
= TRUE will put 1998 in the upper left corner and proceed row-wise.

Here's an example using the singer data:

histogram( ~ height | voice.part, data = singer, nint = 17,

   endpoints = c(59.5, 76.5), layout = c(2,4), aspect = 1,
   xlab = Height (inches))
histogram( ~ height | voice.part, data = singer, nint = 17, as.table = TRUE,
   endpoints = c(59.5, 76.5), layout = c(2,4), aspect = 1,

   xlab = Height (inches))

The '2' voices are lower than the '1' voices, so the ordering is correct.

HTH,
Dennis


On Mon, Jan 31, 2011 at 2:44 AM, Francesco Nutini nutini.france...@gmail.com 
wrote:



Dear R users,

I'm using xyplot to obtain a graph about a correlation x~y for different years 
(a categoric variable).

The program dispose automatically the graphs in this way:



2010

2007 2008 2009

2004 2005 2006

2001 2002 2003

1998 1999 2000



Which code should I use to obtain this sequance of graphs?



1998 1999 2000 2001 2002 2003 2004 2005 2006  2007 2008 2009 2010





I have tried with par code but it's doesn't work.



Thanks for help,



Francesco Nutini









[[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.


  
[[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] [r] align xyplot

2011-01-31 Thread Francesco Nutini

Dear R users,
I'm using xyplot to obtain a graph about a correlation x~y for different years 
(a categoric variable).
The program dispose automatically the graphs in this way:

2010
2007 2008 2009
2004 2005 2006 
2001 2002 2003 
1998 1999 2000

Which code should I use to obtain this sequance of graphs?

1998 1999 2000 2001 2002 2003 2004 2005 2006  2007 2008 2009 2010


I have tried with par code but it's doesn't work.

Thanks for help,

Francesco Nutini



  
[[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.


Re: [R] overlap different line in a xyplot (lattice)

2010-12-13 Thread Francesco Nutini


 From: fe...@nfrac.org
 Date: Sun, 12 Dec 2010 11:47:55 +1100
 Subject: Re: [R] overlap different line in a xyplot (lattice)
 To: ehl...@ucalgary.ca
 CC: nutini.france...@gmail.com; r-help@r-project.org
 
 On 12 December 2010 00:08, Peter Ehlers ehl...@ucalgary.ca wrote:
  On 2010-12-11 03:12, Francesco Nutini wrote:
 
  mmmh, yes this method works...
  but I have to overlap this two graphs:
 
   xyplot(a ~b |sites, data=dataset, col=red)
 
   xyplot(c ~b |sites, data=dataset, col=blue)
 
 
  a, b and c are columns in the same dataset. Sites is also a column in
  the dataset, but it's a factorial variables.
  How can I use your method?
 
  The idea is the same: you need to get your data
  into long format with a grouping variable and
  then use the 'groups' argument to xyplot.
  Here's fake data frame (you should have provided one):
 
   DF - data.frame(y1 = rnorm(30),
   y2 = rnorm(30) + 2,
   x  = rep(1:10, 3),
sites = gl(3, 10, lab=LETTERS[1:3]))
 
  ## Use the reshape2 package to melt the data:
  ## (or use reshape() in base R)
   require(reshape2)
   DF1 - melt(DF, measure.vars = c('y1', 'y2'),
  variable.name = 'grp', value.name = 'y')
 
  ## and plot:
   require(lattice)
   p - xyplot( y ~ x | sites, data = DF1, groups = grp,
  col = c(red, blue), type = b)
   print(p)
 
  Peter Ehlers
 
 
 By the way, in this particular case there is a shortcut which does the
 reshaping internally:
 
 xyplot(y1 + y2 ~ x | sites, DF, type = b)


Great Felix! this is what I was looking for! 
But if y1 and y2 have a different scales? Can I plot, for example y2, on 
secondary axis?

Thanks for your help,

Francesco Nutini


 
  sorry for my ignorance!
 
  Francesco Nutini
 
Date: Fri, 10 Dec 2010 10:13:00 -0800
From: ehl...@ucalgary.ca
To: nutini.france...@gmail.com
CC: r-help@r-project.org
Subject: Re: [R] [r] overlap different line in a xyplot (lattice)
   
On 2010-12-10 07:04, Francesco Nutini wrote:

 dear [R] users,
 is there a way to plot different data (but with the same
  x-variables) in the same xyplot window?
 There are already a similar question, but the answer is not enought
  explanatory...
   
Something like this?
   
x - rep(1:10, 2)
y1 - rnorm(10); y2 - rnorm(10) + 2
y - c(y1, y2)
g - gl(2, 10)
xyplot( y ~ x, groups = g, type = 'b')
   
Peter Ehlers
   


 Thanks a lot,
 Francesco

   
 
  __
  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.
 
 
 
 
 -- 
 Felix Andrews / $B0BJ!N)(B
 http://www.neurofractal.org/felix/
  
[[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] post-hoc test for ANCOVA method

2010-12-13 Thread Francesco Nutini

 Dear [R] Users,
 I have implemented a linear model with this syntax:

 model-  lm  (var_dependent ~ var_indipendent + factor +  var_indipendent : 
factor, dataframe)
 anova (model)
 Response: var_dependent
  Df  Sum Sq   Mean Sq   F value
 Pr(F)
var_indipendent   1   20.5522   20.5522  87.8701
1.167e-14 ***
factor  1   0.10600.1060 0.4530 
0.50277
var_indipendent:factor  1   1.38611.3861 5..92610.01706 
*
Residuals 83 19.4132  0.2339
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1


The factor variable influence significatvly the regression. Which test I have 
to use to understand whom factors (i.e. in my dataset factors are the different 
sampling sites) influence the correlation?  
Any suggestions how to perform post-hoc comparions?
 Thanks a lot!
 Francesco Nutini

 P.S. numbers have no significance, it's just an example

  
[[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.


Re: [R] [r] overlap different line in a xyplot (lattice)

2010-12-11 Thread Francesco Nutini

mmmh, yes this method works...
but I have to overlap this two graphs:



 xyplot(  a ~  b |  sites, data=dataset,  col=red)



 xyplot(  c ~  b |  sites, data=dataset,  col=blue)


a, b and c are columns in the same dataset. Sites is also a column in the 
dataset, but it's a factorial variables.
How can I use your method?
sorry for my ignorance! 

Francesco Nutini

 Date: Fri, 10 Dec 2010 10:13:00 -0800
 From: ehl...@ucalgary.ca
 To: nutini.france...@gmail.com
 CC: r-help@r-project.org
 Subject: Re: [R] [r] overlap different line in a xyplot (lattice)
 
 On 2010-12-10 07:04, Francesco Nutini wrote:
 
  dear [R] users,
  is there a way to plot different data (but with the same x-variables) in 
  the same xyplot window?
  There are already a similar question, but the answer is not enought 
  explanatory...
 
 Something like this?
 
   x - rep(1:10, 2)
   y1 - rnorm(10); y2 - rnorm(10) + 2
   y - c(y1, y2)
   g - gl(2, 10)
   xyplot( y ~ x, groups = g, type = 'b')
 
 Peter Ehlers
 
 
 
  Thanks a lot,
  Francesco
 
 
  
[[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] [r] overlap different line in a xyplot (lattice)

2010-12-10 Thread Francesco Nutini

dear [R] users,
is there a way to plot different data (but with the same x-variables) in the 
same xyplot window?
There are already a similar question, but the answer is not enought 
explanatory...


Thanks a lot,
Francesco


  
[[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] difference between linear model scatterplot matrix

2010-12-03 Thread Francesco Nutini




Dear R-users,
I'm studing a DB, structured like this (just a little part of my dataset): 
_









  Site
  Latitude
  Longitude
  Year
  Tot-Prod
  Total_Density
  dmp



  Dendoudi-1
  15.441964
  -13.540179
  2005
  3271.16
  1007
  16993.25


  Dendoudi-2
  15.397321
  -13.611607
  2005
  1616.84
  250
  25376.67


  …
  …
  …
  …
  …
  …
  …

_

If I made a scatterplotmatrix with the command show below I obtain a matrix 
(visible in the image) that show which variables is more correlated with dmp 
data (violet color).
But, if I made a linear model between the dependent variable (dmp) and  many 
independent variables
I get different information about the significativity of the variable. 
I mean, variables that appear correlated with dependent variable in the matrix 
result not correlated in the summary of linear model, and vice versa. Have I 
made a mistake in the interpretation of the result, or not?

Thank you in advance,
Francesco



#command for matrix-plot


dta -
senegal5[c(  2,4,5,6,7,8,9,13,15,17,21,
39,44,45)]

dta.r -
abs(cor(dta))

dta.col
- dmat.color(dta.r)

dta.o -
order.single(dta.r) 

cpairs(dta,
dta.o, panel.colors=dta.col, gap=.5,

main=Variables Ordered and Colored by
Correlation)
#command for linear model and summary()


a- lm ( dmp ~ Latitude
+ Longitude +  Year +  Tot.Prod +Herbaceous.Prod.kg.ha. +  Leaf.Prod +  
Tree.bio  + Total_Density  + X1st.SpecieDensity.trunk.ha.+
X2nd.SpecieDensity.trunk.ha.+ Herb_Specie_Index1 +  iNDVI.JASO. 
+ 
RFE.Cum.JASO., data=senegal5 )




summary(a)



Call:

lm(formula = dmp ~
Latitude + Longitude + Year + Tot.Prod + Herbaceous.Prod.kg.ha. + 

Leaf.Prod + Tree.bio + Total_Density +
X1st.SpecieDensity.trunk.ha. + 

X2nd.SpecieDensity.trunk.ha. +
Herb_Specie_Index1 + iNDVI.JASO. + 

RFE.Cum.JASO.,
data = senegal5)

Residuals:

Min 
1Q  Median  3Q
Max 

-676.49 -195.77  -33.06 
113.34  816.17 



Coefficients:

   Estimate Std. Error
t value Pr(|t|)

(Intercept)  -3.283e+05  4.505e+04 
-7.288 4.41e-11 ***

Latitude -6.100e+01  1.990e+02 
-0.307   0.7598

Longitude-3.617e+02  8.639e+01 
-4.187 5.60e-05 ***

Year  1.604e+02  2.300e+01  
6.973 2.15e-10 ***

Tot.Prod -4.893e+00  1.565e+02 
-0.031   0.9751

Herbaceous.Prod.kg.ha.4.905e+00  1.565e+02  
0.031   0.9751

Leaf.Prod  
  4.842e+00  1.565e+02  
0.031   0.9754

Tree.bio -4.241e+01  2.771e+02 
-0.153   0.8786

Total_Density-1.930e+00  8.933e-01 
-2.160   0.0329 *  

X1st.SpecieDensity.trunk.ha.  1.992e+00 
9.246e-01   2.154  
0.0333 *  

X2nd.SpecieDensity.trunk.ha.  3.416e+00 
1.642e+00   2.080   0.0398 * 


Herb_Specie_Index1   -1.091e+00  1.844e+00 
-0.592   0.5552

iNDVI.JASO.   8.914e+02  6.076e+01 
14.670   2e-16 ***

RFE.Cum.JASO. 2.525e+00  4.529e-01  
5.575 1.68e-07 ***

---

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’
1 



Residual standard
error: 295.3 on 114 degrees of freedom

Multiple R-squared:
0.9206, Adjusted R-squared: 0.9116 

F-statistic: 101.7 on
13 and 114 DF,  p-value:  2.2e-16




  __
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] [r] ANCOVA method

2010-12-03 Thread Francesco Nutini

 Dear [R] Users,
I have implemented a linear model with this syntax:

model-  lm  (var_dependent ~ var_indipendent + factor +  var_indipendent : 
factor, dataframe)
anova (model)
Response: var_dependent
  Df  Sum Sq  Mean Sq  F valuePr(F)
var_indipendent   1   20.5522 20.5522  87.87011.167e-14 ***
factor1   0.1060  0.1060   0.4530 0.50277
var_indipendent:factor1   1.3861  1.3861   5.9261 0.01706 *  
Residuals 83  19.4132 0.2339  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 
If I read the line var_indipendent:factor can I understand if the factor 
influence significatvly the regression between dependent-indipendent variable?

Thanks a lot!
Francesco Nutini

P.S. numbers have no significance, it's just an example
  
[[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] summary() of a linear model

2010-12-03 Thread Francesco Nutini












Dear R-users,

Why variables that appear correlated with dependent variable in a scatterplot, 
results not correlated in the summary of linear model, and vice versa?
I mean, variable Longitude (see the example below) is correlated (***) with 
dependent variable in the linear model. But if I made a scatterplot the r2 is 
very low. 
How can I interpretate the information of command summary()?

Thank you in advance,
Francesco


#command for summary() of linear model 

summary(model_example)



Call:

lm(formula = dmp ~
Latitude + Longitude + Year + Tot.Prod + RFE.Cum.JASO.,
data = senegal5)

Residuals:

Min 
1Q  Median  3Q
Max 

-676.49 -195.77  -33.06 
113.34  816.17 

 

Coefficients:

   Estimate Std. Error
t value Pr(|t|)

(Intercept)  -3.283e+05  4.505e+04 
-7.288 4.41e-11 ***

Latitude -6.100e+01  1.990e+02 
-0.307   0.7598

Longitude-3.617e+02  8.639e+01 
-4.187 5.60e-05 ***

Year  1.604e+02  2.300e+01  
6.973 2.15e-10 ***

Tot.Prod -4.893e+00  1.565e+02 
-0.031   0.9751RFE.Cum.JASO. 2.525e+00  4.529e-01  
5.575 1.68e-07 ***

---

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’
1 

 

  
[[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.