[R] cross-validation for count data

2006-11-15 Thread [EMAIL PROTECTED]
Hi everybody,
I'm trying to use cross-validation (cv.glm) for count data. Does someone know 
which is the appropriate cost function for Poisson distribution?
Thank you in advance.

Valerio. 
Conservation Biology Unit
Department of Environmental and Territory Sciences
University of Milano-Bicocca
Piazza della Scienza,1
20126 Milano, Italy.



--
Scopri se hai Vinto un Tv Color LCD! Clicca qui
http://click.libero.it/webnation15nov06

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to compute p-value?

2006-11-15 Thread Christoph Buser
Dear Michael

It calls the function pt() to calculate the p-value based on
your t statistics and the degree of freedoms.

If you are interested how it is calculated in details, you can
have a look into the source code:

 /R-2.4.0/src/nmath/pt.c

There you can find the C-code.

Hope this helps

Christoph Buser

--

Credit and Surety PML study: visit our web page www.cs-pml.org

--
Christoph Buser [EMAIL PROTECTED]
Seminar fuer Statistik, LEO C13
ETH Zurich  8092 Zurich  SWITZERLAND
phone: x-41-44-632-4673 fax: 632-1228
http://stat.ethz.ch/~buser/
--


Michael writes:
  Hi all,
  
  I just want to understand how R computes p-value in a simple linear
  regression model? The reason is that in Matlab in the
  
  function which evaluate standard errors for multivariate normal
  regression, it just provide estimates and standard errors, without giving
  out p-value,
  
  It computes t-statistics as follows:
  
  abs(beta_hat/std_beta_hat)
  
  how to go further to get p-value?
  
  Thanks
  
   [[alternative HTML version deleted]]
  
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] cross-validation for count data

2006-11-15 Thread Brian Ripley
On Wed, 15 Nov 2006, [EMAIL PROTECTED] wrote:

 I'm trying to use cross-validation (cv.glm) for count data. Does someone 
 know which is the appropriate cost function for Poisson distribution?

It depends on the scientific problem, not the distribution.
You could use the deviance but it may well not be appropriate for your 
context, so please seek statistical advice.

BTW, this is off-topic (see the posting guide) which is why your previous

https://stat.ethz.ch/pipermail/r-help/2006-November/116948.html

went unanswered.  Please don't clog the list with repeats like this.

And cv.glm is part of package boot (I presume) which you did not mention 
and if so is support software for a book that may help you 

 Thank you in advance.

 Valerio.
 Conservation Biology Unit
 Department of Environmental and Territory Sciences
 University of Milano-Bicocca
 Piazza della Scienza,1
 20126 Milano, Italy.

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] RODBC and NULL values

2006-11-15 Thread chao gai
Mark,

I think you should realize that SQL is evolved from a different culture, large 
databases. It does not have these fancy data types that we find so usefull in 
R, so somewhere there is guessing what class a variable is.

I tried to examine what NULL values would do on my computer Linux, Suse 9.2, 
MySQL 4.0.21, ODBC ver 03.51. R 2.4 latest packages. As this was a trial I 
added the lot, Inf, -Inf, NA, NaN.
At first my rows with Inf and -Inf were dropped without even a warning. With 
RMySQL it went a bit better, Inf and -Inf were kept. 
In the end, using also the MySQLCC console manager I figured out that one 
could indeed insert the correct values. 
Then I realized: How would RODBC know what my database can handle, there may 
be a zillion different types of ODBC drivers with databases under them. 
Why would the database be so versatile anyway. Inf, -Inf, NA and NaN are not 
exaclty what one would use for say an inventory, personel adminstration or 
the such. These are probably not part of the SQL standard anyway.

So, in short, even though R sometimes seems magically to guess what you want, 
it does not work for reading SQL. The only true magic in R are squares, its 
existence and all those beatifull packages.

Kees

# my code
library(RODBC)
chan - odbcConnect('myodbc1',uid='kees')

x - c(0,Inf,-Inf,NaN,NA)
y  - c(1,2,3,4,5)
df1 - data.frame(x=x,y=y)

sqlSave(chan, df1, testNA1, rownames=T,verbose=TRUE,fast=TRUE)
str(sqlFetch(chan,'testNA1'))
'data.frame':   3 obs. of  2 variables:
 $ x: num  0 NA NA
 $ y: num  1 4 5

sqlQuery(chan,'CREATE TABLE testNA2  (rownames varchar(255), x double, y 
double)')
sqlQuery(chan,INSERT INTO testNA2 ( rownames, x, y ) VALUES ( '1', 0, 1 ))
sqlQuery(chan,INSERT INTO testNA2 ( rownames, x, y ) VALUES ( '2', 'inf', 
2))
sqlQuery(chan,INSERT INTO testNA2 ( rownames, x, y ) VALUES ( '3', '-inf', 
3 ))
sqlQuery(chan,INSERT INTO testNA2 ( rownames, x, y ) VALUES ( '4', 'nan', 
4 ))
sqlQuery(chan,INSERT INTO testNA2 ( rownames, x, y ) VALUES ( '5', NULL , 
5 ))

str(sqlFetch(chan,'testNA2'))
'data.frame':   5 obs. of  2 variables:
 $ x: num 0  Inf -Inf  NaN   NA
 $ y: num  1 2 3 4 5
# end of code

On Tuesday 14 November 2006 21:01, Mark Wardle wrote:
 Mark Wardle wrote:
  Dear all,
 
  I'm afraid I'm still having trouble with RODBC and NULL values on Mac OS
  ... snip
  limited to RODBC, and is not an ODBC driver problem? Any ideas? I'll be
  switching to RdbiPgSQL from now, but I thought it appropriate to flag
  this up as an unsolved problem.

 Hmmm.. there are several issues with RdbiPgSQL (including not doing as
 good a job at recognising factors for example - this requires manually
 checking data frames returned, and fixing data types with liberal use of
 as.factor() etc..), so if anyone has information on the best way to
 access PostgreSQL from R, then all advice appreciated!

 Apart from the NULL value problem, RODBC seems the best and most mature
 and does a great job of inferring data types.  The RPGSQL website
 suggests it is abandoned in favour of Rdbi, Rdbi's website suggests it
 is abandoned in favour of DBI. This doesn't complete support postgresql
 as far as I can see, but they recommend the RdbiPgSQL package on
 bioconductor as above.

 Thanks,

 Mark

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] gam() question

2006-11-15 Thread Simon Wood
 Hi everyone,
 I am fitting a bivariate smoothing model by using gam.
 But I got an error message like this:
 Error in eigen(hess1, symmetric = TRUE) : 0 x 0 matrix
- this is a known problem in mgcv 1.3-20 (an optimizer fails to cope with  
convergence in one step).  It's fixed in 1.3-21, which I'll try and get 
uploaded to CRAN today.

Simon

-- 
 Simon Wood, Mathematical Sciences, University of Bath, Bath, BA2 7AY UK
 +44 1225 386603  www.maths.bath.ac.uk/~sw283

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] RODBC and NULL values

2006-11-15 Thread Mark Wardle
chao gai wrote:
 Why would the database be so versatile anyway. Inf, -Inf, NA and NaN are not 
 exaclty what one would use for say an inventory, personel adminstration or 
 the such. These are probably not part of the SQL standard anyway.
 

Thanks for your reply. I have to agree with most of your suggestions,
and can easily workaround this NULL value issue. However, NULLs are part
of the SQL standard and one can check for them within ANSI SQL.

Perhaps my mistake was using NULLs as a meaningful entry. In my case,
that an event has not (yet) been reached. As I say, it is easily worked
around, but there may be something amiss with the way the ODBC driver is
reporting NULL values --- some clients can cope, but RODBC cannot. It
may be a primary problem with the ODBC driver itself, but I do not have
the understanding or skill to get to the bottom of the problem.

I will add one further diagnostic point. If I modify the table schema so
the column is of type text rather than numeric or int4, then RODBC
works --- NULLs are properly transferred as NAs, and the data is
correctly identified as numeric (which I have to say is very clever!). I
don't know whether this fact is of any help.

Best wishes,

Mark

-- 
Dr. Mark Wardle
Clinical research fellow and Specialist Registrar in Neurology,
C2-B2 link, Cardiff University, Heath Park, CARDIFF, CF14 4XN. UK

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] OPTIM--non finite finite different [13]

2006-11-15 Thread Xin
Dear All:

I used optim() to minimise the loglikelihood function for fitting data to 
negative binomial distribution. But there initial value of log-likelihood and 
iteration 10 value are reasonable. for example:
initial value 1451657.994524
iter 10 value 47297.534905
iter 20 value -623478636.8236478

Then the iter 20 vlaue suddelnly changes to a negative value and in the end the 
error mesage is 
non finite finite different [13]

   Has any one have this experience of what the wrong is?

  Thanks!

   Xin

My function is:

function (parameters,y,x1,x3)
{

alpha-parameters[1:10];
beta-parameters[11];
g-parameters[12];
theta-parameters[13];

j=x3

p=alpha[j]*(x1^beta)*exp(-g*x1)

ifelse(x10,

L-lgamma(y+p)+p*log(theta)+y*(log(1-theta))-lfactorial(y)-lgamma(p)

,Inf)

L

}

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] How to made it more faster ?

2006-11-15 Thread justin bem
Hi, dear all
 
As Professor LUMLEY suggest, I use the withReplicates function to comute SE of 
a complex statistics here below the source I wrote :
 
wi-weights(EC2deg)
Qratio-function(w=wi,don=EC2,x,a1=.2,a2=.8){
  xx-unlist(model.frame(x,don))
  Qtle - function(p){
  oo - order(unlist(xx))
  cum.w - cumsum(w[oo])/sum(w)
  val - approxfun(cum.w, xx[oo])
  val(p)
  }
  
res-weighted.mean(xx[xx=Qtle(a2)],w[xxQtle(a2)])/weighted.mean(xx[xx=Qtle(a1)],w[xxQtle(a1)])
  
  res
}
svyqratio-function(x,design,a1=.2,a2=.8){
rval-withReplicates(design,Qratio,x=x)
rval
} 
When I use it, very slow e.g

 duration-system.time(tab1-svyqratio(~DEPUC,BootEC2))
 duration
[1] 237.73   7.24 256.81 NA NA
 
I know to make make it more fast I can reduce the number of replicates. I have 
100 but this solution is statiscally insteresting. I want to use something like 
svyby(~DEPUC,~S00Q1,BootEC2,svyqratio) . I can I modify this code source to 
made it more fast ?
 
Processor Intel PIV, 2.66 GHz, 512MB RAM
 
 sessionInfo()
R version 2.4.0 (2006-10-03) 
i386-pc-mingw32 
 
attached base packages:
[1] methods   stats graphics  grDevices utils datasets 
[7] tcltk base 
 
other attached packages:
ineq   xtable  foreign   survey svIO   R2HTML   svMisc svSocket 
 0.2-7  1.3-2 0.8-17  3.6-4  0.9-5   1.58  0.9-5  0.9-5 
   svIDE 
 0.9-5 

 
Justin BEM
Elève Ingénieur Statisticien Economiste
BP 294 Yaoundé Cameroun.
Tél (00237)9597295.






___ 
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Profitez des connaissances, des opinions et des expériences des internautes sur 
Yahoo! Questions/Réponses 

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] dynamic aggregation of many variables

2006-11-15 Thread Christian Schulz
Hi,

i have many variables for in example 4weeks and want to do
aggregations, like mean standard , deviation etc..

With mean it works but how i can  calculate the standard deviation for 
the 4weeks and for every  ID.

many thanks  regards, christian

week1 - grep((_PRO_001),names(dmx3),perl=T)
week1table - subset(dmx3,select=c(ID,week1))

week2 - grep((_PRO_002),names(dmx3),perl=T)
week2table - subset(dmx3,select=c(ID,week2))

week3 - grep((_PRO_003),names(dmx3),perl=T)
week3table - subset(dmx3,select=c(ID,week3))

week4 - grep((_PRO_004),names(dmx3),perl=T)
week4table - subset(dmx3,select=c(ID,week4))
mws - 
(week1table[,2:117]+week2table[,2:117]+week3table[,2:117]+week4table[,2:117])/4

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] newie question fitting ARIMA

2006-11-15 Thread Schweitzer, Markus
Hello,

I actually have an understanding problem about estimating ARIMA-Models.

I use the package forecast
and here I simply do best.arima.
I can get fitted values by the comand fitted()
To estimate the forecasterrors

x=c(1:20)
y=best.arima(x)
fitted(y)

forecasterrors(fitted(y), x)


My question is, whether this is the right approach or not.
Should there be a lag of 1 in y since the forecast is always for the
period t+1?

I also try to do this procedure for other models (HoltWinters etc) and I
want to choose the model with the lowest Mean absolute Error.

attached please also find a plot of another arima model and its fitted
values. 
I hope there is an easy answer to my question.

Thank you very much in advance and best regards, 


Markus Schweitzer - http://www.pokertips.tk

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] trellis.par.set and grid : how to set by default that I want a grid on my graphes ?

2006-11-15 Thread Pascal Boisson
Hello all,

I want to draw a grid behind my graphes, using lattice package.
I manage to do it with instructions like this one :

xyplot(Sepal.Length + Sepal.Width ~ Petal.Length ,
   data = iris, allow.multiple = TRUE, scales = same,type=l,
   panel = function(...) {  panel.grid(h=-1, v= -1) ;
panel.superpose(...)
}
)

