Re: [R] replayPlot in loop

2005-09-19 Thread Uwe Ligges
[EMAIL PROTECTED] wrote:

 Hi,
 
 In order to make a movie-like animation of different graphs
 with replayPlot inside a fast loop:
 
 is there a way to avoid the appearance of some
 white stripes/streaks between the different calls to replayPlot?


In principle it is device dependend and the devices are generally not 
designed to display movies.
Also drawing of a plot might take a considerable amount of time.

Uwe Ligges



 thanks in advance
  Johan VH
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] graph tick label size

2005-09-19 Thread Uwe Ligges
FISCHER, Matthew wrote:

 Hi R-users,
 
 
 I'm running R under Unix and producing postscript output of graphs.
 Soemtimes, some tick axis labels disappear from my output.
  eg if I have a vector
 
 months - c(J,F,M,A,M,J,J,A,S,O,N,D)
 
 Then the M and one or 2 other letters are dropped from the axis.
 
 This seems to be a size problem, but the spacing looks fine to me (all
 the letters could easily be seen if they were all there).  So my
 question is, can I override what R is doing to the tick labels, without 
 making the
 labels smaller?  I searched the help files but couldn't find anything 
 specifically on this.


Not directly, but you can fake by plotting the stuff in two chunks as in:

plot(1:12, xaxt=n)
months - c(J,F,M,A,M,J,J,A,S,O,N,D)
temp - seq(1, 12, 2)
axis(1, temp, labels=months[temp])
temp - seq(2, 12, 2)
axis(1, temp, labels=months[temp])

Uwe Ligges



 cheers,
 
 Matt.
 
 Dr Matt Fischer
 ANSTO - Institute for Nuclear Geophysiology 
 PMB 1 Menai NSW 2234
 Ph: +61 2 9717 9686
 Fax: +61 2 9717 3599
 Mobile: 0428 363 146
 http://www.ansto.gov.au/nugeo/
 http://ipilps.ansto.gov.au/
 
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] minimal hedge variance ratio

2005-09-19 Thread Krishna
Hi all

i have two data sets, spot and futures cash market prices. to estimate
the minimum variance hedge ratio, i first had a glance on the
correlation coefficient of relative price change (ln(St / St-1).
surprizingly the value is just 0.2 compared to actual price
correlation of 0.9. (i did regress the spot change on future change,
co-effi is 0.3, and R2 is only 0.025

a) in such scenario can someone help me in estimating the ratio which
are time varying.
b) is there a way to define the function as the correlation will work
at given level of basis (futures - spot).

thank u for the help and co-operation

rgds

snvk

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] How to update R from ver 1.9.1 to 2

2005-09-19 Thread Prof Brian Ripley
See the rw-FAQ ..., Q2.8 in the latest version.

On Sat, 17 Sep 2005, Srinivas Iyyer wrote:

 Dear group,
 apologies if this is a stupid question.  I searched
 CRAN sites. I am afraid I missed it.
 Can any one help me if I can update my windows version
 of 1.9.1 to 2 or higer.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
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

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] indicator value in labdsv

2005-09-19 Thread astrzelczak


Hi,

I'm trying to find out what threshold of indicator value in labadsv should be
used to accept a specie as an indicator one? So far I assumed that indval=0.5
is high enough to avoid any mistakes but it was based only in my intuition.

I'd be greatful for any advise

best regards

Agnieszka

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] distance to eye in persp()

2005-09-19 Thread Robin Hankin
Hi

the manpage for persp() has a wonderful section where a the trans3d 
()  function
is used with points() and lines() to add red dots and a green sinusoid
to the Mexican hat surface.

Does anyone have a way to tell what distance  a point is from the eye/ 
camera?

Take the following line:

lines (trans3d(x, y=10, z= 6 + sin(x), pm = res), col = 3)

Is there a function like trans3d() that returns a vector of distances  
from
the x,y,z point to the camera?  I want this so I can plot clouds of  
points
with the further ones in smaller plotsizes, and perhaps even fading  
to white
(as though viewed through fog).





--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
  tel  023-8059-7743

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] dynamic object names?

2005-09-19 Thread samir

I am trying to extract data from a matrix. Let's say that i am interested in
extracting 
rows from a 4x4 matrix. Instead of giving a fix name to these 4 rows I would
like to add a number to prefix. As result I should get 4 objects named: 

prefix_1 
prefix_2 
prefix_3
prefix_4

I attepted to solve the problem with a loop, but without success. Any hints??

 matrix(LETTERS[1:16], ncol=4) - MM
 MM
 [,1] [,2] [,3] [,4]
[1,] A  E  I  M 
[2,] B  F  J  N 
[3,] C  G  K  O 
[4,] D  H  L  P 


for (xxx in 1:4) {
MM[xxx,] - prefix_xxx;
}


Thanks

samir

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] dynamic object names?

2005-09-19 Thread Uwe Ligges
[EMAIL PROTECTED] wrote:

 I am trying to extract data from a matrix. Let's say that i am interested in
 extracting 
 rows from a 4x4 matrix. Instead of giving a fix name to these 4 rows I would
 like to add a number to prefix. As result I should get 4 objects named: 
 
 prefix_1 
 prefix_2 
 prefix_3
 prefix_4
 
 I attepted to solve the problem with a loop, but without success. Any hints??


1. In fact, you do not really want it.
2. You want to use - rather than - for assigments. Reading your 
code is really hard when you are using this non-conventional way.
3. In order to answer your question: This is the FAQ How can I turn a 
string into a variable?. The posting guide asks you to read these FAQs 
before sending questions to R-help. Please do so.

Uwe Ligges




 
matrix(LETTERS[1:16], ncol=4) - MM
MM
 
  [,1] [,2] [,3] [,4]
 [1,] A  E  I  M 
 [2,] B  F  J  N 
 [3,] C  G  K  O 
 [4,] D  H  L  P 
 
 
 for (xxx in 1:4) {
 MM[xxx,] - prefix_xxx;
 }
 
 
 Thanks
 
 samir
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] distance to eye in persp()

2005-09-19 Thread Ted Harding

On 19-Sep-05 Robin Hankin wrote:
 Hi
 
 the manpage for persp() has a wonderful section where a the
 trans3d()  function is used with points() and lines() to add
 red dots and a green sinusoid to the Mexican hat surface.
 
 Does anyone have a way to tell what distance  a point is from
 the eye/camera?
 
 Take the following line:
 
 lines (trans3d(x, y=10, z= 6 + sin(x), pm = res), col = 3)
 
 Is there a function like trans3d() that returns a vector of
 distances from the x,y,z point to the camera?  I want this so
 I can plot clouds of points with the further ones in smaller
 plotsizes, and perhaps even fading to white (as though viewed
 through fog).

Wonderfully put! That's what statistics is about!

I think you may have to write your own. This is possible given
the values for the parameters xlim, ylim, zlim, r, theta, phi
(default as defined in ?persp, or explicitly user-defined),
since you can then determine the 3D coordinates of the Eye
relative to the (X,Y,Z) axes being plotted, after which the
distance to a particular (x,y,z) point is trivial.

E.g.

1. Coordinates of Eye relative to the centre of the box

   xE - r*sin(theta + pi)*cos(phi)
   yE - r*cos(theta + pi)*cos(phi)
   zE - r*sin(phi)

2. Centre of box relative to real (0,0,0)

   xC - mean(xlim); yC -mean(ylim); xC - mean(zlim)

3. Coordinates of (x,y,z) relative to Eye

   x1 - x - xE - xC; y1 - y - yE - yC; z1 - z - zE - zC

4. Distance from Eye to (x,y,z)

   d = sqrt(x1^2 + y1^2 + z1^2)

(Hoping I've not got anything the wrong way round there!)

Best wishes,
Ted.



E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 19-Sep-05   Time: 10:17:55
-- XFMail --

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Problem with tick marks in lines.survfit (package survival)

2005-09-19 Thread Rachel Pearce
I have attempted to follow posting guidelines but I have failed to find out 
what I am doing wrong here.
 I am trying to use lines.survfit to plot a second curve onto a survival 
curve produced by plot.survfit. In my case this is to be a progression free 
survival curve superimposed upon an overall survival curve, but I will 
illustrate my problem using the example given in the help for lines.survfit.
 I would like to have tick marks for censored data points on both curves, so 
I would like to do something like:
  fit - survfit(Surv(time, status) ~ sex, pbc,subset=1:312)
 plot(fit[2], mark.time=TRUE, xscale=365.24,
+ xlab='Years', ylab='Survival')
 lines(fit[1], lwd=2, xscale=365.24, mark.time=TRUE)
 but when I do this, no tick marks appear on the second curve. Can anyone 
see what I am doing wrong here?
 Rachel

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Integrate functions with loops

2005-09-19 Thread A.Brennan
Thanks Sundar
what you suggested worked fine 

 You will see that x is a vector and tt[i]^x returns a vector of the 
 same length. You are trying to place this vector into a[i] which is 
 length 1. Try the following *untested* code instead:
 
 untested
 integrandtotest - function(x) {
sum(sapply(x, function(xi) sum(tt^xi)))
 }

except you are summing twice so it should be.

integrandtotest - function(x) {(sapply(x, function(xi) sum(tt^xi)))


Alan Brennan
Director of Health Economics and Decision Science
http://www.shef.ac.uk/scharr/sections/heds
ScHARR
School of Health and Related Research
University of Sheffield
Regent Ct
30 Regent St
Sheffield S1 4DA
Tel:+44 (0)114 2220684
Fax:+44 (0)114 2724095
e-mail:[EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Integrate functions with loops

2005-09-19 Thread A.Brennan
Thankyou Brian

   integrandtotest - function(x) colSums(outer(t, x, ^))
 
This worked fine 

in fact this integration can be done analytically (it is a 
 sum of exponentials).
I know but i have another five terms in the integrand as well as the 
one that was causing the trouble

Many, many thanks
Alan

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Use of least-squares means, are they misleading?

2005-09-19 Thread Felipe
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi.
Sorry for sending this question twice, but I would really like to know
your opinion on this topic.

I have been reading about the (in)convenience of using least-squares
means (a. k. a. adjusted means) in multiple comparisons (I used to
resort to them when using SAS). I even read a post in this list warning
against them, but not giving much detail.

What is your opinion? Should I avoid using LSmeans for comparison (e.g.
after ANOVA)?

Greetings.

Felipe

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html


-BEGIN PGP SIGNATURE-

iEYEARECAAYFAkMulV4ACgkQWtdQtNzjBl6QpwCfXYweOQWipAYY2ZZFiDYuAiwJ
LQYAnicmypM4yZhzMztRmZvppTZWes1z
=696Z
-END PGP SIGNATURE-

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] dynamic object names?

2005-09-19 Thread John Charles Considine
On Mon, 2005-09-19 at 11:38 +0200, Uwe Ligges wrote:
 [EMAIL PROTECTED] wrote:
 
  I am trying to extract data from a matrix. Let's say that i am interested in
  extracting 
  rows from a 4x4 matrix. Instead of giving a fix name to these 4 rows I would
  like to add a number to prefix. As result I should get 4 objects named: 
  
  prefix_1 
  prefix_2 
  prefix_3
  prefix_4
Samir,
In addition to the other comments, part of the problem may be that you
can't assign the character '_' to standard objects.  Could you use '.'
instead?

JC 

  
  I attepted to solve the problem with a loop, but without success. Any 
  hints??
 
 
 1. In fact, you do not really want it.
 2. You want to use - rather than - for assigments. Reading your 
 code is really hard when you are using this non-conventional way.
 3. In order to answer your question: This is the FAQ How can I turn a 
 string into a variable?. The posting guide asks you to read these FAQs 
 before sending questions to R-help. Please do so.
 
 Uwe Ligges
 
 
 
 
  
 matrix(LETTERS[1:16], ncol=4) - MM
 MM
  
   [,1] [,2] [,3] [,4]
  [1,] A  E  I  M 
  [2,] B  F  J  N 
  [3,] C  G  K  O 
  [4,] D  H  L  P 
  
  
  for (xxx in 1:4) {
  MM[xxx,] - prefix_xxx;
  }
  
  
  Thanks
  
  samir
  
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide! 
  http://www.R-project.org/posting-guide.html
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] minimal hedge variance ratio

2005-09-19 Thread vincent
Krishna a écrit :

 i have two data sets, spot and futures cash market prices. to estimate
 the minimum variance hedge ratio, i first had a glance on the
 correlation coefficient of relative price change (ln(St / St-1).
 surprizingly the value is just 0.2 compared to actual price
 correlation of 0.9.

The correlation coefficient measures the strengh of *linear*
relation between 2 variables X and Y.

Thus when you replace X by X'=aX+b or Y by Y'=cY+d
(for instance use f = function(U) {return((U - mean(U))/sd(U));})
then you always have cor(X,Y)=cor(X',Y')=cor(X,Y')=cor(X',Y).

But when you use X'=f(X), Y'=g(Y) with f,g non linear functions
there is no reason to have cor(X',Y')=cor(X,Y).
... and f(X) = logreturn(X) is not really a linear transformation.

hih

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] dynamic object names?

2005-09-19 Thread vincent
see
?paste
hih

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] dynamic object names?

