Re: [R] Printing Lattice Graphs from Windows

2004-06-07 Thread Deepayan Sarkar
On Sunday 06 June 2004 22:11, Charles and Kimberly Maner wrote:
 Hi.  This did not work for me per my R output/session below:
  library(lattice)
  win.metafile()
  trellis.par.set('background', list('white'))

This doesn't make sense; the components need to be named. Should be 

trellis.par.set('background', list(col = 'white'))

  trellis.par.set('plot.symbol',list(cex=0.8, col=blue, font=1,
  pch=1)) 
  xyplot(1 ~ 1) 

 Error in unit(rep(1 * xaxis.cex[1], length(strbar)), strheight,
 strbar) : x and units must have length  0

Looks like a completely unrelated bug, which I'll fix. Can be worked 
around by starting the device with 

trellis.device(win.metafile)

  dev.off()

 null device
   1


 When I pasted the result into MS Word, I got the same paste--blank. 

Probably due to the error above and not the bug we have been discussing.

 And, yes, another default bg color such as white or transparent
 would be great as I am definitely not a fan of the standard gray
 either.  I researched how to default it to something else, but it
 seems to have to be done manually when a lattice/trellis graph is
 fired up.  Strange, though, as the standard/base graph/plotting does
 default to a white background.

Well, the idea is for screen devices to have grey backgrounds and 
'print' devices white. Currently, only pdf, postscript and xfig are 
considered print devices. If the general consensus is that win.metafile 
should also be put into that category, I could probably make the 
necessary changes easily enough.

That said, defaults are just that, and you can change them. In 
particular, calling 

lset(col.whitebg())

before the xyplot call should give a fairly robust scheme with a white 
(or rather 'transparent') background.

Deepayan

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


Re: [R] contour lines on levelplot?

2004-06-07 Thread Deepayan Sarkar
On Sunday 06 June 2004 20:40, Spencer Graves wrote:
   With image and contour, one can get both colors and lines
 to enhance the image of a contour plot.  What's the best way to do
 this with Lattice graphics?  The following is one ugly hack,
 producing the desired result after much trial and error (R 1.9.1
 alpha under Windows 2000):

 # setup
 DF - expand.grid(x=1:3, y=1:3)
 DF$z - (DF$x+DF$y)

 # Traditional base graphics:
 image(x=1:3, y=1:3, z=array(DF$z, dim=c(3,3)))
 contour(x=1:3, y=1:3, z=array(DF$z, dim=c(3,3)), add=T)

 # Lattice hack:
 lvlplt - levelplot(z~x*y, DF)
 cont - contourplot(z~x*y, DF)
 print(lvlplt, more=T)
 print(cont, position=c(0, 0, 0.9055, 1))

 ##
   By comparison, the same ugly hack in S-Plus required 0.952
 instead of 0.955.  Is this the best we can currently get with a
 modest effort?

There's certainly much easier ways to do this, namely 

contourplot(z~x*y, DF, region = TRUE)

or 

levelplot(z~x*y, DF, contour = TRUE)

the only restriction being that you would need to use the same 'at' 
vector. If you want them to differ, you need to write a small panel 
function of your own that makes use of panel.levelplot().

Deepayan

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


[R] Rmetrics - new Built 190.10054

2004-06-07 Thread Diethelm Wuertz
*
Rmetrics - new Built 190.10054
**Juni 7 , 2004

*The new built at www.rmetrics.org should now run out of the box under 
Windows and Linux. In
addition new functionality has been added, and some fixes have been 
done. Many new example
files have been added. Please inspect the CHANGES file. The user guides 
and reference guides
are not yet updated, they have still the status of Version 181.100xx.

Diethelm Wuertz
ETH Zurich
www.rmetrics.org

[[alternative HTML version deleted]]

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


Re: [R] MCLUST Covariance Parameterization.

2004-06-07 Thread Murray Jorgensen
I'm not going to directly answer your question but it seems to me that 
you want to fit a completely unconstrained Gaussian mixture model. This 
may not be the best thing to do as without constraints on the Sigma_k 
the model may have more parameters than it is reasonable to try to 
estimate with the available data.

A preliminary fit of a mixture model, even if it does not have quite the 
 covariance structure that you want gives a clustering of the data that 
you can use to explore the correlation structure of the components 
empirically: then you can revise the covariance structure and re-fit.

I think that this sort of approach is likely to be more effective than 
fitting the fully unstructured model directly.

Murray Jorgensen
[EMAIL PROTECTED] wrote:
Hello all (especially MCLUS users). 

I'm trying to make use of the MCLUST package by C. Fraley and A. Raftery. My problem is trying to figure out how the (model) identifier (e.g, EII, VII, VVI, etc.) relates to the covariance matrix. The parameterization of the covariance matrix makes use of the method of decomposition in Banfield and Rraftery (1993) and Fraley and Raftery (2002) where 

Sigma_k = lambda_k*D_k*A_k*D_k^' 

where Sigma_k is the covariance matrix for the kth (k=1,...,G), lambda_k is the kth groups constant of proportionality, D_k is the orthogonal matrix of eigenvectors for the kth group, and A_k is a diagonal matrix whose elements are proportional to the eigenvalues. The parameterization of the covariance matrix Sigma_k depends on the distribution (whether spherical, diagonal, or ellipsoidal), volume (equal or variable), shape (equal or variable), and orientation (coordinate axes, equal, or variable). The distribution, volume, shape and orientation are a function of  lambda_k, D_k, and A_k. Thus, depending on whether or not these values are constant across class defines Sigma_k. 

What I'm trying to figure out is how the distribution, volume, shape, and orientation relate to Sigma_k. As far as the 
parameterization of Sigma_k, what do distribution, volume, shape, and orientation 
even mean. Does a table exist of how these values relate to the Sigma_k? I know a table exists in the MCLUST software manual on the 
MCLUST website, but this table doesn't relate the values of distribution, volume, shape, and orientation to Sigma_k directly, only to 
how Sigma_k would be parameterized (this isnt helpful unless you know what distribution, volume, shape and orientation  mean 
in terms of the within class covariance matrix) So, just what do the distribution, volume, shape, and orientation mean in the context 
of Sigma_k?
 
What do the distribution, volume, shape, and orientation mean for a Sigma_k=sigma^2*I where I is a p by p covariance matrix, sigma^2 is the constant variance and Sigma_1=Sigma_2==Sigma_G. What about when a Sigma_k=sigma^2_k*I, or when Sigma_1=Sigma_2==Sigma_G in situations where each element of the (constant across class) covariance matrix is different?

I would say I have a pretty good understanding of finite mixture modeling, but nothing I've read (expect the works cited in the 2002 JASA paper) talks about parameterizing the Sigma_k matrix in such a way. It would be nice to specify a structure directly for Sigma_k (as most books talk about). Any help on this issue would be greatly appreciated. 

Thanks, 
Ken.

__

[[alternative HTML version deleted]]
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

--
Dr Murray Jorgensen  http://www.stats.waikato.ac.nz/Staff/maj.html
Department of Statistics, University of Waikato, Hamilton, New Zealand
Email: [EMAIL PROTECTED]Fax 7 838 4155
Phone  +64 7 838 4773 wk+64 7 849 6486 homeMobile 021 1395 862
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] dfs in lme

2004-06-07 Thread Lorenz . Gygax
Dear R-mixed-effects-modelers,

I could not answer this questions with the book by Pinheiro  Bates and did
not find anything appropriate in the archives, either ...

We are preparing a short lecture on degrees of freedom and would like to
show lme's as an example as we often need to work with these. I have a
problem in understanding how many dfs are needed if random terms are used
for explanatory variables in addition to the intercept (if I have understood
correctly that ist the same as saying that interactions between random and
fixed effects are considered). I tried the following code:

library ('nlme')
options (contrasts= c ('contr.treatment', 'contr.poly'))

# create fake data
data.df - data.frame (gruppe= rep (1:4, rep (20, 4)))

# create response variable
data.df$zv - rnorm (80, 2)

# create potential explanatory variables
data.df$explan - rnorm (80, 2)
data.df$treat -  as.factor (sample (1:3, 80, T))
data.df$treat1 - as.factor (sample (1:4, 80, T))
data.df$treat2 - as.factor (sample (1:5, 80, T))
data.df$treat3 - as.factor (sample (1:6, 80, T))

# with each of the explanatory variables
withoutInt - lme (zv ~ explan, data= data.df, random= ~1 | gruppe)
withInt - lme (zv ~ explan, data= data.df, random= ~ explan | gruppe)
anova (withoutInt)
anova (withInt)
anova (withoutInt, withInt)


There are two main things that I wonder about:

(1) the two anova() commands on the single models have the same residual
degrees of freedom even though the model withInt has an additional
explanatory variable. Why are the residual dfs not reduced?

(2) In the model comparison, it becomes visible that the model with 'explan'
in the random effect does indeed use more dfs. But I cannot figure out where
that number of dfs comes from. I thought that basically for each of the
levels in the grouping variable additional parameters are estimated? Thus, I
would expect somethind like df(interaction)= df(explanatory
variable)*df(random effect), but what I find is:

explanatory variabledelta-dfs of the model comparison
(= dfs of the interaction of the explanatory
   variable with the random effect 'gruppe',
   which has 4 levels, 3 dfs)
continuous (1 df)2
3 levels (2 dfs) 5
4 levels (3 dfs) 9
5 levels (4 dfs)14
6 levels (5 dfs)20

Can anyone point me in the right direction on where and how to answer these
questions?

Many thanks and regards, Lorenz
- 
Lorenz Gygax
Tel: +41 (0)52 368 33 84 / [EMAIL PROTECTED]  

Center for proper housing of ruminants and pigs
Swiss Veterinary Office
agroscope FAT Tänikon, CH-8356 Ettenhausen / Switzerland
Fax : +41 (0)52 365 11 90 / Tel: +41 (0)52 368 31 31

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


Re: [R] MCLUST Covariance Parameterization.

2004-06-07 Thread Christian Hennig
Dear Ken,

in principle you have all relevant informations already in your mail.
As far as I know, the parameterization of Fraley and Raftery is the most 
intuitive one. I don't know for which kind of application you need 
direct parameterization,
but in my experience the parameters volume, shape and orientation are 
more interesting in most applications than the direct values of Sigma_k.

However, not all possible structures seem to be implemented. Your examples
are not, I suspect:

 What do the distribution, volume, shape, and orientation mean for a 
 Sigma_k=sigma^2*I where I is a p by p covariance matrix, sigma^2 is the constant 
 variance and Sigma_1=Sigma_2=…=Sigma_G. 

This would be VEE. If you assume det(Sigma_1)=1 (which is necessary for your
parameterization to be identified), then sigma^2 is lambda, i.e., 
the volume parameter, and Sigma_1 would be the remaining matrix product.
However, VEE is not implemented. You may mail to Chris Fraley and ask why...
You see that the problem is not the parameterization, but the fact that 
VEE is missing in mclust.

(It is somewhat confusing the you use I for the covariance matrix, because
emclust uses this letter for a covariance matrix, which is the identity 
matrix.)
 

 What about when a Sigma_k=sigma^2_k*I, or when Sigma_1=Sigma_2=…=Sigma_G in 
 situations where each element of the (constant across class) covariance matrix is 
 different?

I do not really understand this. Do you want to assume that the elements of
Sigma_1 should be pairwise different? Why do you need such an assumption?
That's not a very favourable choice for estimation, I think,  and it would 
be estimated by VEE as well (which would yield such a solution with
probability 1), if it would be implemented.

Best,
Christian

***
Christian Hennig
Fachbereich Mathematik-SPST/ZMS, Universitaet Hamburg
[EMAIL PROTECTED], http://www.math.uni-hamburg.de/home/hennig/
###
ich empfehle www.boag-online.de

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


[R] Average R-squared of model1 to model n

2004-06-07 Thread kan Liu
Hi,
 
We got a question about interpretating R-suqared.
 
The actual outputs for a test dataset is X=(x1,x2,
..., xn).
model 1 predicted the outputs as Y1=(y11,y12,..., y1n)
model n predicted the outputs as Y2=(y21,y22,..., y2n)
 
...
model m predicted the outputs as Ym=(ym1,ym2,..., ymn)
 
Now we have two ways to calculate R squared to
evaluate the average performance of committee model.
 
(a) Calculate R squared between (X, Y1), (X, Y2), ...,
(X,Ym), and then averaging the R squared
(b) Calculate average Y=(Y1+Y2, + ... Ym)/m, and then
calculate the R squared between (X, Y).
 
We found it seemed that R squared calculated in (b) is
'always' higher than that in (a).
 
Does this result depends on the test dataset or this
happened by chance?Can you advise me any reference for
this issue? 

Many thanks in advance!

Kan

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


[R] Aggregate rows to see the number of occurences

2004-06-07 Thread Nicolas STRANSKY
Hi,
I have a set of data like the following:
  [,1]  [,2]
[1,]   102
[2,]70
[3,]10
[4,]10
[5,]   150
[6,]   174
[7,]40
[8,]   198
[9,]   102
[10,]  195
I'd like to aggregate it in order to obtain the frequency (the number of 
occurences) for each couple of values (e.g.: (10,2) appears twice, (7,0) 
appears once). Something cool would be to have this value in a third 
column...
I've been looking at aggregate() but either I couldn't get the right 
parameters, or this is not the right tool to use...

Thank's for any help !
--
Nicolas STRANSKY
Équipe Oncologie Moléculaire
Institut Curie - UMR 144 - CNRS Tel : +33 1 42 34 63 40
26, rue d'Ulm - 75248 Paris Cedex 5 - FRANCEFax : +33 1 42 34 63 49
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] question

2004-06-07 Thread zze-PELAY Nicolas FTRD/DMR/BEL
Hello,

I'd like to know if I can modify a constant value with a function.

Example :

a=4

f1-function()
{a=3}

Of course, after the function f1() is executed , the value of a is
always 4.
I'd like the value returned is 3, like it is possible in C by doing *a=3


Thank you

nicolas

[[alternative HTML version deleted]]

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


Re: [R] Aggregate rows to see the number of occurences

2004-06-07 Thread Petr Pikal
Hallo

On 7 Jun 2004 at 12:18, Nicolas STRANSKY wrote:

 Hi,
 
 I have a set of data like the following:
[,1]  [,2]
 [1,]   102
 [2,]70
 [3,]10
 [4,]10
 [5,]   150
 [6,]   174
 [7,]40
 [8,]   198
 [9,]   102
 [10,]  195

Maybe it can be done more elegantly but table and match can 
probably do what you want.

 tab
   V2 V3
1  10  2
2   7  0
3   1  0
4   1  0
5  15  0
6  17  4
7   4  0
8  19  8
9  10  2
10 19  5

 counts-table(tab[,1])
 count.no-as.numeric(names(counts))
 selection-match(tab[,1],count.no)

 cbind(tab,no=as.numeric(counts[selection]))
   V2 V3 no
1  10  2  2
2   7  0  1
3   1  0  2
4   1  0  2
5  15  0  1
6  17  4  1
7   4  0  1
8  19  8  2
9  10  2  2
10 19  5  2


Is this what you want?

Cheers
Petr

 
 I'd like to aggregate it in order to obtain the frequency (the number
 of occurences) for each couple of values (e.g.: (10,2) appears twice,
 (7,0) appears once). Something cool would be to have this value in a
 third column... I've been looking at aggregate() but either I couldn't
 get the right parameters, or this is not the right tool to use...
 
 Thank's for any help !
 
 -- 
 Nicolas STRANSKY
 quipe Oncologie Molculaire
 Institut Curie - UMR 144 - CNRS Tel : +33 1 42 34 63
 40 26, rue d'Ulm - 75248 Paris Cedex 5 - FRANCEFax : +33 1 42 34
 63 49
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html