I was wondering if there were a way to do it using for example
trellis.par.set() to set this by default, like what I do for colors e.g. :
trellis.par.set(list(superpose.line = list(col = c( red, yellow,
green, blue, purple, orange, black, maroon, pink, cyan,
grey, magenta  

instead of using in each call this log panel = function (...) { }
instruction

I tried emprirically
 trellis.par.set(list(grid.pars= list(h = -1, v=-1)))

with no success (I am not even sure that this grid.pars is about drawing
grids ... but it is the nearest instruction i found in trellis parameters

As i am not very confident with this trellis.par.set(), I might have missed
something ... I also tried to define a function

grid-function(...) {  panel.grid(h=-1, v= -1) ;  panel.superpose(...)   }

xyplot(Sepal.Length + Sepal.Width ~ Petal.Length ,
   data = iris, allow.multiple = TRUE, scales = same,type=l,
   panel = grid()   #also tried grid(...)
)

but the only result is an arror message
with grid() :  Erreur dans unit(y0, default.units) : 'x' et 'units' doivent
avoir une longueur positive  (x and units should have a positive length)
with grid(...) :  '...' utilisé dans un contexte incorrect  ('...' used in
a wrong context)

Could anyone tell me a way of doing it ?





-- 
Pascal Boisson
[EMAIL PROTECTED]
http://pak.enroweb.com
http://www.flickr.com/photos/hoothootprod/

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] gsub

2006-11-15 Thread Luis Ridao Cruz
R-help,

I want to remove the following strings
cpue and nogd

string - c(upsanogd ,toskanogd ,   hysunogd   ,  konganogd
  
 ,gullaksnogd , longunogd  ,  blalongunogd  , brosmunogd)

I could use first : first - gsub(cpue , , string)
and then : second - gsub(nogd , , first)

Can it be done at once?

Thanks in advance


 version
   _   
platform   i386-pc-mingw32 
arch   i386
os mingw32 
system i386, mingw32   
status 
major  2   
minor  4.0 
year   2006
month  10  
day03  
svn rev39566   
language   R   
version.string R version 2.4.0 (2006-10-03)


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Newbie: how to get unique x unique x aggregate chart?

2006-11-15 Thread Christian Convey
I'm very new to R, so please forgive me if I just missed the answer in
existing documentation...

I have a data set with at least three columns, X, Y, and Z.

I want to produce a chart where one axis shows all the unique values of X,
and the other axis shows all the unique values of Y.  Each cell within the
chart should contain the result of applying an aggregate function (such as
mean(), for example) to Z value of those rows that are associated with that
cell (via their X and Y values).

Can someone recommend a good way to do this?

Thanks very much,
Christian

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] trellis.par.set and grid : how to set by default that I want a grid on my graphes ?

2006-11-15 Thread Gabor Grothendieck
1. Another way to address this is to include g in the type vector:

xyplot(Sepal.Length + Sepal.Width ~ Petal.Length ,
  data = iris, allow.multiple = TRUE, scales = same, type = c(l, g))

2. Also look in the example section of:

library(zoo)
?xyplot.zoo

which gives an example of plotting a grid behind an existing plot.  You
could define a function to do that and then just call it after your xyplot call.

3. You could define your own panel function:

mypanel - function(...) { panel.grid(); panel.superpose(...) }

so that you only have to write panel = mypanel in the arg list.

4. You could define your own xyplot2 which calls xyplot and uses one
of the above methods to ensure that it does it with a grid.



On 11/15/06, Pascal Boisson [EMAIL PROTECTED] wrote:
 Hello all,

 I want to draw a grid behind my graphes, using lattice package.
 I manage to do it with instructions like this one :

 xyplot(Sepal.Length + Sepal.Width ~ Petal.Length ,
   data = iris, allow.multiple = TRUE, scales = same,type=l,
   panel = function(...) {  panel.grid(h=-1, v= -1) ;
 panel.superpose(...)
 }
 )

 I was wondering if there were a way to do it using for example
 trellis.par.set() to set this by default, like what I do for colors e.g. :
 trellis.par.set(list(superpose.line = list(col = c( red, yellow,
 green, blue, purple, orange, black, maroon, pink, cyan,
 grey, magenta  

 instead of using in each call this log panel = function (...) { }
 instruction

 I tried emprirically
  trellis.par.set(list(grid.pars= list(h = -1, v=-1)))

 with no success (I am not even sure that this grid.pars is about drawing
 grids ... but it is the nearest instruction i found in trellis parameters

 As i am not very confident with this trellis.par.set(), I might have missed
 something ... I also tried to define a function

 grid-function(...) {  panel.grid(h=-1, v= -1) ;  panel.superpose(...)   }

 xyplot(Sepal.Length + Sepal.Width ~ Petal.Length ,
   data = iris, allow.multiple = TRUE, scales = same,type=l,
   panel = grid()   #also tried grid(...)
 )

 but the only result is an arror message
 with grid() :  Erreur dans unit(y0, default.units) : 'x' et 'units' doivent
 avoir une longueur positive  (x and units should have a positive length)
 with grid(...) :  '...' utilisé dans un contexte incorrect  ('...' used in
 a wrong context)

 Could anyone tell me a way of doing it ?





 --
 Pascal Boisson
 [EMAIL PROTECTED]
 http://pak.enroweb.com
 http://www.flickr.com/photos/hoothootprod/

[[alternative HTML version deleted]]



 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] gsub

2006-11-15 Thread Duncan Murdoch
On 11/15/2006 8:29 AM, Luis Ridao Cruz wrote:
 R-help,
 
 I want to remove the following strings
 cpue and nogd
 
 string - c(upsanogd ,toskanogd ,   hysunogd   ,  konganogd
   
  ,gullaksnogd , longunogd  ,  blalongunogd  , brosmunogd)
 
 I could use first : first - gsub(cpue , , string)
 and then : second - gsub(nogd , , first)
 
 Can it be done at once?

gsub(cpue|nogd, , string)

See ?regex for a description of the kinds of patterns R can use, in 
particular

Two regular expressions may be joined by the infix operator |; the 
resulting regular expression matches any string matching either 
subexpression. For example, abba|cde matches either the string abba or 
the string cde. Note that alternation does not work inside character 
classes, where | has its literal meaning.

Duncan Murdoch

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to create this design matrix?

2006-11-15 Thread John Fox
Dear Michael,

This looks like a multivariate simple regression -- that is, 12 response
variables, one predictor. If the data are in the matrix X, then lm(X[,1:12]
~ X[,13]) should do the trick.

I hope this helps,
 John


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

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Michael
 Sent: Wednesday, November 15, 2006 12:23 AM
 To: R-help@stat.math.ethz.ch
 Subject: [R] how to create this design matrix?
 
 Hi all,
 
 I have a multiple-linear regression problem.
 
 There are 13 columns of data, the whole data matrix is:  n x 
 13, where n is the number of samples.
 
 Now I want to regress  EACH of the first 12 columns onto the 
 13th column, with 2-parameter linear model  y_i = b0 + b1 * 
 x_i, where i goes from 1 to n, and b0 is the intercept.
 
 How do I create a design matrix to do the 12-column 
 regression collectively all at once using multiple linear regressions?
 
 Thanks a lot
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Merging two columns with a single value

2006-11-15 Thread Megan O'Connor

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] [R-pkgs] New package for Biased Urn Models

2006-11-15 Thread Agner Fog
A new package named BiasedUrn is available.

This package implements various noncentral hypergeometric distributions, 
univariate and multivariate.
Includes the distribution you get when taking colored balls from an urn 
without replacement, with bias.
These distributions have many applications in models of biased sampling 
and models of evolution by natural selection.

The multivariate hypergeometric distribution can be generated as a 
special case.

The underlying theoretical publication is not out yet. Please see the 
package vignette and www.agner.org/random/theory/ if you need the theory 
details.

___
R-packages mailing list
R-packages@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-packages

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] INSTALL R-2.4.0 on Compaq Tru64 UNIX V5.1B

2006-11-15 Thread saya


Dear all:
I got some error messages when I installed R-2.4.0 on Compaq Tru64 Unix
V5.1B, I set the R_HOME=/shs/R and then try 'make' command after
configuration and it showed Make: Cannot open /share/make/vars.mk.
Stop.,after that,I used the 'gmake' to implement.

The following is my installation steps:
1. ./configure --enable-R-shlib --prefix=/shs/R MAKE=gmake (no error
messages)
2. gmake

it still failed with 'gmake' command,the following are the error messages:

gcc -I. -I../../src/include -I../../src/include  -I/usr/local/include
-DHAVE_CONFIG_H  -mieee-with-inexact   -g -O2 -std=gnu99 -c dynload.c -o
dynload.o
In file included from dynload.c:33:
../../src/include/Defn.h:554: parse error before R_CStackLimit
../../src/include/Defn.h:554: warning: type defaults to `int' in
declaration of `R_CStackLimit'
../../src/include/Defn.h:554: warning: data definition has no type or
storage class
../../src/include/Defn.h:555: parse error before R_CStackStart
../../src/include/Defn.h:555: warning: type defaults to `int' in
declaration of `R_CStackStart'
../../src/include/Defn.h:555: warning: data definition has no type or
storage class
gmake[3]: *** [dynload.o] Error 1
gmake[3]: Leaving directory `/shs/R-2.4.0/src/unix'
gmake[2]: *** [R] Error 2
gmake[2]: Leaving directory `/shs/R-2.4.0/src/unix'
gmake[1]: *** [R] Error 1
gmake[1]: Leaving directory `/shs/R-2.4.0/src'
gmake: *** [R] Error 1

Has anyone ever solved this problem?


[img
src=http://skins.hotbar.com/skins/mailskins/em/082502/082502regards_prv.gifbr
a href='mailto:[EMAIL PROTECTED]'[EMAIL PROTECTED]/a/html]
盛淑蕙Shu Hui Sheng
生技與醫藥研究所
分生組 生醫資訊部
本信件可能包含工研院機密資訊,非指定之收件者,請勿使用或揭露本信件內容,並請銷毀此信件。
This email may contain confidential information. Please do n...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] random forest regression

2006-11-15 Thread Liaw, Andy
One way is to graft the stratified sampling code from the classification
part onto the regression part.  I will get to it eventually, but just
not now.

Andy 

From: Naiara Pinto
 
 Dear all,
 
  I am doing a regression in ramdomForest, using the option 
 sampsize reduce the number of records used to produce the 
 randomForest object.
 The manual says For classification, if sampsize is a vector 
 of the length the number of strata, then sampling is 
 stratified by strata, and the elements of sampsize indicate 
 the numbers to be drawn from the strata.  I need my sampling 
 to be done with factors, but I am doing a regression. Does 
 anyone know a way to do that?
 
 Thanks,
 
 Naiara.
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 
 


--
Notice:  This e-mail message, together with any attachments,...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] POSIXlt converted to POSIXct in as.data.frame()

2006-11-15 Thread Martin Maechler
Thank you, Spencer.

It *does* depend on the exact environment such as timezone,
locale, ???
In my (Linux) setup, I can reproduce Rogers' 1-off problem
using exactly your (Spencer's) R script.

Carefully considering the warning in  ?POSIXlt,
and using  Sys.getenv(TZ)  to see that I had no timezone set,
I've used 
Sys.putenv(TZ = MET)
to correctly set my timezone, but that still did not help,
so I tried
Sys.putenv(TZ = UTC+1)
and that *did* solve the problem.
Interestingly, even
Sys.putenv(TZ = )
does solve the problem for me.

Here is small function, derived from your codes,
which is useful for testing these settings:
   
tstD - function(x.Plt = strptime(paste(9:13, Nov 2006), format=%d %b %Y))
{
## Purpose: Check POSIXlt - Dataframe (i.e. - POSIXct) - Date conversion
## --
## Arguments: x.Plt:  a correct POSIXlt object
## --
## Author: Martin Maechler, Date: 15 Nov 2006, 10:16

stopifnot(inherits(x.Plt, POSIXlt))
d0 - as.Date(x.Plt)
if(isTRUE(getOption(verbose))) {
cat(as.Date(*): ); str(d0) }

dd - data.frame(x.Plt)
## - column converted to P..ct -- definitely needed and desired
dDate - as.Date(dd[,x.Plt])
stopifnot(dDate - d0 == 0)
## else
OK
}

 SpG == Spencer Graves [EMAIL PROTECTED]
 on Sun, 12 Nov 2006 08:26:09 -0800 writes:

SpG I'm not qualified to say much about POSIX, but I haven't seen a 
SpG reply to this in almost 3 days, so I'll offer a comment in the hopes 
SpG that it might be useful or that someone else might correct any 
SpG misstatement I might make: 

SpG First, I didn't find a discrepancy. 
 sessionInfo()
SpG R version 2.4.0 (2006-10-03)
SpG i386-pc-mingw32

SpG locale:
SpG LC_COLLATE=English_United States.1252;LC_CTYPE=English_United 
SpG States.1252;LC_MONETARY=English_United 
SpG States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

SpG attached base packages:
SpG [1] methods   stats graphics  grDevices utils 
datasets
SpG [7] base

SpG I used the following modification  extension of your example: 

SpG my_POSIXlt - strptime(c(11-09-2006, 11-10-2006, 11-11-2006,
SpG11-12-2006, 11-13-2006), %m-%d-%Y)
SpG str(my_POSIXlt)
SpG class(my_POSIXlt)
SpG my_Date - as.Date(my_POSIXlt)
SpG str(my_Date)
SpG myCharacters - format(my_Date)
SpG class(myCharacters)

SpG my_DF - data.frame(my_POSIXlt)
SpG str(my_DF)
SpG DF_Date - as.Date(my_DF$my_POSIXlt)
SpG str(DF_Date)
SpG DF_Date

SpG all.equal(DF_Date, my_Date)
SpG # TRUE

SpG The data.frame function converts POSIXlt, which is a list, to 
SpG POSIXct, which is a numeric vector with attributes: 

 attributes(my_DF$my_POSIXlt)
SpG $class
SpG [1] POSIXt  POSIXct

SpG $tzone
SpG [1] 

 is.numeric(my_DF$my_POSIXlt)
SpG [1] TRUE

SpG If you are getting a day shift, I would guess that you might have 
SpG a different version of some of the software or a difference in your 
SpG locale.  I just did 'update.packages()' yesterday, so if I'm out of 
date 
SpG on something, I hope someone will help me understand and fix the 
problem. 

SpG Beyond this, have you reviewed the ?POSIXt help file plus Gabor 
SpG Grothendieck and Thomas Petzoldt. R help desk: Date and time classes 
in 
SpG R. R News, 4(1):29-32, June 2004 (available from www.r-project.org - 
SpG Newsletter)? 

SpG Hope this helps. 
SpG Spencer Graves

SpG Roger Bivand wrote:
 In trying to use as.Date(), I've come across the conversion of POSIXlt 
to 
 POSIXct when a POSIXlt variable is included in a data frame:
 
 my_POSIX - strptime(c(11-09-2006, 11-10-2006, 11-11-2006, 
 11-12-2006, 11-13-2006), %m-%d-%Y)
 str(my_POSIX)
 my_Date - as.Date(my_POSIX)
 str(my_Date)
 data - format(my_Date)
 str(data)
 my_DF - data.frame(my_POSIX)
 str(my_DF)
 DF_Date - as.Date(my_DF$my_POSIX)
 str(DF_Date)
 DF_Date
 
 The consequence (for my LC_TIME and machine time zone) is that when 
 as.Date() is applied to the data frame column, it dispatches on 
 as.Date.POSIXct() not as.Date.POSIXlt(), causing a day shift (actually 
60 
 minutes, but because as.Date.POSIXct() says floor(), it ends up being a 
 whole day). Should data.frame() be changing POSIXlt to POSIXct?

Yes, that was at least a main idea of POSIXct: it can be dealt
with like a numeric vector and hence fits ideally into a data frame.

 As as.data.frame.POSIXlt() is written, it says:
 
 
 as.data.frame.POSIXlt
 
 function (x, row.names = NULL, optional = FALSE, ...) 
 {
 value - as.data.frame.POSIXct(as.POSIXct(x), row.names, 
 optional, ...)
 if (!optional) 
 names(value) - 

Re: [R] Newbie: how to get unique x unique x aggregate chart?

2006-11-15 Thread Chuck Cleland
Christian Convey wrote:
 I'm very new to R, so please forgive me if I just missed the answer in
 existing documentation...
 
 I have a data set with at least three columns, X, Y, and Z.
 
 I want to produce a chart where one axis shows all the unique values of X,
 and the other axis shows all the unique values of Y.  Each cell within the
 chart should contain the result of applying an aggregate function (such as
 mean(), for example) to Z value of those rows that are associated with that
 cell (via their X and Y values).
 
 Can someone recommend a good way to do this?

  I'm not sure exactly what kind of chart you want, but this may give
you some ideas.

library(reshape) # Provides melt() and cast()

df - data.frame(X = rep(c(A,B,C,D), each = 40),
 Y = rep(1:4, 40),
 Z = runif(160))

df - melt(df, measure.var=Z)

newdf - cast(df, X + Y ~ ., fun.aggregate = mean)

library(lattice) # Provides barchart and bwplot()

barchart(value ~ X | Y, data = newdf, layout=c(4,1,1))

barchart(value ~ X, groups=Y, data = newdf, auto.key=TRUE)

  Also, you might consider this which shows much more than the location
of Z:

bwplot(Z ~ X | Y, data = df, layout=c(4,1,1))

  Finally, here is another possibly useful way to aggregrate df (an
alternative to melt() and cast() which gives a different structure):

with(df, tapply(Z, list(X,Y), mean))

 Thanks very much,
 Christian
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Newbie: how to get unique x unique x aggregate chart?

2006-11-15 Thread Jeffrey Robert Spies
I'm not sure I understand the question, but you might look into the  
following functions:

unique
heatmap
image

Again, if I understand the question, you would create a length(unique 
(x)) by length(unique(y)) sized matrix, and fill it with appropriate  
values of z.  Then pass that to heatmap or image.

Hope that helps--feel free to tell me if I've answered  the wrong  
question,

Jeff.

On Nov 15, 2006, at 8:30 AM, Christian Convey wrote:

 I'm very new to R, so please forgive me if I just missed the answer in
 existing documentation...

 I have a data set with at least three columns, X, Y, and Z.

 I want to produce a chart where one axis shows all the unique  
 values of X,
 and the other axis shows all the unique values of Y.  Each cell  
 within the
 chart should contain the result of applying an aggregate function  
 (such as
 mean(), for example) to Z value of those rows that are associated  
 with that
 cell (via their X and Y values).

 Can someone recommend a good way to do this?

 Thanks very much,
 Christian

   [[alternative HTML version deleted]]

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting- 
 guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Dotmatrix Plots

2006-11-15 Thread Jeffrey Robert Spies
Hi all,

Does anyone know what happened to the dna library or the dotmatrix  
function?  For the life of me, I can't find it anywhere with the  
exception of this reference:

http://rss.acs.unt.edu/Rdoc/library/dna/html/dotmatrix.html

Thanks!

Jeff.
http://www.nd.edu/~jspies/



[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Plot title with numeric variables

2006-11-15 Thread Thomas Lumley
On Tue, 14 Nov 2006, RMan54 wrote:


 This works for the original posted question:

 n-5
 title - bquote(bold(paste(Figure , .(n), : Plot , C[max],  versus
 CrCl)))
 plot(1, main=title)

 However, my problem is that I want to define the text before the value of n
 is known.
 The idea is that the title is defined ahead, passed to a function that makes
 many plots, and n is incremented for each plot.


  pretitle - quote(bold(Figure~.(N)~Plot~C[max]~versus CrCl))

## later on inside a function
  N-1
  title-do.call(bquote,list(pretitle))

-thomas

Thomas Lumley   Assoc. Professor, Biostatistics
[EMAIL PROTECTED]   University of Washington, Seattle

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] segfault in AIX

2006-11-15 Thread Roy Heimbach
I'm trying to build R 2.4.0 on an IBM P5-570 that's running
AIX 5.3.  I'm using xlc 7.0, xlc++ 7.0 and xlf 9.1 in 32 bit
mode (OBJECT_MODE is 32 in the build environment).

The source is the patched version of 2.4.0, downloaded yesterday.

Configure options were --prefix, --srcdir, --x-includes, --x-libraries,
and --without-readline.  Compiler flags were -O2.

The make step fails with a segfault when it's building package
grDevices.  Here's the last part of the make output:

-
building package 'grDevices'
mkdir ../../../library/grDevices
mkdir ../../../library/grDevices/R
mkdir ../../../library/grDevices/po
mkdir ../../../library/grDevices/afm
mkdir ../../../library/grDevices/enc
mkdir ../../../library/grDevices/man
making chull.d from 
/scratch/royh/src/bio/R/2.4.0p/src/src/library/grDevices/src/chull.c
making devNull.d from 
/scratch/royh/src/bio/R/2.4.0p/src/src/library/grDevices/src/devNull.c
making devPicTeX.d from 
/scratch/royh/src/bio/R/2.4.0p/src/src/library/grDevices/src/devPicTeX.c
making devPS.d from 
/scratch/royh/src/bio/R/2.4.0p/src/src/library/grDevices/src/devPS.c
making devQuartz.d from 
/scratch/royh/src/bio/R/2.4.0p/src/src/library/grDevices/src/devQuartz.c
making init.d from 
/scratch/royh/src/bio/R/2.4.0p/src/src/library/grDevices/src/init.c
Target Makedeps is up to date.
 xlc -qlanglvl=extc99 -I../../../../include -I../../../../include 
-I../../../include -I/scratch/royh/src/bio/R/2.4.0p/src/src/include
-DHAVE_CONFIG_H -I/usr/local/include  -O2 -c
/scratch/royh/src/bio/R/2.4.0p/src/src/library/grDevices/src/chull.c
-o chull.o
 xlc -qlanglvl=extc99 -I../../../../include -I../../../../include 
-I../../../include -I/scratch/royh/src/bio/R/2.4.0p/src/src/include
-DHAVE_CONFIG_H -I/usr/local/include  -O2 -c
/scratch/royh/src/bio/R/2.4.0p/src/src/library/grDevices/src/devNull.c
-o devNull.o
 xlc -qlanglvl=extc99 -I../../../../include -I../../../../include 
-I../../../include -I/scratch/royh/src/bio/R/2.4.0p/src/src/include
-DHAVE_CONFIG_H -I/usr/local/include  -O2 -c
/scratch/royh/src/bio/R/2.4.0p/src/src/library/grDevices/src/devPicTeX.c
-o devPicTeX.o
 xlc -qlanglvl=extc99 -I../../../../include -I../../../../include 
-I../../../include -I/scratch/royh/src/bio/R/2.4.0p/src/src/include
-DHAVE_CONFIG_H -I/usr/local/include  -O2 -c
/scratch/royh/src/bio/R/2.4.0p/src/src/library/grDevices/src/devPS.c
-o devPS.o
 xlc -qlanglvl=extc99 -I../../../../include -I../../../../include 
-I../../../include -I/scratch/royh/src/bio/R/2.4.0p/src/src/include
-DHAVE_CONFIG_H -I/usr/local/include  -O2 -c
/scratch/royh/src/bio/R/2.4.0p/src/src/library/grDevices/src/devQuartz.c
-o devQuartz.o
 xlc -qlanglvl=extc99 -I../../../../include -I../../../../include
-I../../../include -I/scratch/royh/src/bio/R/2.4.0p/src/src/include
-DHAVE_CONFIG_H -I/usr/local/include  -O2 -c
/scratch/royh/src/bio/R/2.4.0p/src/src/library/grDevices/src/init.c
-o init.o
 xlc -qlanglvl=extc99 -Wl,-G -Wl,-bexpall -Wl,-bnoentry
-L/usr/local/lib -o grDevices.so chull.o devNull.o devPicTeX.o
devPS.o devQuartz.o init.o  -lm
mkdir ../../../../library/grDevices/libs

  *** caught segfault ***
address 61633346, cause 'memory not mapped'

Traceback:
  1: .Call(R_lazyLoadDBfetch, key, file, compressed, hook, PACKAGE = 
base)
  2: lazyLoadDBfetch(key, datafile, compressed, envhook)
  3: .Call(La_dgesv, a, b, tol, PACKAGE = base)
  4: solve.default(rgb)
  5: solve(rgb)
  6: drop(whitexyz %*% solve(rgb))
  7: make.rgb(red = c(0.625, 0.34), green = c(0.28, 0.595), blue = 
c(0.155, 0.07), gamma = 1.
8, white = D65, name = Apple RGB)
  8: eval(expr, envir, enclos)
  9: eval(i, envir)
10: sys.source(codeFile, env, keep.source = keep.source)
11: try(sys.source(codeFile, env, keep.source = keep.source))
12: loadNamespace(package, lib.loc, keep.source, TRUE, TRUE)
13: code2LazyLoadDB(package, lib.loc = lib.loc, keep.source = 
keep.source, compress = compre
ss)
14: tools:::makeLazyLoading(grDevices)
aborting ...
make: 1254-059 The signal code from the last command is 11.


Stop.
make: 1254-004 The error code from the last command is 1.
-

Is this a known problem and is there a known workaround?  Any
feedback would be appreciated.

Thanks,
Roy Heimbach
-- 
Roy Heimbach [EMAIL PROTECTED] / 505-277-8348
User Services / Center for High Performance Computing
University of New Mexico

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Import csv file

2006-11-15 Thread Peter Bolton
Hello!
I have some data stored into 2 separate csv file. 1 file (called A.csv) (12 
results named Group1, Group2, Group3, etc...) odds ratios, 2 file (called 
B.csv) 12 corresponded errors.
How to import that data into R and make forest plot like I saw inside help file 
Rmeta and meta with included different font colors and names trough X and Y 
axis.
 
I know for meta libb
...
out - metagen(name1,name2)
plot(out,xlab=abcd)

 
But I need for my data to look like this?
 
library(rmeta) 
op - par(lend=square, no.readonly=TRUE) 
data(catheter) 
a - meta.MH(n.trt, n.ctrl, col.trt, col.ctrl, data=catheter, 
 names=Name, subset=c(13,6,5,3,7,12,4,11,1,8,10,2)) 
# angry fruit salad
metaplot(a$logOR, a$selogOR, nn=a$selogOR^-2, a$names, 
 summn=a$logMH, sumse=a$selogMH, sumnn=a$selogMH^-2,
 logeffect=TRUE, colors=meta.colors(box=magenta, 
 lines=blue, zero=red, summary=orange, 
 text=forestgreen)) 
par(op) # reset parameters 


Of course if someone have better idea to import data - not trough csv file no 
problem any format is OK - data frame or something else and to make forest plot 
... no problem ... I need them on the forest plot.
Greetings...
Peter Boolton
MCA adcc..

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] gzfile with multiple entries in the archive

2006-11-15 Thread Greg Snow
If you know how to use the unix/linux tools already, then you may want
to look at cygwin (http://www.cygwin.com/), it allows those of us
trapped in a windows world to still lead productive lives with the
unix/linux tools. 


-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of John James
Sent: Tuesday, November 14, 2006 5:07 AM
To: r-help@stat.math.ethz.ch
Subject: [R] gzfile with multiple entries in the archive

If I open a tgz archive with gzfile and then parse it using readLines I
miss the initial line of each member of the archive - and also the name
of the file although the archive otherwise complete (but useless!).

 

Is there any way within R to extract both the list of files in a tgz
archive and to extract any one of these files?

 

Clearly I can use zcat and tar on Linux, but I need this to work within
the R environment on Windows!

 

Thanks

 

John James


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] 回覆: Re:??: Re: Need help in wavesl im package: imodwt and universal.thresh.modwt

2006-11-15 Thread Airon Yiu
Hi Rogerio:
   
  Here is what I tried.  I have used only data points 1 to 1447 but the same 
problems appear if I used all the data in the file I sent .
   
  library(waveslim)
infile -C:\\airon.csv
ckhdat - read.csv(infile,header=TRUE, quote=)
  ...
1464   23-Dec-05,80.8,81,80.7,80.95,1538304,80.95
146528-Dec-05,80.85,81,80.3,80.7,3728116,80.7
1466  29-Dec-05,80.8,80.95,80.3,80.4,3145493,80.4
146730-Dec-05,80.4,80.2,78.85,79.65,7508611,79.65
xdata - ckhdata$adjcls[1:1447]
   ckhdwt.la8 - modwt(xdata, la8,  n.levels = 6)
 names(ckhdwt.la8) - c(w1, w2, w3, w4, w5,w6, v6)
 
 ydata - imodwt(ckhdwt.la8)
 ydata
numeric(0)
 thre_wc_univ - universal.thresh.modwt(ckhdwt.la8, max.level = 4, hard = 
 FALSE)
¿ù»~¦babs(wc.fine) : ¨ç¼Æ¤£¯à¦³«D¼Æ­È¤Þ¼Æ
 

  Note that the error message for universal.thresh.modwt  is in Chinese.  It 
roughly means Error at abs(wc.find) : variable cannot have non-numeric value 
   
  I need to find an WinXP (English) machine to see if the same issue appers.
   
  Thks
  
rdporto1 [EMAIL PROTECTED] »¡¡G
  Airon,

I used R2.4.0 on a Windows XP (SP2) (not Chinese :-))
and it still works:

 data = read.csv(u:/airon.csv)
 xdata = data$Adj..Close
 modwt.la8 = modwt(xdata, la8, n.level=6)
 summary(modwt.la8)
Length Class Mode
d1 1467 -none- numeric
d2 1467 -none- numeric
d3 1467 -none- numeric
d4 1467 -none- numeric
d5 1467 -none- numeric
d6 1467 -none- numeric
s6 1467 -none- numeric
 ydata = imodwt(modwt.la8)
 summary(ydata)
Min. 1st Qu. Median Mean 3rd Qu. Max.
37.35 57.56 67.93 67.31 78.32 104.90
 max(ydata-xdata)
[1] 2.957279e-11

Can you provide a simple program and the resulting
messages showing that it doesn't work?

Rogerio.


-- Cabeçalho original ---

De: Airon Yiu [EMAIL PROTECTED]
Para: rdporto1 [EMAIL PROTECTED]
Cópia: r-help r-help@stat.math.ethz.ch
Data: Tue, 14 Nov 2006 13:56:51 +0800 (CST)
Assunto: ??: Re:[R] Need help in waveslim package: imodwt and 
universal.thresh.modwt

 Hi Rogerio:

 I am using Waveslim 1.5 on R 2.3.0, running on Chinese WinXP (SP2). 

 The data, attached in the CSV file, is a stock data (0001 from Hong Kong) 
 downloaded from Yahoo!Finance. The time series data are the Adj. Close prices 
 (last column) from 4-Jan-00 to 30-Nov-2005.

 The waveslim mra rountines are working fine on these data.

 Thks



 ___
 YM - Â÷½u°T®§
 
´Nºâ§A¨S¦³¤Wºô¡A§AªºªB¤Í¤´¥i¥H¯d¤U°T®§µ¹§A¡A·í§A¤Wºô®É´N¯à¥ß§Y¬Ý¨ì¡A¥ô¦ó»¡¸Ü³£ÉN¨«¥¢¡C

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] gsub

2006-11-15 Thread john seers \(IFR\)


Is this what you want?  :

gsub(cpue\|nogd, , string)


John
 
---

Web sites:

www.ifr.ac.uk   
www.foodandhealthnetwork.com


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Luis Ridao Cruz
Sent: 15 November 2006 13:29
To: r-help@stat.math.ethz.ch
Subject: [R] gsub


R-help,

I want to remove the following strings
cpue and nogd

string - c(upsanogd ,toskanogd ,   hysunogd   ,  konganogd
  
 ,gullaksnogd , longunogd  ,  blalongunogd  , brosmunogd)

I could use first : first - gsub(cpue , , string)
and then : second - gsub(nogd , , first)

Can it be done at once?

Thanks in advance


 version
   _   
platform   i386-pc-mingw32 
arch   i386
os mingw32 
system i386, mingw32   
status 
major  2   
minor  4.0 
year   2006
month  10  
day03  
svn rev39566   
language   R   
version.string R version 2.4.0 (2006-10-03)


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Dotmatrix Plots

2006-11-15 Thread Peter Dalgaard
Jeffrey Robert Spies [EMAIL PROTECTED] writes:

 Hi all,
 
 Does anyone know what happened to the dna library or the dotmatrix  
 function?  For the life of me, I can't find it anywhere with the  
 exception of this reference:
 
 http://rss.acs.unt.edu/Rdoc/library/dna/html/dotmatrix.html
 
 Thanks!
 
 Jeff.
 http://www.nd.edu/~jspies/

For some reason, Jim prefers to play hide and seek with his packages
(which for some reason he insists on calling libraries...). The
current whereabouts seem to be  

http://popgen.unimaas.nl/~jlindsey/rcode.html


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

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] lpSolve and mixed signs

2006-11-15 Thread Martin Maechler
 Erin == Erin Hodgess [EMAIL PROTECTED]
 on Tue, 14 Nov 2006 17:30:11 -0600 writes:

Erin Hi R People:
Erin If you have a linear programming problem in which
Erin some of the constraints have the =, some
Erin have = and some have =, all in the same problem,
Erin should the solver work?

Yes, I think it should. But ...

Erin I'm having trouble with that.  Any help much appreciated!

you haven't done as the posting guide asks

Erin Sincerely,
Erin Erin Hodgess
..

Erin __
Erin R-help@stat.math.ethz.ch mailing list
Erin https://stat.ethz.ch/mailman/listinfo/r-help
Erin PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
Erin and provide commented, minimal, self-contained, reproducible code.
  ^^
.. please ..

Regards,
Martin

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Correlations not in sync with r2 from regression

2006-11-15 Thread Leeds, Mark \(IED\)
I have two variables, minutereturnsa which can be thought of as my
independent variable and minutereturnsb which can be thought of as my
dependent variable. When I run correlations on the two variables,
depending on which of the three methods I use, I get values of between
-.15 through -.19.
 
Then, when I do a regression, I get an rsquared of .004 which is more in
line with my intuition. In other words, I think the cor
function is doing something very different from what a regression
calculates. In fact, when I use my full data set ( not
included here ), I get correlations at the level of -0.97 which is
extremely unreasonable given the two variables. So, I think cor is 
calculating something else in terms of what I  am used to ? Or, maybe
the scale of my variables is too small and this could be causing
something to go wrong ?

Has anyone else had this experience where their value from a corr is
extremely high and yet the x y plot of the data and the regression
itself do not reflect this. All the code is below the two data sets in
case anyone wants to run it in order to see better what
I mean. It's probably just an non understanding on my part of what the
cor function is actually doing ? Thanks a lot.


minutereturnsa-c(-2.36264407318387e-05, -0.000114546483004574,
0.000480296012887571, 
-3.4370702667097e-05, -1.75028713567116e-05, -4.48227082969765e-05, 
2.90329205787643e-05, 0.000305825164510942, -5.03948020931233e-05, 
-0.000132337254829196, 0.000257366609910825, -0.000143416497692783, 
7.75575880389567e-05, -0.000390396184700492, 5.8463592766067e-05, 
-0.000166182789493874, 2.60897827946138e-05, -9.68285203182262e-05, 
0.000306300707090479, -0.000212593666131689, -2.05973305682505e-05, 
-0.000892262006425781, -7.65296399478643e-05, 9.29686476904834e-05, 
0.000400462742000229, -5.68981524482481e-05, 8.75374496889236e-06, 
-0.000325482754985451, -0.00026561900794686, 6.6048490682924e-05, 
5.22638320941127e-05, -9.67113649918971e-05, 2.9231547120645e-05, 
-5.85151902221526e-06, -6.50840736984293e-05, 3.34530686902923e-05, 
9.92970200188736e-05, 4.57716366808469e-05, 3.98160204646558e-05, 
-6.00275310205234e-05, -0.000182345705006526, -8.2237112582817e-05, 
8.49939625151563e-05, -3.54341054409346e-05, -0.000100100119395208, 
-0.000480874457688962, -5.96482127885878e-05, -1.57319826001867e-05, 
-0.000144679725631036, -0.000135114371429879, -4.7961402529495e-06, 
-0.000169457716609145, 3.99966377280236e-05, -5.124402520984e-05, 
0.000328975614625193, -0.00025080739315797, -0.000573125487459691, 
-7.7472898995623e-05, 3.44346931751005e-05, -3.06202186477478e-05, 
0.000370039560674940, 7.8350343693856e-05, -3.16439540668512e-05, 
-0.000160178561449342, -0.000396591758462961, -0.000210859243796158, 
0.000388855276420408, -0.000179700371241154, 4.16133481957459e-05, 
1.41192273312996e-05, 7.08468899466297e-05, -1.52706151546056e-06, 
3.67659444577839e-05, -0.000234283509586319, 0.000137243567309930, 
-5.20968533468391e-05, -0.000134271000559849, 0.00015686727434705, 
-1.20143299762177e-05, 0.000101875337767510, 3.65842929905824e-06, 
4.69929868991414e-05, 5.7532628616741e-05, -4.97275753463811e-06, 
-0.000170415848516292, 3.72182099566132e-05, -3.63157298233219e-05, 
6.5485377211516e-05, 1.70517614943577e-05, -0.0004420425496, 
0.000117663889794173, -0.000156675474467072, -9.45186652945296e-06, 
0.000228093804488516, -0.00018346543434, 8.7116036074697e-05, 
-0.000105286831582063, 3.77385685590426e-05, 0.000229830364734340, 
7.83212236301623e-05)

minutereturnsb-c(8.4645336092315e-05, 0.000342545113518611,
0.000619138432391253, 
2.39224895137724e-05, -0.000105430737374235, -4.64094877949961e-05, 
0.000232692295488945, 0.000170343242044346, -0.000278101637244177, 
-2.39061360733928e-05, -0.000308615318143524, 0.00088876749136002, 
8.32424077339411e-05, -0.00055346752090557, 8.45076374274e-05, 
-0.00054551438959205, 0.000259390072846699, 0.000144324272249641, 
0.000180899432469239, 0.000288664295990948, 9.95638801164489e-05, 
0.00097571036608901, -4.60863646098986e-05, -0.00047897519405371, 
5.14178471453519e-05, 2.4281687986516e-05, 0.00036058584985188, 
0.000134937727959361, 0.000103280488242596, 2.88151877292364e-05, 
-0.000310955520890666, 0.000106216873712484, 5.52294891624783e-05, 
5.71829552473702e-05, 0, -4.24836809553852e-06, -0.000112243149114732, 
-0.000225054512974054, -0.000127369605538163, -4.718171803475e-06, 
0.000575331719490535, 0.000414750691947852, -2.48462938587934e-05, 
-0.000508280783423132, 0.000246095358950704, -0.000407474448815393, 
0.000288693409606466, -7.07108562671976e-05, -0.000794312866452707, 
-0.000106260214363552, 0.00028805175686486, 7.4386971687268e-05, 
-0.000298442739602223, 0.000194096767056173, -0.000298344525328176, 
0.000220745065718120, 0.000709521706545146, -0.000217011729104044, 
-1.82252827203300e-05, -0.000385731348574225, 0.000332978442621368, 
-8.95786863042147e-05, 0.000104547275809885, -0.000295648677070659, 
-9.6397420641381e-06, 0.000224064465289331, 

[R] stl and the relative scale data-seasonal

2006-11-15 Thread Berta
I am trying to plot the time series decomposition using plot(stl..). 
Eventhough I understand why the scale of the 4 plots is better to be 
unequal, I would like to plot all 4  in the same scale (otherwise 
interpretation at a simple look may be misleading). Is there a way I could 
do so (easier than extracting all the components and plot 4 separate figures 
using 4 plot-comands)?

Thanks a lot in advance.

Berta.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] MLE for Student's t-distribution

2006-11-15 Thread Benjamin Dickgiesser
Hi
is there an easy way/ R-function to calculate the numerical maximum
likelihood estimators for a Student's t-distribution?
I searched the mailing list archive the last 30mins but didn't find an answer.

Regards
Ben

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Code for Screenshots graphics (following on from ease-of-use issues on www.r-project.org)

2006-11-15 Thread Knut M. Wittkowski
Apologies if this is the wrong list, but could somebody put the 
information on how to create the graphs on 
http://www.r-project.org/screenshots/screenshots.html (or a link to 
these instructions) next to the graphs?

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Correlations not in sync with r2 from regression

2006-11-15 Thread Leeds, Mark \(IED\)
oops, I forgot to square !! Thanks Chuck. I would have
spent the rest of the day and then some trying to figure that one out




-Original Message-
From: Chuck Cleland [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 15, 2006 11:46 AM
To: Leeds, Mark (IED)
Subject: Re: [R] Correlations not in sync with r2 from regression

Mark:
  cor() and R^2 are in sync for me on the data you provided:

 summary(lm(minutereturnsa ~ minutereturnsb))$r.squared
[1] 0.03640094

 summary(lm(minutereturnsa ~ minutereturnsb))$r.squared^.5
[1] 0.1907903

 cor(minutereturnsa, minutereturnsb)
[1] -0.1907903

 cor(minutereturnsa, minutereturnsb)^2
[1] 0.03640094

  I suspect you are doing different things with missing values in cor()
versus lm().

hope this helps,

Chuck

Leeds, Mark (IED) wrote:
 I have two variables, minutereturnsa which can be thought of as my 
 independent variable and minutereturnsb which can be thought of as my 
 dependent variable. When I run correlations on the two variables, 
 depending on which of the three methods I use, I get values of between
 -.15 through -.19.
  
 Then, when I do a regression, I get an rsquared of .004 which is more 
 in line with my intuition. In other words, I think the cor function is

 doing something very different from what a regression calculates. In 
 fact, when I use my full data set ( not included here ), I get 
 correlations at the level of -0.97 which is extremely unreasonable 
 given the two variables. So, I think cor is calculating something else

 in terms of what I  am used to ? Or, maybe the scale of my variables 
 is too small and this could be causing something to go wrong ?
 
 Has anyone else had this experience where their value from a corr is 
 extremely high and yet the x y plot of the data and the regression 
 itself do not reflect this. All the code is below the two data sets in

 case anyone wants to run it in order to see better what I mean. It's 
 probably just an non understanding on my part of what the cor function

 is actually doing ? Thanks a lot.
 
 
 minutereturnsa-c(-2.36264407318387e-05, -0.000114546483004574, 
 0.000480296012887571, -3.4370702667097e-05, -1.75028713567116e-05, 
 -4.48227082969765e-05, 2.90329205787643e-05, 0.000305825164510942, 
 -5.03948020931233e-05, -0.000132337254829196, 0.000257366609910825, 
 -0.000143416497692783, 7.75575880389567e-05, -0.000390396184700492, 
 5.8463592766067e-05, -0.000166182789493874, 2.60897827946138e-05, 
 -9.68285203182262e-05, 0.000306300707090479, -0.000212593666131689, 
 -2.05973305682505e-05, -0.000892262006425781, -7.65296399478643e-05, 
 9.29686476904834e-05, 0.000400462742000229, -5.68981524482481e-05, 
 8.75374496889236e-06, -0.000325482754985451, -0.00026561900794686, 
 6.6048490682924e-05, 5.22638320941127e-05, -9.67113649918971e-05, 
 2.9231547120645e-05, -5.85151902221526e-06, -6.50840736984293e-05, 
 3.34530686902923e-05, 9.92970200188736e-05, 4.57716366808469e-05, 
 3.98160204646558e-05, -6.00275310205234e-05, -0.000182345705006526, 
 -8.2237112582817e-05, 8.49939625151563e-05, -3.54341054409346e-05, 
 -0.000100100119395208, -0.000480874457688962, -5.96482127885878e-05, 
 -1.57319826001867e-05, -0.000144679725631036, -0.000135114371429879, 
 -4.7961402529495e-06, -0.000169457716609145, 3.99966377280236e-05, 
 -5.124402520984e-05, 0.000328975614625193, -0.00025080739315797, 
 -0.000573125487459691, -7.7472898995623e-05, 3.44346931751005e-05, 
 -3.06202186477478e-05, 0.000370039560674940, 7.8350343693856e-05, 
 -3.16439540668512e-05, -0.000160178561449342, -0.000396591758462961, 
 -0.000210859243796158, 0.000388855276420408, -0.000179700371241154, 
 4.16133481957459e-05, 1.41192273312996e-05, 7.08468899466297e-05, 
 -1.52706151546056e-06, 3.67659444577839e-05, -0.000234283509586319, 
 0.000137243567309930, -5.20968533468391e-05, -0.000134271000559849, 
 0.00015686727434705, -1.20143299762177e-05, 0.000101875337767510, 
 3.65842929905824e-06, 4.69929868991414e-05, 5.7532628616741e-05, 
 -4.97275753463811e-06, -0.000170415848516292, 3.72182099566132e-05, 
 -3.63157298233219e-05, 6.5485377211516e-05, 1.70517614943577e-05, 
 -0.0004420425496, 0.000117663889794173, -0.000156675474467072, 
 -9.45186652945296e-06, 0.000228093804488516, -0.00018346543434, 
 8.7116036074697e-05, -0.000105286831582063, 3.77385685590426e-05, 
 0.000229830364734340,
 7.83212236301623e-05)
 
 minutereturnsb-c(8.4645336092315e-05, 0.000342545113518611, 
 0.000619138432391253, 2.39224895137724e-05, -0.000105430737374235, 
 -4.64094877949961e-05, 0.000232692295488945, 0.000170343242044346, 
 -0.000278101637244177, -2.39061360733928e-05, -0.000308615318143524, 
 0.00088876749136002, 8.32424077339411e-05, -0.00055346752090557, 
 8.45076374274e-05, -0.00054551438959205, 0.000259390072846699, 
 0.000144324272249641, 0.000180899432469239, 0.000288664295990948, 
 9.95638801164489e-05, 0.00097571036608901, -4.60863646098986e-05, 
 -0.00047897519405371, 5.14178471453519e-05, 

Re: [R] MLE for Student's t-distribution

2006-11-15 Thread Prof Brian Ripley
On Wed, 15 Nov 2006, Benjamin Dickgiesser wrote:

 Hi
 is there an easy way/ R-function to calculate the numerical maximum
 likelihood estimators for a Student's t-distribution?
 I searched the mailing list archive the last 30mins but didn't find an answer.

See fitdistr() in MASS.

MLE of what, BTW?  If you want the MLE of 'df', fitdistr will give it to 
you but beware that its statistical properties are surprising.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] how to get empty sequence for certain bounds

2006-11-15 Thread Tamas K Papp
Hi,

I have encountered this problem quite a few times and thought I would
ask.

Let's say that I have two endpoints, a and b, which are integers.  If
a = b, I would like to get a:b, but if a  b, then numeric(0), for
example:

myseq(3,5) = 3:5
myseq(3,3) = 3
myseq(3,2) = numeric(0)

The operator : just gives decreasing sequences in the latter case, and
I could not coax seq into doing this either (of course the
documentation is correct, it never claims that I could).  Should I
just write my own function, or is there a standard R way to do this?

Thanks,

Tamas

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] MLE for Student's t-distribution

2006-11-15 Thread Benjamin Dickgiesser
I need to estimate all parameters (except maybe df). Thank you for
pointing me into a direction, I will have a look.
The aim is to use a fat-tail distribution to calculate the Value At
Risk instead of using the Normal distribution.

Ben

On 11/15/06, Prof Brian Ripley [EMAIL PROTECTED] wrote:
 On Wed, 15 Nov 2006, Benjamin Dickgiesser wrote:

  Hi
  is there an easy way/ R-function to calculate the numerical maximum
  likelihood estimators for a Student's t-distribution?
  I searched the mailing list archive the last 30mins but didn't find an 
  answer.

 See fitdistr() in MASS.

 MLE of what, BTW?  If you want the MLE of 'df', fitdistr will give it to
 you but beware that its statistical properties are surprising.

 --
 Brian D. Ripley,  [EMAIL PROTECTED]
 Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
 University of Oxford, Tel:  +44 1865 272861 (self)
 1 South Parks Road, +44 1865 272866 (PA)
 Oxford OX1 3TG, UKFax:  +44 1865 272595


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Poisson example from Snedechor Cochran

2006-11-15 Thread Christoph Scherber

Dear R users,

I am trying to reproduce table 7.4.12 (page 131) from Snedechor  
Cochran (eigth edition); the example is counts of weed seeds with a 
fitted Poisson distribution, tested for goodness-of-fit using a Chi-square:


observed=c(3,17,26,16,18,9,3,5,0,1,0,0)
expected=dpois(0:11,lambda=3.020408)*98
chisq.test(observed,p=expected,rescale.p=T)

Now the problem I have is that chisq.test gives me the chi-squared value 
of roughly 8.30 (which is the value given by Snedechor  Cochran), but I 
am wondering why the warning message occurs at the end of the test.


Further, it is not clear to me how these calculations could be done 
using the full dataset of N=98 observations:


observed.full=rep(0:11,c(3,17,26,16,18,9,3,5,0,1,0,0))

What would the correct specification for a chisq.test against a poisson 
distribution look like in this case?


Thanks for your help!

Best wishes
Christoph




##
Chi-squared test for given probabilities

data:  observed
X-squared = 8.2628, df = 8, p-value = 0.4082

Warning message:
Chi-squared approximation may be incorrect in: chisq.test(observed, p = 
expected, rescale.p = T)
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Poisson example from Snedechor Cochran

2006-11-15 Thread Christoph Scherber

Dear R users,

I am trying to reproduce table 7.4.12 (page 131) from Snedechor 
Cochran (eigth edition); the example is counts of weed seeds with a
fitted Poisson distribution, tested for goodness-of-fit using a Chi-square:

observed=c(3,17,26,16,18,9,3,5,0,1,0,0)
expected=dpois(0:11,lambda=3.020408)*98
chisq.test(observed,p=expected,rescale.p=T)

Now the problem I have is that chisq.test gives me the chi-squared value
of roughly 8.30 (which is the value given by Snedechor  Cochran), but I
am wondering why the warning message occurs at the end of the test.

Further, it is not clear to me how these calculations could be done
using the full dataset of N=98 observations:

observed.full=rep(0:11,c(3,17,26,16,18,9,3,5,0,1,0,0))

What would the correct specification for a chisq.test against a poisson
distribution look like in this case?

Thanks for your help!

Best wishes
Christoph




##
Chi-squared test for given probabilities

data:  observed
X-squared = 8.2628, df = 8, p-value = 0.4082

Warning message:
Chi-squared approximation may be incorrect in: chisq.test(observed, p =
expected, rescale.p = T)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to get empty sequence for certain bounds

2006-11-15 Thread Marc Schwartz
On Wed, 2006-11-15 at 11:35 -0500, Tamas K Papp wrote:
 Hi,
 
 I have encountered this problem quite a few times and thought I would
 ask.
 
 Let's say that I have two endpoints, a and b, which are integers.  If
 a = b, I would like to get a:b, but if a  b, then numeric(0), for
 example:
 
 myseq(3,5) = 3:5
 myseq(3,3) = 3
 myseq(3,2) = numeric(0)
 
 The operator : just gives decreasing sequences in the latter case, and
 I could not coax seq into doing this either (of course the
 documentation is correct, it never claims that I could).  Should I
 just write my own function, or is there a standard R way to do this?
 
 Thanks,
 
 Tamas


seq(a, b, length = ifelse(a = b, b - a + 1, 0))

Thus:

a - 3
b - 5

 seq(a, b, length = ifelse(a = b, b - a + 1, 0))
[1] 3 4 5

a - 5
b - 3

 seq(a, b, length = ifelse(a = b, b - a + 1, 0))
integer(0)


However, is that better than:

a - 3
b - 5

 if (a = b) a:b else numeric(0)
[1] 3 4 5

a - 5
b - 3

 if (a = b) a:b else numeric(0)
numeric(0)


?


Of course, you could define your own operator:


%:% - function(a, b) {if (a = b) a:b else numeric(0)}

a - 3
b - 5

 a %:% b
[1] 3 4 5

a - 5
b - 3

 a %:% b
numeric(0)


HTH,

Marc Schwartz

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Code for Screenshots graphics (following on from ease-of-use issues on www.r-project.org)

2006-11-15 Thread Patrick Drechsler
Knut M. Wittkowski wrote:
 Apologies if this is the wrong list, but could somebody put the 
 information on how to create the graphs on 
 http://www.r-project.org/screenshots/screenshots.html (or a link to 
 these instructions) next to the graphs?

A nice reference for graphics with R can be found here:

http://addictedtor.free.fr/graphiques/

I think you'll find most graphs from the screenshot page in the gallery 
(including R code).

HTH

Patrick

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] ppform of B-spline basis

2006-11-15 Thread Tamas K Papp
Hi,

I would like to get the piecewise polynomial form of a B-spline basis
(for repeated calculations of the same spline).  polySpline gives the
polynomial representation of a particular spline.  I wonder if anybody
has code to do that for the basis itself...

Thanks,

Tamas

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to get empty sequence for certain bounds

2006-11-15 Thread Prof Brian Ripley
On Wed, 15 Nov 2006, Tamas K Papp wrote:

 Hi,

 I have encountered this problem quite a few times and thought I would
 ask.

 Let's say that I have two endpoints, a and b, which are integers.  If
 a = b, I would like to get a:b, but if a  b, then numeric(0), for
 example:

 myseq(3,5) = 3:5
 myseq(3,3) = 3
 myseq(3,2) = numeric(0)

 The operator : just gives decreasing sequences in the latter case, and
 I could not coax seq into doing this either (of course the
 documentation is correct, it never claims that I could).  Should I
 just write my own function, or is there a standard R way to do this?

This has been discussed fairly recently, so see the list archives.

myseq - function(m, n) m - 1 + seq_len(max(n-m+1, 0))

looks about right.  Note that this is a little strange, as you want to 
include the left endpoint sometimes and not others.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to get empty sequence for certain bounds

2006-11-15 Thread Berton Gunter

... seq(a, b, length = ifelse(a = b, b - a + 1, 0))

seq(a,b,length = max(0,b-a+1))

seems a bit simpler and more transparent.

-- Bert

Bert Gunter
Genentech Nonclinical Statistics
South San Francisco, CA 94404

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Sparse matrix calculation

2006-11-15 Thread YONGWAN CHUN
Hello, 


I work on large matrices and found something interesting. For multiplication of 
matrices, the order has a huge influence on computing time when one of them is 
a sparse matrix. In the below example, M is a full matrix and A is a sparse 
matrix in a regular matrix class. A %*% M takes much more time than M %*% A; 
moreover, t(t(M) %*% t(A)) is much faster than A %*% M with same result. I 
would like to know how it is possible. Even though I do not have an exact 
reason, this fact may be helpful to others. 

Thanks, 

Yongwan


 n - 1000
 M - diag(n) - matrix(1/n,n,n)
 A - matrix(rnorm(n*n)2,n,n)
 system.time(M %*% A)
[1] 0.10 0.03 0.12   NA   NA
 system.time(A %*% M)
[1] 3.47 0.03 3.50   NA   NA
 system.time(t(t(M) %*% t(A)))
[1] 0.23 0.00 0.23   NA   NA

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Poisson example from Snedechor Cochran

2006-11-15 Thread Peter Dalgaard
Christoph Scherber [EMAIL PROTECTED] writes:

 Dear R users,
 
 I am trying to reproduce table 7.4.12 (page 131) from Snedechor 
 Cochran (eigth edition); the example is counts of weed seeds with a
 fitted Poisson distribution, tested for goodness-of-fit using a Chi-square:
 
 observed=c(3,17,26,16,18,9,3,5,0,1,0,0)
 expected=dpois(0:11,lambda=3.020408)*98
 chisq.test(observed,p=expected,rescale.p=T)
 
 Now the problem I have is that chisq.test gives me the chi-squared value
 of roughly 8.30 (which is the value given by Snedechor  Cochran), but I
 am wondering why the warning message occurs at the end of the test.

Because you have expected values less than 5.

BTW, the result given does not correspond to your code! You cannot
have 8 DF from testing a vector of length 12. The closest I can get is

  chisq.test(observed[1:9],p=c(expected[1:8]/98,1-sum(expected[1:8]/98)))

Chi-squared test for given probabilities

data:  observed[1:9] 
X-squared = 9.5561, df = 8, p-value = 0.2976

Warning message:
Chi-squared approximation may be incorrect in:
chisq.test(observed[1:9], p = c(expected[1:8]/98, 1 - sum(expected[1:8]/98))) 

You can avoid the warning by using simulate.p=TRUE, but beware that
the result is still wrong because lambda is not really known, but
estimated from your data.

 
 Further, it is not clear to me how these calculations could be done
 using the full dataset of N=98 observations:
 
 observed.full=rep(0:11,c(3,17,26,16,18,9,3,5,0,1,0,0))
 
 What would the correct specification for a chisq.test against a poisson
 distribution look like in this case?

Tabulate it and you're back at square 1

Alternatively, you can test for overdispersion (only), by looking at
var(observed.full)/mean(observed.full) which should follow an
approximate chi-square/f distribution (with f=N-1=97). 

 
 ##
 Chi-squared test for given probabilities
 
 data:  observed
 X-squared = 8.2628, df = 8, p-value = 0.4082
 
 Warning message:
 Chi-squared approximation may be incorrect in: chisq.test(observed, p =
 expected, rescale.p = T)
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] filling an array, vectorized

2006-11-15 Thread Tamas K Papp
Hi,

I am sure this has come up before, but my searches of the archive
didn't give any results (maybe I didn't use the right keywords, but if
I use too many, the search times out).

I have a vector of dimensions n, length is not fixed, eg

n - c(4,5,7)

or 

n - c(19,4,5,7)

and a function f that takes a vector of indices, same length of n, and
gives a scalar.

I would like to fill the array

a - array(dim=n)

so that (... is just notation, not R's ...)

a[i,j,k,...] - f(list(i,j,k,...))

I would use loops, but since n can have different lengths, I don't
know how many loops I would need beforehand.  Is there a way to do
this?

Thanks,

Tamas

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Sparse matrix calculation

2006-11-15 Thread Tamas K Papp
On Wed, Nov 15, 2006 at 01:22:19PM -0500, YONGWAN CHUN wrote:

 I work on large matrices and found something interesting. For multiplication 
 of matrices, the order has a huge influence on computing time when one of 
 them is a sparse matrix. In the below example, M is a full matrix and A is a 
 sparse matrix in a regular matrix class. A %*% M takes much more time than M 
 %*% A; moreover, t(t(M) %*% t(A)) is much faster than A %*% M with same 
 result. I would like to know how it is possible. Even though I do not have an 
 exact reason, this fact may be helpful to others. 
 
  n - 1000
  M - diag(n) - matrix(1/n,n,n)
  A - matrix(rnorm(n*n)2,n,n)
  system.time(M %*% A)
 [1] 0.10 0.03 0.12   NA   NA
  system.time(A %*% M)
 [1] 3.47 0.03 3.50   NA   NA
  system.time(t(t(M) %*% t(A)))
 [1] 0.23 0.00 0.23   NA   NA

Hi Yongwan,

Sorry but I could not reproduce this:

 n - 1000
 M - diag(n) - matrix(1/n,n,n)
 A - matrix(rnorm(n*n)2,n,n)
 system.time(M %*% A)
[1] 3.466 0.060 3.744 0.000 0.000
 system.time(A %*% M)
[1] 3.327 0.088 4.046 0.000 0.000
 system.time(t(t(M) %*% t(A)))
[1] 3.681 0.089 3.814 0.000 0.000

What OS, R version, linalg package are you using?

Tamas

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] splineDesign and not-a-knot conditions

2006-11-15 Thread Tamas K Papp
I finally found the answer: the easiest way to enforce this is just
removing the 2 knots, like this:

## thanks for all those who replied to the increasing sequences questions
incseq - function(a,b) {
  if (a = b)
seq.int(from=a,to=b)
  else
integer(0)
}

## remove  augment knots
extendknots - function(x) {
  stopifnot(length(x) = 4  all(diff(x)  0))
  l - length(x)# last element
  c(rep(x[1],4),x[incseq(3,l-2)],rep(x[l],4))
}

library(splines)
x - 0:10  # knots
splineDesign(extendknots(x),x) # design matrix to fit not-a-knot cubic splines

Tamas



On Tue, Nov 14, 2006 at 10:41:39PM -0500, Tamas K Papp wrote:

 Hi,
 
 I would like to fit an (interpolating) spline to data where the
 derivatives at the endpoints of the interval are nonzero, thus the
 natural spline endpoint-specification does not make sense.  Books (de
 Boor, etc) suggest that in this case I use not-a-knot splines.
 
 I know what not-a-knot splines are (so if I were solving for the
 coefficients directly I knew how to do this), but I don't know how to
 sensibly enforce this restriction on the B-spline basis.  I would
 appreciate any advice, references or example code.
 
 Thanks,
 
 Tamas
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Sparse matrix calculation

2006-11-15 Thread Douglas Bates
On 11/15/06, YONGWAN CHUN [EMAIL PROTECTED] wrote:
 I work on large matrices and found something interesting. For multiplication 
 of matrices, the order has a huge influence on computing time when one of 
 them is a sparse matrix. In the below example, M is a full matrix and A is a 
 sparse matrix in a regular matrix class. A %*% M takes much more time than M 
 %*% A; moreover, t(t(M) %*% t(A)) is much faster than A %*% M with same 
 result. I would like to know how it is possible. Even though I do not have an 
 exact reason, this fact may be helpful to others.


  n - 1000
  M - diag(n) - matrix(1/n,n,n)
  A - matrix(rnorm(n*n)2,n,n)
  system.time(M %*% A)
 [1] 0.10 0.03 0.12   NA   NA
  system.time(A %*% M)
 [1] 3.47 0.03 3.50   NA   NA
  system.time(t(t(M) %*% t(A)))
 [1] 0.23 0.00 0.23   NA   NA

It is difficult to give a general answer to a question like this
because the behavior could change with different compilers or levels
of optimization or, more importantly, with the use of an accelerated
BLAS (Basic Linear Algebra Subroutines) library.  From Tamas' response
that he was unable to reproduce this behavior it appears that you may
be using an accelerated BLAS that creates a matrix product by using
the elements of a column of the right operand to define a linear
combination of the columns of the left operand.  If an element of the
right operand is zero then an entire 'AXPY' (y - a * x + y) operation
can be skipped so it is an advantage to have the sparse matrix on the
right.

operand.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to create this design matrix?

2006-11-15 Thread Michael
There are 12 response variables, columns 1 to 12 are response variables, i.e.,
these are y's, they all regress to the 13th column, which is the predictor,
i.e. the X.

Let's take column 1, call this Y1, and there are n rows(n samples) of it,

I need Y1= b0_1 + b1_1* X + epsilon, where X is the 13th column

Similarly, for column 1 to column 12, we do the above,

Y12= b0_12 + b1_12 * X + epsilon, where Y12 is the 12th column,

they all have different b0's and b1's.

Totally there are 24 b0's and b1's.

I want a group regression, not separated regression...

Thanks



On 11/15/06, John Fox [EMAIL PROTECTED] wrote:

 Dear Michael,

 This looks like a multivariate simple regression -- that is, 12 response
 variables, one predictor. If the data are in the matrix X, then
 lm(X[,1:12]
 ~ X[,13]) should do the trick.

 I hope this helps,
 John

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

  -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED] On Behalf Of Michael
  Sent: Wednesday, November 15, 2006 12:23 AM
  To: R-help@stat.math.ethz.ch
  Subject: [R] how to create this design matrix?
 
  Hi all,
 
  I have a multiple-linear regression problem.
 
  There are 13 columns of data, the whole data matrix is:  n x
  13, where n is the number of samples.
 
  Now I want to regress  EACH of the first 12 columns onto the
  13th column, with 2-parameter linear model  y_i = b0 + b1 *
  x_i, where i goes from 1 to n, and b0 is the intercept.
 
  How do I create a design matrix to do the 12-column
  regression collectively all at once using multiple linear regressions?
 
  Thanks a lot
 
[[alternative HTML version deleted]]
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
  http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.



[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Newbie: how to get unique x unique x aggregate chart?

2006-11-15 Thread Christian Convey
Thanks, let me try to clarify my question with an example.

Suppose I have the following data:

Gender,   Major,  Course-Grade
F, Psy, 3.5
F, Psy, 3.1
M, Hst, 3.7
F,  Hst,  3.6
M, Hst,  2.6
M, Eng, 3.9

I want to compute a table like the following:

X-axis: Gender
Y-axis: Major
Cell(x,y) = mean course-grade

So for example, with the data above:

  F M

Psy |   3.3NA
Hst |   3.63.15
Eng |  NA3.9

If I were doing this in SQL I'd do it with a cross-tab query.  But the world
of R still has much unfamiliar terrain :)

Thanks,
Christian


On 11/15/06, Jeffrey Robert Spies [EMAIL PROTECTED] wrote:

 I'm not sure I understand the question, but you might look into the
 following functions:

 unique
 heatmap
 image

 Again, if I understand the question, you would create a length(unique
 (x)) by length(unique(y)) sized matrix, and fill it with appropriate
 values of z.  Then pass that to heatmap or image.

 Hope that helps--feel free to tell me if I've answered  the wrong
 question,

 Jeff.

 On Nov 15, 2006, at 8:30 AM, Christian Convey wrote:

  I'm very new to R, so please forgive me if I just missed the answer in
  existing documentation...
 
  I have a data set with at least three columns, X, Y, and Z.
 
  I want to produce a chart where one axis shows all the unique
  values of X,
  and the other axis shows all the unique values of Y.  Each cell
  within the
  chart should contain the result of applying an aggregate function
  (such as
  mean(), for example) to Z value of those rows that are associated
  with that
  cell (via their X and Y values).
 
  Can someone recommend a good way to do this?
 
  Thanks very much,
  Christian
 
[[alternative HTML version deleted]]
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-
  guide.html
  and provide commented, minimal, self-contained, reproducible code.



[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Newbie: how to get unique x unique x aggregate chart?

2006-11-15 Thread Marc Schwartz
On Wed, 2006-11-15 at 15:03 -0500, Christian Convey wrote:
 Thanks, let me try to clarify my question with an example.
 
 Suppose I have the following data:
 
 Gender,   Major,  Course-Grade
 F, Psy, 3.5
 F, Psy, 3.1
 M, Hst, 3.7
 F,  Hst,  3.6
 M, Hst,  2.6
 M, Eng, 3.9
 
 I want to compute a table like the following:
 
 X-axis: Gender
 Y-axis: Major
 Cell(x,y) = mean course-grade
 
 So for example, with the data above:
 
   F M
 
 Psy |   3.3NA
 Hst |   3.63.15
 Eng |  NA3.9
 
 If I were doing this in SQL I'd do it with a cross-tab query.  But the world
 of R still has much unfamiliar terrain :)
 
 Thanks,
 Christian


Presuming that DF is a data frame containing your data:

 with(DF, tapply(Course.Grade, list(Major, Gender), 
  mean, na.rm = TRUE))
  FM
Eng  NA 3.90
Hst 3.6 3.15
Psy 3.3   NA


See ?tapply and ?with

HTH,

Marc Schwartz

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Newbie: how to get unique x unique x aggregate chart?

2006-11-15 Thread Gabor Grothendieck
Marc's solution looks a bit easier but here are a few more anyways:

# 1
reshape(DF, dir = wide, timevar = Gender, idvar = Major)

# 2
library(reshape)
DFm - melt(DF, id = 1:2)
cast(DFm, Major ~ Gender, fun = mean)

On 11/15/06, Christian Convey [EMAIL PROTECTED] wrote:
 Thanks, let me try to clarify my question with an example.

 Suppose I have the following data:

 Gender,   Major,  Course-Grade
 F, Psy, 3.5
 F, Psy, 3.1
 M, Hst, 3.7
 F,  Hst,  3.6
 M, Hst,  2.6
 M, Eng, 3.9

 I want to compute a table like the following:

 X-axis: Gender
 Y-axis: Major
 Cell(x,y) = mean course-grade

 So for example, with the data above:

  F M
 
 Psy |   3.3NA
 Hst |   3.63.15
 Eng |  NA3.9

 If I were doing this in SQL I'd do it with a cross-tab query.  But the world
 of R still has much unfamiliar terrain :)

 Thanks,
 Christian


 On 11/15/06, Jeffrey Robert Spies [EMAIL PROTECTED] wrote:
 
  I'm not sure I understand the question, but you might look into the
  following functions:
 
  unique
  heatmap
  image
 
  Again, if I understand the question, you would create a length(unique
  (x)) by length(unique(y)) sized matrix, and fill it with appropriate
  values of z.  Then pass that to heatmap or image.
 
  Hope that helps--feel free to tell me if I've answered  the wrong
  question,
 
  Jeff.
 
  On Nov 15, 2006, at 8:30 AM, Christian Convey wrote:
 
   I'm very new to R, so please forgive me if I just missed the answer in
   existing documentation...
  
   I have a data set with at least three columns, X, Y, and Z.
  
   I want to produce a chart where one axis shows all the unique
   values of X,
   and the other axis shows all the unique values of Y.  Each cell
   within the
   chart should contain the result of applying an aggregate function
   (such as
   mean(), for example) to Z value of those rows that are associated
   with that
   cell (via their X and Y values).
  
   Can someone recommend a good way to do this?
  
   Thanks very much,
   Christian
  
 [[alternative HTML version deleted]]
  
   __
   R-help@stat.math.ethz.ch mailing list
   https://stat.ethz.ch/mailman/listinfo/r-help
   PLEASE do read the posting guide http://www.R-project.org/posting-
   guide.html
   and provide commented, minimal, self-contained, reproducible code.
 
 

[[alternative HTML version deleted]]

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] ??: Re:??: Re: Need help in wa veslim package: imodwt and universal.thresh. modwt

2006-11-15 Thread rdporto1
Airon, 

I don't think you have to find an English computer 'cause the
following must work in your Chinese one :-)

Let me explain. First of all, change your lines to

xdata - ckhdat$Adj..Close[1:1447]
#names(ckhdwt.la8) - c(w1, w2, w3, w4, w5,w6, v6)

note the # sign, i.e., DO NOT change the names before
the function imodwt.

This is because the function imodwt looks for the names
created by the modwt function. If you need to change names,
do it AFTER the reconstruction.

I hope that it helps you.

Rogerio

-- Cabeçalho original ---

De: Airon Yiu [EMAIL PROTECTED]
Para: rdporto1 [EMAIL PROTECTED]
Cópia: r-help r-help@stat.math.ethz.ch
Data: Wed, 15 Nov 2006 23:49:57 +0800 (CST)
Assunto: ??: Re:??: Re:[R] Need help in waveslim package: imodwt and  
universal.thresh.modwt

 Hi Rogerio:

   Here is what I tried.  I have used only data points 1 to 1447 but the same 
 problems appear if I used all the data in the file I sent .

   library(waveslim)
 infile -C:\\airon.csv
 ckhdat - read.csv(infile,header=TRUE, quote=)
   ...
 1464   23-Dec-05,80.8,81,80.7,80.95,1538304,80.95
 146528-Dec-05,80.85,81,80.3,80.7,3728116,80.7
 1466  29-Dec-05,80.8,80.95,80.3,80.4,3145493,80.4
 146730-Dec-05,80.4,80.2,78.85,79.65,7508611,79.65
 xdata - ckhdata$adjcls[1:1447]
ckhdwt.la8 - modwt(xdata, la8,  n.levels = 6)
  names(ckhdwt.la8) - c(w1, w2, w3, w4, w5,w6, v6)
  
  ydata - imodwt(ckhdwt.la8)
  ydata
 numeric(0)
  thre_wc_univ - universal.thresh.modwt(ckhdwt.la8, max.level = 4, hard = 
  FALSE)
 ???abs(wc.fine) : ??
  
 
   Note that the error message for universal.thresh.modwt  is in Chinese.  It 
 roughly means Error at abs(wc.find) : variable cannot have non-numeric 
 value 

   I need to find an WinXP (English) machine to see if the same issue appers.

   Thks

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Newbie: how to get unique x unique x aggregate chart?

2006-11-15 Thread Christian Convey
That did it!  Thanks Marc.

- Christian

On 11/15/06, Marc Schwartz [EMAIL PROTECTED] wrote:

 On Wed, 2006-11-15 at 15:03 -0500, Christian Convey wrote:
  Thanks, let me try to clarify my question with an example.
 
  Suppose I have the following data:
 
  Gender,   Major,  Course-Grade
  F, Psy, 3.5
  F, Psy, 3.1
  M, Hst, 3.7
  F,  Hst,  3.6
  M, Hst,  2.6
  M, Eng, 3.9
 
  I want to compute a table like the following:
 
  X-axis: Gender
  Y-axis: Major
  Cell(x,y) = mean course-grade
 
  So for example, with the data above:
 
F M
  
  Psy |   3.3NA
  Hst |   3.63.15
  Eng |  NA3.9
 
  If I were doing this in SQL I'd do it with a cross-tab query.  But the
 world
  of R still has much unfamiliar terrain :)
 
  Thanks,
  Christian


 Presuming that DF is a data frame containing your data:

  with(DF, tapply(Course.Grade, list(Major, Gender),
   mean, na.rm = TRUE))
   FM
 Eng  NA 3.90
 Hst 3.6 3.15
 Psy 3.3   NA


 See ?tapply and ?with

 HTH,

 Marc Schwartz




[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Regression

2006-11-15 Thread Alvaro
I need to run a regression analysis with a large number of samples. Each
sample (identified in the first file column) has its own x and y values. I
will use the same model in all samples. How can I run the model for each
sample? In SAS code I would use the BY SAMPLE statement.

 

Alvaro

 

 


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] can I get standard error from predict.gam()?

2006-11-15 Thread Andrew Robinson
Hi Kevin,

sadly, you have (again) not provided enough information to enable us
to make a constructive response - for example, what package are you
using?  I assume that it's not mgcv, as mgcv does have a predict.gam
with an se.fit argument:

predict.gam   package:mgcv   R Documentation

Prediction from fitted GAM model

Description:

...

Usage:

 ## S3 method for class 'gam':
 predict(object,newdata,type=link,se.fit=FALSE,terms=NULL,
 block.size=1000,newdata.guaranteed=FALSE,na.action=na.pass,...)

But -- maybe I'm wrong.

Furthermore, we can't tell from your note in what way se=T or se.fit=T
is no use.  What is the error message?  Please try to read the
posting guide http://www.R-project.org/posting-guide.html and provide
commented, minimal, self-contained, reproducible code.

Cheers,

Andrew

On Wed, Nov 15, 2006 at 04:35:21PM -0500, seeTigers wrote:
 Hi everybody,
 I am using predict.gam() now. I but it seems there is no such option to get
 standard errors of the predicted values. I tried to set se=T or se.fit=T but
 no use.
 
 If you know anything about that please let me know. Thanks very much.
 Kevin.
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

-- 
Andrew Robinson  
Department of Mathematics and StatisticsTel: +61-3-8344-9763
University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599
http://www.ms.unimelb.edu.au/~andrewpr
http://blogs.mbs.edu/fishing-in-the-bay/

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] OPTIM--non finite finite different [13]

2006-11-15 Thread Ben Bolker
Xin jasonshi510 at hotmail.com writes:

 
 Dear All:
 
 I used optim() to minimise the loglikelihood function for fitting data to
negative binomial
 distribution. But there initial value of log-likelihood and iteration 10 value
are reasonable. for example:
 initial value 1451657.994524
 iter 10 value 47297.534905
 iter 20 value -623478636.8236478
 
 Then the iter 20 vlaue suddelnly changes to a negative value and in the end
the error mesage is 
 non finite finite different [13]
 
Has any one have this experience of what the wrong is?
 
   Thanks!
 
Xin
 
 My function is:
 
 function (parameters,y,x1,x3)
 {
 
 alpha-parameters[1:10];
 beta-parameters[11];
 g-parameters[12];
 theta-parameters[13];
 
 j=x3
 
 p=alpha[j]*(x1^beta)*exp(-g*x1)
 
 ifelse(x10,
 
 L-lgamma(y+p)+p*log(theta)+y*(log(1-theta))-lfactorial(y)-lgamma(p)
 
 ,Inf)
 
 L
 
 }


  It would help if you could provide self-contained/reproducible
code, which this is not (we don't have the data, x1).  There are
several slightly odd things about this code, but I'm guessing
that the problem is that you don't restrict alpha, beta, theta
to be positive.  You could also be getting overflow errors.

  Other points about the code:

 - you probably want the _sum_ of the log-likelihoods
(unless you just have one data point -- i.e.
length(x1) and length(y) are both 1 ! )

 - you can use dnbinom(...,log=TRUE) instead of spelling
out the probability distribution.

 - you probably want

L - ifelse(x10,...,Inf)

  instead of what you have written here.

  - A way of doing further debugging is to use cat() statements
to print out parameter values and negative log-likelihoods for
each function call.

  good luck
Ben Bolker

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] nmle for time of structural change?

2006-11-15 Thread Spencer Graves
Hi, All: 

  Does 'nlme' require the nonlinear function to be differentiable?  
I'm fitting structural change models to many related time series, and 
I'd like to improve the estimates of the change point times through some 
type of pooling.  Unfortunately, I've so far been unable to get 'nlme' 
to work for me.  The following toy example is the closest I've come to 
what I want using 'nlme': 

library(nlme)
tstDF5 - data.frame(t.=rep(1:5, 3), subj=rep(1:3, e=5),
 y=c(rep(0:1, c(1,4)), rep(0:1, c(2,3)),
 rep(0:1, c(3,2)) ) )
breakpoint0seg2t - function(t., lT){
  t1 - 5*plogis(-lT)
  ((t.=t1)+(t1t.))
}
tstFit - nlme(y~breakpoint0seg2t(t., lT1),
data=tstDF5, fixed=lT1~1,
random=list(subj=pdDiag(l1~1)), start=0 )

Error in chol((value + t(value))/2) : the leading minor of order 1 is 
not positive definite

  The function 'breakpoint0seg2t' is constant except at the data 
points, where it is discontinuous.  Is this error message generated by 
the fact that the first derivative of 'breakpoint0seg2t' is 0 almost 
everywhere?  If yes, what are the options for getting around this? 

  The real problem behind this toy example involves fitting either 
step functions or linear or quadratics in time with any number of 
breakpoints.  I'm currently estimating the required parameters using the 
'strucchange' package.  That work, but I'm having trouble with this 
enhancement. 

  Thanks,
  Spencer Graves

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Job Opportunity - AMD Sunnyvale

2006-11-15 Thread Kittler, Richard
To all:

We have an opening for a recent graduate to work as a Statistical
Programmer at Advanced Micro Devices (AMD) in Sunnyvale CA beginning
January 2007. AMD is a global supplier of microprocessors and
silicon-based solutions to the communications and computer industries. 

This position will support the development of statistical applications
for engineering groups within AMD's technology development and volume
manufacturing operations. 

You will be responsible for:

*   Working with Statisticians to determine requirements for
statistical applications.
*   Designing, developing, testing, and documenting applications
written mainly in R.
*   Working with web developers to integrate these applications
within larger applications.

Preferred Education and Experience

*   Recent Bachelor's degree in Statistics with a Master's
preferred.
*   High level of fluency and experience in statistical program
development using R or S-Plus.
*   Moderate fluency in SAS.
*   An understanding of the basics of software engineering.
*   Experience with Linux or Solaris
*   Experience with Oracle or MySQL is a plus.
*   Excellent verbal and written communication skills.
*   Ability to work with a multi-disciplinary team. 

To apply, please email a resume or C.V. to Hafeez Khan
([EMAIL PROTECTED]).  Please do **not** reply directly or cc this
list.

Richard Kittler
Advanced Micro Devices, Inc. 
Sunnyvale, CA


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] how to create this design matrix?

2006-11-15 Thread Michael
How about I make a design matrix as follows:

1  d1,1  0   0 0   0 0   0   0
00   1   d1,2  0   0 0   0   0
00   0   0 1   d1,3  0   0   0
...
...

000  0 0   0  ...  ... 1  d1,12


The above matrix will work for the 1st row of Y data;

d1, 1 means the 1st column of the 1st row of data;
d1, 12 means the 12th column of the 1st row of data.


But now since I have N samples(rows) of Y data; how do I conceptually do a
3D design matrix?

On 11/15/06, John Fox [EMAIL PROTECTED] wrote:

 Dear Michael,

  -Original Message-
  From: Michael [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, November 15, 2006 2:40 PM
  To: John Fox
  Cc: R-help@stat.math.ethz.ch
  Subject: Re: [R] how to create this design matrix?
 
  There are 12 response variables, columns 1 to 12 are response
  variables, i.e., these are y's, they all regress to the 13th
  column, which is the predictor, i.e. the X.
 

 Right.

  Let's take column 1, call this Y1, and there are n rows(n
  samples) of it,
 
  I need Y1= b0_1 + b1_1* X + epsilon, where X is the 13th column
 
  Similarly, for column 1 to column 12, we do the above,
 
  Y12= b0_12 + b1_12 * X + epsilon, where Y12 is the 12th column,
 
  they all have different b0's and b1's.

 Right.

  Totally there are 24 b0's and b1's.
 

 Yes.

  I want a group regression, not separated regression...
 

 I'm not sure what you mean by a group regression rather than separated
 regressions. The multivarite linear regression that I suggested will give
 you 12 slopes and 12 intercepts. They are exactly what you'd get from 12
 individual least-squares regression of each Y on X, but the multivariate
 regression can also give you, e.g., the covariances among all of the
 coefficients (if you want them).

 John

  Thanks
 
 
 
 
  On 11/15/06, John Fox  [EMAIL PROTECTED] wrote:
 
Dear Michael,
 
This looks like a multivariate simple regression --
  that is, 12 response
variables, one predictor. If the data are in the matrix
  X, then lm(X[,1:12]
~ X[,13]) should do the trick.
 
I hope this helps,
John
 

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

 
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto: [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED] ] On Behalf Of Michael
 Sent: Wednesday, November 15, 2006 12:23 AM
 To: R-help@stat.math.ethz.ch
 Subject: [R] how to create this design matrix?

 Hi all,

 I have a multiple-linear regression problem.

 There are 13 columns of data, the whole data matrix is:  n x
 13, where n is the number of samples.

 Now I want to regress  EACH of the first 12 columns onto the
 13th column, with 2-parameter linear model  y_i = b0 + b1 *
 x_i, where i goes from 1 to n, and b0 is the intercept.

 How do I create a design matrix to do the 12-column
 regression collectively all at once using multiple
  linear regressions?

 Thanks a lot

   [[alternative HTML version deleted]]

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
   http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained,
  reproducible code.
 
 
 
 
 



[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] (no subject)

2006-11-15 Thread karen xie
Dear List,

Does anyone have experience using mmlcr Package? I am working on a
longitudinal dataset. The model fitting is fine. However, I had a problem
with the command plot.mmlcr. It seems to me it can not plot a very
nice trajectory plot for longitudinal dataset. I wonder whether somebody can
share the experience, i.e. how to make a nice trajectory plot for
longitudinal data.

Thanks.
Karen

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] 回覆: Re:??: Re:??: Re: Need help in waveslim package: imodwt and universal.thresh.m odwt

2006-11-15 Thread Airon Yiu
Hi Rogerio:
   
  Thks a lot. It works.
   
  By the way, I have 2 related sides issues that need some help:
  (1)  What I want to do is this
  - do modwt on original time series
  - do thresholding on wavelet coefficients
  - obtain the inversed smoothed and detailed components of the original time 
series using the thesholded coefficients. How can this be done ?
   
  mra accept the original time series as input.
  imodwt rountine will give me the inversed transformed in the form of original 
time series, instead of separating them into detailed and smoothed component.  
   
  (2) Is there a way to make R giving me error messages in English instead of 
Chinese so that I can communicate with others easily
   
  Thks

rdporto1 [EMAIL PROTECTED] »¡¡G
  Airon,

I don't think you have to find an English computer 'cause the
following must work in your Chinese one :-)

Let me explain. First of all, change your lines to

xdata - ckhdat$Adj..Close[1:1447]
#names(ckhdwt.la8) - c(w1, w2, w3, w4, w5,w6, v6)

note the # sign, i.e., DO NOT change the names before
the function imodwt.

This is because the function imodwt looks for the names
created by the modwt function. If you need to change names,
do it AFTER the reconstruction.

I hope that it helps you.

Rogerio

-- Cabeçalho original ---

De: Airon Yiu [EMAIL PROTECTED]
Para: rdporto1 [EMAIL PROTECTED]
Cópia: r-help r-help@stat.math.ethz.ch
Data: Wed, 15 Nov 2006 23:49:57 +0800 (CST)
Assunto: ??: Re:??: Re:[R] Need help in waveslim package: imodwt and 
universal.thresh.modwt

 Hi Rogerio:

 Here is what I tried. I have used only data points 1 to 1447 but the same 
 problems appear if I used all the data in the file I sent .

 library(waveslim)
 infile -C:\\airon.csv
 ckhdat - read.csv(infile,header=TRUE, quote=)
 ...
 1464 23-Dec-05,80.8,81,80.7,80.95,1538304,80.95
 1465 28-Dec-05,80.85,81,80.3,80.7,3728116,80.7
 1466 29-Dec-05,80.8,80.95,80.3,80.4,3145493,80.4
 1467 30-Dec-05,80.4,80.2,78.85,79.65,7508611,79.65
 xdata - ckhdata$adjcls[1:1447]
  ckhdwt.la8 - modwt(xdata, la8, n.levels = 6)
  names(ckhdwt.la8) - c(w1, w2, w3, w4, w5,w6, v6)
 
  ydata - imodwt(ckhdwt.la8)
  ydata
 numeric(0)
  thre_wc_univ - universal.thresh.modwt(ckhdwt.la8, max.level = 4, hard = 
  FALSE)
 ???abs(wc.fine) : ??
 

 Note that the error message for universal.thresh.modwt is in Chinese. It 
 roughly means Error at abs(wc.find) : variable cannot have non-numeric value

 I need to find an WinXP (English) machine to see if the same issue appers.

 Thks



 ___
 YM - Â÷½u°T®§
 
´Nºâ§A¨S¦³¤Wºô¡A§AªºªB¤Í¤´¥i¥H¯d¤U°T®§µ¹§A¡A·í§A¤Wºô®É´N¯à¥ß§Y¬Ý¨ì¡A¥ô¦ó»¡¸Ü³£ÉN¨«¥¢¡C

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Matrix-vector multiplication without loops

2006-11-15 Thread Richard Graham
On 11/14/06, Ravi Varadhan [EMAIL PROTECTED] wrote:
 I am trying to do the following computation:

   p - rep(0, n)
   coef - runif(K+1)
   U - matrix(runif(n*(2*K+1)), n, 2*K+1)
   for (i in 0:K){
   for (j in 0:K){
   p - p + coef[i+1]* coef[j+1] * U[,i+j+1]
   } }

 I would appreciate any suggestions on how to perform this computation
 efficiently without the for loops?

This kicks butt on my machine:

p - as.vector(U %*% convolve(coef,rev(coef),type=open))

HTH!

Richard Graham
JHU '84 EECS

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Interaction and factor ':'

2006-11-15 Thread Hong Ooi

___


Hello,

Not sure if this counts as a bug or not, but I just noticed in R 2.4.0
that : and interaction are not quite equivalent. For example:

 x - factor(letters[1:4])
 y - factor(letters[11:14])

 x:y
[1] a:k b:l c:m d:n
Levels: a:k a:l a:m a:n b:k b:l b:m b:n c:k c:l c:m c:n d:k d:l d:m d:n

 interaction(x, y, sep=:)
[1] a:k b:l c:m d:n
Levels: a:k b:k c:k d:k a:l b:l c:l d:l a:m b:m c:m d:m a:n b:n c:n d:n

The ordering of the levels is different between the two, although
?interaction says


f:g is the same as interaction(f,g, sep=:) when f and g are
factors.

I came across this when fitting multinom models, and the column order of
the predicted probabilities shifted around depending on whether I used
interaction or : on the LHS of the formula.


-- 
Hong Ooi
Senior Research Analyst, IAG Limited
388 George St, Sydney NSW 2000
+61 (2) 9292 1566

___

The information transmitted in this message and its attachme...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Simple Questions

2006-11-15 Thread Louis Tay
Hi, I'm just starting out on R. I have an example data frame listed below.
I have regressed Y on X1. lm(Y~X1). Would like to obtain the Brown-Forsythe
test on residuals.
I am unsure of how to conduct the following steps.
(1) Inputting the residuals from regression into the data frame.
(2) Splitting the groups above (X11) and below mean of X1 (X12) in the data
frame.
(3) Calculating the sum squared deviations of each group residual about the
group median residual.

Is there a quick/dirty way to do this?


 Y X1 X2
1   64  4  2
2   73  4  4
3   61  4  2
4   76  4  4
5   72  6  2
6   80  6  4
7   71  6  2
8   83  6  4
9   83  8  2
10  89  8  4
11  86  8  2
12  93  8  4
13  88 10  2
14  95 10  4
15  94 10  2
16 100 10  4


Best,
Louis

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Building R from source

2006-11-15 Thread YONGWAN CHUN
Dear Prof. Ripley, 


Finally, I succeeded in building R from source. I just changed WINHELP part in 
'MkRules' file from WINHELP = CHM to WINHELP = NO. Then R was built 
successfully. 

Thank you so much. 

Yongwan Chun

- Original Message -
From: Prof Brian Ripley [EMAIL PROTECTED]
Date: Tuesday, November 14, 2006 3:01 am
Subject: Re: [R] Building R from source

 We have seen one other report of this (from someone cross-
 compiling) but 
 cannot reproduce it, and pcre_dfa.exec.o should not be being 
 linked in.
 
 Please do check against the R-admin manual (the definitive source) 
 that 
 you have the same versions of tools as recommended.  It looks like 
 this is 
 a bug in some version of ld.exe (from binutils).
 
 A possible workaround is to edit src/extra/pcre/Makefile.win and 
 remove 
 pcre_dfa_exec.c from CSOURCES.  Then delete libpcre.a, and try 
 making 
 again.  But if you have a buggy ld.exe, I would want to use a non-
 buggy 
 one.
 
 On Mon, 13 Nov 2006, YONGWAN CHUN wrote:
 
  Hello,
 
 
  I was trying to build R from source on Windows XP. I installed 
 software 
  which are mentioned from the follow web page 
  http://www.murdoch-sutherland.com/Rtools/ (Last accessed on Nov. 
 13th, 
  2006) . Unfortunately, I got error messages whenever I run 'make 
 all 
  recommended' without modifying 'MkRules' file. I have removed 
 software 
  and reinstalled them several times but I still failed to get it 
 done. 
  The below message is what I got.
 
  If anybody gives information, I would appreciate it very much.
 
  Thanks,
 
  Yongwan
 
  ===
  D:\Rsource\R-2.4.0\src\gnuwin32make all recommended
  make[1]: `Rpwd.exe' is up to date.
  make[4]: Nothing to be done for `svnonly'.
  installing C headers
  make[2]: `all' is up to date.
  make[2]: `libRblas.dll.a' is up to date.
  make[5]: Nothing to be done for `svnonly'.
  installing C headers
  make --no-print-directory -C ../extra/intl -f Makefile.win
  make --no-print-directory -C ../appl  OPTFLAGS='-O3 -Wall -
 pedantic -std=gnu99' FOPTFLAGS='-O3 -Wall' -f Makefile.win
  make --no-print-directory -C ../nmath OPTFLAGS='-O3 -Wall -
 pedantic -std=gnu99' -f Makefile.win
  make --no-print-directory -C ../main  OPTFLAGS='-O3 -Wall -
 pedantic -std=gnu99 -DLEA_MALLOC' FFLAGS='-O3 -Wall' -f Makef
  ile.win
  make --no-print-directory -C ./graphapp OPTFLAGS='-O3 -Wall -
 pedantic -std=gnu99'
  make --no-print-directory -C ./getline OPTFLAGS='-O3 -Wall -
 pedantic -std=gnu99'
  make[4]: `gl.a' is up to date.
  make -f Makefile.win chartables.h
  make[5]: `chartables.h' is up to date.
  make -f Makefile.win makeMakedeps
  make -f Makefile.win libpcre.a
  make[5]: `libpcre.a' is up to date.
  make[4]: Nothing to be done for `all'.
  make[4]: Nothing to be done for `all'.
  gcc  -shared -s -mwindows -o R.dll R.def console.o dataentry.o 
 dynload.o edit.o editor.o embeddedR.o extra.o opt.o pager
  .o preferences.o psignal.o rhome.o rui.o run.o shext.o sys-
 win32.o system.o e_pow.o malloc.o ../main/libmain.a ../appl/l
  ibappl.a ../nmath/libnmath.a graphapp/ga.a getline/gl.a 
 ../extra/xdr/libxdr.a ../extra/zlib/libz.a ../extra/pcre/libpcre
  .a ../extra/bzip2/libbz2.a ../extra/intl/libintl.a 
 ../extra/trio/libtrio.a dllversion.o -L. -lg2c -lRblas -lcomctl32 -lv
  ersion
  
 ../extra/pcre/libpcre.a(pcre_dfa_exec.o):pcre_dfa_exec.c:(.text+0x15f9): 
 undefined reference to `_pcre_ucp_findprop'
  
 ../extra/pcre/libpcre.a(pcre_dfa_exec.o):pcre_dfa_exec.c:(.text+0x1639): 
 undefined reference to `_pcre_ucp_findprop'
  
 ../extra/pcre/libpcre.a(pcre_dfa_exec.o):pcre_dfa_exec.c:(.text+0x1736): 
 undefined reference to `_pcre_ucp_findprop'
  
 ../extra/pcre/libpcre.a(pcre_dfa_exec.o):pcre_dfa_exec.c:(.text+0x1770): 
 undefined reference to `_pcre_ucp_findprop'
  
 ../extra/pcre/libpcre.a(pcre_dfa_exec.o):pcre_dfa_exec.c:(.text+0x184d): 
 undefined reference to `_pcre_ucp_findprop'
  
 ../extra/pcre/libpcre.a(pcre_dfa_exec.o):pcre_dfa_exec.c:(.text+0x1e0f): more 
 undefined references to `_pcre_ucp_findpro
  p' follow
  collect2: ld returned 1 exit status
  make[3]: *** [R.dll] Error 1
  make[2]: *** [../../bin/R.dll] Error 2
  make[1]: *** [rbuild] Error 2
  make: *** [all] Error 2
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-
 project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
 
 -- 
 Brian D. Ripley,  [EMAIL PROTECTED]
 Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
 University of Oxford, Tel:  +44 1865 272861 (self)
 1 South Parks Road, +44 1865 272866 (PA)
 Oxford OX1 3TG, UKFax:  +44 1865 272595


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

Re: [R] how to create this design matrix?

2006-11-15 Thread Charles C. Berry
On Wed, 15 Nov 2006, Michael wrote:

 How about I make a design matrix as follows:

 1  d1,1  0   0 0   0 0   0   0
 00   1   d1,2  0   0 0   0   0
 00   0   0 1   d1,3  0   0   0
 ...
 ...

 000  0 0   0  ...  ... 1  d1,12


 The above matrix will work for the 1st row of Y data;

 d1, 1 means the 1st column of the 1st row of data;
 d1, 12 means the 12th column of the 1st row of data.


And 'd1,1' might not equal 'd1,2' , etc ???

If so, this is decidedly different than what you described below where you 
say that there is a common regressor for all 12 regressands (viz. they 
all regress to the 13th column, which is the predictor, i.e. the X.)

Here, you seem to have a different value of the regressor variable for 
each regressand.

John's suggestion was 'spot on' for the setup in your original posting.


 But now since I have N samples(rows) of Y data; how do I conceptually do a
 3D design matrix?

As you have it above, if 'D' is an N by 12 matrix,

t(matrix(apply(D,1,diag),nr=12))

will produce the even numbered columns and

diag(12)[rep(1:12,N),]

will take care of the odd numbered columns. cbind() and the tips in 
this recent thread

http://article.gmane.org/gmane.comp.lang.r.general/73730

provide the needed tools to assemble the results in the form you specify 
above.

But I seriously doubt that this is what you need, so please don't use this 
in a regression without assurance from a statistician who understands your 
setup that the implied model is reasonable.


 On 11/15/06, John Fox [EMAIL PROTECTED] wrote:

 Dear Michael,

 -Original Message-
 From: Michael [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, November 15, 2006 2:40 PM
 To: John Fox
 Cc: R-help@stat.math.ethz.ch
 Subject: Re: [R] how to create this design matrix?

 There are 12 response variables, columns 1 to 12 are response
 variables, i.e., these are y's, they all regress to the 13th
 column, which is the predictor, i.e. the X.


 Right.

 Let's take column 1, call this Y1, and there are n rows(n
 samples) of it,

 I need Y1= b0_1 + b1_1* X + epsilon, where X is the 13th column

 Similarly, for column 1 to column 12, we do the above,

 Y12= b0_12 + b1_12 * X + epsilon, where Y12 is the 12th column,

 they all have different b0's and b1's.

 Right.

 Totally there are 24 b0's and b1's.


 Yes.

 I want a group regression, not separated regression...


 I'm not sure what you mean by a group regression rather than separated
 regressions. The multivarite linear regression that I suggested will give
 you 12 slopes and 12 intercepts. They are exactly what you'd get from 12
 individual least-squares regression of each Y on X, but the multivariate
 regression can also give you, e.g., the covariances among all of the
 coefficients (if you want them).

 John

 Thanks




 On 11/15/06, John Fox  [EMAIL PROTECTED] wrote:

   Dear Michael,

   This looks like a multivariate simple regression --
 that is, 12 response
   variables, one predictor. If the data are in the matrix
 X, then lm(X[,1:12]
   ~ X[,13]) should do the trick.

   I hope this helps,
   John

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

   -Original Message-
   From: [EMAIL PROTECTED]
   [mailto: [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] ] On Behalf Of Michael
   Sent: Wednesday, November 15, 2006 12:23 AM
   To: R-help@stat.math.ethz.ch
   Subject: [R] how to create this design matrix?
  
   Hi all,
  
   I have a multiple-linear regression problem.
  
   There are 13 columns of data, the whole data matrix is:  n x
   13, where n is the number of samples.
  
   Now I want to regress  EACH of the first 12 columns onto the
   13th column, with 2-parameter linear model  y_i = b0 + b1 *
   x_i, where i goes from 1 to n, and b0 is the intercept.
  
   How do I create a design matrix to do the 12-column
   regression collectively all at once using multiple
 linear regressions?
  
   Thanks a lot
  
 [[alternative HTML version deleted]]
  
   __
   R-help@stat.math.ethz.ch mailing list
   https://stat.ethz.ch/mailman/listinfo/r-help
   PLEASE do read the posting guide
   http://www.R-project.org/posting-guide.html
  http://www.R-project.org/posting-guide.html
   and provide commented, minimal, self-contained,
 reproducible code.








   [[alternative HTML version deleted]]

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

[R] trouble loading example package

2006-11-15 Thread Charles Annis, P.E.
Greetings:

I've installed Rtools, MikTeX, perl, minGW, and HTML Help Workshop, and have
succeeded in making, checking (using R CMD check mypkg) then building the
simple example package.skeleton(list=c(f,g,d,e), name=mypkg)  R
CMD build mypkg produces a tarball.  I don't know how to get a zip file.

But when I try to Install package(s) from local zip files, I get this error
message:

Error in gzfile(file, r) : unable to open connection
In addition: Warning messages:
1: error -1 in extracting from zip file 
2: cannot open compressed file 'mypkg/DESCRIPTION'

But when I click on that file in the tarball it opens and shows me what I
expected.

I had hoped that I had weathered the hard part - building the package - but
I still need some help:

1) How do I get a zipped file, rather than a tarball,
2) How do I install what I've built?

Thanks in advance.

Charles Annis, P.E.

[EMAIL PROTECTED]
phone: 561-352-9699
eFax:  614-455-3265
http://www.StatisticalEngineering.com
 

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] trouble loading example package

2006-11-15 Thread Benilton Carvalho
How do you build your packages?

have you tried

R CMD build --binary mypkg

b

On Nov 16, 2006, at 12:32 AM, Charles Annis, P.E. wrote:

 Greetings:

 I've installed Rtools, MikTeX, perl, minGW, and HTML Help Workshop,  
 and have
 succeeded in making, checking (using R CMD check mypkg) then  
 building the
 simple example package.skeleton(list=c(f,g,d,e),  
 name=mypkg)  R
 CMD build mypkg produces a tarball.  I don't know how to get a zip  
 file.

 But when I try to Install package(s) from local zip files, I get  
 this error
 message:

 Error in gzfile(file, r) : unable to open connection
 In addition: Warning messages:
 1: error -1 in extracting from zip file
 2: cannot open compressed file 'mypkg/DESCRIPTION'

 But when I click on that file in the tarball it opens and shows me  
 what I
 expected.

 I had hoped that I had weathered the hard part - building the  
 package - but
 I still need some help:

 1) How do I get a zipped file, rather than a tarball,
 2) How do I install what I've built?

 Thanks in advance.

 Charles Annis, P.E.

 [EMAIL PROTECTED]
 phone: 561-352-9699
 eFax:  614-455-3265
 http://www.StatisticalEngineering.com


 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting- 
 guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Re : Regression

2006-11-15 Thread justin bem
Another way is 

reg-lapply(split(data,data$byvar),lm,formula=y~x)
 
Justin BEM
Elève Ingénieur Statisticien Economiste
BP 294 Yaoundé.
Tél (00237)9597295.



- Message d'origine 
De : Chuck Cleland [EMAIL PROTECTED]
À : Alvaro [EMAIL PROTECTED]
Cc : r-help@stat.math.ethz.ch
Envoyé le : Mercredi, 15 Novembre 2006, 23h58mn 09s
Objet : Re: [R] Regression


Alvaro wrote:
 I need to run a regression analysis with a large number of samples. Each
 sample (identified in the first file column) has its own x and y values. I
 will use the same model in all samples. How can I run the model for each
 sample? In SAS code I would use the BY SAMPLE statement.

  Here are a couple of ways:

by(warpbreaks, warpbreaks$tension, function(x) lm(breaks ~ wool, data = x))

library(nlme)

summary(lmList(breaks ~ wool | tension, warpbreaks))

?by

?lmList

  
 
 Alvaro
 
  
 
  
 
 
 [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.






___ 
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Profitez des connaissances, des opinions et des expériences des internaut

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Dotmatrix Plots

2006-11-15 Thread Marwan Khawaja

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Peter Dalgaard
 Sent: Wednesday, November 15, 2006 5:58 PM
 To: Jeffrey Robert Spies
 Cc: r-help
 Subject: Re: [R] Dotmatrix Plots
 
 Jeffrey Robert Spies [EMAIL PROTECTED] writes:
 
  Hi all,
  
  Does anyone know what happened to the dna library or the dotmatrix 
  function?  For the life of me, I can't find it anywhere with the 
  exception of this reference:
  
  http://rss.acs.unt.edu/Rdoc/library/dna/html/dotmatrix.html
  
  Thanks!
  
  Jeff.
  http://www.nd.edu/~jspies/
 
 For some reason, Jim prefers to play hide and seek with his 
 packages (which for some reason he insists on calling 
 libraries...). The current whereabouts seem to be  
 
 http://popgen.unimaas.nl/~jlindsey/rcode.html
 

Well, I think he is enjoying his retirement. His packages seem to work fine
(updated) using R 2.4.0.

Marwan

--
Marwan Khawaja   http://staff.aub.edu.lb/~mk36
-- 

 
 -- 
O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
   c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
  (*) \(*) -- University of Copenhagen   Denmark  Ph:  
 (+45) 35327918
 ~~ - ([EMAIL PROTECTED])  FAX: 
 (+45) 35327907
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Re : Simple Questions

2006-11-15 Thread justin bem
If you want a quick way to do this that mean you have a way to do that who is 
not to fast. First propose it.
 
Justin BEM
Elève Ingénieur Statisticien Economiste
BP 294 Yaoundé.
Tél (00237)9597295.



- Message d'origine 
De : Louis Tay [EMAIL PROTECTED]
À : r-help@stat.math.ethz.ch
Envoyé le : Jeudi, 16 Novembre 2006, 6h19mn 44s
Objet : [R] Simple Questions


Hi, I'm just starting out on R. I have an example data frame listed below.
I have regressed Y on X1. lm(Y~X1). Would like to obtain the Brown-Forsythe
test on residuals.
I am unsure of how to conduct the following steps.
(1) Inputting the residuals from regression into the data frame.
(2) Splitting the groups above (X11) and below mean of X1 (X12) in the data
frame.
(3) Calculating the sum squared deviations of each group residual about the
group median residual.

Is there a quick/dirty way to do this?


 Y X1 X2
1   64  4  2
2   73  4  4
3   61  4  2
4   76  4  4
5   72  6  2
6   80  6  4
7   71  6  2
8   83  6  4
9   83  8  2
10  89  8  4
11  86  8  2
12  93  8  4
13  88 10  2
14  95 10  4
15  94 10  2
16 100 10  4


Best,
Louis

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.






___ 
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Profitez des connaissances, des opinions et des expériences des internaut

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] 回覆: Re:??: Re:??: Re: Need help in waveslim package: imodwt and universal.thresh.m odwt

2006-11-15 Thread Prof Brian Ripley
On Thu, 16 Nov 2006, Airon Yiu wrote:

 Hi Rogerio:

  Thks a lot. It works.

  By the way, I have 2 related sides issues that need some help:
  (1)  What I want to do is this
  - do modwt on original time series
  - do thresholding on wavelet coefficients
  - obtain the inversed smoothed and detailed components of the original time 
 series using the thesholded coefficients. How can this be done ?

  mra accept the original time series as input.
  imodwt rountine will give me the inversed transformed in the form of 
 original time series, instead of separating them into detailed and smoothed 
 component.

  (2) Is there a way to make R giving me error messages in English 
 instead of Chinese so that I can communicate with others easily

Yes, and it is described in the rw-FAQ and in the R-admin manual.  You 
need to set LANGUAGE=en, where exactly depending on your unstated OS.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.