2005-09-19 Thread Uwe Ligges
John Charles Considine wrote:

 On Mon, 2005-09-19 at 11:38 +0200, Uwe Ligges wrote:
 
[EMAIL PROTECTED] wrote:


I am trying to extract data from a matrix. Let's say that i am interested in
extracting 
rows from a 4x4 matrix. Instead of giving a fix name to these 4 rows I would
like to add a number to prefix. As result I should get 4 objects named: 

prefix_1 
prefix_2 
prefix_3
prefix_4
 
 Samir,
 In addition to the other comments, part of the problem may be that you
 can't assign the character '_' to standard objects.


Why not???
R can handle standard names with _ in it for ages now.

Uwe Ligges



  Could you use '.' instead?
 JC 
 
 
I attepted to solve the problem with a loop, but without success. Any hints??


1. In fact, you do not really want it.
2. You want to use - rather than - for assigments. Reading your 
code is really hard when you are using this non-conventional way.
3. In order to answer your question: This is the FAQ How can I turn a 
string into a variable?. The posting guide asks you to read these FAQs 
before sending questions to R-help. Please do so.

Uwe Ligges





matrix(LETTERS[1:16], ncol=4) - MM
MM

 [,1] [,2] [,3] [,4]
[1,] A  E  I  M 
[2,] B  F  J  N 
[3,] C  G  K  O 
[4,] D  H  L  P 


for (xxx in 1:4) {
MM[xxx,] - prefix_xxx;
}


Thanks

samir

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] month increment for chron dates

2005-09-19 Thread bmw8042
Gabor, 
This is great.  Thank you.  It runs in just 3 seconds.

Brian

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] distance to eye in persp()

2005-09-19 Thread Duncan Murdoch
(Ted Harding) wrote:
 On 19-Sep-05 Robin Hankin wrote:
 
Hi

the manpage for persp() has a wonderful section where a the
trans3d()  function is used with points() and lines() to add
red dots and a green sinusoid to the Mexican hat surface.

Does anyone have a way to tell what distance  a point is from
the eye/camera?

Take the following line:

lines (trans3d(x, y=10, z= 6 + sin(x), pm = res), col = 3)

Is there a function like trans3d() that returns a vector of
distances from the x,y,z point to the camera?  I want this so
I can plot clouds of points with the further ones in smaller
plotsizes, and perhaps even fading to white (as though viewed
through fog).
 
 
 Wonderfully put! That's what statistics is about!
 
 I think you may have to write your own. This is possible given
 the values for the parameters xlim, ylim, zlim, r, theta, phi
 (default as defined in ?persp, or explicitly user-defined),
 since you can then determine the 3D coordinates of the Eye
 relative to the (X,Y,Z) axes being plotted, after which the
 distance to a particular (x,y,z) point is trivial.
 
 E.g.
 
 1. Coordinates of Eye relative to the centre of the box
 
xE - r*sin(theta + pi)*cos(phi)
yE - r*cos(theta + pi)*cos(phi)
zE - r*sin(phi)
 
 2. Centre of box relative to real (0,0,0)
 
xC - mean(xlim); yC -mean(ylim); xC - mean(zlim)
 
 3. Coordinates of (x,y,z) relative to Eye
 
x1 - x - xE - xC; y1 - y - yE - yC; z1 - z - zE - zC
 
 4. Distance from Eye to (x,y,z)
 
d = sqrt(x1^2 + y1^2 + z1^2)
 
 (Hoping I've not got anything the wrong way round there!)
 

I think you forgot the rescaling to [0,1], but it's probably even easier 
than that.  persp returns the 4x4 transformation matrix used to take 
user coordinates into screen coordinates.  trans3d uses that matrix to 
extract the screen x and screen y coordinates (extend the 3-vector to 
homogeneous coordinates by appending a 1, multiply by the projection 
matrix, convert back to Euclidean coordinates by dividing by the last 
coordinate).  You can probably just do what trans3d does, but keep the 
z-coordinate, to get a reasonable measure of depth.  i.e.

depth3d - function(x,y,z, pmat) {
   tr - cbind(x, y, z, 1) %*% pmat
   return(tr[,3]/tr[,4])
}

This is sufficient for doing fog calculations.  For perspective 
shrinkage, you'll need to say where the user's eye is in these 
coordinates (or just use depths as distances).

Duncan Murdoch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Converting the result of classification tree into SQL query

2005-09-19 Thread Yuliya S Ivanova
I built the model of classification tree.Now I want to convert the result
rules of the tree into Sql query for applying received rules to my dataset
in the database managment system.
Can this be done or not ? If it can, tell me please how I can do it.
Thanks for your help.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Teaching R - In front of the computer?

2005-09-19 Thread Rau, Roland
Dear R-Users,

given you have been teaching R to students (grad level, mainly social
science background, no previous programming experience, 80% know SPSS),
what are your experiences concerning the style of teaching? Do you
prefer to stand in front of the class like in normal lectures and you
show them slides? Or do you you explain some concept (for example things
like mydata[order(var1, var2),]) and show it directly on the computer
via beamer/projector and also the students have to enter it on the
computers in front of them.

Any experiences you can share are highly appreciated.

Thanks,
Roland

+
This mail has been sent through the MPI for Demographic Rese...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] toLatex

2005-09-19 Thread Simone Vantini
hallo!
does everybody know which kind of objects the function toLatex can manage?
thanks
simone vantini


-- 
Simone Vantini
MOX (Modelling and Scientific Computing)
Dipartimento di Matematica F. Brioschi
Politecnico di Milano
P.za Leonardo da Vinci, 32
20133 Milano (Italy)
tel: +39 02 2399 4604
email: [EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Converting the result of classification tree into SQL query

2005-09-19 Thread Yuliya S Ivanova
I built the model of classification tree.Now I want to convert the result
rules of the tree into Sql query for applying received rules to my dataset
in the database managment system.
Can this be done or not ? If it can, tell me please how I can do it.
Thanks for your help.
Yulia

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] toLatex

2005-09-19 Thread Roger D. Peng
Try 'methods(toLatex)'.

-roger

Simone Vantini wrote:
 hallo!
 does everybody know which kind of objects the function toLatex can manage?
 thanks
 simone vantini
 
 

-- 
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Teaching R - In front of the computer?

2005-09-19 Thread Robin Hankin
Hi

the only way I have ever made this work is to have an R
session projected on the screen, and each student to
have their own machine on which they can try out
what I type.

You can then set the students questions to force them
to play around with R syntax.  A good one is to put
up a graph that you have prepared beforehand, and
say reproduce this.

Just be careful with ad-hoc playing around, in a live public
session.  I got badly bitten by this:

f - function(x){(x*x -1) - (x-1)*(x+1) }
f(10:100010)


[everything behaving as documented, but embarrassingly
unexpected!]

best

Robin







On 19 Sep 2005, at 14:25, Rau, Roland wrote:

 Dear R-Users,

 given you have been teaching R to students (grad level, mainly social
 science background, no previous programming experience, 80% know  
 SPSS),
 what are your experiences concerning the style of teaching? Do you
 prefer to stand in front of the class like in normal lectures and  
 you
 show them slides? Or do you you explain some concept (for example  
 things
 like mydata[order(var1, var2),]) and show it directly on the computer
 via beamer/projector and also the students have to enter it on the
 computers in front of them.

 Any experiences you can share are highly appreciated.

 Thanks,
 Roland

 +
 This mail has been sent through the MPI for Demographic Rese... 
 {{dropped}}

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting- 
 guide.html


--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
  tel  023-8059-7743

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] R(D)COM and Excel compile error

2005-09-19 Thread Jan Wijffels
Dear R-users,
I tried to install the R(D)COM server version 1.35, to connect MS Excel
and R. 
I am using R-version 2.1.0 on a Windows environment. And I am using MS
Excel 2000 in a dutch version. 
I get the following error when I open Excel: Compile error, can not
find the project or the library (translated from dutch). And it
indicates LEFT in blue bold.
Does anyone of you know what could have caused this error? Does the
R(D)COM only work with English Excel versions?
 
Thanks,
Jan
 
Jan Wijffels
University Center for Statistics 
W. de Croylaan 54
3001 Heverlee
Belgium
tel: +32 (0)16 322784
fax: +32 (0)16 322831
 http://www.kuleuven.be/ucs http://www.kuleuven.be/ucs
 


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Converting the result of classification tree into SQL query

2005-09-19 Thread Sean Davis
On 9/19/05 9:32 AM, Yuliya S Ivanova [EMAIL PROTECTED] wrote:

 I built the model of classification tree.Now I want to convert the result
 rules of the tree into Sql query for applying received rules to my dataset
 in the database managment system.
 Can this be done or not ? If it can, tell me please how I can do it.
 Thanks for your help.

This will need to be done by hand, I think.  In other words, you will need
to write the SQL query yourself.  Of course, you can make such a query
dynamic using tools like paste, but I don't think there is a tool to do
exactly what you want.

Sean

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Use of least-squares means, are they misleading?

2005-09-19 Thread Felipe
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Thank you, I will try there.
Felipe