Petr Pikal
[EMAIL PROTECTED]

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


Re: [R] question

2004-06-07 Thread Petr Pikal
Hi

On 7 Jun 2004 at 12:57, zze-PELAY Nicolas FTRD/DMR/BE 
wrote:

 Hello,
 
 I'd like to know if I can modify a constant value with a function.
 
 Example :
 
 a=4
 
 f1-function()
 {a=3}

Simply use - in the function. But I am not sure if this is 
recommendable way of items manipulating in R.

 f1-function() a-3
 f1()
 a-4
 a
[1] 4
 f1()
 a
[1] 3

Cheers
Petr

BTW using informative subject is preferable to plain question 
statement. :-)

 
 Of course, after the function f1() is executed , the value of a is
 always 4. I'd like the value returned is 3, like it is possible in C
 by doing *a=3
 
 
 Thank you
 
 nicolas
 
  [[alternative HTML version deleted]]
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html

Petr Pikal
[EMAIL PROTECTED]

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


Re: [R] Aggregate rows to see the number of occurences

2004-06-07 Thread Petr Pikal
Oops, you wanted to count number of pairs, this modification 
should work

int-interaction(tab[,1],tab[,2])
counts-table(int)
count.no-names(counts)
selection-match(int,count.no)
cbind(tab,no=as.numeric(counts[selection]))

Cheers
Petr





On 7 Jun 2004 at 13:05, Petr Pikal wrote:

 Hallo
 
 On 7 Jun 2004 at 12:18, Nicolas STRANSKY wrote:
 
  Hi,
  
  I have a set of data like the following:
 [,1]  [,2]
  [1,]   102
  [2,]70
  [3,]10
  [4,]10
  [5,]   150
  [6,]   174
  [7,]40
  [8,]   198
  [9,]   102
  [10,]  195
 
 Maybe it can be done more elegantly but table and match can 
 probably do what you want.
 
  tab
V2 V3
 1  10  2
 2   7  0
 3   1  0
 4   1  0
 5  15  0
 6  17  4
 7   4  0
 8  19  8
 9  10  2
 10 19  5
 
  counts-table(tab[,1])
  count.no-as.numeric(names(counts))
  selection-match(tab[,1],count.no)
 
  cbind(tab,no=as.numeric(counts[selection]))
V2 V3 no
 1  10  2  2
 2   7  0  1
 3   1  0  2
 4   1  0  2
 5  15  0  1
 6  17  4  1
 7   4  0  1
 8  19  8  2
 9  10  2  2
 10 19  5  2
 
 
 Is this what you want?
 
 Cheers
 Petr
 
  
  I'd like to aggregate it in order to obtain the frequency (the
  number of occurences) for each couple of values (e.g.: (10,2)
  appears twice, (7,0) appears once). Something cool would be to have
  this value in a third column... I've been looking at aggregate() but
  either I couldn't get the right parameters, or this is not the right
  tool to use...
  
  Thank's for any help !
  
  -- 
  Nicolas STRANSKY
  quipe Oncologie Molculaire
  Institut Curie - UMR 144 - CNRS Tel : +33 1 42 34 63
  40 26, rue d'Ulm - 75248 Paris Cedex 5 - FRANCEFax : +33 1 42 34
  63 49
  
  __
  [EMAIL PROTECTED] mailing list
  https://www.stat.math.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide!
  http://www.R-project.org/posting-guide.html
 
 Petr Pikal
 [EMAIL PROTECTED]
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html

Petr Pikal
[EMAIL PROTECTED]

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


[R] filled.contour - color palette so z=0 ONLY is blue

2004-06-07 Thread Laura Quinn
I am trying to create a topographic map of an island - the filled.contour
function works fine except i am experiencing difficulty trying to
represent the sea properly. Basically I want the default colour blue for
any instance where z=0, if I simply use the default topo.color I get
shades of blue for z values up to 220 metres. Is there a way in which I
can specify terrain.color for all values of z0 but blue for z=0 - or is
there another way of acheiving this simply?

Thanks,
Laura

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


Re: [R] Confidence intervals for predicted values in nls

2004-06-07 Thread joerg van den hoff
Cristina Silva wrote:
Dear all
I have tried to estimate the confidence intervals for predicted values of a
nonlinear model fitted with nls. The function predict gives the predicted
values and the lower and upper limits of the prediction, when the class of
the object is lm or glm. When the object is derived from nls, the function
predict (or predict.nls) gives only the predicted values. The se.fit and
interval aguments are just ignored.
Could anybody tell me how to estimate the confidence intervals for the
predicted values (not the model parameters), using an object of class nls?
Regards,
Cristina
--
Cristina Silva
IPIMAR - Departamento de Recursos Marinhos
Av. de Brasília, 1449-006 Lisboa
Portugal
Tel.: 351 21 3027096
Fax: 351 21 3015948
[EMAIL PROTECTED]
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

maybe this example helps:
==cut here===
#define a model formula (a and b are the parameters, f is x):
frml - k1 ~ f*(1-a*exp(-b/f))
#simulate some data:
a0 - .6
b0 - 1.2
f  - seq(0.01,4,length=20)
k1true- f*(1-a0*exp(-b0/f))
#include some noise
amp - .1
k1 - rnorm(k1true,k1true,amp*k1true)
#fit:
fifu - deriv(frml,c(a,b),function(a,b,x){})
rr-nls(k1~fifu(a,b,f),start=list(a=.5,b=1))
#the derivatives and variance/covariance matrix:
#(derivs could be extracted from fifu, too)
dk1.da - D(frml[[3]],'a')
dk1.db - D(frml[[3]],'b')
covar - vcov(rr)
#gaussian error propagation:
a - coef(rr)['a']
b - coef(rr)['b']
vark1 -
  eval(dk1.da)^2*covar[1,1]+
  eval(dk1.db)^2*covar[2,2]+
  2*eval(dk1.da)*eval(dk1.db)*covar[1,2]
errk1 - sqrt(vark1)
lower.bound - fitted(rr)-2*errk1  #two sigma !
upper.bound - fitted(rr)+2*errk1  #dito
plot(f,k1,pch=1)
ff - outer(c(1,1),f)
kk - outer(c(1,1),k1)*c(1-amp,1+amp)
matlines(ff,kk,lty=3,col=1)
matlines(f,cbind(k1true,fitted(rr),lower.bound,upper.bound),col=c(1,2,3,3),lty=c(1,1,2,2))
xylim - par('usr')
xpos - .1*(xylim[2]-xylim[1])+xylim[1]
ypos - xylim[4] - .1*(xylim[4]-xylim[3])
legend(xpos,ypos,
 c( 
'data',
'true',
'fit', 
'confidence'
  ), 
  pch=c(1,-1,-1,-1),
  lty=c(0,1,1,2),
  col=c(1,1,2,3)
)
==cut here===
if you put this in a file and source it a few times from within R you'll 
get an impression how often the fit deviates from the 'true' curve more 
than expected from
the shown confidence limits.

I believe this approach is 'nearly' valid as long as gaussian error 
probagation is valid (i.e. only to first order in covar and therefore 
for not too large std. errors, am I right?).
to my simple physicist's mind this should suffice to get 'reasonable' 
(probably, in strict sense, not completely correct?) confidence 
intervals for the fit/the prediction.
If somebody objects, please let me know!

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


Re: [R] Aggregate rows to see the number of occurences

2004-06-07 Thread Christophe Pallier
 I have a set of data like the following:
  [,1]  [,2]
[1,]   102 ...
[10,]  195
I'd like to aggregate it in order to obtain the frequency (the number 
of occurences) for each couple of values (e.g.: (10,2) appears twice, 
(7,0) appears once). Something cool would be to have this value in a 
third column...
I've been looking at aggregate() but either I couldn't get the right 
parameters, or this is not the right tool to use...

You can use:
x=paste(a[,1],a[,2],sep=,)
table(x)
then, if you need to have the count for each line from the original table:
 table(x)[x]
Or you could indeed use the 'aggregate' function:
 aggregate(a[,1],list(a[,1],a[,2]),length)
This yields one line per unique value (but that may be what you want...)
Christophe Pallier
www.pallier.org
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] filled.contour - color palette so z=0 ONLY is blue

2004-06-07 Thread Peter Dalgaard
Laura Quinn [EMAIL PROTECTED] writes:

 I am trying to create a topographic map of an island - the filled.contour
 function works fine except i am experiencing difficulty trying to
 represent the sea properly. Basically I want the default colour blue for
 any instance where z=0, if I simply use the default topo.color I get
 shades of blue for z values up to 220 metres. Is there a way in which I
 can specify terrain.color for all values of z0 but blue for z=0 - or is
 there another way of acheiving this simply?

 my.colors - function(n)c(blue,terrain.colors(n-1))
 data(volcano) 
 filled.contour(volcano, color = my.colors, asp = 1)

You'll probably need to diddle the levels=  setting too.
-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

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


Re: [R] question

2004-06-07 Thread TEMPL Matthias
 Hello,
 
 I'd like to know if I can modify a constant value with a function.
 
 Example :
 
 a=4
 
 f1-function()
 {a=3}
 
 Of course, after the function f1() is executed , the value of 
 a is always 4. I'd like the value returned is 3, like it is 
 possible in C by doing *a=3
 
Use return:

f1 - function()
{a=3; return(a)}


Matthias

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


RE: [R] Average R-squared of model1 to model n

2004-06-07 Thread Liaw, Andy
The Y1, Y2, etc. that Kan mentioned are predicted values of a test set data
from models that supposedly were fitted to the same (or similar) data.  It's
hard for me to imagine the outcome would be as `severe' as Y1 = -Y2.

That said, I do not think that the R-squared (or q-squared as some call it)
of the aggregate model is necessarily larger or equal to the average
R-squared of the component models.  It obviously depends on how the
component models are generated.  As a hypothetical example (because I
haven't acutally tried it, just speculating):  Suppose the data are
generated from a step function, the sort that would be perfect for
regression trees.  If one grows several well-pruned trees, I'd guess that
the average R-squared of the individual trees has a chance of being larger
than the R-squared of the averaged model.

Best,
Andy

 From: Gabor Grothendieck
 
 Suppose m=2, Y1=Y and Y2= -Y.  Then (b) is zero so (a) must be
 greater or equal to (b).  Thus (b) is not necessarily greater 
 than (a).
 
 
 kan Liu kan_liu1 at yahoo.com writes:
 
 : 
 : Hi,
 : 
 : We got a question about interpretating R-suqared.
 : 
 : The actual outputs for a test dataset is X=(x1,x2, ..., xn).
 : model 1 predicted the outputs as Y1=(y11,y12,..., y1n)
 : model n predicted the outputs as Y2=(y21,y22,..., y2n)
 : 
 : ... 
 : model m predicted the outputs as Ym=(ym1,ym2,..., ymn)
 : 
 : Now we have two ways to calculate R squared to evaluate the average 
 performance of committee model.
 : 
 : (a) Calculate R squared between (X, Y1), (X, Y2), ..., 
 (X,Ym), and then 
 averaging the R squared
 : (b) Calculate average Y=(Y1+Y2, + ... Ym)/m, and then 
 calculate the R 
 squared between (X, Y). 
 : 
 : We found it seemed that R squared calculated in (b) is 
 'always' higher than 
 that in (a).
 : 
 : Does this result depends on the test dataset or this 
 happened by chance?Can 
 you advise me any reference for
 : this issue? 
 : 
 : Many thanks in advance!
 : 
 : Kan
 : 
 : 
 : 
 : -
 : 
 : [[alternative HTML version deleted]]
 : 
 : __
 : R-help at stat.math.ethz.ch mailing list
 : https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 : PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 : 
 :
 
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 


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


[R] Lazy Evaluation?

2004-06-07 Thread Thomas Stabla
Hello,

I've stumbled upon following problem, when trying to overload the methods
for group Math for an S4-class which contains functions as slots.


  setClass(NumFunction, representation = list(fun = function))

  NumFunction - function(f) new(NumFunction, fun = f)

  square - function(x) x^2
  NF - NumFunction(square)

  setMethod(Math,
NumFunction,
function(x){
nfun  - function(n) callGeneric([EMAIL PROTECTED](n))
tmp - function(n) nfun(n)
NumFunction(tmp)
})

  sinNF - sin(NF)
  [EMAIL PROTECTED](sqrt(pi/2))

# works as expected, returns 1

# now a slightly different version of setMethod(Math, NumFunction,
# ...), which dispenses the unnecessary wrapper function tmp()

  setMethod(Math,
NumFunction,
function(x){
nfun  - function(n) callGeneric([EMAIL PROTECTED](n))
return(NumFunction(nfun))
})

   sinNF - sin(NF)
   [EMAIL PROTECTED](sqrt(pi/2))

# produces an error, namely:
# Error in typeof(fdef) : evaluation nested too deeply: infinite
# recursion / options(expression=)?


Replacing the generating function NumFunction() with corresponding
new(..) calls doesn't change the outcome.

When I call the newly defined functions nfun resp. tmp from within the
function body of setMethod(), e.g.

  setMethod(Math,
NumFunction,
function(x){
nfun  - function(n) callGeneric([EMAIL PROTECTED](n))
cat(nfun(1))
NumFunction(nfun)
})

by tmp(1) resp. nfun(1), both versions cat correct output when called by
sin(NF).

If I don't return NumFunction(tmp) resp. NumFunction(nfun) but tmp resp.
nfun, both versions work just fine, i.e. sin(NF)(sqrt(pi/2)) returns 1.

Would someone explain me this behavior? (R Version 1.9.0)

Best regards,
Thomas Stabla

Sourcecode can be found at:
http://www.uni-bayreuth.de/departments/math/org/mathe7/DISTR/NumFun.R

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


Re: [R] Aggregate rows to see the number of occurences

2004-06-07 Thread Nicolas STRANSKY
Petr Pikal wrote:
Oops, you wanted to count number of pairs, this modification 
should work

int-interaction(tab[,1],tab[,2])
counts-table(int)
count.no-names(counts)
selection-match(int,count.no)
cbind(tab,no=as.numeric(counts[selection]))
Yes, thank's for all your answers. This is a way to do what I wanted to.
I have to also say that there is a one-liner to do it :) (hint by P. 
Hup).

 x - cbind(c(10,7,1,1,15,17,4,19,10,19,10), c(2,0,0,0,0,4,0,8,2,5,2))
 aggregate(x, list(a=x[,1],b=x[,2]),NROW)
--
Nicolas STRANSKY
quipe Oncologie Molculaire
Institut Curie - UMR 144 - CNRS Tel : +33 1 42 34 63 40
26, rue d'Ulm - 75248 Paris Cedex 5 - FRANCEFax : +33 1 42 34 63 49
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Xtable giving an interesting problem

2004-06-07 Thread Shawn Way
I'm using the current version of xtable for 1.9.0 and I have an
interesting error:

Error in match.names(clabs, names(xi)) : names don't match previous
names:
 F value, Pr(F)
In addition: Warning message: 
longer object length
is not a multiple of shorter object length in: clabs == nmi 

This is produced in the following manner:

data.trans - data.frame(ref=rep(c(3.995,20.003),2),
  actual=c(.1,100.3,.1,100.3),
  level=gl(2,1))
 
parameters - data.frame(trans.range=c(0,100), trans.output=c(4,20),
  ref.error=c(.0074))
a - lm(trans.range~trans.output,data=parameters)
pred - data.frame(trans.output=data.trans$actual)
data.trans$cor - predict(a,pred)
fit.trans - lm(cor~ref,data.trans)
fit.trans.aov - aov(cor~ref+Error(level),data.trans)
fit.trans

Call:
lm(formula = cor ~ ref, data = data.trans)

Coefficients:
(Intercept)  ref  
-180.6639.12  

 fit.trans.aov

Call:
aov(formula = cor ~ ref + Error(level), data = data.trans)

Grand Mean: 288.75 

Stratum 1: level

Terms:
 ref
Sum of Squares  392189.1
Deg. of Freedom1

Estimated effects are balanced

Stratum 2: Within

Terms:
   Residuals
Sum of Squares  1.074245e-27
Deg. of Freedom2

Residual standard error: 2.317591e-14 
 summary(fit.trans.aov)

Error: level
Df Sum Sq Mean Sq
ref  1 392189  392189

Error: Within
  Df Sum SqMean Sq F value Pr(F)
Residuals  2 1.0742e-27 5.3712e-28   
 library(xtable)
 xtable(fit.trans.aov)
Error in match.names(clabs, names(xi)) : names don't match previous
names:
 F value, Pr(F)
In addition: Warning message: 
longer object length
is not a multiple of shorter object length in: clabs == nmi 


Any ideas?


Everything should made as simple as possible, but not simpler. 
-Albert Einstein


Shawn Way, PE
Tanox, Inc.
10301 Stella Link
Houston, TX 77025
Engineering Manager
Sway[at]tanox.com



Note: Any use, dissemination, forwarding, printing or copying of this
e-mail without consent of Tanox, Inc. is not authorized.  Further, this
communication may contain confidential information intended only for the
person to whom it is addressed, and any use, dissemination, forwarding,
printing or copying of such confidential information without the express
consent of Tanox or in violation of any agreements to which the
recipient is subject is prohibited.  If you have received this e-mail in
error, please immediately notify the sender and delete the original and
all copies.  Any views or opinions expressed may be solely those of the
author and do not necessarily represent the views or opinions of Tanox,
Inc.

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


Re: [R] Xtable giving an interesting problem

2004-06-07 Thread Prof Brian Ripley
Did you try dump.frames/debugger?  Or even traceback()?

 debugger()
Message:  Error in match.names(clabs, names(xi)) : names don't match 
previous names:
 F value, Pr(F)
Available environments had calls:
1: xtable(fit.trans.aov)
2: xtable.aovlist(fit.trans.aov)
3: xtable.summary.aovlist(summary(x), caption = caption, label = label, 
align = ali
4: rbind(result, xtable.anova(x[[i]][[1]], caption = caption, label = 
label, align
5: rbind(...)
6: match.names(clabs, names(xi))
7: stop(paste(names don't match previous names:\n\t, paste(nmi[nii == 0], collaps

and if you look in xtable.summary.aovlist you will see it is trying to 
rbind a dataframe with 5 columns to one with three columns.  That's not
surprising given the print output for summary(fit.trans.aov) and is a 
design error in the xtable package that should be reported to the 
maintainer.

However, is this model really `interesting'?  I cannot see what you hoped 
to learn by fitting it.


