RE: [R] Density Estimation

2004-04-10 Thread Prof Brian Ripley
help.search(kernel density) reports

KernSec(GenKern)Univariate kernel density estimate
KernSur(GenKern)Bivariate kernel density estimation
bkde(KernSmooth)Compute a Binned Kernel Density Estimate
bkde2D(KernSmooth)  Compute a 2D Binned Kernel Density Estimate
dpik(KernSmooth)Select a Bandwidth for Kernel Density
Estimation
kde2d(MASS) Two-Dimensional Kernel Density Estimation

amongst others, and package sm also has a user-friendly selection.

So, apart from point out alternatives I wanted to point out how easy it 
was to find the information originally requested.


On Sat, 10 Apr 2004, Ko-Kang Kevin Wang wrote:

  -Original Message-
  From: [EMAIL PROTECTED]
 
  Dear Sir/Madam;
  Would you please tell me what is the command that allows the
  estimation of the Kernel Density for some data.
  Thanks,
 
 ?density

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

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


[R] Automation of c()

2004-04-10 Thread Miha STAUT
Hi,

I have around 300 files with the x, y and z coordinates of a DEM that I 
would like to join in a single data frame object. I know how to automate the 
import of the 300 data frames.

in Bash
ls  names
in R
names-scan(names...)
With rep() and data.frame() construct a series of read.table() commands, 
which you write to a file and execute them with source().

I do not know however how to automate the combination of the e.g. x vectors 
from all imported data frames in a single vector avoiding the manual writing 
of all the imported data frame names.

Thanks in advance, Miha

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


Re: [R] Automation of c()

2004-04-10 Thread pallier
 I have around 300 files with the x, y and z coordinates of a DEM that 
I would like to join in a
 single data frame object. I know how to automate the import of the 
300 data frames.


 I do not know however how to automate the combination of the e.g. x 
vectors from all
 imported data frames in a single vector avoiding the manual writing 
of all the imported
 data frame names.

Why not concatenate all the data files under Bash?

cat *.dat alldata.txt

You can then read 'alldata.txt' with a single read.table

Or, if you need to keep the file names in the data frame:

awk '{print FILENAME,$0}' *.dat alldata.txt

Or am I missing something?

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


Re: [R] Automation of c()

2004-04-10 Thread Uwe Ligges


Miha STAUT wrote:
 
 Hi,
 
 I have around 300 files with the x, y and z coordinates of a DEM that I
 would like to join in a single data frame object. I know how to automate the
 import of the 300 data frames.
 
 in Bash
 ls  names
 
 in R
 names-scan(names...)
 With rep() and data.frame() construct a series of read.table() commands,
 which you write to a file and execute them with source().

It's simpler, all can be done within R:

names - list.files()
dat - read.table(names[1])
for(i in names[-1])
dat - rbind(dat, read.table(i))

  
This example is quite ugly and maybe slow (I guess for huge data frames,
the solution presented by Christophe Pallier will be faster), in
particular the rbind() calls. If all data.frames have the same nrow(),
one can improve quite easily...

Uwe Ligges

 
 I do not know however how to automate the combination of the e.g. x vectors
 from all imported data frames in a single vector avoiding the manual writing
 of all the imported data frame names.
 
 Thanks in advance, Miha

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


[R] all poss. regression

2004-04-10 Thread Erin Hodgess
Dear R People:

Is there an all possible subsets function in regression, please?

Typically, I use the step function.  A student asked me
about the all possibles.

Thanks in advance!

R 1.8.1 Windows

Sincerely,
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: [EMAIL PROTECTED]

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


Re: [R] all poss. regression

2004-04-10 Thread Prof Brian Ripley
Look at package leaps.  Note that it applies to columns of the 
design matrix and not terms, so can be nonsensical with categorical 
predictors (let alone interactions of such).

On Sat, 10 Apr 2004, Erin Hodgess wrote:

 Dear R People:
 
 Is there an all possible subsets function in regression, please?
 
 Typically, I use the step function.  A student asked me
 about the all possibles.
 
 Thanks in advance!
 
 R 1.8.1 Windows

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

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


[R] (offtopic) I need two sets of 5 different color scales

2004-04-10 Thread Tamas Papp
Hi,

I am plotting a policy function (result from a dynamic stochastic
optimization problem, discretized approximation).  The policy function
maps from an 2 x 2 x 2 x 3 x B x F state space to a B x F state space
(B and F are usually between 4-6, and represent domestic and foreign
savings.  The other variables are income (Y), inflation (Pi), domestic
and foreign interest rates (R and Z)).  I actually wrote a plotting
function to represent all this, the result is attached -- please have
a look at it and help me...

I need advice in the following: I need two sets of colors for B and F
which are easy to distinguish (when printed on a color laser printer),
represent cardinality (ie have an intuitive mapping to an interval) or
at least ordinality.

I have experimented with the following:

Bcolors - hsv(.6, seq(0.2, 1, length=5), 1)
Fcolors - hsv(seq(.1,0, length=5), seq(0.2, 1, length=5)

this is what you see in the plot.  What colors would you use?  Do you
think that varying both brightness and hue helps to distinguish
colors?  Should I change saturation, too?

Thanks,

Tamas

PS.: The plot is simply gzipped.  If you need a zipped version, or the
source code, contact me.

-- 
Tamás K. Papp
E-mail: [EMAIL PROTECTED]
Please try to send only (latin-2) plain text, not HTML or other garbage.
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

The list engine removed the .eps.gz attachment [Re: [R] (offtopic) I need two sets of 5 different color scales]

2004-04-10 Thread Tamas Papp
On Sat, Apr 10, 2004 at 01:09:18PM +0200, Tamas Papp wrote:

 PS.: The plot is simply gzipped.  If you need a zipped version, or the
 source code, contact me.

It appears to be removed by the list engine.

Is it possible to send eps files to the list?  I gzipped it because it
was 90k originally, but 8k compressed.  What should I do, send the
uncompressed version?

The posting guide says: No binary attachments except for PS, PDF, and
some image and archive formats, that means no gzipped versions of
these?

Thanks

Tamas

-- 
Tamás K. Papp
E-mail: [EMAIL PROTECTED]
Please try to send only (latin-2) plain text, not HTML or other garbage.

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


Re: [R] (offtopic) I need two sets of 5 different color scales

2004-04-10 Thread Uwe Ligges
Tamas Papp wrote:
Hi,

I am plotting a policy function (result from a dynamic stochastic
optimization problem, discretized approximation).  The policy function
maps from an 2 x 2 x 2 x 3 x B x F state space to a B x F state space
(B and F are usually between 4-6, and represent domestic and foreign
savings.  The other variables are income (Y), inflation (Pi), domestic
and foreign interest rates (R and Z)).  I actually wrote a plotting
function to represent all this, the result is attached -- please have
a look at it and help me...
I need advice in the following: I need two sets of colors for B and F
which are easy to distinguish (when printed on a color laser printer),
represent cardinality (ie have an intuitive mapping to an interval) or
at least ordinality.
I have experimented with the following:

Bcolors - hsv(.6, seq(0.2, 1, length=5), 1)
Fcolors - hsv(seq(.1,0, length=5), seq(0.2, 1, length=5)
this is what you see in the plot.  What colors would you use?  Do you
think that varying both brightness and hue helps to distinguish
colors?  Should I change saturation, too?
Hmm, Ross Ihaka has given a talk at the DSC2003 conference about 
constructing sensible colors. Unfortunately, there is no paper available 
at http://www.ci.tuwien.ac.at/Conferences/DSC-2003/Proceedings/ ...
Some notes and a color package are available at 
http://www.stat.auckland.ac.nz/~ihaka/color/

Also, you might want to look at the package RColorBrewer available at 
CRAN. The package is supposed to provide palettes of sensible colors.

Uwe Ligges

PS: If you want to send any attachments: Preferably upload to a web site 
and just post the link.



Thanks,

Tamas

PS.: The plot is simply gzipped.  If you need a zipped version, or the
source code, contact me.




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


Re: [R] looking for a tutorial on exception handling

2004-04-10 Thread Luke Tierney
Unfortunately there isn't yet.  Writing a paper on this is fairly high
on my list of priorities but hasn't happened yet.

Best,

luke

On Fri, 9 Apr 2004, Tamas Papp wrote:

 Hi,
 
 I would like to learn how to do exception handling in R.  I had a look
 at the help page for tryCatch and I am trying to understand it (I am
 sure it is well-written, but I have not used exception handling before
 in any language, so I have no experience in that area).
 
 Is there a tutorial or an introduction into exception handling in R
 with tryCatch  friends?  Preferably with lots of examples.  It would
 be nice if there was one online, but references to books would also be
 appreciated.
 
 Thanks,
 
 Tamas
 
 

-- 
Luke Tierney
University of Iowa  Phone: 319-335-3386
Department of Statistics andFax:   319-335-3017
   Actuarial Science
241 Schaeffer Hall  email:  [EMAIL PROTECTED]
Iowa City, IA 52242 WWW:  http://www.stat.uiowa.edu

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


Re: [R] (offtopic) I need two sets of 5 different color scales

2004-04-10 Thread Matthias . Kohl
maybe, the RColorBrewer package does what you want?
see also: ColorBrewer.org

 Hi,

 I am plotting a policy function (result from a dynamic stochastic
 optimization problem, discretized approximation).  The policy function
 maps from an 2 x 2 x 2 x 3 x B x F state space to a B x F state space (B
 and F are usually between 4-6, and represent domestic and foreign
 savings.  The other variables are income (Y), inflation (Pi), domestic
 and foreign interest rates (R and Z)).  I actually wrote a plotting
 function to represent all this, the result is attached -- please have a
 look at it and help me...

 I need advice in the following: I need two sets of colors for B and F
 which are easy to distinguish (when printed on a color laser printer),
 represent cardinality (ie have an intuitive mapping to an interval) or
 at least ordinality.

 I have experimented with the following:

 Bcolors - hsv(.6, seq(0.2, 1, length=5), 1)
 Fcolors - hsv(seq(.1,0, length=5), seq(0.2, 1, length=5)

 this is what you see in the plot.  What colors would you use?  Do you
 think that varying both brightness and hue helps to distinguish
 colors?  Should I change saturation, too?

 Thanks,

 Tamas

 PS.: The plot is simply gzipped.  If you need a zipped version, or the
 source code, contact me.

 --
 Tamás K. Papp
 E-mail: [EMAIL PROTECTED]
 Please try to send only (latin-2) plain text, not HTML or other garbage.

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


[R] Re: missing values for mda package

2004-04-10 Thread Trevor Hastie
The mda package has no facilities for missing data.
Users are expected to supply clean data; i.e. any
missing value treatment should take place before using
any of the routines in the package.

In particular, our version of the mars function takes 
inputs x and y, which are assumed to have no missing values.

The spam data were used to demonstrate mars in
Elements of Statistical Learning 
The spam data has no missing values, and can be obtained from
http://www-stat.stanford.edu/~tibs/ElemStatLearn/

Trevor Hastie

  Trevor Hastie  [EMAIL PROTECTED]  
  Professor, Department of Statistics, Stanford University
  Phone: (650) 725-2231 (Statistics)Fax: (650) 725-8977  
(650) 498-5233 (Biostatistics)   Fax: (650) 725-6951
  URL: http://www-stat.stanford.edu/~hastie  
  address: room 104, Department of Statistics, Sequoia Hall
   390 Serra Mall, Stanford University, CA 94305-4065  


[[alternative HTML version deleted]]

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


Re: [R] confidential interval of correlation coefficient using bootstrap

2004-04-10 Thread Prof Brian Ripley
You are not using boot() correctly.  Please do try reading the help page, 
which says

statistic: ...

  In all other cases 'statistic' must take at least two arguments.  The
  first argument passed will always be the original data. The second will
  be a vector of indices ...

so you need a function of two args like

 f - function(data, i) cor(data[i, 1], data[i, 2])
 boot(cbind(x,y), f, 200)

ORDINARY NONPARAMETRIC BOOTSTRAP


Call:
boot(data = cbind(x, y), statistic = f, R = 200)


Bootstrap Statistics :
 original biasstd. error
t1* 0.5711816 0.05765583   0.2178101


However, once you have done that you need a way to get a confidence 
interval, and you will find ?abc.ci has an example for you, using 
correlations.


On Sat, 10 Apr 2004, XIAO LIU wrote:

 I tried 2 methods to estimate C.I. of correlation coefficient of variables x and y:
 
  x - c(44.4, 45.9, 41.9, 53.3, 44.7, 44.1, 50.7, 45.2, 60.1)
  y - c( 2.6,  3.1,  2.5,  5.0,  3.6,  4.0,  5.2,  2.8,  3.8)
 
 #METHOD 1: Pearson's
 **
  cor.test(x, y, method = pearson, conf.level = 0.95)
 
 Pearson's product-moment correlation
 
 data:  x and y 
 t = 1.8411, df = 7, p-value = 0.1082
 alternative hypothesis: true correlation is not equal to 0 
 95 percent confidence interval:
  -0.1497426  0.8955795 
 sample estimates:
   cor 
 0.5711816 
 ***
 
 #METHOD 2: bootstrap
 ***
  boot(cbind(x,y), cor, 200)
 
 ORDINARY NONPARAMETRIC BOOTSTRAP
 
 
 Call:
 boot(data = cbind(x, y), statistic = cor, R = 200)
 
 
 Bootstrap Statistics :
  original biasstd. error
 t1* 0.5429120 -0.5232893   0.3799117
 t2* 0.3832856 -0.3779026   0.387
 
 
 'cor.test' gave the value of cor as 0.5711816.  Why did 'boot' give two original 
 cors: t1 and t2.  And why does none of t1 and t2 equal to what 'cor.test' gave.
 
 Thank you very much
 
 Xiao

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

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


[R] nlme: creating pdMats

2004-04-10 Thread Scott Rifkin
I have an experiment with an interaction (VT) between Varieties and Time.  
There are 12 Varieties and 2 Times (Early and Late), and Time is a fixed 
affect.

I have been estimating a single variance from this interaction using 
pdIdent(~VT-1).

I would like to test 2 more complicated models.

1) Estimate 2 variances, one for Variety*Time(Early) and one for 
Variety*Time(Late), again with a diagonal matrix.

2) The above with a covariance term between the Times across Varieties.  
To do this, I think I would want a variance covariance matrix like (1) but
with one more parameter wherever a row and a column share a Variety but 
differ in Times.  The rest would be zero.

I would appreciate if someone would explain how I can do this using the 
standard pdMat classes, or, more likely, how to create a new one to do 
this.

Thanks much,
Scott Rifkin

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


[R] fixed and random effects question

2004-04-10 Thread Scott Rifkin
On page 146 of Pinheiro  Bates, they mention models  where every fixed 
effect has an associated random effect. What does it mean for a fixed 
effect to have an associated random effect?

Thanks for any clarification,
Scott Rifkin

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