Peter Flom wrote:
| Felipe
|
| I doubt you will get much response on this list, although it's an
| interesting question.  You might try asking it on another list.  Some
| that often have discussions of such topics are
|
| SAS-L
| EDSTAT-L and
| STAT-L
|
| Regards
|
| Peter
|
| Peter L. Flom, PhD
| Assistant Director, Statistics and Data Analysis Core
| Center for Drug Use and HIV Research
| National Development and Research Institutes
| 71 W. 23rd St
| http://cduhr.ndri.org
| www.peterflom.com
| New York, NY 10010
| (212) 845-4485 (voice)
| (917) 438-0894 (fax)
|
|
|
|Felipe [EMAIL PROTECTED] 09/19/05 6:39 AM 
|
| Hi.
| Sorry for sending this question twice, but I would really like to know
| your opinion on this topic.
|
| I have been reading about the (in)convenience of using least-squares
| means (a. k. a. adjusted means) in multiple comparisons (I used to
| resort to them when using SAS). I even read a post in this list warning
| against them, but not giving much detail.
|
| What is your opinion? Should I avoid using LSmeans for comparison (e.g.
| after ANOVA)?
|
| Greetings.
|
| Felipe
|
| __
| R-help@stat.math.ethz.ch mailing list
| https://stat.ethz.ch/mailman/listinfo/r-help
| PLEASE do read the posting guide!
| http://www.R-project.org/posting-guide.html
|
|

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html


-BEGIN PGP SIGNATURE-

iEYEARECAAYFAkMuxT0ACgkQWtdQtNzjBl7LWACcCddjPgTnZX2+15aDLbxe+qxD
rHcAoIdkgW8ke/M8bb7pSlcptTz9K53j
=eCEC
-END PGP SIGNATURE-

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Problem with tick marks in lines.survfit (package survival)

2005-09-19 Thread Robert Baer
How about:
plot(fit, mark.time=TRUE, xscale=365.24,xlab='Years',
ylab='Survival',lwd=c(2,1))

Rob
- Original Message - 
From: Rachel Pearce [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Sent: Monday, September 19, 2005 4:59 AM
Subject: [R] Problem with tick marks in lines.survfit (package survival)


 I have attempted to follow posting guidelines but I have failed to find
out
 what I am doing wrong here.
  I am trying to use lines.survfit to plot a second curve onto a survival
 curve produced by plot.survfit. In my case this is to be a progression
free
 survival curve superimposed upon an overall survival curve, but I will
 illustrate my problem using the example given in the help for
lines.survfit.
  I would like to have tick marks for censored data points on both curves,
so
 I would like to do something like:
   fit - survfit(Surv(time, status) ~ sex, pbc,subset=1:312)
  plot(fit[2], mark.time=TRUE, xscale=365.24,
 + xlab='Years', ylab='Survival')
  lines(fit[1], lwd=2, xscale=365.24, mark.time=TRUE)
  but when I do this, no tick marks appear on the second curve. Can anyone
 see what I am doing wrong here?
  Rachel

 [[alternative HTML version deleted]]

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Teaching R - In front of the computer?

2005-09-19 Thread Uwe Ligges
Rau, Roland wrote:

 Dear R-Users,
 
 given you have been teaching R to students (grad level, mainly social
 science background, no previous programming experience, 80% know SPSS),
 what are your experiences concerning the style of teaching? Do you
 prefer to stand in front of the class like in normal lectures and you
 show them slides? Or do you you explain some concept (for example things
 like mydata[order(var1, var2),]) and show it directly on the computer
 via beamer/projector and also the students have to enter it on the
 computers in front of them.
 
 Any experiences you can share are highly appreciated.

I like to teach using a projector and people sitting in front of other 
machines beeing able to try out some of the nonsense I am telling.
Of course, they need more exercises than just the few minutes in between 
my sentences.
I am always noth using slides and showing the examples in R directly.


For all other stuff, it is the same as with other courses and lectures.

If this is a one-week course, I'd like to propose 1.5 hours course + 1.5 
hours exercise in the morning and the same again in the afternoon. If 
this is a whole-term course, you may be able to let people do homework, 
but always talk about their results and show them hoe to do it in a 
good fashion.

Unfortunately, for courses with lots of poeple (say 90, for the 
first-years' R course I am teaching) it is impossible that people are 
sitting in front of a computer for some reasons: not enough machines, no 
big rooms, and too much noise caused by both machines and people.

The really important fact from my point of view:
Give people many *exercises* and the *time* to work on these exercises. 
Expect that people without any programming experience will be much 
slower than you imagine in your worst nightmares. ;-)

Uwe Ligges




 Thanks,
 Roland
 
 +
 This mail has been sent through the MPI for Demographic Rese...{{dropped}}
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] distance to eye in persp()

2005-09-19 Thread Robin Hankin
Duncan


 You can probably just do what trans3d does, but keep the
 z-coordinate, to get a reasonable measure of depth.  i.e.

 depth3d - function(x,y,z, pmat) {
tr - cbind(x, y, z, 1) %*% pmat
return(tr[,3]/tr[,4])
 }



fantastic!  This is exactly what I was looking for.


 This is sufficient for doing fog calculations.  For perspective
 shrinkage, you'll need to say where the user's eye is in these
 coordinates (or just use depths as distances).



I was going to use hsv(h=1, v=1, s=exp(d/d0) )

(some people believe that red light [ie hsv(h=1, )] penetrates  
further
through mist than other colours.  I can now test this !-)

The other idea I had was to plot points with less than the  median
depth with big symbols  and the others  with small symbols.
That would seem to be a nice nonparametric way to do it.
Any other ideas?


very best wishes to everyone

Robin




--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
  tel  023-8059-7743

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Problem with tick marks in lines.survfit (package survival)

2005-09-19 Thread Rachel Pearce
Sorry, yes I think that would work, for the example I gave, but I am
trying to superimpose a curve onto an existing plot. The option of
using plot to draw both curves is not available, since the data are
(or were) in two different columns. For that reason I was trying to
use lines for the second curve.

I used the example given with the package so that I didn't have to
publish my own data (which are not mine to publish, if you see what I
mean).

I have now given up and created a new data frame with OS and PFS
stacked on top of each other, but this is a very time-consuming
workaround.

Do you (or anyone) know how to make lines.survfit draw tick marks?

Rachel

On 19/09/05, Robert Baer [EMAIL PROTECTED] wrote:
 How about:
 plot(fit, mark.time=TRUE, xscale=365.24,xlab='Years',
 ylab='Survival',lwd=c(2,1))
 
 Rob
 - Original Message -
 From: Rachel Pearce [EMAIL PROTECTED]
 To: r-help@stat.math.ethz.ch
 Sent: Monday, September 19, 2005 4:59 AM
 Subject: [R] Problem with tick marks in lines.survfit (package survival)
 
 
  I have attempted to follow posting guidelines but I have failed to find
 out
  what I am doing wrong here.
   I am trying to use lines.survfit to plot a second curve onto a survival
  curve produced by plot.survfit. In my case this is to be a progression
 free
  survival curve superimposed upon an overall survival curve, but I will
  illustrate my problem using the example given in the help for
 lines.survfit.
   I would like to have tick marks for censored data points on both curves,
 so
  I would like to do something like:
fit - survfit(Surv(time, status) ~ sex, pbc,subset=1:312)
   plot(fit[2], mark.time=TRUE, xscale=365.24,
  + xlab='Years', ylab='Survival')
   lines(fit[1], lwd=2, xscale=365.24, mark.time=TRUE)
   but when I do this, no tick marks appear on the second curve. Can anyone
  see what I am doing wrong here?
   Rachel
 
  [[alternative HTML version deleted]]
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html
 
 


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Change in behavior of compare statement

2005-09-19 Thread Tomas Andersson
Dear all,

 

I have come across some Windows Script code which calls the
file.exists function in R to check for the existence of a particular
file on an R server. This is what the code looks like:

 

do

{

// some useful code

}

while (m_workspace.session.eval(file.exists( + dataFile +
)) != 1);

 

It appears that the behavior of this code is different when used with R
version 2.1.1 compared to R version 1.9.1. If the compare statement s is
changed from

 

while (s != 1)

to

while (s != True)

or

while !(s)

 

the behavior of the code is the same with both versions of R.

 

After reading the R documentation, I have not found any evidence that
the original syntax (s != 1) is in any way recommended or supported
(in version 2.1.1). Still, my questions are:

 

1. Is it possible that the syntax has been supported in older versions
of R?

2. Is the reason for the recent change in behavior known and documented
anywhere?

 

I have been unable to find an answer to either question, so any
information about this would be appreciated.

 

Thanks,

 

T. Andersson


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] FDR analyses: minimum number of features

2005-09-19 Thread Dupont, William
Dear List,

We are planning a genotyping study to be analyzed using false discovery
rates (FDRs) (See Storey and Tibshirani PNAS 2003; 100:9440-5).  I am
interested in learning if there is any consensus as to how many
features (ie. how many P values) need to be studied before reasonably
reliable FDRs can be derived.  Does anyone know of a citation where
this is discussed?

Bill Dupont 

William D. Dupont  phone: 615-343-4100  URL
http://biostat.mc.vanderbilt.edu/twiki/bin/view/Main/WilliamDupont

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] indicator value in labdsv

2005-09-19 Thread Dave Roberts
Agnieszka,

 As Jari indicated, it depends on which function you meant in you 
inquiry.  The duleg() function implements the Dufrene-Legendre 
algorithm, where indicator species are indicative of a priori 
communities.  It this requires a classification, and is biased to find 
species which occur in the dataset approximately as often as the mean 
cluster size.

 The indpsc() function calculates the mean similarity of all samples 
a species occurs in.  This is slightly biased because  we know that the 
samples being used to calculate the mean share at least the species that 
defines them, but it is still possible to compare those values to the 
mean similarity of the whole matrix, or to an expectation of maximum 
similarity.  Obviously, as species occur more frequently, the harder it 
is to have a really high similarity (indicator value), with the extreme 
case that a species that occurs in every sample must have the same value 
as the mean of the whole matrix.

 To tell the truth, I forgot that indspc() was included in the 
current version of labdsv.  In the new version (due to be released any 
day), I have included a permutation test that estimates quantiles of 
expected values for different numbers of occurrences.  It works, but is 
pretty slow.  Jari has created a version that uses parametric statistics 
to estimate the same envelope, but I haven't had a chance to try it yet.

 What research are you doing, and what are you really trying to 
determine?  Perhaps something altogether different will work better.

Thanks, Dave Roberts

 On Mon, 2005-09-19 at 09:41 +0200, [EMAIL PROTECTED] wrote:
 
Hi,

I'm trying to find out what threshold of indicator value in labadsv should be
used to accept a specie as an indicator one? So far I assumed that indval=0.5
is high enough to avoid any mistakes but it was based only in my intuition.

I'd be greatful for any advise

best regards

 
 
 Agnieszka,
 
 R mailing list software appends the following to your message:
 
 
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 
 
 Then about indicator value analysis. You should be more specific: there
 seem to be three alternatives functions for indicator species in
 labdsv. Which did  you mean? At least two of these return an item called
 indval, and these two alternative indvals are very different. For
 the Dufrêne-Legendre indvals, you should check the original paper (see
 references in the help page), and there you even have an associated P
 value. In indspc, the variance of the indval clearly is dependent on
 species frequency. Moreover, in indspc the expected indval (and its
 variance) are dependent on the whole set of sites you have: these
 reflect the general homogeneity of your data set. Therefore you cannot
 say there that any certain value would mean that a species is a good
 indicator. However, it would be easy to work out standard errors for
 indspc indvals.
 
 I think it would be more useful to post to some other mailing group
 where people are more concerned about indicator species, or to contact
 the package author directly (I CC this message to him).
 
 cheers, jari oksanen