On Mon, 7 Jun 2004, Shawn Way wrote:

 I'm using the current version of xtable for 1.9.0 and I have an
 interesting error:
 
 Error in match.names(clabs, names(xi)) : names don't match previous
 names:
F value, Pr(F)
 In addition: Warning message: 
 longer object length
   is not a multiple of shorter object length in: clabs == nmi 
 
 This is produced in the following manner:
 
 data.trans - data.frame(ref=rep(c(3.995,20.003),2),
   actual=c(.1,100.3,.1,100.3),
   level=gl(2,1))
  
 parameters - data.frame(trans.range=c(0,100), trans.output=c(4,20),
   ref.error=c(.0074))
 a - lm(trans.range~trans.output,data=parameters)
 pred - data.frame(trans.output=data.trans$actual)
 data.trans$cor - predict(a,pred)
 fit.trans - lm(cor~ref,data.trans)
 fit.trans.aov - aov(cor~ref+Error(level),data.trans)
 fit.trans
 
 Call:
 lm(formula = cor ~ ref, data = data.trans)
 
 Coefficients:
 (Intercept)  ref  
 -180.6639.12  
 
  fit.trans.aov
 
 Call:
 aov(formula = cor ~ ref + Error(level), data = data.trans)
 
 Grand Mean: 288.75 
 
 Stratum 1: level
 
 Terms:
  ref
 Sum of Squares  392189.1
 Deg. of Freedom1
 
 Estimated effects are balanced
 
 Stratum 2: Within
 
 Terms:
Residuals
 Sum of Squares  1.074245e-27
 Deg. of Freedom2
 
 Residual standard error: 2.317591e-14 
  summary(fit.trans.aov)
 
 Error: level
 Df Sum Sq Mean Sq
 ref  1 392189  392189
 
 Error: Within
   Df Sum SqMean Sq F value Pr(F)
 Residuals  2 1.0742e-27 5.3712e-28   
  library(xtable)
  xtable(fit.trans.aov)
 Error in match.names(clabs, names(xi)) : names don't match previous
 names:
F value, Pr(F)
 In addition: Warning message: 
 longer object length
   is not a multiple of shorter object length in: clabs == nmi 
 
 
 Any ideas?
 
 
 Everything should made as simple as possible, but not simpler. 
 -Albert Einstein
 
 
 Shawn Way, PE
 Tanox, Inc.
 10301 Stella Link
 Houston, TX 77025
 Engineering Manager
 Sway[at]tanox.com
 
 
 
 Note: Any use, dissemination, forwarding, printing or copying of this
 e-mail without consent of Tanox, Inc. is not authorized.  Further, this
 communication may contain confidential information intended only for the
 person to whom it is addressed, and any use, dissemination, forwarding,
 printing or copying of such confidential information without the express
 consent of Tanox or in violation of any agreements to which the
 recipient is subject is prohibited.  If you have received this e-mail in
 error, please immediately notify the sender and delete the original and
 all copies.  Any views or opinions expressed may be solely those of the
 author and do not necessarily represent the views or opinions of Tanox,
 Inc.
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 
 

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

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


Re: [R] question

2004-06-07 Thread Martin Maechler
 Petr == Petr Pikal [EMAIL PROTECTED]
 on Mon, 07 Jun 2004 13:12:07 +0200 writes:

Petr Hi On 7 Jun 2004 at 12:57, zze-PELAY Nicolas
Petr FTRD/DMR/BE wrote:

 Hello,
 
 I'd like to know if I can modify a constant value with a
 function.
 
 Example :
 
 a=4
 
 f1-function() {a=3}

Petr Simply use - in the function.
yes.

Petr But I am not sure if this is recommendable way of
Petr items manipulating in R. 

Thank you, Petr.  Indeed, I am even sure that it *is* not recommended:
Very much recommended is to write a function such that 

 1) it only uses its arguments (and no global variables) as input
 2) provides all its results as return() value, often a list().

There are exceptions to these rules, e.g. for plot() 
functions, 2) will often not be true [and for print.*() methods,
the unwritten R standard asks for print.*(x, ) to return(invisible(x))]
1) {and sometimes 2) as well} will be violated for UI (not only GUI)
functions. 

When working very large objects, it can make sense to
violate both 1) and 2).. -- but that's really for more
advanced programming.

Martin Maechler

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


Re: [R] MCLUST Covariance Parameterization.

2004-06-07 Thread [EMAIL PROTECTED]
Hi Christian and thanks for your message. 
 
From reading standard mixture model books, I don't recall any of them talking 
directly about shape, orientation, and volume. So, in the finite mixture context I'm 
not exactly sure what these terms even mean as they relate to the covariance matrix. 
Maybe I'm missing something but it seems that the Fraley and Raftery framework is 
different than any mixture approach I've read about. 
 
I have a three dimensional model. Thus, the covariance matrix will be 3 by 3 for each 
of the G classes. I want the covariance matrix to be unrestricted (i.e., each of the 6 
elements free to be estimated), yet for each of the G classes to share a common 
covariance matrix. That is, Sigma_1=Sigma_2=...=Sigma_G, where the elements are 
themselves unrestricted. 
 
My problem is translating the structure of the covariance matrix to the Fraley and 
Raftery framework. Reading their work I kept thanking they would have a table that 
translated the structure of the covariance matrix to their method of parameterization. 
You mention that it is the most intuitive framework, and I would agree if what was 
interested was the volume, shape, orientation, and distribution. My impression though 
is that people think in terms of the covariance structure. Where are these terms even 
defined? 
 
Anyway, thanks for your help. Any insight would be greatly appreciated. 
Ken


Christian Hennig [EMAIL PROTECTED] wrote:
Dear Ken,

in principle you have all relevant informations already in your mail.
As far as I know, the parameterization of Fraley and Raftery is the most 
intuitive one. I don't know for which kind of application you need 
direct parameterization,
but in my experience the parameters volume, shape and orientation are 
more interesting in most applications than the direct values of Sigma_k.

However, not all possible structures seem to be implemented. Your examples
are not, I suspect:

 What do the distribution, volume, shape, and orientation mean for a 
 Sigma_k=sigma^2*I where I is a p by p covariance matrix, sigma^2 is the constant 
 variance and Sigma_1=Sigma_2=…=Sigma_G. 

This would be VEE. If you assume det(Sigma_1)=1 (which is necessary for your
parameterization to be identified), then sigma^2 is lambda, i.e., 
the volume parameter, and Sigma_1 would be the remaining matrix product.
However, VEE is not implemented. You may mail to Chris Fraley and ask why...
You see that the problem is not the parameterization, but the fact that 
VEE is missing in mclust.

(It is somewhat confusing the you use I for the covariance matrix, because
emclust uses this letter for a covariance matrix, which is the identity 
matrix.)


 What about when a Sigma_k=sigma^2_k*I, or when Sigma_1=Sigma_2=…=Sigma_G in 
 situations where each element of the (constant across class) covariance matrix is 
 different?

I do not really understand this. Do you want to assume that the elements of
Sigma_1 should be pairwise different? Why do you need such an assumption?
That's not a very favourable choice for estimation, I think, and it would 
be estimated by VEE as well (which would yield such a solution with
probability 1), if it would be implemented.

Best,
Christian

***
Christian Hennig
Fachbereich Mathematik-SPST/ZMS, Universitaet Hamburg
[EMAIL PROTECTED], http://www.math.uni-hamburg.de/home/hennig/
###
ich empfehle www.boag-online.de


__



[[alternative HTML version deleted]]

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


[R] Precision for a former question*

2004-06-07 Thread zze-PELAY Nicolas FTRD/DMR/BEL
I got many answers to the question I asked below , and I thank you all.
Several of you told me to use - but told also that it is not a
recommendable way of items manipulating in R.
I don't really understand what it exactly means :
1) does it mean it's not a very good way of programming , a
dangerous way of programming because the variable a can be modified ? ,
etc
Or  2) does it mean that R is not done to manipulate the operation
- in a function in a safe way , that  there can be some mistakes, that
the memory allocation is not forseen for this case?
 
I indeed saw in the archive the function f - function(x) { g -
function() x[1] - x[1]+1; g() } # g nested , which is an exemple of
function where x (of the global environnement) won't be modified when
doing f(x) , but I'm not in the case of complicated  programmes such as
f.
I am just carefull because in my programmes, I use arrays with important
datas , and it would better for my programmes to be able to modify some
variables (of the global environnement) directly in my function by using
-. Consequently, I just want to be sure that I will note have false
results , and that i won't have problems I can't deal with (such as
allocation memory). 
So , is it 1) or 2) ?
Thank you

Nicolas

--
* Former question :
I'd like to know if I can modify a constant value with a function.

Example :

a=4

f1-function()
{a=3}

Of course, after the function f1() is executed , the value of a is
always 4.
I'd like the value returned is 3, like it is possible in C by doing *a=3


[[alternative HTML version deleted]]

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


Re: [R] MCLUST Covariance Parameterization.

2004-06-07 Thread Christian Hennig
Hi Ken,

it seems that you want equal covariance matrices, which means equal, but
free volume, orientation and shape. That's EEE, and it *is*
implemented. 

I still do not really understand your translation problem. All
information is in the formula which appeared in your first posting:

Sigma_k = lambda_k*D_k*A_k*D_k^'

That is, if you have lambda (volume0), D (orientation, orthogonal) and A
(shape, diagonal0), you can compute Sigma and if you have Sigma, you can
compute lambda, A, and D by spectral decomposition. 

Hope this helps,
Christian

On Mon, 7 Jun 2004, [EMAIL PROTECTED] wrote:

 Hi Christian and thanks for your message. 
  
 From reading standard mixture model books, I don't recall any of them talking 
 directly about shape, orientation, and volume. So, in the finite mixture context 
 I'm not exactly sure what these terms even mean as they relate to the covariance 
 matrix. Maybe I'm missing something but it seems that the Fraley and Raftery 
 framework is different than any mixture approach I've read about. 
  
 I have a three dimensional model. Thus, the covariance matrix will be 3 by 3 for 
 each of the G classes. I want the covariance matrix to be unrestricted (i.e., each 
 of the 6 elements free to be estimated), yet for each of the G classes to share a 
 common covariance matrix. That is, Sigma_1=Sigma_2=...=Sigma_G, where the elements 
 are themselves unrestricted. 
  
 My problem is translating the structure of the covariance matrix to the Fraley and 
 Raftery framework. Reading their work I kept thanking they would have a table that 
 translated the structure of the covariance matrix to their method of 
 parameterization. You mention that it is the most intuitive framework, and I would 
 agree if what was interested was the volume, shape, orientation, and distribution. 
 My impression though is that people think in terms of the covariance structure. 
 Where are these terms even defined? 
  
 Anyway, thanks for your help. Any insight would be greatly appreciated. 
 Ken
 
 
 Christian Hennig [EMAIL PROTECTED] wrote:
 Dear Ken,
 
 in principle you have all relevant informations already in your mail.
 As far as I know, the parameterization of Fraley and Raftery is the most 
 intuitive one. I don't know for which kind of application you need 
 direct parameterization,
 but in my experience the parameters volume, shape and orientation are 
 more interesting in most applications than the direct values of Sigma_k.
 
 However, not all possible structures seem to be implemented. Your examples
 are not, I suspect:
 
  What do the distribution, volume, shape, and orientation mean for a 
  Sigma_k=sigma^2*I where I is a p by p covariance matrix, sigma^2 is the constant 
  variance and Sigma_1=Sigma_2=…=Sigma_G. 
 
 This would be VEE. If you assume det(Sigma_1)=1 (which is necessary for your
 parameterization to be identified), then sigma^2 is lambda, i.e., 
 the volume parameter, and Sigma_1 would be the remaining matrix product.
 However, VEE is not implemented. You may mail to Chris Fraley and ask why...
 You see that the problem is not the parameterization, but the fact that 
 VEE is missing in mclust.
 
 (It is somewhat confusing the you use I for the covariance matrix, because
 emclust uses this letter for a covariance matrix, which is the identity 
 matrix.)
 
 
  What about when a Sigma_k=sigma^2_k*I, or when Sigma_1=Sigma_2=…=Sigma_G in 
  situations where each element of the (constant across class) covariance matrix is 
  different?
 
 I do not really understand this. Do you want to assume that the elements of
 Sigma_1 should be pairwise different? Why do you need such an assumption?
 That's not a very favourable choice for estimation, I think, and it would 
 be estimated by VEE as well (which would yield such a solution with
 probability 1), if it would be implemented.
 
 Best,
 Christian
 
 ***
 Christian Hennig
 Fachbereich Mathematik-SPST/ZMS, Universitaet Hamburg
 [EMAIL PROTECTED], http://www.math.uni-hamburg.de/home/hennig/
 ###
 ich empfehle www.boag-online.de
 
 
 __
 
 
 
   [[alternative HTML version deleted]]
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

***
Christian Hennig
Fachbereich Mathematik-SPST/ZMS, Universitaet Hamburg
[EMAIL PROTECTED], http://www.math.uni-hamburg.de/home/hennig/
###
ich empfehle www.boag-online.de

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 

Re: [R] contour lines on levelplot?

2004-06-07 Thread Spencer Graves
Thanks very much.  spencer graves
Deepayan Sarkar wrote:
On Sunday 06 June 2004 20:40, Spencer Graves wrote:
 

 With image and contour, one can get both colors and lines
to enhance the image of a contour plot.  What's the best way to do
this with Lattice graphics?  The following is one ugly hack,
producing the desired result after much trial and error (R 1.9.1
alpha under Windows 2000):
# setup
DF - expand.grid(x=1:3, y=1:3)
DF$z - (DF$x+DF$y)
# Traditional base graphics:
image(x=1:3, y=1:3, z=array(DF$z, dim=c(3,3)))
contour(x=1:3, y=1:3, z=array(DF$z, dim=c(3,3)), add=T)
# Lattice hack:
lvlplt - levelplot(z~x*y, DF)
cont - contourplot(z~x*y, DF)
print(lvlplt, more=T)
print(cont, position=c(0, 0, 0.9055, 1))
##
 By comparison, the same ugly hack in S-Plus required 0.952
instead of 0.955.  Is this the best we can currently get with a
modest effort?
   

There's certainly much easier ways to do this, namely 

contourplot(z~x*y, DF, region = TRUE)
or 

levelplot(z~x*y, DF, contour = TRUE)
the only restriction being that you would need to use the same 'at' 
vector. If you want them to differ, you need to write a small panel 
function of your own that makes use of panel.levelplot().

Deepayan
 

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


[R] Vectors of years, months, and days to dates?

2004-06-07 Thread Shin, Daehyok
The interface for dates in R is a little confusing to me.
I want to create a vector of Date objects from vectors of years, months, and
days.
One solution I found is:

years - c(1991, 1992)
months - c(1, 10)
days - c(1, 2)

dates - as.Date(ISOdate(years, months, days))

But, in this solution the ISOdate function converts the vectors into
characters,
which can cause serious performance and memory loss
when the vectors of years, months, and days are huge.
I am quite sure there is much better solution for it. What is it?

Thanks.

Daehyok Shin

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


[R] models for compositional data by J. Aitchison

2004-06-07 Thread Schmidt.Matthias (FORST)
Hi,
is there any R software for model building with data of the compositional
data type:
The statistical analysis of compositional data by J. Aitchison.

thanks

***
Matthias Schmidt
Forstliche Versuchs- und Forschungsanstalt Baden-Württemberg (FVA) 
Abteilung Biometrie und Informatik
Wonnhaldestr. 4
79100 Freiburg i. Br
Tel.: + 49 (0)761 / 4018 -187
Fax: + 49 (0)761 / 4018 - 333

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


Re: [R] Vectors of years, months, and days to dates?

2004-06-07 Thread Prof Brian Ripley
On Mon, 7 Jun 2004, Shin, Daehyok wrote:

 The interface for dates in R is a little confusing to me.
 I want to create a vector of Date objects from vectors of years, months, and
 days.
 One solution I found is:
 
 years - c(1991, 1992)
 months - c(1, 10)
 days - c(1, 2)
 
 dates - as.Date(ISOdate(years, months, days))
 
 But, in this solution the ISOdate function converts the vectors into
 characters,
 which can cause serious performance and memory loss
 when the vectors of years, months, and days are huge.

Really?  You have measured the loss?  A million causes no problem for 
example, and what are you going to do with a million dates that is 
instantaneous and worthwhile?  And a million dates are hardly going to be 
unique so you only need to convert the unique values.

 I am quite sure there is much better solution for it. What is it?

Write your own C code, or make a POSIXlt object directly from the numbers 
and convert that.

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

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


Re: [R] Vectors of years, months, and days to dates?

2004-06-07 Thread Roger Bivand
On Mon, 7 Jun 2004, Daehyok Shin wrote:

 How can I create POSIXlt directly from the numbers?
 I failed to find the solution from help documents.

?POSIXlt

?as.POSIXlt:

 res - as.POSIXlt(paste(years, months, days, sep=-))
 str(res)
`POSIXlt', format: chr [1:2] 1991-01-01 1992-10-02
 res$year 
[1] 91 92

 
 Daehyok
 
 --On Monday, June 07, 2004 4:44 PM +0100 Prof Brian Ripley 
 [EMAIL PROTECTED] wrote:
 
  On Mon, 7 Jun 2004, Shin, Daehyok wrote:
 
  The interface for dates in R is a little confusing to me.
  I want to create a vector of Date objects from vectors of years, months,
  and days.
  One solution I found is:
 
  years - c(1991, 1992)
  months - c(1, 10)
  days - c(1, 2)
 
  dates - as.Date(ISOdate(years, months, days))
 
  But, in this solution the ISOdate function converts the vectors into
  characters,
  which can cause serious performance and memory loss
  when the vectors of years, months, and days are huge.
 
  Really?  You have measured the loss?  A million causes no problem for
  example, and what are you going to do with a million dates that is
  instantaneous and worthwhile?  And a million dates are hardly going to be
  unique so you only need to convert the unique values.
 
  I am quite sure there is much better solution for it. What is it?
 
  Write your own C code, or make a POSIXlt object directly from the numbers
  and convert that.
 
  --
  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
 
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: [EMAIL PROTECTED]

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


Re: [R] Precision for a former question*

2004-06-07 Thread Duncan Murdoch
On Mon, 7 Jun 2004 16:08:58 +0200, zze-PELAY Nicolas FTRD/DMR/BEL
[EMAIL PROTECTED] wrote :

I got many answers to the question I asked below , and I thank you all.
Several of you told me to use - but told also that it is not a
recommendable way of items manipulating in R.
I don't really understand what it exactly means :
   1) does it mean it's not a very good way of programming , a
dangerous way of programming because the variable a can be modified ? ,
etc
Or 2) does it mean that R is not done to manipulate the operation
- in a function in a safe way , that  there can be some mistakes, that
the memory allocation is not forseen for this case?

I think it's dangerous in the first sense.  It's best to try to
contain the effects of functions as much as possible, avoiding side
effects like a change to a variable outside the function.

Something else that hasn't been mentioned is that - is different in
R and S-PLUS, so it may come to haunt you if you ever try to port your
code there.

Duncan Murdoch

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


RE: [R] Vectors of years, months, and days to dates?

2004-06-07 Thread Shin, Daehyok
  res - as.POSIXlt(paste(years, months, days, sep=-))

This command still convert numbers to a character vector, right?

Daehyok Shin (Peter)
Terrestrial Hydrological Ecosystem Modellers
Geography Department
University of North Carolina-Chapel Hill
[EMAIL PROTECTED]

We can do no great things, 
only small things with great love.
 - Mother Teresa

 -Original Message-
 From: Roger Bivand [mailto:[EMAIL PROTECTED]
 Sent: Monday, June 07, 2004 PM 12:20
 To: Daehyok Shin
 Cc: R, Help
 Subject: Re: [R] Vectors of years, months, and days to dates?
 
 
 On Mon, 7 Jun 2004, Daehyok Shin wrote:
 
  How can I create POSIXlt directly from the numbers?
  I failed to find the solution from help documents.
 
 ?POSIXlt
 
 ?as.POSIXlt:
 
  res - as.POSIXlt(paste(years, months, days, sep=-))
  str(res)
 `POSIXlt', format: chr [1:2] 1991-01-01 1992-10-02
  res$year 
 [1] 91 92
 
  
  Daehyok
  
  --On Monday, June 07, 2004 4:44 PM +0100 Prof Brian Ripley 
  [EMAIL PROTECTED] wrote:
  
   On Mon, 7 Jun 2004, Shin, Daehyok wrote:
  
   The interface for dates in R is a little confusing to me.
   I want to create a vector of Date objects from vectors of 
 years, months,
   and days.
   One solution I found is:
  
   years - c(1991, 1992)
   months - c(1, 10)
   days - c(1, 2)
  
   dates - as.Date(ISOdate(years, months, days))
  
   But, in this solution the ISOdate function converts the vectors into
   characters,
   which can cause serious performance and memory loss
   when the vectors of years, months, and days are huge.
  
   Really?  You have measured the loss?  A million causes no problem for
   example, and what are you going to do with a million dates that is
   instantaneous and worthwhile?  And a million dates are hardly 
 going to be
   unique so you only need to convert the unique values.
  
   I am quite sure there is much better solution for it. What is it?
  
   Write your own C code, or make a POSIXlt object directly from 
 the numbers
   and convert that.
  
   --
   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
  
  
  __
  [EMAIL PROTECTED] mailing list
  https://www.stat.math.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
  
 
 -- 
 Roger Bivand
 Economic Geography Section, Department of Economics, Norwegian School of
 Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
 Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
 e-mail: [EMAIL PROTECTED]
 
 


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


RE: [R] Vectors of years, months, and days to dates?

2004-06-07 Thread Shin, Daehyok
Thanks, but, what I want is to convert three vectors of years, months, and
days directly into POSIXlt or Date objects
without creating character vectors.

Daehyok Shin (Peter)
Terrestrial Hydrological Ecosystem Modellers
Geography Department
University of North Carolina-Chapel Hill
[EMAIL PROTECTED]

We can do no great things,
only small things with great love.
 - Mother Teresa

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Monday, June 07, 2004 PM 12:15
 To: [EMAIL PROTECTED]
 Subject: Re: [R] Vectors of years, months, and days to dates?






 If you 'unclass' dates you will get a numeric vector that just
 has the days
 since the epoch.  Is this what you want?

  years - c(1991, 1992)
  months - c(1, 10)
  days - c(1, 2)
 
  dates - as.Date(ISOdate(years, months, days))
  dates
 [1] 1991-01-01 1992-10-02
  str(dates)
 Class 'Date'  num [1:2] 7670 8310
  unclass(dates)
 [1] 7670 8310
 
 __
 James HoltmanWhat is the problem you are trying to solve?
 Executive Technical Consultant  --  Office of Technology, Convergys
 [EMAIL PROTECTED]
 +1 (513) 723-2929




   Shin, Daehyok

   [EMAIL PROTECTED]To:   R,
 Help [EMAIL PROTECTED]
   cc:

   Sent by: Subject:  [R]
 Vectors of years, months, and days to dates?
   [EMAIL PROTECTED]

   ath.ethz.ch





   06/07/2004 11:16

   Please respond to

   sdhyok









 The interface for dates in R is a little confusing to me.
 I want to create a vector of Date objects from vectors of years, months,
 and
 days.
 One solution I found is:

 years - c(1991, 1992)
 months - c(1, 10)
 days - c(1, 2)

 dates - as.Date(ISOdate(years, months, days))

 But, in this solution the ISOdate function converts the vectors into
 characters,
 which can cause serious performance and memory loss
 when the vectors of years, months, and days are huge.
 I am quite sure there is much better solution for it. What is it?

 Thanks.

 Daehyok Shin

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





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


Re: [R] Vectors of years, months, and days to dates?

2004-06-07 Thread Peter Dalgaard
Prof Brian Ripley [EMAIL PROTECTED] writes:

 On Mon, 7 Jun 2004, Shin, Daehyok wrote:
 
  The interface for dates in R is a little confusing to me.
  I want to create a vector of Date objects from vectors of years, months, and
  days.
  One solution I found is:
  
  years - c(1991, 1992)
  months - c(1, 10)
  days - c(1, 2)
  
  dates - as.Date(ISOdate(years, months, days))
  
  But, in this solution the ISOdate function converts the vectors into
  characters,
  which can cause serious performance and memory loss
  when the vectors of years, months, and days are huge.
 
 Really?  You have measured the loss?  A million causes no problem for 
 example, and what are you going to do with a million dates that is 
 instantaneous and worthwhile?  And a million dates are hardly going to be 
 unique so you only need to convert the unique values.

However, considering what goes on in ISOdatetime, one might as well do

  as.Date(paste(years, months, days, sep=-))


-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

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


[R] error message

2004-06-07 Thread Tim York
I received the below error using UNIX R.  Could someone instruct me on 
helpful batch options to avoid this please? 

ERROR: cannot allocate vector of size 32kb
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] Vectors of years, months, and days to dates?

2004-06-07 Thread Roger Bivand
On Mon, 7 Jun 2004, Shin, Daehyok wrote:

   res - as.POSIXlt(paste(years, months, days, sep=-))
 
 This command still convert numbers to a character vector, right?

Yes, as Prof. Ripley said, the overhead of conversion to character and
using carefully crafted R functions is much less, for reasonable numbers
of dates, than inserting all the appropriate values into the POSIXlt class
object, since you need, in addition to years (since 1900), checked
month-days (31 February?), and months, week-days, year days, daylight
savings time flag, and seconds, minutes and hours. 