-- 

David W. Roberts office 406-994-4548
Professor and Head  FAX 406-994-3190
Department of Ecology email [EMAIL PROTECTED]
Montana State University
Bozeman, MT 59717-3460

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] indicator value in labdsv

2005-09-19 Thread astrzelczak

Hello,

I was uclear before, I'm sory about it. I forgot to add that I'm using duleg...

I used mvpart for multivariate regression trees. My input variables are
environmental parameters, output variables are macrophyte species
(presence=1,absence=0 in conecutive cases=lakes). For obtained classes I used
duleg to find indicator species for every class. I checked the article Dufrene,
M. and Legendre, P. 1997. Species assemblages and indicator species: the need
for a flexible asymmetrical approach. Ecol. Monogr. 67(3):345-366. The authors
used the threshold of indval=0.25(25%) and that's the only hint I've found in
the literature. This threshod seems to reasonable, but still I have impression
that's too low...

best regards
Agnieszka


 Agnieszka,

  As Jari indicated, it depends on which function you meant in you
 inquiry.  The duleg() function implements the Dufrene-Legendre
 algorithm, where indicator species are indicative of a priori
 communities.  It this requires a classification, and is biased to find
 species which occur in the dataset approximately as often as the mean
 cluster size.

  The indpsc() function calculates the mean similarity of all samples
 a species occurs in.  This is slightly biased because  we know that the
 samples being used to calculate the mean share at least the species that
 defines them, but it is still possible to compare those values to the
 mean similarity of the whole matrix, or to an expectation of maximum
 similarity.  Obviously, as species occur more frequently, the harder it
 is to have a really high similarity (indicator value), with the extreme
 case that a species that occurs in every sample must have the same value
 as the mean of the whole matrix.

  To tell the truth, I forgot that indspc() was included in the
 current version of labdsv.  In the new version (due to be released any
 day), I have included a permutation test that estimates quantiles of
 expected values for different numbers of occurrences.  It works, but is
 pretty slow.  Jari has created a version that uses parametric statistics
 to estimate the same envelope, but I haven't had a chance to try it yet.

  What research are you doing, and what are you really trying to
 determine?  Perhaps something altogether different will work better.

 Thanks, Dave Roberts

 On Mon, 2005-09-19 at 09:41 +0200, [EMAIL PROTECTED] wrote:

Hi,

I'm trying to find out what threshold of indicator value in labadsv should be
used to accept a specie as an indicator one? So far I assumed that indval=0.5
is high enough to avoid any mistakes but it was based only in my intuition.

I'd be greatful for any advise

best regards



 Agnieszka,

 R mailing list software appends the following to your message:


PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html


 Then about indicator value analysis. You should be more specific: there
 seem to be three alternatives functions for indicator species in
 labdsv. Which did  you mean? At least two of these return an item called
 indval, and these two alternative indvals are very different. For
 the Dufręne-Legendre indvals, you should check the original paper (see
 references in the help page), and there you even have an associated P
 value. In indspc, the variance of the indval clearly is dependent on
 species frequency. Moreover, in indspc the expected indval (and its
 variance) are dependent on the whole set of sites you have: these
 reflect the general homogeneity of your data set. Therefore you cannot
 say there that any certain value would mean that a species is a good
 indicator. However, it would be easy to work out standard errors for
 indspc indvals.

 I think it would be more useful to post to some other mailing group
 where people are more concerned about indicator species, or to contact
 the package author directly (I CC this message to him).

 cheers, jari oksanen





--
Best regards,
  mailto:[EMAIL PROTECTED]

Agnieszka Strzelczak, Research Assistant
mailto:[EMAIL PROTECTED]

Institute of Chemistry and Environmental Protection
Faculty of Chemical Engineering
Szczecin University of Technology
Aleja Piastow 42
71-065 Szczecin
Poland

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Change in behavior of compare statement

2005-09-19 Thread Tomas Andersson
Dear all, 

I have come across some Windows Script code which calls the
file.exists function in R to check for the existence of a particular
file on an R server. This is what the code looks like:

do
{
// some useful code
}
while (m_workspace.session.eval(file.exists( + dataFile
+ )) != 1);

It appears that the behavior of this code is different when used with
R version 2.1.1 compared to R version 1.9.1. If the compare statement
s is changed from

while (s != 1)
to
while (s != True)
or
while !(s)

the behavior of the code is the same with both versions of R.

After reading the R documentation, I have not found any evidence that
the original syntax (s != 1) is in any way recommended or supported
(in version 2.1.1). Still, my questions are:

1. Is it possible that the syntax has been supported in older versions of R?
2. Is the reason for the recent change in behavior known and
documented anywhere?

I have been unable to find an answer to either question, so any
information about this would be appreciated.

Thanks,

T. Andersson

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] How to mimic pdMat of lme under lmer?

2005-09-19 Thread Joris De Wolf
Dear members,

I would like to switch from nlme to lme4 and try to translate some of my 
models that worked fine with lme.
I have problems with the pdMat classes.

Below a toy dataset with a fixed effect F and a random effect R. I gave 
also 2 similar lme models.
The one containing pdLogChol (lme1) is easy to translate (as it is an 
explicit notation of the default model)
The more parsimonious model with pdDiag replacing pdLogChol I cannot 
reproduce with lmer. The obvious choice for me would be my model lmer2, 
but this is yielding different result.

Somebody any idea?
Thanks,
Joris

I am using R version 2.1.0 for Linux
and the most recent downloads of Matrix and  nlme

#dataset from McLean, Sanders and Stroup
F - factor(c(1,1,1,1,1,1,2,2,2,2,2,2))
R - factor(c(1,1,2,2,3,3,1,1,2,2,3,3))
s - 
c(51.43,51.28,50.93,50.75,50.47,50.83,51.91,52.43,52.26,52.33,51.58,51.23)
DS - data.frame(F,R,s)
DS$F - as.factor(DS$F)
DS$R - as.factor(DS$R)

library(nlme)
lme1 - lme(data = DS,s ~ F,random = list(R = pdLogChol(~F)))
lme2 - lme(data = DS,s ~ F,random = list(R = pdDiag(~F)))
summary(lme1)
summary(lme2)

library(lme4)
lmer1 - lmer(data = DS,s ~ F + (F|R))
lmer2 - lmer(data = DS,s ~ F + (1|R) + (1|F))
summary(lmer1)
summary(lmer2)



confidentiality notice:
The information contained in this e-mail is confidential and...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] anova for random-intercept lmer

2005-09-19 Thread A Das
Hi,
This might be a silly question, but how do I
create  a pooled model (binomial family) as a baseline
for a likelihood-ratio test for a random-intercept
lmer model? R won't compare a glm model with an lmer
model (or  glmmPQL ). Thanks in advance.
-Bobby

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] indicator value in labdsv

2005-09-19 Thread Dave Roberts
Wow!  That was fast!

 Unfortunately, Agnieszka, I don't think you will find an objective 
criterion for this.  Clearly, species which do not have a statistically 
significant value are probably less useful, but of the many that are 
significant, many may be marginal.

 Without knowing fully what you are hoping to achieve, I think I 
would rank the species by indicator value, and establish the highest 
threshold for indicator value that gives you a suitable number of 
species for each type.  That way, if you are looking to write a field 
key, for example, you would have sufficient values to identify every 
type I suspect.

Good luck, Dave

[EMAIL PROTECTED] wrote:
 Hello,
 
 I was uclear before, I'm sory about it. I forgot to add that I'm using 
 duleg...
 
 I used mvpart for multivariate regression trees. My input variables are
 environmental parameters, output variables are macrophyte species
 (presence=1,absence=0 in conecutive cases=lakes). For obtained classes I used
 duleg to find indicator species for every class. I checked the article 
 Dufrene,
 M. and Legendre, P. 1997. Species assemblages and indicator species: the need
 for a flexible asymmetrical approach. Ecol. Monogr. 67(3):345-366. The authors
 used the threshold of indval=0.25(25%) and that's the only hint I've found in
 the literature. This threshod seems to reasonable, but still I have impression
 that's too low...
 
 best regards
 Agnieszka
 
 
 
Agnieszka,
 
 
 As Jari indicated, it depends on which function you meant in you
inquiry.  The duleg() function implements the Dufrene-Legendre
algorithm, where indicator species are indicative of a priori
communities.  It this requires a classification, and is biased to find
species which occur in the dataset approximately as often as the mean
cluster size.
 
 
 The indpsc() function calculates the mean similarity of all samples
a species occurs in.  This is slightly biased because  we know that the
samples being used to calculate the mean share at least the species that
defines them, but it is still possible to compare those values to the
mean similarity of the whole matrix, or to an expectation of maximum
similarity.  Obviously, as species occur more frequently, the harder it
is to have a really high similarity (indicator value), with the extreme
case that a species that occurs in every sample must have the same value
as the mean of the whole matrix.
 
 
 To tell the truth, I forgot that indspc() was included in the
current version of labdsv.  In the new version (due to be released any
day), I have included a permutation test that estimates quantiles of
expected values for different numbers of occurrences.  It works, but is
pretty slow.  Jari has created a version that uses parametric statistics
to estimate the same envelope, but I haven't had a chance to try it yet.
 
 
 What research are you doing, and what are you really trying to
determine?  Perhaps something altogether different will work better.
 
 
Thanks, Dave Roberts
 
 
On Mon, 2005-09-19 at 09:41 +0200, [EMAIL PROTECTED] wrote:


Hi,

I'm trying to find out what threshold of indicator value in labadsv should 
be
used to accept a specie as an indicator one? So far I assumed that 
indval=0.5
is high enough to avoid any mistakes but it was based only in my intuition.

I'd be greatful for any advise

best regards



Agnieszka,

R mailing list software appends the following to your message:



PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html


Then about indicator value analysis. You should be more specific: there
seem to be three alternatives functions for indicator species in
labdsv. Which did  you mean? At least two of these return an item called
indval, and these two alternative indvals are very different. For
the Dufręne-Legendre indvals, you should check the original paper (see
references in the help page), and there you even have an associated P
value. In indspc, the variance of the indval clearly is dependent on
species frequency. Moreover, in indspc the expected indval (and its
variance) are dependent on the whole set of sites you have: these
reflect the general homogeneity of your data set. Therefore you cannot
say there that any certain value would mean that a species is a good
indicator. However, it would be easy to work out standard errors for
indspc indvals.

I think it would be more useful to post to some other mailing group
where people are more concerned about indicator species, or to contact
the package author directly (I CC this message to him).

cheers, jari oksanen
 
 
 
 
 
 
 --
 Best regards,
   mailto:[EMAIL PROTECTED]
 
 Agnieszka Strzelczak, Research Assistant
 mailto:[EMAIL PROTECTED]
 
 Institute of Chemistry and Environmental Protection
 Faculty of Chemical Engineering
 Szczecin University of Technology
 Aleja Piastow 42
 71-065 Szczecin
 Poland
 
 


-- 

Re: [R] Teaching R - In front of the computer?