I would also be interested to know whether you can demonstrate
(system.time()) that anything reliable is faster than as.POSIXlt() for
fewer than millions of dates (and would you trust it on 29 February even
if it was faster?). Using base classes and functions is in general much
more robust than rolling your own, simply because many more people use
them - they have much more data run through them, and the time you might
save trying to avoid integer to character conversion will/should be eaten
up by debugging.

 
 Daehyok Shin (Peter)
 Terrestrial Hydrological Ecosystem Modellers
 Geography Department
 University of North Carolina-Chapel Hill
 [EMAIL PROTECTED]
 
 We can do no great things, 
 only small things with great love.
  - Mother Teresa
 
  -Original Message-
  From: Roger Bivand [mailto:[EMAIL PROTECTED]
  Sent: Monday, June 07, 2004 PM 12:20
  To: Daehyok Shin
  Cc: R, Help
  Subject: Re: [R] Vectors of years, months, and days to dates?
  
  
  On Mon, 7 Jun 2004, Daehyok Shin wrote:
  
   How can I create POSIXlt directly from the numbers?
   I failed to find the solution from help documents.
  
  ?POSIXlt
  
  ?as.POSIXlt:
  
   res - as.POSIXlt(paste(years, months, days, sep=-))
   str(res)
  `POSIXlt', format: chr [1:2] 1991-01-01 1992-10-02
   res$year 
  [1] 91 92
  
   
   Daehyok
   
   --On Monday, June 07, 2004 4:44 PM +0100 Prof Brian Ripley 
   [EMAIL PROTECTED] wrote:
   
On Mon, 7 Jun 2004, Shin, Daehyok wrote:
   
The interface for dates in R is a little confusing to me.
I want to create a vector of Date objects from vectors of 
  years, months,
and days.
One solution I found is:
   
years - c(1991, 1992)
months - c(1, 10)
days - c(1, 2)
   
dates - as.Date(ISOdate(years, months, days))
   
But, in this solution the ISOdate function converts the vectors into
characters,
which can cause serious performance and memory loss
when the vectors of years, months, and days are huge.
   
Really?  You have measured the loss?  A million causes no problem for
example, and what are you going to do with a million dates that is
instantaneous and worthwhile?  And a million dates are hardly 
  going to be
unique so you only need to convert the unique values.
   
I am quite sure there is much better solution for it. What is it?
   
Write your own C code, or make a POSIXlt object directly from 
  the numbers
and convert that.
   
--
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
   
   
   __
   [EMAIL PROTECTED] mailing list
   https://www.stat.math.ethz.ch/mailman/listinfo/r-help
   PLEASE do read the posting guide! 
  http://www.R-project.org/posting-guide.html
   
  
  -- 
  Roger Bivand
  Economic Geography Section, Department of Economics, Norwegian School of
  Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
  Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
  e-mail: [EMAIL PROTECTED]
  
  
  
 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: [EMAIL PROTECTED]

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


Re: [R] Vectors of years, months, and days to dates?

2004-06-07 Thread Peter Dalgaard
Shin, Daehyok [EMAIL PROTECTED] writes:

 Thanks, but, what I want is to convert three vectors of years, months, and
 days directly into POSIXlt or Date objects
 without creating character vectors.

Well, if you insist:

 x - as.POSIXlt(structure(rep(0,2),class=POSIXct))
 x$year - years-1900
 x$mon - months-1
 x$mday - days
 as.Date(as.POSIXct(x))

This is definitely not kosher programming, and I doubt that it is the
least bit faster than the other solutions, but there's no character
vectors in there...

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

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


Re: [R] Vectors of years, months, and days to dates?

2004-06-07 Thread Gabor Grothendieck
Shin, Daehyok sdhyok at email.unc.edu writes:

 
 Thanks, but, what I want is to convert three vectors of years, months, and
 days directly into POSIXlt or Date objects
 without creating character vectors.

I would probably just convert it to character using paste and from
that to Date as others have already suggested but if it is really
important to you for some reason not to use character variables
as intermediates try this:

require(chron)
z - structure(julian(months, days, years), class=Date)

Note that when you print it out it may look like its character but
its not.Try 

class(z)
is.character(z)
str(z)
dput(z)

to convince yourself.

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


RE: [R] error message

2004-06-07 Thread Liaw, Andy
The message says at some point in the calculation, R tries to get about
312MB of memory and was not able to.  Maybe try increasing the amount of
virtual (or physical) memory in your system?

Andy

 From: Tim York
 
 I received the below error using UNIX R.  Could someone 
 instruct me on 
 helpful batch options to avoid this please? 
 
 ERROR: cannot allocate vector of size 32kb
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 


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


[R] (low level) profiling of code

2004-06-07 Thread Liaw, Andy
Dear R-help,

Can some one tell me how to profile compiled code dynamically loaded into R?
Here's what I tried on our dual Opteron running SUSE Linux Enterprise Server
8 (GCC 3.3):

Start with R-patched dated 2004-06-07: 

(I also had MAIN_CFLAGS=-pg in config.site.)

R is now configured for x86_64-unknown-linux-gnu

  Source directory:  .
  Installation directory:/usr/local

  C compiler:gcc  -O2 -g -pg -march=k8 -msse2 -m64
  C++ compiler:  g++  -O2 -g -pg -march=k8 -msse2 -m64
  Fortran compiler:  g77  -O2 -g -pg -march=k8 -msse2 -m64

  Interfaces supported:  X11, tcltk
  External libraries:readline
  Additional capabilities:   PNG, JPEG
  Options enabled:   R profiling

  Recommended packages:  no

I then tried running 

  /path/to/R-patched/bin/R CMD BATCH -q -slave myscript.R

where inside myscript.R is call to R functions that calls .C().  However,
this does not produce the gmon.out file.  Can anyone tell me what I'm
missing?  Any help much appreciated!

Best,
Andy

Andy Liaw, PhD
Biometrics Research  PO Box 2000, RY33-300 
Merck Research Labs   Rahway, NJ 07065
andy_liaw (at) merck.com732-594-0820

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


Re: [R] (low level) profiling of code

2004-06-07 Thread Prof Brian Ripley
You normally need to switch R profiling off, as that uses the same
interrupts as low-level profiling.

I would expect you to get gmon.out output from the the main R executable 
on any run, so the first question must be `does your OS support -pg?'

I don't think dynamically loaded code is relevant (provided it is compiled
with -pg).  I am pretty sure I managed to profile some examples from the
cluster package on RH8.0 Linux the other day.

On Mon, 7 Jun 2004, Liaw, Andy wrote:

 Dear R-help,
 
 Can some one tell me how to profile compiled code dynamically loaded into R?
 Here's what I tried on our dual Opteron running SUSE Linux Enterprise Server
 8 (GCC 3.3):
 
 Start with R-patched dated 2004-06-07: 
 
 (I also had MAIN_CFLAGS=-pg in config.site.)
 
 R is now configured for x86_64-unknown-linux-gnu
 
   Source directory:  .
   Installation directory:/usr/local
 
   C compiler:gcc  -O2 -g -pg -march=k8 -msse2 -m64
   C++ compiler:  g++  -O2 -g -pg -march=k8 -msse2 -m64
   Fortran compiler:  g77  -O2 -g -pg -march=k8 -msse2 -m64
 
   Interfaces supported:  X11, tcltk
   External libraries:readline
   Additional capabilities:   PNG, JPEG
   Options enabled:   R profiling
 
   Recommended packages:  no
 
 I then tried running 
 
   /path/to/R-patched/bin/R CMD BATCH -q -slave myscript.R
 
 where inside myscript.R is call to R functions that calls .C().  However,
 this does not produce the gmon.out file.  Can anyone tell me what I'm
 missing?  Any help much appreciated!


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

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


Re: [R] ask for help

2004-06-07 Thread Wolski
Hi Don!

Welcome new R user.

Just use one of the mailing list search interfaces which you can find browsing the 
www.r-project.org page.
After you find the search interface just paste you error message in the search form.
I ensure you you will find the a lot of e-mails wich will help you to solve your 
problem.

Sincerely

Eryk

*** REPLY SEPARATOR  ***

On 6/7/2004 at 1:44 PM don wrote:

Dear colleagues,
I am a beginner of using R. I am involved in some microarray data 
analyses and found that R is the most common software in this area. I 
tried to install the free software today. It seemed to be successful in 
installing, but when I trigger the short-cut, I got a error massage 
saying 'Fetal error: invalid HOMEDRIVE'. I have no idea where the 
homedrive was defined (or implied) and how to solve the problem. I 
wonder if someone could help me to start the first step of this fancy
trip.
Many thanks!

Don Li
National Cancer Institute of Canada - Clinical Trials Group

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



Dipl. bio-chem. Eryk Witold Wolski@MPI-Moleculare Genetic   
Ihnestrasse 63-73 14195 Berlin   'v'
tel: 0049-30-83875219   /   \
mail: [EMAIL PROTECTED]---W-Whttp://www.molgen.mpg.de/~wolski

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


Re: [R] ask for help

2004-06-07 Thread Prof Brian Ripley
The problem is probably a bug in your OS.  You haven't even told us what
that is, but I bet you have Windows XP with critical update KB835732
installed.  If so, see

http://www.murdoch-sutherland.com/HOMEPATH.html

and the archives of this list.

On Mon, 7 Jun 2004, don wrote:

 I am a beginner of using R. I am involved in some microarray data 
 analyses and found that R is the most common software in this area. I 
 tried to install the free software today. It seemed to be successful in 
 installing, but when I trigger the short-cut, I got a error massage 
 saying 'Fetal error: invalid HOMEDRIVE'. I have no idea where the 
 homedrive was defined (or implied) and how to solve the problem. I 
 wonder if someone could help me to start the first step of this fancy trip.

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

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


Re: [R] ask for help

2004-06-07 Thread Rolf Turner

Don Li wrote:

 I am a beginner of using R. I am involved in some microarray data 
 analyses and found that R is the most common software in this area. I 
 tried to install the free software today. It seemed to be successful in 
 installing, but when I trigger the short-cut, I got a error massage 
 saying 'Fetal error: .

Shouldn't that be ``Foetal error''? :-)

cheers,

Rolf Turner
[EMAIL PROTECTED]

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


RE: [R] Vectors of years, months, and days to dates?

2004-06-07 Thread Shin, Daehyok
Is what I asked such an exceptional case?
A lot of data I am dealing with (usually hydrologic data) are recorded with
three columns of years, months, and days.
In my opinion, the direct conversion from numeric vectors of years, months
and days into some internal representation of date
is widely supported in most matrix oriented languages (ex. datenum() in
MATLAB).
Am I really asking an odd operation for date conversion?

For performance, you are right. The loss of performance is negligible when
users call it directly.
But, what happens when it is called in an iterative loop?
How can we assume some functions are only called directly by users in an
interactive shell?

Please consider positively this kind of simple interface for as.Date.
I am quite sure this operation will be used widely once implemented.

as.Date(c(years, months, days))

Is there no one supporting my idea?

Daehyok Shin (Peter)
Terrestrial Hydrological Ecosystem Modellers
Geography Department
University of North Carolina-Chapel Hill
[EMAIL PROTECTED]