2005-09-19 Thread Francisco J. Zagmutt
Adding to Uwe's comment, in my experience is also useful to use a text 
editor that connects to R (i.e. in Windows you have Tinn-R, jgr, SciViews) 
so people can see the function arguments as they type.  People are 
accustomed to this feature from Excel so it helps them to fell more 
comfortable with the syntax.  And yes, some students used to the mainstream 
point-and-click software can be REALLY slow so you may want to plan for 
that!

Good luck!

Francisco



From: Uwe Ligges [EMAIL PROTECTED]
To: Rau, Roland [EMAIL PROTECTED]
CC: r-help@stat.math.ethz.ch
Subject: Re: [R] Teaching R - In front of the computer?
Date: Mon, 19 Sep 2005 16:14:57 +0200

Rau, Roland wrote:

  Dear R-Users,
 
  given you have been teaching R to students (grad level, mainly social
  science background, no previous programming experience, 80% know SPSS),
  what are your experiences concerning the style of teaching? Do you
  prefer to stand in front of the class like in normal lectures and you
  show them slides? Or do you you explain some concept (for example things
  like mydata[order(var1, var2),]) and show it directly on the computer
  via beamer/projector and also the students have to enter it on the
  computers in front of them.
 
  Any experiences you can share are highly appreciated.

I like to teach using a projector and people sitting in front of other
machines beeing able to try out some of the nonsense I am telling.
Of course, they need more exercises than just the few minutes in between
my sentences.
I am always noth using slides and showing the examples in R directly.


For all other stuff, it is the same as with other courses and lectures.

If this is a one-week course, I'd like to propose 1.5 hours course + 1.5
hours exercise in the morning and the same again in the afternoon. If
this is a whole-term course, you may be able to let people do homework,
but always talk about their results and show them hoe to do it in a
good fashion.

Unfortunately, for courses with lots of poeple (say 90, for the
first-years' R course I am teaching) it is impossible that people are
sitting in front of a computer for some reasons: not enough machines, no
big rooms, and too much noise caused by both machines and people.

The really important fact from my point of view:
Give people many *exercises* and the *time* to work on these exercises.
Expect that people without any programming experience will be much
slower than you imagine in your worst nightmares. ;-)

Uwe Ligges




  Thanks,
  Roland
 
  +
  This mail has been sent through the MPI for Demographic 
Rese...{{dropped}}
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] indicator value in labdsv

2005-09-19 Thread astrzelczak

That's what I was afraid of.. I'm not a biologist, so I have to involve my
co-workes who are well-versed in biological issues. Thank you very, very much
for help!!!

best regards
Agnieszka


Monday, September 19, 2005, 6:38:35 PM, you wrote:

 Wow!  That was fast!

  Unfortunately, Agnieszka, I don't think you will find an objective
 criterion for this.  Clearly, species which do not have a statistically
 significant value are probably less useful, but of the many that are
 significant, many may be marginal.

  Without knowing fully what you are hoping to achieve, I think I
 would rank the species by indicator value, and establish the highest
 threshold for indicator value that gives you a suitable number of
 species for each type.  That way, if you are looking to write a field
 key, for example, you would have sufficient values to identify every
 type I suspect.

 Good luck, Dave

 [EMAIL PROTECTED] wrote:
 Hello,

 I was uclear before, I'm sory about it. I forgot to add that I'm using
duleg...

 I used mvpart for multivariate regression trees. My input variables are
 environmental parameters, output variables are macrophyte species
 (presence=1,absence=0 in conecutive cases=lakes). For obtained classes I used
 duleg to find indicator species for every class. I checked the article
Dufrene,
 M. and Legendre, P. 1997. Species assemblages and indicator species: the need
 for a flexible asymmetrical approach. Ecol. Monogr. 67(3):345-366. The
authors
 used the threshold of indval=0.25(25%) and that's the only hint I've found in
 the literature. This threshod seems to reasonable, but still I have
impression
 that's too low...

 best regards
 Agnieszka



Agnieszka,


 As Jari indicated, it depends on which function you meant in you
inquiry.  The duleg() function implements the Dufrene-Legendre
algorithm, where indicator species are indicative of a priori
communities.  It this requires a classification, and is biased to find
species which occur in the dataset approximately as often as the mean
cluster size.


 The indpsc() function calculates the mean similarity of all samples
a species occurs in.  This is slightly biased because  we know that the
samples being used to calculate the mean share at least the species that
defines them, but it is still possible to compare those values to the
mean similarity of the whole matrix, or to an expectation of maximum
similarity.  Obviously, as species occur more frequently, the harder it
is to have a really high similarity (indicator value), with the extreme
case that a species that occurs in every sample must have the same value
as the mean of the whole matrix.


 To tell the truth, I forgot that indspc() was included in the
current version of labdsv.  In the new version (due to be released any
day), I have included a permutation test that estimates quantiles of
expected values for different numbers of occurrences.  It works, but is
pretty slow.  Jari has created a version that uses parametric statistics
to estimate the same envelope, but I haven't had a chance to try it yet.


 What research are you doing, and what are you really trying to
determine?  Perhaps something altogether different will work better.


Thanks, Dave Roberts


On Mon, 2005-09-19 at 09:41 +0200, [EMAIL PROTECTED] wrote:


Hi,

I'm trying to find out what threshold of indicator value in labadsv should
be
used to accept a specie as an indicator one? So far I assumed that
indval=0.5
is high enough to avoid any mistakes but it was based only in my intuition.

I'd be greatful for any advise

best regards



Agnieszka,

R mailing list software appends the following to your message:



PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html


Then about indicator value analysis. You should be more specific: there
seem to be three alternatives functions for indicator species in
labdsv. Which did  you mean? At least two of these return an item called
indval, and these two alternative indvals are very different. For
the Dufręne-Legendre indvals, you should check the original paper (see
references in the help page), and there you even have an associated P
value. In indspc, the variance of the indval clearly is dependent on
species frequency. Moreover, in indspc the expected indval (and its
variance) are dependent on the whole set of sites you have: these
reflect the general homogeneity of your data set. Therefore you cannot
say there that any certain value would mean that a species is a good
indicator. However, it would be easy to work out standard errors for
indspc indvals.

I think it would be more useful to post to some other mailing group
where people are more concerned about indicator species, or to contact
the package author directly (I CC this message to him).

cheers, jari oksanen



__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 

[R] factor as seq() in for loop

2005-09-19 Thread Tord Snall
Dear all,
I would like to use the values in vegaggr.BLMCMR02$colony 

str(vegaggr.BLMCMR02)
`data.frame':   1678 obs. of  3 variables:
$ vegtype   : Factor w/ 27 levels 2010,2020,..: 3 4 5 19 4 5 19 5  
$ colony: Factor w/ 406 levels 0,1,10,100,..: 1 1 1 1 2 2 2 
$ Totvegproparea: num  0.00055 0.03956 0.95705 0.00284 0.05215 ...

as the seq in a for loop (for(var in seq)), and therefore first picked them 
out as 
cols = aggregate(list(A = vegaggr.BLMCMR02$Totvegproparea), 
list(colony = vegaggr.BLMCMR02$colony), sum)[,1]
 str(cols)
 Factor w/ 406 levels 0,1,10,100,..: 1 2 3 4 5 6 7 8 9 10 ...

I next planned to transform cols using as.integer(cols). However, this 
transformation gives a vector corresponding to seq(from=1,to=length(cols)). 

Could someone please give advice on how to make use of a factor as the seq 
in a for loop (which is strictly not allowed' according to ?Control).

Thanks!

Tord

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Change in behavior of compare statement

2005-09-19 Thread Duncan Murdoch
On 9/19/2005 12:25 PM, Tomas Andersson wrote:
 Dear all, 
 
 I have come across some Windows Script code which calls the
 file.exists function in R to check for the existence of a particular
 file on an R server. This is what the code looks like:
 
 do
 {
 // some useful code
 }
 while (m_workspace.session.eval(file.exists( + dataFile
 + )) != 1);

What is this function m_workspace.session.eval?  It's not a base 
function.  Perhaps its definition has changed?
 
 It appears that the behavior of this code is different when used with
 R version 2.1.1 compared to R version 1.9.1. If the compare statement
 s is changed from
 
 while (s != 1)
 to
 while (s != True)
 or
 while !(s)
 
 the behavior of the code is the same with both versions of R.
 
 After reading the R documentation, I have not found any evidence that
 the original syntax (s != 1) is in any way recommended or supported
 (in version 2.1.1). Still, my questions are:

s != 1 is perfectly valid R code.  It will evaluate to TRUE in at 
least the following case:

as.character(s) is not an NA, but isn't 1.

s != True will evaluate to TRUE in most cases, unless s happens to 
contain that exact string.
 
 1. Is it possible that the syntax has been supported in older versions of R?
 2. Is the reason for the recent change in behavior known and
 documented anywhere?

The syntax is fine, but it looks like a behaviour change in that 
function m_workspace.session.eval.  You'll need to ask the author of 
that function what is happening.

Duncan Murdoch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Teaching R - In front of the computer?

2005-09-19 Thread Ted Harding
On 19-Sep-05 Rau, Roland wrote:
 Dear R-Users,
 
 given you have been teaching R to students (grad level, mainly
 social science background, no previous programming experience,
 80% know SPSS),what are your experiences concerning the style
 of teaching? Do you prefer to stand in front of the class like
 in normal lectures and you show them slides? Or do you you
 explain some concept (for example things like mydata[order(var1,
 var2),]) and show it directly on the computer via beamer/projector
 and also the students have to enter it on the computers in front
 of them.
 
 Any experiences you can share are highly appreciated.
 
 Thanks,
 Roland

I'd like to suggest (perhaps more for discussion than for
implementation) thinking of the use of 'xmx' (X MultipleXer).
See

  http://www.cs.brown.edu/software/xmx/

This work in X Windows on Unix/Linux. The essence of it is that
the software is installed on each of a group of networked computers.
One of these is the master, who starts it up in Floor mode
and nominates any or all of the others to be in Floor, Seat
or View mode (terminilogy apparently inspired by what happens
at meetings).

This causes an W window to appear on all nominated computers,
within which is running a virutal X session. Anyone with Floor
rights can do anything in that session, and it will be mirrored
to all others. This includes keyboard input and mouse movements.
Anyone in View mode an only see what is going on, but cannot
make any input. In Seat mode, a user can virtually raise their
hand and be granted Floor privileges.

Anything anybody does outside the XMX window is private to them,
and will not be seen by others, nor have any effect on the XMX
session.

This software seems not to have undergone further development
in its public form for some time (apparently June 1999). I don't
know if there have been further developments in a private or
proprietary form.

Its creator, John Bazik at Brown University, states that Xmx
provides reasonable real-time performance on a local 10 Mb/sec
ethernet on 52 UltraSparc-class machines.

It might well provide a good vehicle for expository teaching
in a class that large, since each student can see on their
own screen what the instructor is displaying (and this could
include a slide-show presentation alongside code files,
commands being run in an R window, graphics plots, etc.).

However, you would not want a class that size to all be in
Floor mode! Seat mode could be OK, though, since anyone
who wants to ask a question can go into Floor and then thsy
can input things into the XMX session, or even just move their
mouse around to indicate what they are talking about -- something
which in a normal class could only be done by coming out to the
front.

I have used it for teaching on a much smaller scale -- tutorial
sessions with 1 or 2 others, where everyone can be in Floor
mode and can make their own spontaneous changes to what's ging
on without any bureaucracy. This can include having everyone
participate in editing a file of R commands, so that everyone
can see what the effect of doing this or that is. I have found
it to work well, and to be appreciated by students.

This mode could work with more than 1 or 2 students.

The main snag with using XMX is that the X display must be the
same on all machines. This was a deliberate design implementation,
since it cuts down enormously on network traffic. However, it
does mean that all machines must have a sufficiently large overlap
in X resouces (i.e. as reported by 'xdpyinfo').

The resources don't have to be absolutely identical, but certainly
colour-depths must be the same all round, and in my experience
you had better have the same display geometry (e.g. 1280x1024),
and there are various other things. One way to find out is to
start it up nominating all the participating machines at once.
If there's a compatible sufficient overlap, it will work.

However, in a teaching Lab with all the machines the same, it
should be straightforward to get it going.

One nice thing about doing things this way is that a student
could be running a private R session alongside the public XMX
one, and copypaste from the public one into the private one
(or vice versa). They could also be running an editor session
to write their own course notes.

Anyway, there it is if you hadn't heard of it.

Best wishes to all,
Ted.



E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 19-Sep-05   Time: 18:36:32
-- XFMail --

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] factor as seq() in for loop

2005-09-19 Thread Peter Dalgaard
Tord Snall [EMAIL PROTECTED] writes:

 Dear all,
 I would like to use the values in vegaggr.BLMCMR02$colony 
 
 str(vegaggr.BLMCMR02)
 `data.frame':   1678 obs. of  3 variables:
 $ vegtype   : Factor w/ 27 levels 2010,2020,..: 3 4 5 19 4 5 19 5  
 $ colony: Factor w/ 406 levels 0,1,10,100,..: 1 1 1 1 2 2 2 
 $ Totvegproparea: num  0.00055 0.03956 0.95705 0.00284 0.05215 ...
 
 as the seq in a for loop (for(var in seq)), and therefore first picked them 
 out as 
 cols = aggregate(list(A = vegaggr.BLMCMR02$Totvegproparea), 
 list(colony = vegaggr.BLMCMR02$colony), sum)[,1]
  str(cols)
  Factor w/ 406 levels 0,1,10,100,..: 1 2 3 4 5 6 7 8 9 10 ...
 
 I next planned to transform cols using as.integer(cols). However, this 
 transformation gives a vector corresponding to seq(from=1,to=length(cols)). 

Yes, it would do that... The construction looks a bit complicated,
though. If you want the levels of the factor, wouldn't
levels(vegaggr.BLMCMR02$colony) do it?
 
 Could someone please give advice on how to make use of a factor as the seq 
 in a for loop (which is strictly not allowed' according to ?Control).

You're not exactly being clear about what the for loop should achieve!


-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] factor as seq() in for loop

2005-09-19 Thread Gabor Grothendieck
On 9/19/05, Tord Snall [EMAIL PROTECTED] wrote:
 Dear all,
 I would like to use the values in vegaggr.BLMCMR02$colony
 
 str(vegaggr.BLMCMR02)
 `data.frame':   1678 obs. of  3 variables:
 $ vegtype   : Factor w/ 27 levels 2010,2020,..: 3 4 5 19 4 5 19 5
 $ colony: Factor w/ 406 levels 0,1,10,100,..: 1 1 1 1 2 2 2
 $ Totvegproparea: num  0.00055 0.03956 0.95705 0.00284 0.05215 ...
 
 as the seq in a for loop (for(var in seq)), and therefore first picked them
 out as
 cols = aggregate(list(A = vegaggr.BLMCMR02$Totvegproparea),
list(colony = vegaggr.BLMCMR02$colony), sum)[,1]
  str(cols)
  Factor w/ 406 levels 0,1,10,100,..: 1 2 3 4 5 6 7 8 9 10 ...
 
 I next planned to transform cols using as.integer(cols). However, this
 transformation gives a vector corresponding to seq(from=1,to=length(cols)).
 
 Could someone please give advice on how to make use of a factor as the seq
 in a for loop (which is strictly not allowed' according to ?Control).
 

What are you trying to loop over?

Species - head(iris$Species)
for(i in seq(Species)) print(Species[i])

will loop over the elements of the factor Species and you can use

for(lev in levels(Species)) print(lev)

to loop over its levels.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] library (tree)- which samples belong to each terminal branch?

2005-09-19 Thread Chris Buddenhagen
Dear all

 

What I would like to know is if there is a way to know which specific
samples fall within a terminal branch created by tree? The classification
summarizes data, but I want to know which specific samples fall within each
classification (branch in the dendrogram). 

 

Data contains site codes and multiple fields describing the characters of a
single specimen of grass growing there. Each sample is an individual plant
from a site, all plants are similar to each other, but may represent
different species. I classified species using tree and these are labeled by
site name. The classification gives me a nice separation of supposed species
in terms of only 3 sites but with some sites occurring on more than one
terminal branch, this obviously summarizes one or more species/sites on each
branch of the dendrogram. So back to my question, how do I find out which
samples fall within each branch?

 

Cheers

 

Chris Buddenhagen, Botany Department, Charles Darwin Research Station, Santa
Cruz,Galapagos. Mail: Charles Darwin Foundation, Casilla 17-01-3891 Avenida
6 de Diciembre N36-109 y Pasaje California Quito, ECUADOR

 





__
EL CONTENIDO DE ESTE MENSAJE ES DE ABSOLUTA RESPONSABILIDAD DEL AUTOR.
FUNDACION CHARLES DARWIN
WWW.DARWINFOUNDATION.ORG
[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] waveform filtering

2005-09-19 Thread tom wright
I'm not an engineer so I hope I'm using the correct terminology here. I
have a recorded waveform that I want to apply low and high pass filters
too, are tehre already R functions existing to do this or am I going to
have to program my own?
thanks for any pointers
tom

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] how to extract the column name or value from the numerical value of the matrix

2005-09-19 Thread shanmuha boopathy
Dear sir,
 i have a matrix like
 x-c(1:20)
A-matrix(x,4,5)
 A
 [,1] [,2] [,3] [,4] [,5]
[1,]159   13   17
[2,]26   10   14   18
[3,]37   11   15   19
[4,]48   12   16   20

I want to extract the column value for the matrix
value 11...

or the row value for 14..
how it is possible?

thanks for your help

with regards,
boopathy.

Thirumalai Shanmuha Boopathy, 
Zimmer no : 07-15,
Rütscher strasse 165, 
52072  Aachen . 
Germany.
 
Home zone   :  0049 - 241 - 9813409
Mobile zone :  0049 - 176 - 23567867

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] library (tree)- which samples belong to each terminal branch?

2005-09-19 Thread Prof Brian Ripley
On Mon, 19 Sep 2005, Chris Buddenhagen wrote:

 What I would like to know is if there is a way to know which specific
 samples fall within a terminal branch created by tree? The classification
 summarizes data, but I want to know which specific samples fall within each
 classification (branch in the dendrogram).

Please read the help page (as we do ask).  Component `where' in the 
returned object tells you the information you are seeking.

If you want this for new data, predict.tree has a type=where to tell 
you.

 Data contains site codes and multiple fields describing the characters of a
 single specimen of grass growing there. Each sample is an individual plant
 from a site, all plants are similar to each other, but may represent
 different species. I classified species using tree and these are labeled by
 site name. The classification gives me a nice separation of supposed species
 in terms of only 3 sites but with some sites occurring on more than one
 terminal branch, this obviously summarizes one or more species/sites on each
 branch of the dendrogram. So back to my question, how do I find out which
 samples fall within each branch?

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
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

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] how to extract the column name or value from the numerical value of the matrix

2005-09-19 Thread Greg Snow
look at ?col and ?row.  One way to use them is:

col(A)[A==11]
row(A)[A==14]

hope this helps,

Greg Snow, Ph.D.
Statistical Data Center, LDS Hospital
Intermountain Health Care
[EMAIL PROTECTED]
(801) 408-8111

 shanmuha boopathy [EMAIL PROTECTED] 09/19/05 01:30PM 
Dear sir,
 i have a matrix like
 x-c(1:20)
A-matrix(x,4,5)
 A
 [,1] [,2] [,3] [,4] [,5]
[1,]159   13   17
[2,]26   10   14   18
[3,]37   11   15   19
[4,]48   12   16   20

I want to extract the column value for the matrix
value 11...

or the row value for 14..
how it is possible?

thanks for your help

with regards,
boopathy.

Thirumalai Shanmuha Boopathy, 
Zimmer no : 07-15,
Rütscher strasse 165, 
52072  Aachen . 
Germany.
 
Home zone   :  0049 - 241 - 9813409
Mobile zone :  0049 - 176 - 23567867

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help 
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] how to extract the column name or value from the numerical value of the matrix

2005-09-19 Thread Marc Schwartz (via MN)
On Mon, 2005-09-19 at 12:30 -0700, shanmuha boopathy wrote:
 Dear sir,
  i have a matrix like
  x-c(1:20)
 A-matrix(x,4,5)
  A
  [,1] [,2] [,3] [,4] [,5]
 [1,]159   13   17
 [2,]26   10   14   18
 [3,]37   11   15   19
 [4,]48   12   16   20
 
 I want to extract the column value for the matrix
 value 11...
 
 or the row value for 14..
 how it is possible?
 
 thanks for your help
 
 with regards,
 boopathy.


Why did you copy r-devel? r-help is the appropriate forum.


See ?which and take note of the 'arr.ind' argument:

 which(A == 11, arr.ind = TRUE)
 row col
[1,]   3   3


 which(A == 14, arr.ind = TRUE)
 row col
[1,]   2   4


HTH,

Marc Schwartz

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] restore file magic number

2005-09-19 Thread Kristin_Cothern
Hello,

I recently lost access to my workspace developed over a long time.  When I
try to load this work space (called Casmalia.Rdata) or double click on it
to open it in R, I see  a popup which says (Embedded image moved to file:
pic17720.jpg)
:
And under this, the last line in the console commands is:   Bad restore
file magic number.  (File may be corrupted) - no data loaded.

The Casmalia.Rdata file looks the right size.  But is apparently missing a
magic number.  Can this file be fixed in an editor such as Textpad so that
it can be restored?


---
Kristin Cothern, URS Corporation
130 Robin Hill Road
Santa Barbara, California 93117
tel.  805-964-6010



 This e-mail and any attachments are confidential. If you receive this
message in error or are not the intended recipient, you should not retain,
distribute, disclose or use any of this information and you should destroy
the e-mail and any attachments or copies.
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Re: [R] Change in behavior of compare statement

2005-09-19 Thread Duncan Murdoch
On 9/19/2005 1:40 PM, Duncan Murdoch wrote:
 On 9/19/2005 12:25 PM, Tomas Andersson wrote:
 Dear all, 
 
 I have come across some Windows Script code which calls the
 file.exists function in R to check for the existence of a particular
 file on an R server. This is what the code looks like:
 
 do
 {
 // some useful code
 }
 while (m_workspace.session.eval(file.exists( + dataFile
 + )) != 1);
 
 What is this function m_workspace.session.eval?  It's not a base 
 function.  Perhaps its definition has changed?

This has to be one of the most out-to-lunch answers I ever wrote. 
Sorry, please ignore it.