We can do no great things,
only small things with great love.
 - Mother Teresa

 -Original Message-
 From: Roger Bivand [mailto:[EMAIL PROTECTED]
 Sent: Monday, June 07, 2004 PM 1:02
 To: Shin, Daehyok
 Cc: R, Help
 Subject: RE: [R] Vectors of years, months, and days to dates?


 On Mon, 7 Jun 2004, Shin, Daehyok wrote:

res - as.POSIXlt(paste(years, months, days, sep=-))
 
  This command still convert numbers to a character vector, right?

 Yes, as Prof. Ripley said, the overhead of conversion to character and
 using carefully crafted R functions is much less, for reasonable numbers
 of dates, than inserting all the appropriate values into the POSIXlt class
 object, since you need, in addition to years (since 1900), checked
 month-days (31 February?), and months, week-days, year days, daylight
 savings time flag, and seconds, minutes and hours.

 I would also be interested to know whether you can demonstrate
 (system.time()) that anything reliable is faster than as.POSIXlt() for
 fewer than millions of dates (and would you trust it on 29 February even
 if it was faster?). Using base classes and functions is in general much
 more robust than rolling your own, simply because many more people use
 them - they have much more data run through them, and the time you might
 save trying to avoid integer to character conversion will/should be eaten
 up by debugging.

 
  Daehyok Shin (Peter)
  Terrestrial Hydrological Ecosystem Modellers
  Geography Department
  University of North Carolina-Chapel Hill
  [EMAIL PROTECTED]
 
  We can do no great things,
  only small things with great love.
   - Mother Teresa
 
   -Original Message-
   From: Roger Bivand [mailto:[EMAIL PROTECTED]
   Sent: Monday, June 07, 2004 PM 12:20
   To: Daehyok Shin
   Cc: R, Help
   Subject: Re: [R] Vectors of years, months, and days to dates?
  
  
   On Mon, 7 Jun 2004, Daehyok Shin wrote:
  
How can I create POSIXlt directly from the numbers?
I failed to find the solution from help documents.
  
   ?POSIXlt
  
   ?as.POSIXlt:
  
res - as.POSIXlt(paste(years, months, days, sep=-))
str(res)
   `POSIXlt', format: chr [1:2] 1991-01-01 1992-10-02
res$year
   [1] 91 92
  
   
Daehyok
   
--On Monday, June 07, 2004 4:44 PM +0100 Prof Brian Ripley
[EMAIL PROTECTED] wrote:
   
 On Mon, 7 Jun 2004, Shin, Daehyok wrote:

 The interface for dates in R is a little confusing to me.
 I want to create a vector of Date objects from vectors of
   years, months,
 and days.
 One solution I found is:

 years - c(1991, 1992)
 months - c(1, 10)
 days - c(1, 2)

 dates - as.Date(ISOdate(years, months, days))

 But, in this solution the ISOdate function converts the
 vectors into
 characters,
 which can cause serious performance and memory loss
 when the vectors of years, months, and days are huge.

 Really?  You have measured the loss?  A million causes no
 problem for
 example, and what are you going to do with a million dates that is
 instantaneous and worthwhile?  And a million dates are hardly
   going to be
 unique so you only need to convert the unique values.

 I am quite sure there is much better solution for it. What is it?

 Write your own C code, or make a POSIXlt object directly from
   the numbers
 and convert that.

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

   
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting 

RE: [R] Vectors of years, months, and days to dates?

2004-06-07 Thread Rolf Turner
Daehyok Shin (Peter) wrote:

 Is what I asked such an exceptional case?

Apparently.

 A lot of data I am dealing with (usually hydrologic data) are
 recorded with three columns of years, months, and days.  In my
 opinion, the direct conversion from numeric vectors of years, months
 and days into some internal representation of date is widely
 supported in most matrix oriented languages (ex. datenum() in
 MATLAB).  Am I really asking an odd operation for date conversion?

Apparently.  You still haven't given any indication of what's
wrong with the way R does things, which is perfectly
transparent and user friendly.  If other packages do things
in a slightly different way, so what?

 For performance, you are right. The loss of performance is negligible
 when users call it directly.  But, what happens when it is called in
 an iterative loop?  How can we assume some functions are only called
 directly by users in an interactive shell?

Have you ***any*** evidence that R's procedure degrades
performance, under any circumstances?  (Apparently not.) In
that case why are you going on and on about it?

 Please consider positively this kind of simple interface for as.Date.
 [as.Date(c(years, months, days))]

The standard response to this kind of request is ``R is a
cooperative endeavour.  Feel free to contribute.''

 I am quite sure this operation will be used widely once implemented.

Have you ***any*** evidence for this assertion?

 Is there no one supporting my idea?

Apparently not.

cheers,

Rolf Turner
[EMAIL PROTECTED]

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


Re: [R] GLMM(..., family=binomial(link=cloglog))?

2004-06-07 Thread Spencer Graves
 Thanks, Andy, Doug, Deepayan.  I now have lme4 0.6-1 2004/05/31 
installed for R 1.9.1 alpha under Windows 2000.  When I tried the 
example below, GLMM ran, but the print method reported an error: 

Generalized Linear Mixed Model
Fixed: immun ~ 1
Data: guImmun
log-likelihood:  -1440.052
Random effects:
Groups NameVariance Std.Dev.
comm   (Intercept) 0.31686  0.5629 

Estimated scale (compare to 1)  0.9717356
Error in cm[, 1] : incorrect number of dimensions
 The following is a possibly simpler example that returns the same 
error message: 

 simDF - data.frame(yield=(1:4)/5, gp=factor(rep(1:2,2)), nobs=5)
 simFit - GLMM(yield~1, family=binomial, data=simDF, random=~1|gp, 
weights=nobs)
Iteration 1 Termination Criterion: 2.206532e-08
Iteration 2 Termination Criterion: 8.659736e-16
 simFit
Generalized Linear Mixed Model

Fixed: yield ~ 1
Data: simDF
log-likelihood:  -2.128803
Random effects:
Groups NameVariance   Std.Dev. 
gp (Intercept) 2.2065e-09 4.6974e-05

Estimated scale (compare to 1)  1
Error in cm[, 1] : incorrect number of dimensions

 Any suggestions on what I should try next?  So far, I've only 
gotten this with an intercept-only model such as yield~1.  When I added 
a term from the help file example making it, immun ~ kid2p, this error 
disappeared. 

 Thanks,
 Spencer Graves
Liaw, Andy wrote:
As Doug said in his announcement, version 0.6-1 of lme4 (which is pure R
code) depends on the Matrix package, version 0.8-7.  AFAICT the Windows
binary on CRAN for Matrix is version 0.8-6.  Not sure if that will work with
the current lme4...  It's probably best to wait for the right versions of
these packages to propagate to appropriate places on CRAN...
Best,
Andy
 

From: Spencer Graves
Hi, Deepayan: 

 Thanks for your reply.  How can I get the new release 
in a Windows 
2000 format, downloaded and properly installed? 

 I tried update.packages, but the new version has not yet 
migrated within reach of the default update.packages 
function call.  I 
tried downloading lme4 0.6-0-2.tar.gz from 
http://www.stat.wisc.edu/%7Ebates/;, unzipping it and 
replacing the old 
\\R\rw1090pat\library\lme4 with the new.  Unfortunately, 
when I then 
tried to start R, I got a fatal error message: 

 Error in loadNamespace(i[[1]], c(lib.loc, libPaths()), 
keep.source):  There is no package called 'Matrix'. 

 Fortunately, I was able to restore R to apparently functioning 
order by merely restoring the old version. 

 Is there something easy I can do to get lme4 
0.6-0-2.tar.gz to 
install properly for me?  Or do I need to wait until it 
migrates to my 
update.packages default (http://cran.r-project.org;) or some other 
designated CRAN mirror? 

 Thanks for your excellent work in bringing this 
excellent software 
to its present state. 

 Best Wishes,
 spencer graves
Deepayan Sarkar wrote:
   

On Tuesday 01 June 2004 17:25, Spencer Graves wrote:
 

I'm having trouble using binomial(link=cloglog) with GLMM in
lme4, Version: 0.5-2, Date: 2004/03/11.  The example in the 
   

Help file
   

works fine, even simplified as follows:
fm0 - GLMM(immun~1, data=guImmun, family=binomial,
random=~1|comm)
However, for another application, I need
binomial(link=cloglog),
and this generates an error for me:
   

fm0. - GLMM(immun~1, data=guImmun,
family=binomial(link=cloglog),
 

random=~1|comm)
Error in getClass(thisClass) : family is not a defined class
Error in GLMM(immun ~ 1, data = guImmun, family = binomial(link =
cloglog),  :
  S language method selection got an error when called from
internal dispatch for function GLMM
Any suggestions?
  

   

This should work better in the new lme4 (0.6-x) announced 
 

earlier today 
   

on r-packages. There is still a bug with cases (like in your 
 

example) 
   

with only one fixed effect where the show and summary 
 

methods produce 
   

an error, but that should be fixed soon.
Deepayan
 

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

   

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

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


RE: [R] Vectors of years, months, and days to dates?

2004-06-07 Thread Roger Bivand
On Mon, 7 Jun 2004, Shin, Daehyok wrote:

 Is what I asked such an exceptional case?
 A lot of data I am dealing with (usually hydrologic data) are recorded with
 three columns of years, months, and days.
 In my opinion, the direct conversion from numeric vectors of years, months
 and days into some internal representation of date
 is widely supported in most matrix oriented languages (ex. datenum() in
 MATLAB).
 Am I really asking an odd operation for date conversion?
 
 For performance, you are right. The loss of performance is negligible when
 users call it directly.
 But, what happens when it is called in an iterative loop?
 How can we assume some functions are only called directly by users in an
 interactive shell?

Please read the code inside the functions we have been discussing. You 
will see that there is plenty of error checking, which is needed. In 
addition, paste() is vectorised. Specifically:

 years - sample(1900:2000, 10, replace=TRUE)
 months - sample(1:12, 10, replace=TRUE)
 days - sample(1:28, 10, replace=TRUE)
 system.time(x - as.Date(as.POSIXlt(paste(years, months, days, sep=-
[1] 5.91 0.02 5.98 0.00 0.00
 f - function(y, m, d) { # taken from Peter Dalgaard's reply
+ x - as.POSIXlt(structure(rep(0,length(y)),class=POSIXct))
+ x$year - y-1900
+ x$mon - m-1
+ x$mday - d
+ as.Date(as.POSIXct(x))
+ }
 system.time(y - f(years, months, days))
[1] 2.76 0.01 2.78 0.00 0.00
 identical(x, y)
[1] TRUE

So for 10 dates, the integer insertion is only about twice as fast, 
but it took much longer than the difference to find that out.

 
 Please consider positively this kind of simple interface for as.Date.
 I am quite sure this operation will be used widely once implemented.
 
 as.Date(c(years, months, days))

I have a feeling that won't do what you want, really. Looking at 
as.POSIXlt, and as.Date, you could create a variant recognising an integer 
matrix with your special class as having years in column 1, etc., but I 
think that your implementation and support costs will outbalance the 
saving you think you are making. 

The most enjoyable fortunes package has a fitting opinion:

 fortune(Fox)

I think that it's generally a good idea not to resist the most natural way of
programming in R.
   -- John Fox
  R-help (March 2004)
 
 Is there no one supporting my idea?

Well, you are, so that's a start - contribute an as.Date.MatrixOfDates 
method to dispatch on a MatrixOfDates class, and you may find others?

 
 Daehyok Shin (Peter)
 Terrestrial Hydrological Ecosystem Modellers
 Geography Department
 University of North Carolina-Chapel Hill
 [EMAIL PROTECTED]
 
 We can do no great things,
 only small things with great love.
  - Mother Teresa
 
  -Original Message-
  From: Roger Bivand [mailto:[EMAIL PROTECTED]
  Sent: Monday, June 07, 2004 PM 1:02
  To: Shin, Daehyok
  Cc: R, Help
  Subject: RE: [R] Vectors of years, months, and days to dates?
 
 
  On Mon, 7 Jun 2004, Shin, Daehyok wrote:
 
 res - as.POSIXlt(paste(years, months, days, sep=-))
  
   This command still convert numbers to a character vector, right?
 
  Yes, as Prof. Ripley said, the overhead of conversion to character and
  using carefully crafted R functions is much less, for reasonable numbers
  of dates, than inserting all the appropriate values into the POSIXlt class
  object, since you need, in addition to years (since 1900), checked
  month-days (31 February?), and months, week-days, year days, daylight
  savings time flag, and seconds, minutes and hours.
 
  I would also be interested to know whether you can demonstrate
  (system.time()) that anything reliable is faster than as.POSIXlt() for
  fewer than millions of dates (and would you trust it on 29 February even
  if it was faster?). Using base classes and functions is in general much
  more robust than rolling your own, simply because many more people use
  them - they have much more data run through them, and the time you might
  save trying to avoid integer to character conversion will/should be eaten
  up by debugging.
 
  
   Daehyok Shin (Peter)
   Terrestrial Hydrological Ecosystem Modellers
   Geography Department
   University of North Carolina-Chapel Hill
   [EMAIL PROTECTED]
  
   We can do no great things,
   only small things with great love.
- Mother Teresa
  
-Original Message-
From: Roger Bivand [mailto:[EMAIL PROTECTED]
Sent: Monday, June 07, 2004 PM 12:20
To: Daehyok Shin
Cc: R, Help
Subject: Re: [R] Vectors of years, months, and days to dates?
   
   
On Mon, 7 Jun 2004, Daehyok Shin wrote:
   
 How can I create POSIXlt directly from the numbers?
 I failed to find the solution from help documents.
   
?POSIXlt
   
?as.POSIXlt:
   
 res - as.POSIXlt(paste(years, months, days, sep=-))
 str(res)
`POSIXlt', format: chr [1:2] 1991-01-01 1992-10-02
 res$year
[1] 91 92
   

 Daehyok

 --On 

Re: [R] GLMM(..., family=binomial(link=cloglog))?

2004-06-07 Thread Douglas Bates
Spencer Graves [EMAIL PROTECTED] writes:

   Thanks, Andy, Doug, Deepayan.  I now have lme4 0.6-1 2004/05/31
 installed for R 1.9.1 alpha under Windows 2000.  When I tried the
 example below, GLMM ran, but the print method reported an error:
 Generalized Linear Mixed Model

As I write this I am uploading lme4_0.6-2 to the incoming area at
CRAN.  This version fixes that bug (I neglected to add drop=FALSE in a
subsetting operation in the show method for the summary.ssclme class.)

You can see the details of the fix at
  http://bates4.stat.wisc.edu:2180/cgi-bin/viewcvs.cgi/trunk/lme4/R/ssclme.R
or

/home/bates/src/Rlibs/lme4 $ svn diff -r 209 R/ssclme.R
Index: R/ssclme.R
===
--- R/ssclme.R  (revision 209)
+++ R/ssclme.R  (working copy)
@@ -205,7 +205,7 @@
   cm = cbind(cm, stat, pval)
   colnames(cm) = c(nms, t value, Pr(|t|))
   } else {
-  cm = cm[, 1:2]
+  cm = cm[, 1:2, drop = FALSE]
   stat = cm[,1]/cm[,2]
   pval = 2*pnorm(abs(stat), lower = FALSE)
   nms = colnames(cm)

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


Re: [R] GLMM(..., family=binomial(link=cloglog))?

2004-06-07 Thread Spencer Graves
Hi, Doug: 

 Thanks.  I ran 'tst - getMethod(show, summary.ssclme)', then 
edited tst as you indicated and ran 'setMethod(show, summary.ssclme, 
tst)', and it fixed the problem. 

 Best Wishes,
 spencer graves 

Douglas Bates wrote:
Spencer Graves [EMAIL PROTECTED] writes:
 

 Thanks, Andy, Doug, Deepayan.  I now have lme4 0.6-1 2004/05/31
installed for R 1.9.1 alpha under Windows 2000.  When I tried the
example below, GLMM ran, but the print method reported an error:
Generalized Linear Mixed Model
   

As I write this I am uploading lme4_0.6-2 to the incoming area at
CRAN.  This version fixes that bug (I neglected to add drop=FALSE in a
subsetting operation in the show method for the summary.ssclme class.)
You can see the details of the fix at
 http://bates4.stat.wisc.edu:2180/cgi-bin/viewcvs.cgi/trunk/lme4/R/ssclme.R
or
/home/bates/src/Rlibs/lme4 $ svn diff -r 209 R/ssclme.R
Index: R/ssclme.R
===
--- R/ssclme.R  (revision 209)
+++ R/ssclme.R  (working copy)
@@ -205,7 +205,7 @@
  cm = cbind(cm, stat, pval)
  colnames(cm) = c(nms, t value, Pr(|t|))
  } else {
-  cm = cm[, 1:2]
+  cm = cm[, 1:2, drop = FALSE]
  stat = cm[,1]/cm[,2]
  pval = 2*pnorm(abs(stat), lower = FALSE)
  nms = colnames(cm)
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

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


[R] error during make of R-patched on Fedora core 2

2004-06-07 Thread Gavin Simpson
Dear list,
I've just upgraded to Fedora Core 2 and seeing as there wasn't an rpm 
for this OS on CRAN yet I thought it was about time I had a go at 
compiling R myself. Having run into the X11 problem I switched to trying 
to install R-patched. I followed the instructions in the R Installation 
 Admin manual to download the sources of the Recommended packages and 
place the files in R_HOME/src/library/Recommended. ./configure worked 
fine so I progressed to make, which has hit upon this error when the 
process arrived at the Recommended packages:

make[2]: Leaving directory `/home/gavin/tmp/R-patched/src/library'
make[2]: Entering directory `/home/gavin/tmp/R-patched/src/library'
building/updating vignettes for package 'grid' ...
make[2]: Leaving directory `/home/gavin/tmp/R-patched/src/library'
make[2]: Entering directory `/home/gavin/tmp/R-patched/src/library'
make[2]: Leaving directory `/home/gavin/tmp/R-patched/src/library'
make[1]: Leaving directory `/home/gavin/tmp/R-patched/src/library'
make[1]: Entering directory 
`/home/gavin/tmp/R-patched/src/library/Recommended'
make[2]: Entering directory 
`/home/gavin/tmp/R-patched/src/library/Recommended'
make[2]: Leaving directory 
`/home/gavin/tmp/R-patched/src/library/Recommended'
make[2]: Entering directory 
`/home/gavin/tmp/R-patched/src/library/Recommended'
make[2]: *** No rule to make target `survival.ts', needed by 
`stamp-recommended'.  Stop.
make[2]: Leaving directory 
`/home/gavin/tmp/R-patched/src/library/Recommended'
make[1]: *** [recommended-packages] Error 2
make[1]: Leaving directory 
`/home/gavin/tmp/R-patched/src/library/Recommended'
make: *** [stamp-recommended] Error 2

Being a relative newbie to Linux I have no-idea how to continue to solve 
this issue :-(

The only difference I can see between the /src/library/Recommended 
directories of R-1.9.0 and R-patched is that in R-1.9.0 it contains 
links to each of the tar.gz (excluding the version info) as well as the 
tar.gz themselves for each of the packages. Is this in some way related 
to my problem?

If anyone can help me solve this issue I'd be most grateful.
Thanks in advance,
Gavin
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd.  ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] error during make of R-patched on Fedora core 2

2004-06-07 Thread Roger Bivand
This feels like:

After downloading the R sources you should also download the recommended 
packages by entering the R source tree and running

tools/rsync-recommended

from a shell command line.

from the R Sources page on CRAN - could you try that (I guess rsync is 
installed on most Linux standard distributions)?

On Mon, 7 Jun 2004, Gavin Simpson wrote:

 Dear list,
 
 I've just upgraded to Fedora Core 2 and seeing as there wasn't an rpm 
 for this OS on CRAN yet I thought it was about time I had a go at 
 compiling R myself. Having run into the X11 problem I switched to trying 
 to install R-patched. I followed the instructions in the R Installation 
  Admin manual to download the sources of the Recommended packages and 
 place the files in R_HOME/src/library/Recommended. ./configure worked 
 fine so I progressed to make, which has hit upon this error when the 
 process arrived at the Recommended packages:
 
 make[2]: Leaving directory `/home/gavin/tmp/R-patched/src/library'
 make[2]: Entering directory `/home/gavin/tmp/R-patched/src/library'
 building/updating vignettes for package 'grid' ...
 make[2]: Leaving directory `/home/gavin/tmp/R-patched/src/library'
 make[2]: Entering directory `/home/gavin/tmp/R-patched/src/library'
 make[2]: Leaving directory `/home/gavin/tmp/R-patched/src/library'
 make[1]: Leaving directory `/home/gavin/tmp/R-patched/src/library'
 make[1]: Entering directory 
 `/home/gavin/tmp/R-patched/src/library/Recommended'
 make[2]: Entering directory 
 `/home/gavin/tmp/R-patched/src/library/Recommended'
 make[2]: Leaving directory 
 `/home/gavin/tmp/R-patched/src/library/Recommended'
 make[2]: Entering directory 
 `/home/gavin/tmp/R-patched/src/library/Recommended'
 make[2]: *** No rule to make target `survival.ts', needed by 
 `stamp-recommended'.  Stop.
 make[2]: Leaving directory 
 `/home/gavin/tmp/R-patched/src/library/Recommended'
 make[1]: *** [recommended-packages] Error 2
 make[1]: Leaving directory 
 `/home/gavin/tmp/R-patched/src/library/Recommended'
 make: *** [stamp-recommended] Error 2
 
 Being a relative newbie to Linux I have no-idea how to continue to solve 
 this issue :-(
 
 The only difference I can see between the /src/library/Recommended 
 directories of R-1.9.0 and R-patched is that in R-1.9.0 it contains 
 links to each of the tar.gz (excluding the version info) as well as the 
 tar.gz themselves for each of the packages. Is this in some way related 
 to my problem?
 
 If anyone can help me solve this issue I'd be most grateful.
 
 Thanks in advance,
 
 Gavin
 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: [EMAIL PROTECTED]

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


[R] latex function in Hmisc

2004-06-07 Thread BXC (Bendix Carstensen)
Is there a way to prevent latex.default() from starting LaTeX and JUST
create the file requested?
I generate a number of LaTeX tables for inclusion in a document running
R in batch, and I don't want a lot of calls to LaTeX. 
I cannot find any arguments for that task in the documentation.
It seems a little clumsy to have to direct the output from a function
with a file argument using sink() and 'file='.

Bendix Carstensen
--
Bendix Carstensen
Senior Statistician
Steno Diabetes Center
Niels Steensens Vej 2
DK-2820 Gentofte
Denmark
tel: +45 44 43 87 38
mob: +45 30 75 87 38
fax: +45 44 43 07 06
[EMAIL PROTECTED]
www.biostat.ku.dk/~bxc

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


Re: [R] error during make of R-patched on Fedora core 2

2004-06-07 Thread Marc Schwartz
On Mon, 2004-06-07 at 15:08, Gavin Simpson wrote:
 Dear list,
 
 I've just upgraded to Fedora Core 2 and seeing as there wasn't an rpm 
 for this OS on CRAN yet I thought it was about time I had a go at 
 compiling R myself. Having run into the X11 problem I switched to trying 
 to install R-patched. I followed the instructions in the R Installation 
  Admin manual to download the sources of the Recommended packages and 
 place the files in R_HOME/src/library/Recommended. ./configure worked 
 fine so I progressed to make, which has hit upon this error when the 
 process arrived at the Recommended packages:
 
 make[2]: Leaving directory `/home/gavin/tmp/R-patched/src/library'
 make[2]: Entering directory `/home/gavin/tmp/R-patched/src/library'
 building/updating vignettes for package 'grid' ...
 make[2]: Leaving directory `/home/gavin/tmp/R-patched/src/library'
 make[2]: Entering directory `/home/gavin/tmp/R-patched/src/library'
 make[2]: Leaving directory `/home/gavin/tmp/R-patched/src/library'
 make[1]: Leaving directory `/home/gavin/tmp/R-patched/src/library'
 make[1]: Entering directory 
 `/home/gavin/tmp/R-patched/src/library/Recommended'
 make[2]: Entering directory 
 `/home/gavin/tmp/R-patched/src/library/Recommended'
 make[2]: Leaving directory 
 `/home/gavin/tmp/R-patched/src/library/Recommended'
 make[2]: Entering directory 
 `/home/gavin/tmp/R-patched/src/library/Recommended'
 make[2]: *** No rule to make target `survival.ts', needed by 
 `stamp-recommended'.  Stop.
 make[2]: Leaving directory 
 `/home/gavin/tmp/R-patched/src/library/Recommended'
 make[1]: *** [recommended-packages] Error 2
 make[1]: Leaving directory 
 `/home/gavin/tmp/R-patched/src/library/Recommended'
 make: *** [stamp-recommended] Error 2
 
 Being a relative newbie to Linux I have no-idea how to continue to solve 
 this issue :-(
 
 The only difference I can see between the /src/library/Recommended 
 directories of R-1.9.0 and R-patched is that in R-1.9.0 it contains 
 links to each of the tar.gz (excluding the version info) as well as the 
 tar.gz themselves for each of the packages. Is this in some way related 
 to my problem?
 
 If anyone can help me solve this issue I'd be most grateful.
 
 Thanks in advance,
 
 Gavin


You might want to try the following commands using rsync as an
alternative to downloading the tarball:

rsync -rCv rsync.r-project.org::r-patched R-patched
./R-patched/tools/rsync-recommended
cd R-patched
./configure
make

I actually have the above in a script file that I can just run quickly,
when I want to update the code.

I am now running FC2, so if you have any problems, drop me a line.

Best regards,

Marc Schwartz

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


Re: [R] error during make of R-patched on Fedora core 2

2004-06-07 Thread Gavin Simpson
Roger Bivand wrote:
This feels like:
After downloading the R sources you should also download the recommended 
packages by entering the R source tree and running

tools/rsync-recommended
from a shell command line.
from the R Sources page on CRAN - could you try that (I guess rsync is 
installed on most Linux standard distributions)?

On Mon, 7 Jun 2004, Gavin Simpson wrote:
snip
Thanks Roger and Marc, for suggesting I use ./tools/rsync-recommended 
from within the R-patched directory.

This seems to have done the trick as make completed without errors this 
time round. The Recommended directory also contained the links to the 
actual tar.gz files after doing the rsync command, so I guess this was 
the problem (or at least related to it.) I'm off home now with the 
laptop to see if I can finish make check-all and make install R.

I have re-read the section describing the installation process for 
R-patched or R-devel in the R Installation and Administration manual 
(from R.1.9.0) just in case I missed something. Section 1.2 of this 
manual indicates that one can proceed *either* by downloading R-patched 
and then the Recommended packages from CRAN and placing the tar.gz files 
in R_HOME/src/library/Recommended, or by using rsync to download 
R-patched, and then to get the Recommended packages. The two are quite 
separately documented in the manual, and do seem to be in disagreement 
with the R-sources page on the CRAN website, which doesn't mention the 
manual download method (for Recommended) at all.

Is there something wrong with the current Recommended files on CRAN, or 
is the section in the R Installation  Admin manual out-of-date or in 
error, or am I missing something vital here? This isn't a complaint: I'm 
just pointing this out in case this is something that needs updating in 
the documentation.

All the best,
Gavin
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson [T] +44 (0)20 7679 5522
ENSIS Research Fellow [F] +44 (0)20 7679 7565
ENSIS Ltd.  ECRC [E] [EMAIL PROTECTED]
UCL Department of Geography   [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] error during make of R-patched on Fedora core 2

2004-06-07 Thread Douglas Bates
Gavin Simpson [EMAIL PROTECTED] writes:

 Dear list,
 
 I've just upgraded to Fedora Core 2 and seeing as there wasn't an rpm
 for this OS on CRAN yet I thought it was about time I had a go at
 compiling R myself. Having run into the X11 problem I switched to
 trying to install R-patched. I followed the instructions in the R
 Installation  Admin manual to download the sources of the Recommended
 packages and place the files in
 R_HOME/src/library/Recommended. ./configure worked fine so I
 progressed to make, which has hit upon this error when the process
 arrived at the Recommended packages:
 
 
 make[2]: Leaving directory `/home/gavin/tmp/R-patched/src/library'
 make[2]: Entering directory `/home/gavin/tmp/R-patched/src/library'
 building/updating vignettes for package 'grid' ...
 make[2]: Leaving directory `/home/gavin/tmp/R-patched/src/library'
 make[2]: Entering directory `/home/gavin/tmp/R-patched/src/library'
 make[2]: Leaving directory `/home/gavin/tmp/R-patched/src/library'
 make[1]: Leaving directory `/home/gavin/tmp/R-patched/src/library'
 make[1]: Entering directory
 `/home/gavin/tmp/R-patched/src/library/Recommended'
 
 make[2]: Entering directory
 `/home/gavin/tmp/R-patched/src/library/Recommended'
 
 make[2]: Leaving directory
 `/home/gavin/tmp/R-patched/src/library/Recommended'
 
 make[2]: Entering directory
 `/home/gavin/tmp/R-patched/src/library/Recommended'
 
 make[2]: *** No rule to make target `survival.ts', needed by
 `stamp-recommended'.  Stop.
 
 make[2]: Leaving directory
 `/home/gavin/tmp/R-patched/src/library/Recommended'
 
 make[1]: *** [recommended-packages] Error 2
 make[1]: Leaving directory
 `/home/gavin/tmp/R-patched/src/library/Recommended'
 
 make: *** [stamp-recommended] Error 2
 
 Being a relative newbie to Linux I have no-idea how to continue to
 solve this issue :-(
 
 
 The only difference I can see between the /src/library/Recommended
 directories of R-1.9.0 and R-patched is that in R-1.9.0 it contains
 links to each of the tar.gz (excluding the version info) as well as
 the tar.gz themselves for each of the packages. Is this in some way
 related to my problem?
 
 
 If anyone can help me solve this issue I'd be most grateful.
 
 Thanks in advance,

The easiest approach is to run
 ./tools/rsync-recommended 
from the top-level source directory for R.  That uses rsync to
downloads the sources for the recommended packages then creates the
necessary links.  (At least it works for R-devel and I believe it
works for R-patched.  There was a time when the links were not getting
corrected properly.)

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


[R] Load a dll

2004-06-07 Thread Rui
Hi folks,
 
I have a question about how to load a dll. 
First, I use the command 
 dyn.load(lassofu.dll);
then, I got the message below
“NULL
Warning message: 
DLL attempted to change FPU control word from 9001f to 90003”;
After I tried to use this dll in one of s functions, I got the message
below
“Error in .Fortran(lasso, as.double(x), as.double(y), as.double(b),
as.integer(n),  : 
Fortran function name not in load table”.
BTW, my system is Windows98 + R1.9.0.
Could anyone help me to solve this question? Thanks
 
Rui Wang
 
Phone: (403)220-4501
Email: [EMAIL PROTECTED]
Department of Mathematics and Statistics
University of Calgary
 

[[alternative HTML version deleted]]

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


Re: [R] error during make of R-patched on Fedora core 2

2004-06-07 Thread Marc Schwartz
On Mon, 2004-06-07 at 15:51, Gavin Simpson wrote:

snip

 Thanks Roger and Marc, for suggesting I use ./tools/rsync-recommended 
 from within the R-patched directory.
 
 This seems to have done the trick as make completed without errors this 
 time round. The Recommended directory also contained the links to the 
 actual tar.gz files after doing the rsync command, so I guess this was 
 the problem (or at least related to it.) I'm off home now with the 
 laptop to see if I can finish make check-all and make install R.
 
 I have re-read the section describing the installation process for 
 R-patched or R-devel in the R Installation and Administration manual 
 (from R.1.9.0) just in case I missed something. Section 1.2 of this 
 manual indicates that one can proceed *either* by downloading R-patched 
 and then the Recommended packages from CRAN and placing the tar.gz files 
 in R_HOME/src/library/Recommended, or by using rsync to download 
 R-patched, and then to get the Recommended packages. The two are quite 
 separately documented in the manual, and do seem to be in disagreement 
 with the R-sources page on the CRAN website, which doesn't mention the 
 manual download method (for Recommended) at all.
 
 Is there something wrong with the current Recommended files on CRAN, or 
 is the section in the R Installation  Admin manual out-of-date or in 
 error, or am I missing something vital here? This isn't a complaint: I'm 
 just pointing this out in case this is something that needs updating in 
 the documentation.
 
 All the best,
 
 Gavin

Perhaps I am being dense, but in reviewing the two documents (R Admin
and the CRAN sources page), I think that the only thing lacking is a
description on the CRAN page of the manual download option for the Rec
packages.

You would need to go here now for 1.9.1 Alpha/Beta which is where the
current r-patched is:

http://www.cran.mirrors.pair.com/src/contrib/1.9.1/Recommended/

The standard links on CRAN are for the current 'released' version, which
is still 1.9.0 for the moment.

Procedurally, I think that the rsync approach is substantially easier
(one step instead of multiple downloads) and certainly less error prone.
Also the ./tools/rsync-recommended script is set up to pick up the
proper package versions, which also helps to avoid conflicts.

HTH,

Marc

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


[R] msm capabilities

2004-06-07 Thread russell
Hello,
I'm wondering if anyone has used the msm package to compute the steady 
state probabilities for a Markov model?

thanks,
Russell
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] betareg

2004-06-07 Thread Han-Lin Lai
Hi,
I try beta regression model using betareg.  I have two questions:

(i)  The example data pratergrouped is not exist.
 pratergrouped
 [1] V11 V1  V2  V3  V4  V5  V6  V7  V8  V9  V10
0 rows (or 0-length row.names)

(ii) In the description of betareg, it said variable, say y, is 
restricted in (0,1).  Does this retriction be [0,1] (Kieschnick and 
McCullough,  Statistical modeling 2003, 193-213)?

Thanks for helps in advance.

Cheers!
Han

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


Re: [R] GLMM(..., family=binomial(link=cloglog))?

2004-06-07 Thread Spencer Graves
	  Another GLMM/glmm problem:  I simulate rbinom(N, 100, pz), where 
logit(pz) = rnorm(N).  I'd like to estimate the mean and standard 
deviation of logit(pz).  I've tried GLMM{lme4}, glmmPQL{MASS}, and 
glmm{Jim Lindsey's repeated}.  In several replicates of this for N = 10, 
100, 500, etc., my glmm call produced estimates of the standard 
deviation of the random effect in the range of 0.6 to 0.8 (never as high 
as the 1 simulated).  Meanwhile, my calls to GLMM produced estimates 
between 1e-12 and 1e-9, while the glmmPQL results tended to be closer to 
0.001, though it gave one number as high as 0.7.  (I'm running R 1.9.1 
alpha, lme4 0.6-1 under Windows 2000)

	  Am I doing something wrong, or do these results suggest bugs in the 
software or deficiencies in the theory or ... ?

  Consider the following:
 set.seed(1); N - 10
 z - rnorm(N)
 pz - inv.logit(z)
 DF - data.frame(z=z, pz=pz, y=rbinom(N, 100, pz)/100, n=100, 
smpl=factor(1:N))
 GLMM(y~1, family=binomial, data=DF, random=~1|smpl, weights=n)
Generalized Linear Mixed Model

Fixed: y ~ 1
Data: DF
 log-likelihood:  -55.8861
Random effects:
 Groups NameVariance   Std.Dev.
 smpl   (Intercept) 1.7500e-12 1.3229e-06
Estimated scale (compare to 1)  3.280753
Fixed effects:
Estimate Std. Error z value Pr(|z|)
(Intercept) 0.148271   0.063419  2.3379  0.01939
Number of Observations: 10
Number of Groups: 10
 library(repeated) # Jim Lindsey's repeated package
 glmm(y~1, family=binomial, data=DF, weights=n, nest=smpl)
 Warning messages:
1: non-integer #successes in a binomial glm! in: eval(expr, envir, 
enclos) ...

Coefficients:
(Intercept)   sd
 0.1971   0.6909
Degrees of Freedom: 9 Total (i.e. Null);  8 Residual
Null Deviance:  111.8
Residual Deviance: 32.03AIC: 1305
Normal mixing variance: 0.4773187
 glmmPQL(y~1, family=binomial, data=DF, random=~1|smpl, weights=n)
Linear mixed-effects model fit by maximum likelihood
  Data: DF
  Log-likelihood: -10.78933
  Fixed: y ~ 1
(Intercept)
  0.1622299
Random effects:
 Formula: ~1 | smpl
(Intercept)  Residual
StdDev:   0.7023349 0.5413203
Variance function:
 Structure: fixed weights
 Formula: ~invwt
Number of Observations: 10
Number of Groups: 10
  Suggestions?
	  So far, the best tool I've got for this problem is a normal 
probability plot of a transform of the binomial responses with Monte 
Carlo confidence bands, as suggested by Venables and Ripley, S 
Programming and Atkinson (1985).  However, I ultimately need to estimate 
these numbers.

  Thanks,
  spencer graves
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] (low level) profiling of code

2004-06-07 Thread Liaw, Andy
Someone get out the whip...

Apologies for wasting everyone's time.  I missed setting MAIN_LDFLAGS=-pg
in consig.site. 

Best,
Andy

 From: Prof Brian Ripley 
 
 You normally need to switch R profiling off, as that uses the same
 interrupts as low-level profiling.
 
 I would expect you to get gmon.out output from the the main R 
 executable 
 on any run, so the first question must be `does your OS support -pg?'
 
 I don't think dynamically loaded code is relevant (provided 
 it is compiled
 with -pg).  I am pretty sure I managed to profile some 
 examples from the
 cluster package on RH8.0 Linux the other day.
 
 On Mon, 7 Jun 2004, Liaw, Andy wrote:
 
  Dear R-help,
  
  Can some one tell me how to profile compiled code 
 dynamically loaded into R?
  Here's what I tried on our dual Opteron running SUSE Linux 
 Enterprise Server
  8 (GCC 3.3):
  
  Start with R-patched dated 2004-06-07: 
  
  (I also had MAIN_CFLAGS=-pg in config.site.)
  
  R is now configured for x86_64-unknown-linux-gnu
  
Source directory:  .
Installation directory:/usr/local
  
C compiler:gcc  -O2 -g -pg -march=k8 -msse2 -m64
C++ compiler:  g++  -O2 -g -pg -march=k8 -msse2 -m64
Fortran compiler:  g77  -O2 -g -pg -march=k8 -msse2 -m64
  
Interfaces supported:  X11, tcltk
External libraries:readline
Additional capabilities:   PNG, JPEG
Options enabled:   R profiling
  
Recommended packages:  no
  
  I then tried running 
  
/path/to/R-patched/bin/R CMD BATCH -q -slave myscript.R
  
  where inside myscript.R is call to R functions that calls 
 .C().  However,
  this does not produce the gmon.out file.  Can anyone tell 
 me what I'm
  missing?  Any help much appreciated!
 
 
 -- 
 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
 
 


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


[R] AR models

2004-06-07 Thread Laura Holt
Dear R People:
Is it possible to fit an AR model such as:
y_t = fee_1 y_t-1 + fee_2 y_t-9 + a_t,
please?
I know that we can fit an AR(9) model, but I was wondering if we could do a
partial as described.
Thank you for your help.
Sincerely,
Laura Holt
mailto: [EMAIL PROTECTED]
_
Watch the online reality show Mixed Messages with a friend and enter to win 
a trip to NY 
http://www.msnmessenger-download.click-url.com/go/onm00200497ave/direct/01/

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


Re: [R] How to Describe R to Finance People

2004-06-07 Thread Richard A. O'Keefe
Tamas Papp [EMAIL PROTECTED] wrote:
I would emphasize the following:
... 
2. The programming language is really friendly and convenient to work
with.  In finance, you often need to hack together special solutions
for problems that are not conventional (especially in term structure
models, but I think that the same applies to bi- and trinomial models
and their ilk).  As an R newbie, it took me an afternoon to implement
a basic toolkit for the former, which I could use for interesting
explorations.

There are three perspectives on programming languages like the S/R family:
(1) The programming language perspective.
I am sorry to tell you that the only excuse for R is S.
R is *weird*.  It combines error-prone C-like syntax with data structures
that are APL-like but not sufficiently* APL-like to have behaviour that
is easy to reason about.  The scope rules (certainly the scope rules for
S) were obviously designed by someone who had a fanatical hatred of
compilers and wanted to ensure that the language could never be usefully
compiled.  Thanks to 'with' the R scope rules are little better.  The
fact that (object)$name returns NULL instead of reporting an error when
the object doesn't _have_ a $name property means that errors can be
delayed to the point where debugging is harder than it needs to be.
The existence of two largely unrelated object-oriented extensions
further complicates the language.

APL, Xerox's Interactive Data-analysis Language (an extension of
Interlisp), and Lisp-Stat are *far* cleaner as programming languages.

(2) The Excel perspective.
Many people are using Excel as their statistics package.
(One of my students persists in using it for making his graphs.
I've talked another lecturer and his student into using R although
it's too late for a paper they've published.  Dark backgrounds for
printed graphs don't work well.  What persuaded them was a number
of relevant things available out-of-the-box in R.)
In Excel, there are at least three languages:
- direct manipulation
- the formula language
- Visual Basic for Applications

What R offers is a *single* language that's used uniformly,
with a rich data model.

(3) The statistics package perspective.
I've used Minitab, GLIM, SPSS, Matlab, and Octave (and BASIS, if
anyone remembers that).  I've owned and read manuals for GENSTAT.
Recently I had occasion to look at more SAS code than I ever wish to.
(No, I didn't understand it.)  Several of these packages share a
common design feature:  there is a language of built-in commands,
perhaps a data transformation language, and a separate macro language.
The macro language is typically very clumsy.

What R offers is a *single* language that's used uniformly,
with a rich data model.  Analysis components you get off CRAN are
accessed using the *same* syntax as 'built-in' analyses.

R also offers something important for people who _do_ have the money
to buy commercial packages, and who might be reluctant to trust open
source:  a very high degree of compatibility with an established
commercial product.  R could almost be seen as an indefinite lifetime
'evaluation' version of S-Plus.

The fact that I can use 'contributed' code, or even my own code, exactly
the same way as 'built-in' stuff, even including access to on-line
documentation and examples, actually *improves* the learning curve for R
compared with many packages.  At least it did for me.

In the words of an old Listerine commercial:  'I hate it.  Twice a day.'

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


[R] [Q] raw - gpr in aroma package

2004-06-07 Thread
Hi.
 
Is it possible to make gpr from raw?
 
library(aroma)
#read gpr file
gpr - GenePixData$read(gpr123.gpr, path=aroma$dataPath)
# gpr - raw
raw - as.RawData(gpr)
# raw - ma
ma - getSignal(raw, bgSubtract=FALSE)
ma.norm - clone(ma)
#normalization
normalizeWithinSlide(ma.norm, s)
#ma - raw
raw2 - as.RawData(ma)
 
I want to make gpr data from raw2 and then I want to write new gpr(
write(gpr,¡±result.gpr¡±)).
Is it possible?
Can anyone help me with this?
 
Thanks,
 
Hee-Jeong Jin.

[[alternative HTML version deleted]]

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


[R] Recoding a multiple response question into a series of 1, 0 variables

2004-06-07 Thread Greg Blevins
Hello R folks.

1) The question that generated the data, which I call Qx:
Which of the following 5 items have you performed in the past month?  (multipe 
response)

2) How the data is coded in my current dataframe:
The first item that a person selected is coded under a field called Qxfirst; the 
second selected under Qxsecond, etc.  For the first Person, the NAs mean that that 
person only selected two of the five items.

Hypothetical data is shown

QxfirstQxsecondQxthirdQxfourthQxfifth
Person142NANANA
Person2134   5   NA
Person332NANANA

3) How I want the data to be be coded:

I want each field to be one of the five items and I want each field to contain a 1 or 
0 code--1 if they mentioned the item, 0 otherwise.

Given the above data, the new fields would look as follows:

Item1Item2Item3Item4Item5
Person101   01   0  
Person210   11   1 
 
Person301   10   0 

I know how to do this using brute force (by writing bunch of ifelse statements), but 
given I have quite a lot of data in the above format, I was hoping a function would 
streamline this--I have tried to create a function for this, but my efforts to date 
have turned up junk.

Thanks
Greg Blevins
The Market Solutions Group 




[[alternative HTML version deleted]]

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


Re: [R] Recoding a multiple response question into a series of 1, 0 variables

2004-06-07 Thread Jonathan Baron
On 06/07/04 21:28, Greg Blevins wrote:
Hello R folks.

1) The question that generated the data, which I call Qx:
Which of the following 5 items have you performed in the past month?  (multipe
response)

2) How the data is coded in my current dataframe:
The first item that a person selected is coded under a field called Qxfirst; the
second selected under Qxsecond, etc.  For the first Person, the NAs mean that that
person only selected two of the five items.

Hypothetical data is shown

QxfirstQxsecondQxthirdQxfourthQxfifth
Person142NANANA
Person2134   5   NA
Person332NANANA

3) How I want the data to be be coded:

I want each field to be one of the five items and I want each field to contain a 1 or
0 code--1 if they mentioned the item, 0 otherwise.

Given the above data, the new fields would look as follows:

Item1Item2Item3Item4Item5
Person101   01   0
Person210   11   1
Person301   10   0

Here is an idea:
X - c(4,5,NA,NA,NA) # one row
Y - rep(NA,5) # an empty row
Y[X] - 1

Y is now
NA NA NA 1 1
which is what you want.

So you need to do this on each row and then convert the NAs to
0s.  So first create an empty data frame, the same size as your
original one X, like my Y.  Callit Y.  Then a loop?  (I can't
think of a better way just now, like with mapply.)

for (i in [whatever]) Y[i][X[i]] - 1

(Not tested.)  Jon
-- 
Jonathan Baron, Professor of Psychology, University of Pennsylvania
Home page:http://www.sas.upenn.edu/~baron
R search page:http://finzi.psych.upenn.edu/

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


Re: [R] Recoding a multiple response question into a series of 1, 0 variables

2004-06-07 Thread Jonathan Baron
On 06/07/04 22:45, Jonathan Baron should have written:
for (i in [whatever]) Y[i,][X[i,]] - 1

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


RE: [R] Vectors of years, months, and days to dates?

2004-06-07 Thread Richard A. O'Keefe
Rolf Turner [EMAIL PROTECTED] attacked:
Have you ***any*** evidence that R's procedure degrades
performance, under any circumstances?  (Apparently not.) In
that case why are you going on and on about it?

I did the following:

library(chron)
ymd.to.POSIXlt -
function (y, m, d) as.POSIXlt(chron(julian(y=y, x=m, d=d)))
n - 10
y - sample(1970:2004, n, replace=TRUE)
m - sample(1:12,  n, replace=TRUE)
d - sample(1:28,  n, replace=TRUE)
system.time(ymd.to.POSIXlt(y, m, d))
[1]  8.78  0.10 31.76  0.00  0.00
system.time(as.POSIXlt(paste(y,m,d, sep=-)))
[1] 14.64  0.13 53.30  0.00  0.00

This was on a 500MHz SunBlade100, a slow machine by today's standards,
using R 1.9.0.  There is all the evidence one could reasonably ask for
that going through paste() instead of providing y, m, d as numeric
vectors *does* degrade performance under at least some circumstances.

The cost is less than a factor of 2, but not negligible either.

The standard response to this kind of request is ``R is a
cooperative endeavour.  Feel free to contribute.''

Well, ymd.to.POSIXlt is my contribution.

 Is there no one supporting my idea?

Apparently not.

Wrong:  the idea *is* already supported (all except for one trivial
line of code) by the chron package.

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


Re: [R] More than one series in a coplot

2004-06-07 Thread Paul Murrell
Hi
Matthew Walker wrote:
Hi!
I would like to know, how do you plot more than one data series when 
using coplot?

I think I know the answer if plot is being used:
x - 1:10
y - 1:10
y2 - 1:10* 1.1
plot ( y ~ x, type=n )
points( y ~ x, type = b, col = red )  # plot the points and lines 
for the first series
points( y2 ~ x, type = b, col = blue )  # plot the points and lines 
for the second series

But how should it be done with coplot?
If I make my question more concrete:
df - data.frame( x=x, y=y, y2=y2, v=c(a,b))  # using the vectors above
coplot( df$y~df$x | df$v, type=b, col=red)  # gives me a coplot of y 
~ x

How do I now put points and lines for y2 on the same graphs?

Use the panel argument, as below ...
x - 1:10
y - 1:10
y2 - 1:10* 1.1
df - data.frame( x=x, y=y, y2=y2, v=c(a,b))  # using the vectors above
coplot( df$y~df$x | df$v, type=b, col=red,
   subscripts=TRUE,
   panel=function(x, y, subscripts, ...) {
 points(x, y, ...)
 points(x, y2[subscripts], ...)})
Paul
--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
[EMAIL PROTECTED]
http://www.stat.auckland.ac.nz/~paul/
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Differential Equations

2004-06-07 Thread Márcio de Medeiros Ribeiro
Hello!

I would like to know if R can solve Differential Equations...
I don't think so because, in my point, I see R like a Statistical System, not a 
Math System. Am I wrong?

Thank you very much.

Márcio de Medeiros Ribeiro
Graduando em Ciência da Computação
Departamento de Tecnologia da Informação - TCI
Universidade Federal de Alagoas - UFAL
Maceió - Alagoas - Brasil
Projeto CoCADa

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


RE: [R] Vectors of years, months, and days to dates?

2004-06-07 Thread Shin, Daehyok
Thanks, Richard.
This is what I was looking for.
As you said, the chron package seems so useful that I will use it a lot.
I don't think the performance gain (53:31) is not what we can neglect.
Still, I am wondering why this kind of intuitive interface is not supported
through the base package.

Daehyok Shin (Peter)

 -Original Message-
 From: Richard A. O'Keefe [mailto:[EMAIL PROTECTED]
 Sent: Monday, June 07, 2004 PM 10:50
 To: [EMAIL PROTECTED]
 Subject: RE: [R] Vectors of years, months, and days to dates?


   as.Date(c(years, months, days))

 That would put all the years, followed by all the months,
 followed by all the days, in one vector.

 Try the chron package, where you can use
 julian(y=years, x=months, d=days)
   # vectors = vector of day numbers (I really mean 'x', not 'm')
 chron(julian(...))
   # vector of day numbers = vector of chron objects
 as.POSIXlt(chron(...))
   # vector of chron objects = vector of POSIXlt objects

 So:
 ymd.to.POSIXlt -
 function (y, m, d) as.POSIXlt(chron(julian(y=y, x=m, d=d)))

 Now,
  n - 10
  y - sample(1970:2004, n, replace=TRUE)
  m - sample(1:12,  n, replace=TRUE)
  d - sample(1:28,  n, replace=TRUE)
  system.time(ymd.to.POSIXlt(y, m, d))
 [1]  8.78  0.10 31.76  0.00  0.00# user cpu, system cpu, elapsed
  system.time(as.POSIXlt(paste(y,m,d, sep=-)))
 [1] 14.64  0.13 53.30  0.00  0.00

 This was on a 500MHz SunBlade100, a slow machine by today's standards.
 There *is* a time advantage for the approach you prefer, but it's less
 than a factor of 2.

   Is there no one supporting my idea?

 It _is_ supported, via the chron() package.  Just add ymd.to.POSIXlt
 to your .Rprofile

 It may even be that chron objects do everything you need.


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


Re: [R] Vectors of years, months, and days to dates?

2004-06-07 Thread Patrick Connolly
On Tue, 08-Jun-2004 at 02:57PM +1200, Richard A. O'Keefe wrote:

| Rolf Turner [EMAIL PROTECTED] attacked:
|  Have you ***any*** evidence that R's procedure degrades
|  performance, under any circumstances?  (Apparently not.) In
|  that case why are you going on and on about it?
|  
| I did the following:
| 
| library(chron)
| ymd.to.POSIXlt -
| function (y, m, d) as.POSIXlt(chron(julian(y=y, x=m, d=d)))
| n - 10
| y - sample(1970:2004, n, replace=TRUE)
| m - sample(1:12,  n, replace=TRUE)
| d - sample(1:28,  n, replace=TRUE)
| system.time(ymd.to.POSIXlt(y, m, d))
| [1]  8.78  0.10 31.76  0.00  0.00
| system.time(as.POSIXlt(paste(y,m,d, sep=-)))
| [1] 14.64  0.13 53.30  0.00  0.00
| 
| This was on a 500MHz SunBlade100, a slow machine by today's standards,
| using R 1.9.0.  There is all the evidence one could reasonably ask for
| that going through paste() instead of providing y, m, d as numeric
| vectors *does* degrade performance under at least some circumstances.

Ain't that just the darnest thing?

I tried on a somewhat faster machine and got this:


 system.time(ymd.to.POSIXlt(y, m, d))
[1] 2.06 0.22 2.29 0.00 0.00
 system.time(as.POSIXlt(paste(y,m,d, sep=-)))
[1] 2.82 0.04 2.86 0.00 0.00

Negligible difference, I'd have thought, but I tried a few more times


 system.time(ymd.to.POSIXlt(y, m, d))
[1] 1.12 0.11 1.23 0.00 0.00
 system.time(as.POSIXlt(paste(y,m,d, sep=-)))
[1] 2.69 0.04 2.73 0.00 0.00
 system.time(ymd.to.POSIXlt(y, m, d))
[1] 0.98 0.02 1.00 0.00 0.00
 system.time(as.POSIXlt(paste(y,m,d, sep=-)))
[1] 2.82 0.00 2.82 0.00 0.00
 system.time(ymd.to.POSIXlt(y, m, d))
[1] 0.98 0.04 1.02 0.00 0.00
 system.time(as.POSIXlt(paste(y,m,d, sep=-)))
[1] 2.65 0.03 2.68 0.00 0.00
 


ymd.to.POSIXlt benefits from repeated, but the as.POSIXlt method
doesn't.  I even tried it again with a new R process and got the same
sort of thing?

What makes the difference?

-- 
Patrick Connolly
HortResearch
Mt Albert
Auckland
New Zealand 
Ph: +64-9 815 4200 x 7188
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~
I have the world`s largest collection of seashells. I keep it on all
the beaches of the world ... Perhaps you`ve seen it.  ---Steven Wright 
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~

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