The code above is Windows Script, whatever that is, not R. 
file.exists hasn't changed, but whatever interface you're using to R 
presumably has.  In the code you're looking at there, it converted TRUE 
to 1, and now it doesn't.

Duncan Murdoch
 
 It appears that the behavior of this code is different when used with
 R version 2.1.1 compared to R version 1.9.1. If the compare statement
 s is changed from
 
 while (s != 1)
 to
 while (s != True)
 or
 while !(s)
 
 the behavior of the code is the same with both versions of R.
 
 After reading the R documentation, I have not found any evidence that
 the original syntax (s != 1) is in any way recommended or supported
 (in version 2.1.1). Still, my questions are:
 
 s != 1 is perfectly valid R code.  It will evaluate to TRUE in at 
 least the following case:
 
 as.character(s) is not an NA, but isn't 1.
 
 s != True will evaluate to TRUE in most cases, unless s happens to 
 contain that exact string.
 
 1. Is it possible that the syntax has been supported in older versions of R?
 2. Is the reason for the recent change in behavior known and
 documented anywhere?
 
 The syntax is fine, but it looks like a behaviour change in that 
 function m_workspace.session.eval.  You'll need to ask the author of 
 that function what is happening.
 
 Duncan Murdoch


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] restore file magic number

2005-09-19 Thread Duncan Murdoch
On 9/19/2005 4:29 PM, [EMAIL PROTECTED] wrote:
 Hello,
 
 I recently lost access to my workspace developed over a long time.  When I
 try to load this work space (called Casmalia.Rdata) or double click on it
 to open it in R, I see  a popup which says (Embedded image moved to file:
 pic17720.jpg)
 :
 And under this, the last line in the console commands is:   Bad restore
 file magic number.  (File may be corrupted) - no data loaded.
 
 The Casmalia.Rdata file looks the right size.  But is apparently missing a
 magic number.  Can this file be fixed in an editor such as Textpad so that
 it can be restored?

It's probably missing a lot more than a magic number.  That's just a 
signal that the file format isn't really an R workspace any more.

You need to get an old copy from a backup.

If you're desperate and short of a backup, you could try looking at the 
file in a binary dump program to see if there's anything left of the 
contents (perhaps only part of it got trashed), and maybe try to restore 
just the good stuff, but it's not going to be easy, and the only real 
documentation for what to do is to look at the R source code.

Duncan Murdoch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] text editor TinR?

2005-09-19 Thread Mihai Nica
Greetings,

Please help me remember the name of the tiny text editor that works with 
R TinR maybe? I cannot find it at all, and cannot remember it, it is 
really frustrating...

Thanks,

Mihai Nica, ABD
Jackson State University
170 East Griffith Street G5
Jackson, MS 39201
601 914 0361

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] pairwise comparisons among treatments

2005-09-19 Thread kevin Lin
Hello R listing,

I did two-way anova on lm. Further question the investigator 
interested in is what two treatments are different?

I am looking for a command which could do pairwise comparison for 
every treatment.

Could anyone help me out?

Thanks a bunch

Kevin

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] text editor TinR?

2005-09-19 Thread John Fox
Dear Mihai,

It's Tinn-R (with two n's), at http://www.sciviews.org/Tinn-R/.

John


John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Mihai Nica
 Sent: Monday, September 19, 2005 4:07 PM
 To: r-help@stat.math.ethz.ch
 Subject: Re: [R] text editor TinR?
 
 Greetings,
 
 Please help me remember the name of the tiny text editor 
 that works with R TinR maybe? I cannot find it at all, 
 and cannot remember it, it is really frustrating...
 
 Thanks,
 
 Mihai Nica, ABD
 Jackson State University
 170 East Griffith Street G5
 Jackson, MS 39201
 601 914 0361

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] text editor TinR?

2005-09-19 Thread Peter Dalgaard
Mihai Nica [EMAIL PROTECTED] writes:

 Greetings,
 
 Please help me remember the name of the tiny text editor that works with 
 R TinR maybe? I cannot find it at all, and cannot remember it, it is 
 really frustrating...

http://www.sciviews.org/Tinn-R/


-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] waveform filtering

2005-09-19 Thread Huntsinger, Reid
You should probably have a look at the sound packages for R, tuneR and
sound, I believe, on http://cran.r-project.org. 

Applying a filter can be done with filter(), but you need to come up with
filter coefficients. High-pass and low-pass have simple descriptions in
the Fourier transform space, so you might want to specify the frequency
response of your filter directly there, then do an inverse Fourier transform
(fft() in R) to get coefficients. 

The ingredients are all there in R itself; but the packages tuneR and sound
might have exactly what you want. A book on time series or signal processing
might be helpful.

Reid Huntsinger

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of tom wright
Sent: Monday, September 19, 2005 10:36 AM
To: R-help mailing list
Subject: [R] waveform filtering


I'm not an engineer so I hope I'm using the correct terminology here. I
have a recorded waveform that I want to apply low and high pass filters
too, are tehre already R functions existing to do this or am I going to
have to program my own?
thanks for any pointers
tom

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] pairwise comparisons among treatments

2005-09-19 Thread Berton Gunter

help.search('pairwise comparison')

-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
 
The business of the statistician is to catalyze the scientific learning
process.  - George E. P. Box
 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of kevin Lin
 Sent: Monday, September 19, 2005 2:33 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] pairwise comparisons among treatments
 
 Hello R listing,
 
 I did two-way anova on lm. Further question the investigator 
 interested in is what two treatments are different?
 
 I am looking for a command which could do pairwise comparison for 
 every treatment.
 
 Could anyone help me out?
 
 Thanks a bunch
 
 Kevin
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] pairwise comparisons among treatments

2005-09-19 Thread kevin Lin
Hello Bert,

Thanks for your response. I don't know why I am getting following 
error messages. I use version of R version 2.1.1, 2005-06-20, 
powerpc-apple-darwin7.9.0  in Mac OS X version 10.3.8.
I did try to load following packages before, but it failed.

help.search(pairwise comparison)
Error in help.search(pairwise comparison) :
could not find package 'arrayQuality.1'
In addition: Warning messages:
1: no Rd contents for package 'R2HTML' in 
'/Library/Frameworks/R.framework/Resources/library' in: 
help.search(pairwise comparison)
2: no Rd contents for package 'affylmGUI' in 
'/Library/Frameworks/R.framework/Resources/library' in: 
help.search(pairwise comparison)

Thanks.

Kevin

help.search('pairwise comparison')

-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA

The business of the statistician is to catalyze the scientific learning
process.  - George E. P. Box




__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] text editor TinR?

2005-09-19 Thread Mihai Nica
Thanks to everybody answering my call for help. It is Tinn-R!

Mihai Nica, ABD
Jackson State University
170 East Griffith Street G5
Jackson, MS 39201
601 914 0361

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] How to mimic pdMat of lme under lmer?

2005-09-19 Thread Douglas Bates
On 9/19/05, Joris De Wolf [EMAIL PROTECTED] wrote:
 Dear members,

 I would like to switch from nlme to lme4 and try to translate some of my
 models that worked fine with lme.
 I have problems with the pdMat classes.

 Below a toy dataset with a fixed effect F and a random effect R. I gave
 also 2 similar lme models.
 The one containing pdLogChol (lme1) is easy to translate (as it is an
 explicit notation of the default model)
 The more parsimonious model with pdDiag replacing pdLogChol I cannot
 reproduce with lmer. The obvious choice for me would be my model lmer2,
 but this is yielding different result.

 Somebody any idea?
 Thanks,
 Joris

 I am using R version 2.1.0 for Linux
 and the most recent downloads of Matrix and  nlme

 #dataset from McLean, Sanders and Stroup
 F - factor(c(1,1,1,1,1,1,2,2,2,2,2,2))
 R - factor(c(1,1,2,2,3,3,1,1,2,2,3,3))
 s -
 c(51.43,51.28,50.93,50.75,50.47,50.83,51.91,52.43,52.26,52.33,51.58,51.23)
 DS - data.frame(F,R,s)
 DS$F - as.factor(DS$F)
 DS$R - as.factor(DS$R)

 library(nlme)
 lme1 - lme(data = DS,s ~ F,random = list(R = pdLogChol(~F)))
 lme2 - lme(data = DS,s ~ F,random = list(R = pdDiag(~F)))
 summary(lme1)
 summary(lme2)

 library(lme4)
 lmer1 - lmer(data = DS,s ~ F + (F|R))
 lmer2 - lmer(data = DS,s ~ F + (1|R) + (1|F))
 summary(lmer1)
 summary(lmer2)

You need to generate the two columns of the indicator matrix for F as
separate model matrices.  This will involve some awkward construction
like

 (fm1 - lmer(s ~ F +(F|R), DS))
Linear mixed-effects model fit by REML
Formula: s ~ F + (F | R)
   Data: DS
  AIC  BIClogLik MLdeviance REMLdeviance
 20.69259 23.60203 -4.3462976.03915 8.692593
Random effects:
 Groups   NameVariance Std.Dev. Corr
 R(Intercept) 0.108796 0.32984
  F2  0.102008 0.31939  -0.014
 Residual 0.048525 0.22028
# of obs: 12, groups: R, 3

Fixed effects:
Estimate Std. Error DF  t value  Pr(|t|)
(Intercept)  50.9483 0.2106 10 241.9188  2.2e-16
F21.0083 0.2240 10   4.5014  0.001141
 (fm2 - lmer(s ~ F + (0+as.numeric(F==1)|R) + (0+as.numeric(F==2)|R), DS))
Linear mixed-effects model fit by REML
Formula: s ~ F + (0 + as.numeric(F == 1) | R) + (0 + as.numeric(F ==
2) |  R)
   Data: DS
  AIC  BIClogLik MLdeviance REMLdeviance
 19.62621 22.05075 -4.813107   7.439584 9.626215
Random effects:
 Groups   Name   Variance Std.Dev.
 Ras.numeric(F == 1) 0.108796 0.32984
 Ras.numeric(F == 2) 0.207896 0.45596
 Residual0.048525 0.22028
# of obs: 12, groups: R, 3; R, 3

Fixed effects:
Estimate Std. Error DF  t value Pr(|t|)
(Intercept) 50.948330.21060 10 241.9188   2e-16
F2   1.008330.34891 10   2.8899  0.01611

There are probably more elegant ways of doing this but I don't think
there is any really clean way.  If you want to assume that all the
variances are equal then you can estimate the model using an
interaction.

 (fm3 - lmer(s ~ F + (1|F:R), DS))
Linear mixed-effects model fit by REML
Formula: s ~ F + (1 | F:R)
   Data: DS
  AIC BIClogLik MLdeviance REMLdeviance
 17.77917 19.7188 -4.889587   7.669022 9.779175
Random effects:
 Groups   NameVariance Std.Dev.
 F:R  (Intercept) 0.158346 0.39793
 Residual 0.048525 0.22028
# of obs: 12, groups: F:R, 6

Fixed effects:
Estimate Std. Error DF  t value Pr(|t|)
(Intercept) 50.948330.24672 10 206.5049   2e-16
F2   1.008330.34891 10   2.8899  0.01611





 confidentiality notice:
 The information contained in this e-mail is confidential and...{{dropped}}

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Teaching R - In front of the computer?

2005-09-19 Thread Murray Pung
From the prospective of a student, I highly recommend the hands on approach. I 
had the best outcomes when I was provided with examples, and then encouraged 
to make my own modifications in a lab / class environment, with help 
available. This approach allows students to build the skills required to 
program independently, without becoming overwhelmed at the start. 

Murray

Murray Pung | Research Analyst
AIM Research  HR Consulting
PO Box 328, Nth Sydney NSW 2060
P +61 (02) 9956 3951
F +61 (02) 9922 2210
www.aimsurveys.com.au


-Original Message-
From: John Fox [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 20 September 2005 4:25 AM
To: Rau, Roland
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Teaching R - In front of the computer?


Dear Roland,

I've taught the use of R to this kind of audience many times. Take a
look at
http://socserv.socsci.mcmaster.ca/jfox/Courses/UCLA/index.html for
materials used in such a workshop, and at
http://socserv.socsci.mcmaster.ca/jfox/Teaching-with-R.pdf for a
paper on teaching social statistics with R.

As others have suggested, using static slides is not a good idea, and
having at least a live display for the presenter is essential. It also
helps to have the students sitting at computers and able to try things
out for themselves. If this is a workshop devoted to R, I'd strongly
recommend this format.

On the other hand, if you're teaching R in the context of a more
general statistics course, you can cover the basics in a hands-on
workshop and then use the LCD projector to introduce new commands,
etc., during the course as they're needed. I find that once they've
acquired the basics, students are able to work more independently.

I hope this helps,
 John

On Mon, 19 Sep 2005 15:25:14 +0200
 Rau, Roland [EMAIL PROTECTED] wrote:
 Dear R-Users,
 
 given you have been teaching R to students (grad level, mainly social
 science background, no previous programming experience, 80% know
 SPSS),
 what are your experiences concerning the style of teaching? Do you
 prefer to stand in front of the class like in normal lectures and
 you
 show them slides? Or do you you explain some concept (for example
 things
 like mydata[order(var1, var2),]) and show it directly on the computer
 via beamer/projector and also the students have to enter it on the
 computers in front of them.
 
 Any experiences you can share are highly appreciated.
 
 Thanks,
 Roland
 
 +
 This mail has been sent through the MPI for Demographic
 Rese...{{dropped}}
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html


John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox/

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Are least-squares means useful or appropriate?

2005-09-19 Thread Spencer Graves
Estimado Felipe:

  If you provide a very simple example (as suggested in the posting 
guide, www.R-project.org/posting-guide.html), it would allow those of 
use who rarely use SAS to respond.  Try to think of the simplest 
possible toy data set and analysis that shows the difference between the 
SAS answer and the answer you get from a certain R function.  If you 
post something simple of that nature that someone can copy from your 
email into R and try other things in a minute or two, it will likely 
increase the speed and utility of a reply.

  Buena Suerte,
  spencer graves

Felipe wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Hi.
 I have been reading about the convenience of using least-squares means
 (a. k. a. adjusted means) in multiple comparisons (I used to resort to
 them when using SAS). I even read a post in this list warning against
 them, but not giving much detail. What do you think about this?
 Greetings.
 
 Felipe
 -BEGIN PGP SIGNATURE-
 
 iEYEARECAAYFAkMqq5gACgkQWtdQtNzjBl4AigCfQJ64O0wrdYK/1iMReW5RtI1d
 tMIAn3DQSdk+4D7AK7VQGtWo0TElrFG7
 =j9EX
 -END PGP SIGNATURE-
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

-- 
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

[EMAIL PROTECTED]
www.pdf.com http://www.pdf.com
Tel:  408-938-4420
Fax: 408-280-7915

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] logistic regression with nominal predictors

2005-09-19 Thread Spencer Graves
  This sounds to me like a great research project that could be 
answered relatively easily with a Monte Carlo study.  An execllent 
mathematician might be able to produce simple theoretical limits on the 
error from using ranks or normal scores, but such limits would likely be 
much wider than one could get in a typical case using Monte Carlo.  And 
Monte Carlo in R is normally fairly easy even for quite complicated 
situations.

  spencer graves

Ramón Casero Cañas wrote:

 (Sorry for obvious mistakes, as I am quite a newby with no Statistics
 background).
 
 My question is going to be what is the gain of logistic regression over
 odds ratios when none of the input variables is continuous.
 
 
 My experiment:
  Outcome: ordinal scale, ``quality'' (QUA=1,2,3)
  Predictors: ``segment'' (SEG) and ``stress'' (STR). SEG is
  nominal scale with 24 levels, and STR is dychotomous (0,1).
 
 
 
 Considering the outcome continuous, two-way ANOVA with
 
 aov(as.integer(QUA) ~ SEG * STR)
 
 doesn't find evidence of interaction between SEG and STR, and they are
 significant on their own. This is the result that we would expect from
 clinical knowledge.
 
 
 
 I use
 
 xtabs(~QUA+SEG, data=data2.df, subset=STR==0)
 xtabs(~QUA+SEG, data=data2.df, subset=STR==0)
 
 for the contingency tables. There are zero cells, and for some values of
 SEG, there is only one none-zero cell, i.e. some values of SEG determine
 the output with certainty.
 
 So initially I was thinking of a proportional odds logistic regression
 model, but following Hosmer and Lemeshow [1], zero cells are
 problematic. So I take out of the data table the deterministic values of
 SEG, and I pool QUA=2 and QUA=3, and now I have a dychotomous outcome
 (QUA = Good/Bad) and no zero cells.
 
 The following model doesn't find evidence of interaction
 
 glm(QUA ~ STR * SEG, data=data3.df, family=binomial)
 
 so I go for
 
 glm(QUA ~ STR + SEG, data=data3.df, family=binomial)
 
 
 (I suppose that what glm does is to create design variables for SEG,
 where 0 0 ... 0 is for the first value of SEG, 1 0 ... 0 for the second
 value, 0 1 0 ... 0 for the third, etc).
 
 Coefficients:
   Estimate Std. Error   z value Pr(|z|)
 (Intercept) -1.085e+00  1.933e-01-5.614 1.98e-08 ***
 STR.L2.112e-01  6.373e-02 3.314 0.000921 ***
 SEGP2C.MI   -9.869e-01  3.286e-01-3.004 0.002669 **
 SEGP2C.AI   -1.306e+00  3.585e-01-3.644 0.000269 ***
 SEGP2C.AA   -1.743e+00  4.123e-01-4.227 2.37e-05 ***
 [shortened]
 SEGP4C.ML   -5.657e-01  2.990e-01-1.892 0.058485 .
 SEGP4C.BL   -2.908e-16  2.734e-01 -1.06e-15 1.00
 SEGSAX.MS1.092e-01  2.700e-01 0.405 0.685772
 SEGSAX.MAS  -5.441e-16  2.734e-01 -1.99e-15 1.00
 SEGSAX.MA7.130e-01  2.582e-01 2.761 0.005758 **
 SEGSAX.ML1.199e+00  2.565e-01 4.674 2.96e-06 ***
 SEGSAX.MP1.313e+00  2.570e-01 5.108 3.26e-07 ***
 SEGSAX.MI8.865e-01  2.569e-01 3.451 0.000558 ***
 ---
 Signif. codes:  0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1
 
 (Dispersion parameter for binomial family taken to be 1)
 
 Null deviance: 3462.0  on 3123  degrees of freedom
 Residual deviance: 3012.6  on 3101  degrees of freedom
 AIC: 3058.6
 
 Number of Fisher Scoring iterations: 6
 
 
 Even though some coefficients have no evidence of statistical
 significance, the model requires them from a clinical point of view.
 
 At this point, the question would be how to interpret these results, and
 what advantage they offer over odds ratios. From [1] I can understand
 that in the case of a dychotomous and a continuous predictor, you can
 adjust for the continuous variable.
 
 But when all predictors are dychotomous (due to the design variables), I
 don't quite see the effect of adjustment. Wouldn't it be better just to
 split the data in two groups (STR=0 and STR=1), and instead of using
 logistic regression, use odds ratios for each value of SEG?
 
 Cheers,
 
 Ramón.
 
 [1] D.W. Hosmer and S. Lemeshow. ``Applied Logistic Regression''.
 John-Wiley. 2000.
 

-- 
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

[EMAIL PROTECTED]
www.pdf.com http://www.pdf.com
Tel:  408-938-4420
Fax: 408-280-7915

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Transform variable number of rows per subject to column variables?

2005-09-19 Thread Bing Ho
Hello,

I am very new to R, but I am having trouble with my dataset.

I have a data frame where a subject has a variable number of multiple 
observations for each row, which I wish the transform these 
observations to column variables.

An example of the data frame
ID  TEST.A  TEST.B
1   10  1
1   13  2
1   11  1
2   15  2
2   17  3

And I wish to transform it to the following:
ID  TEST.A1 TEST.A2 TEST.A3 TEST.B1 TEST.B2 TEST.B3
1   10  13  11  1   2   
1
2   15  17  NA  2   3   
NA

In other words, for the variable number of repeated follow up 
studies, a new column variable for each subject, but they are grouped 
by the original test.

Thank you for any help - I'm realizing that I am a terrible programmer!

Bing Ho

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] nls()

2005-09-19 Thread Spencer Graves
  I have passed the identities and values of fixed parameters via the 
... arguments in optim;  I don't know about nls.  Then internal to the 
function that optim is to minimize, I combine the x argument with the 
fixed parameters to obtain the full set of parameters.  I've used that 
effectively.  It's not trivial, but it can be made to work.

  spencer graves

J.M. Breiwick wrote:

 Hi,
 
 I am using nls() with the form: nls(~my.fcn(...)) because I have to 
 iteratively compute the expected y values. The function my.fcn() returns 
 y.obs-y.pred
 
 However, I want to fix some of the parameters in my.fcn at various values 
 and compute the parameter estimates. In Splus there is such a thing as a 
 parameterized dataframe. I don't think this exists in R so does anyone know 
 how to set one or more of the parameters as constants in the model? Thank 
 you.
 
 Jeff Breiwick
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

-- 
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

[EMAIL PROTECTED]
www.pdf.com http://www.pdf.com
Tel:  408-938-4420
Fax: 408-280-7915

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Transform variable number of rows per subject to column variables?

2005-09-19 Thread Gabor Grothendieck
On 9/20/05, Bing Ho [EMAIL PROTECTED] wrote:
 Hello,
 
 I am very new to R, but I am having trouble with my dataset.
 
 I have a data frame where a subject has a variable number of multiple
 observations for each row, which I wish the transform these
 observations to column variables.
 
 An example of the data frame
 ID  TEST.A  TEST.B
 1   10  1
 1   13  2
 1   11  1
 2   15  2
 2   17  3
 
 And I wish to transform it to the following:
 ID  TEST.A1 TEST.A2 TEST.A3 TEST.B1 TEST.B2 TEST.B3
 1   10  13  11  1   2 
   1
 2   15  17  NA  2   3 
   NA
 
 In other words, for the variable number of repeated follow up
 studies, a new column variable for each subject, but they are grouped
 by the original test.


First manufacture a time column and then use reshape:

tt - sequence(rle(DF$ID)$lengths)
reshape(cbind(tt, DF), idvar = ID, timevar = tt, direction = wide)

Another possibility is to use the reshape package:

library(reshape)
DF.d - deshape(cbind(tt, DF), id = 1:2)  # same tt as above
reshape(DF.d, ID ~ variable + tt)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html