[R] [R-pkgs] new R package: UNTB

2006-01-19 Thread Robin Hankin
Dear List

please find uploaded to CRAN a new R package for the simulation and  
analysis
of biodiversity.

The package implements simulations and diagnostics of ecological systems
that obey the Unified Neutral Theory of Biodiversity (untb).

The canonical reference is:


The Unified Neutral Theory of Biodiversity and Biogeography,
Stephen P. Hubbell, Princeton University Press, 2000.


enjoy



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

___
R-packages mailing list
[EMAIL PROTECTED]
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


Re: [R] Legend Outside Plot Dimension

2006-01-19 Thread Petr Pikal
Hi

I think you need to use par(xpd=TRUE). Try to search archives as 
similar question was answered few days ago.

HTH
Petr


On 19 Jan 2006 at 12:19, Abd Rahman Kassim wrote:

From:   Abd Rahman Kassim [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Date sent:  Thu, 19 Jan 2006 12:19:30 -0800
Subject:[R] Legend Outside Plot Dimension

 
 Dear All,
 
 I'm trying to attach a legend outside the plot (Inside plot OK), but
 failed. Any help is very much appreciated.
 
 Thanks.
 
 
 Abd. Rahman Kassim, PhD
 Forest Management  Ecology Program
 Forestry  Conservation Division
 Forest Research Institute Malaysia
 Kepong 52109 Selangor
 MALAYSIA
 
 *
 
 Checked by TrendMicro Interscan Messaging Security.
 For any enquiries, please contact FRIM IT Department.
 *
  [[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

Petr Pikal
[EMAIL PROTECTED]

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


Re: [R] creating objects with a slot of class formula, using new

2006-01-19 Thread Martin Maechler
 Gabor == Gabor Grothendieck [EMAIL PROTECTED]
 on Thu, 19 Jan 2006 00:27:42 -0500 writes:

Gabor Create a virtual class that can either be a formula or be NULL:
 setClassUnion(formulaOrNULL, c(formula, NULL))
 setClass(a,representation(b=list,c=formulaOrNULL))
 new(a, b = list(7))

that's one possibility, and probably closest to what Steve was
asking for,  however read on

Gabor On 1/18/06, Steven Lacey [EMAIL PROTECTED] wrote:
 Hi,
 
 .
 
 But, now suppose you want a slot to accept an object of class formula...

 setClass(a,representation(b=list,c=formula))
 new(a,b=list(7))
 Error in validObject(.Object) : invalid class a object: invalid object
 for slot c in class a: got class NULL, should be or extend class
 formula
 
 Why can't new handle this? Why must the slot be defined?

the 'c' slot need not be defined, but it must be initialized to
an object of class formula

 If I call new without any named arguments, it works fine
  new(a)
 An object of class a
 Slot b:
 list()
 
 Slot c:
 NULL

No, it does not work fine; it has created an *invalid* object,
since, for efficiency reasons,
the internal equivalent of  validObject()  is not called in all
cases of object creation {and that is good: basic object
creation should be fast}:

   (aa - new(a))
  An object of class a
  Slot b:
  list()

  Slot c:
  NULL

   validObject(aa)## gives an error as it should
  Error in validObject(aa) : invalid class a object: invalid object for slot 
c in class a: got class NULL, should be or extend class formula


 If I call new with only a formula, it works fine.
  new(a,c=formula(x~y))
 An object of class a
 Slot b:
 list()
 
 Slot c:
 x ~ y

yes, since 'c' now *is* a formula, and BTW,
even the simpler
 new(a, c = x~y)

is sufficient {recurring topic of yesterday:  'y ~ x'  *is* a formula
   and does not need an as.formula(.) or formula(.)
   around it !!}

 How can I get R to do this?
 setClass(a,representation(b=list,c=formula))
 new(a,b=list(7))
 An object of class a
 Slot b:
 [[1]]
 [1] 7

 Slot c:
 NULL

you can't and shouldn't be able to: If slot 'c' is defined to be
a formula, it should be a formula and not NULL.
So you need to change the class definition.

Apart from Gabor's possibility which I consider a bit unelegant and
not ideal here, I'd strongly suggest you make use of the 
'prototype' argument when you define the class,
e.g. :

   setClass(a, representation(b = list, f = formula),
  +  prototype = prototype(b = list(), f = y ~ x))
  [1] a
   (aa - new(a))
  An object of class a
  Slot b:
  list()

  Slot f:
  y ~ x

   validObject(aa)
  [1] TRUE
   

--
Martin Maechler, ETH Zurich

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


Re: [R] Legend Outside Plot Dimension

2006-01-19 Thread Abd Rahman Kassim

Dear Peter,

Thanks for your promt response. 

Abd. Rahman 
- Original Message - 
From: Petr Pikal [EMAIL PROTECTED]
To: Abd Rahman Kassim [EMAIL PROTECTED]; r-help@stat.math.ethz.ch
Sent: Thursday, January 19, 2006 12:11 AM
Subject: Re: [R] Legend Outside Plot Dimension


 
 Hi
 
 I think you need to use par(xpd=TRUE). Try to search archives as 
 similar question was answered few days ago.
 
 HTH
 Petr
 
 
 On 19 Jan 2006 at 12:19, Abd Rahman Kassim wrote:
 
 From:   Abd Rahman Kassim [EMAIL PROTECTED]
 To: r-help@stat.math.ethz.ch
 Date sent:  Thu, 19 Jan 2006 12:19:30 -0800
 Subject:[R] Legend Outside Plot Dimension
 
 
 Dear All,
 
 I'm trying to attach a legend outside the plot (Inside plot OK), but
 failed. Any help is very much appreciated.
 
 Thanks.
 
 
 Abd. Rahman Kassim, PhD
 Forest Management  Ecology Program
 Forestry  Conservation Division
 Forest Research Institute Malaysia
 Kepong 52109 Selangor
 MALAYSIA
 
 *
 
 Checked by TrendMicro Interscan Messaging Security.
 For any enquiries, please contact FRIM IT Department.
 *
  [[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
 
 Petr Pikal
 [EMAIL PROTECTED]
 
 
 
 *
 Outgoing mail is certified Virus Free.
 Checked by TrendMicro Interscan Messaging Security.
 For any enquiries, please contact FRIM IT Department.
 *

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


Re: [R] Canonical Variance Analysis by any other name?

2006-01-19 Thread Prof Brian Ripley
Canonical variates or canonical variance?

Canonical variates in the sense of your quote is the same thing as 
multi-group LDA (the part of LDA not due to Fisher)

Another sense (e.g. http://en.wikipedia.org/wiki/Canonical_analysis)
is canonical correlation analysis (function cancor).  And indeed, LDA can 
be derived from CCA: see my PRNN book.

On Thu, 19 Jan 2006, Patrick Connolly wrote:

 I've been asked about Canonical Variance Analysis (CVA).  I don't
 see any reference to it searching the R site.  Does it go by other
 names?

 Genstat describes it thus:

 Canonical variates analysis operates on a within-group sums of squares
 and products matrix, calculated from a set of variates and factor that
 specifies the grouping of units. It finds linear combinations of the
 variates that maximize the ratio of between-group to within-group
 variation, thereby giving functions that can be used to discriminate
 between the groups.

 It's probably not particularly difficult to do, so I suspect someone
 has a package for doing it.  What other name might I search for?

 Thnx

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

 __
 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


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

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


[R] Tobit estimation?

2006-01-19 Thread Ajay Narottam Shah
Folks,

Based on
  http://www.biostat.wustl.edu/archives/html/s-news/1999-06/msg00125.html

I thought I should experiment with using survreg() to estimate tobit
models.

I start by simulating a data frame with 100 observations from a tobit model

 x1 - runif(100)
 x2 - runif(100)*3
 ystar - 2 + 3*x1 - 4*x2 + rnorm(100)*2
 y - ystar
 censored - ystar = 0
 y[censored] - 0
 D - data.frame(y, x1, x2)
 head(D)
  y x1x2
1 0.000 0.86848630 2.6275703
2 0.000 0.88675832 1.7199261
3 2.7559349 0.38341782 0.6247869
4 0.000 0.02679007 2.4617981
5 2.2634588 0.96974450 0.4345950
6 0.6563741 0.92623096 2.4983289

 # Estimate it
 library(survival)
 tfit - survreg(Surv(y, y0, type='left') ~ x1 + x2,
  data=D, dist='gaussian', link='identity')

It says:

  Error in survreg.control(...) : unused argument(s) (link ...)
  Execution halted

My competence on library(survival) is zero. Is it still the case that
it's possible to be clever and estimate the tobit model using
library(survival)?

I also saw the two-equation setup in the micEcon library. I haven't
yet understood when I would use that and when I would use a straight
estimation of a censored regression by MLE. Can someone shed light on
that? My situation is: Foreign investment on the Indian stock
market. Lots of firms have zero foreign investment. But many do have
foreign investment. I thought this is a natural tobit situation.

-- 
Ajay Shah  http://www.mayin.org/ajayshah  
[EMAIL PROTECTED] http://ajayshahblog.blogspot.com
*(:-? - wizard who doesn't know the answer.

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


Re: [R] some EPS rotated in journal preview

2006-01-19 Thread Knut Krueger


Knut Krueger schrieb:

I am trying to send a manuscript to a journal.
One of the figures build by R is in the right orientation and 4 are rotated 
clockwise 90 deg in the preview.

  

So I realized that they rotated the Paper not the figure. I did not 
realize it because I did not set the Arcrobat reader to a full size view. 
So I saw only the rotaded figure not the hole page.

maybe this is a better hint.

And the hint from the journal:

Please be advised that your eps figure file could have rotated in the built
PDF due to its size which is larger than the paper.

but I think that could not be the problem, because the figure is in the right 
rotation at the page.



Regards Knut

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


[R] Tobit estimation?

2006-01-19 Thread Ken Knoblauch
If you look at ?survreg, you might notice that there is no link argument,
but that
reference is made to survreg.old that does contain a link argument.  Thus,

help(survreg,package=survival)
 x1 - runif(100)
 x2 - runif(100)*3
 ystar - 2 + 3*x1 - 4*x2 + rnorm(100)*2
 y - ystar
 censored - ystar = 0
 y[censored] - 0
 D - data.frame(y, x1, x2)
 head(D)
 yx1x2
1 0.00 0.8381902 2.3445745
2 2.834993 0.6603959 0.4572142
3 2.322114 0.6683632 0.2619112
4 0.00 0.3762860 1.8897217
5 1.977283 0.9713827 0.8079159
6 0.536224 0.8266868 1.1839211
 library(survival)
Loading required package: splines
 tfit - survreg(Surv(y, y0, type='left') ~ x1 + x2,
+   data=D, dist='gaussian', link='identity')
Error in survreg.control(...) : unused argument(s) (link ...)
+
 tfit - survreg.old(Surv(y, y0, type='left') ~ x1 + x2,
+   data=D, dist='gaussian', link='identity')
 tfit
Call:
survreg(formula = formula, data = data, dist = dist, scale = scale)

Coefficients:
(Intercept)  x1  x2
   1.5945012.825190   -2.985390

Scale= 1.493047

Loglik(model)= -66.1   Loglik(intercept only)= -109.7
Chisq= 87.28 on 2 degrees of freedom, p= 0
n= 100

-- 
Ken Knoblauch
Inserm U371
Cerveau et Vision
Dept. of Cognitive Neuroscience
18 avenue du Doyen Lépine
69500 Bron
France
tel: +33 (0)4 72 91 34 77
fax: +33 (0)4 72 91 34 61
portable: +33 (0)6 84 10 64 10
http://www.lyon.inserm.fr/371/

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


[R] html excel file

2006-01-19 Thread Stefan Semmeling
hallo,

i have a problem reading in the above mentioned kind of a file.
does anybody know an easy way how to read it in?
i can save it as a text file that looks like:

Datum des Fixings
Restlaufzeit

 
1 Jahr
2 Jahre
3 Jahre
4 Jahre
5 Jahre
6 Jahre
7 Jahre
8 Jahre
9 Jahre
10 Jahre
12 Jahre
15 Jahre
13.01.06
2.819
2.983
3.073
3.137
3.194
3.247
3.302
3.355
3.409
3.459
3.548
3.649
12.01.06
2.847
3.013
3.102
3.164
3.217
3.268
3.322
3.373
3.426
3.475
3.564
3.665
...

after skipping the first four lines i want to read it in while the first 12
lines are the heades
the next is the date followed by the singel values...(these lines are always
repeated)

it is supposed to look like 

  123456789101215
datum1abcdefghij k  l   
datum2abcdefghij k  l   
...

i tried to read it in as a normal excel file but it didn´t work out the way
it was supposed to

thank you for helping!!!

stefan

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


[R] R Commenting Style

2006-01-19 Thread Paul Roebuck
I seem to remember reading somewhere about some style
guide regarding R the number of comment characters (#)
prior to the comment meaning something.

Anyone know to what I'm referring? Where?

--
SIGSIG -- signature too long (core dumped)

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


[R] packages about microarray analysis

2006-01-19 Thread Vincent Deng
Dear R-helpers,

Can anybody suggest me some common packages for standard microarray
analysis, either from CRAN or Bioconductor?


Many 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


Re: [R] se.fit in predict.nls

2006-01-19 Thread Manuel Gutierrez
Sorry to be so persistent but I really need to get
some measure of the error in the predictions of my nls
model.
I've tried to find out what predict.nls does and I've
got down to 
MiModelo$m$predict
function (newdata = list(), qr = FALSE) 
{
eval(form[[3]], as.list(newdata), env)
}
environment: 0x88a076c
But I can not find what is form.
Any help, please.
Manuel


Manuel Gutierrez wrote:
 The option se.fit in predict.nls is currently
ignored.
 Is there any other function available to calculate
the
 error in the predictions?
 Thanks,
 Manuel
 



__ 
LLama Gratis a cualquier PC del Mundo. 
Llamadas a fijos y móviles desde 1 céntimo por minuto.

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


Re: [R] packages about microarray analysis

2006-01-19 Thread Andrej Kastrin
Vincent Deng wrote:

Dear R-helpers,

Can anybody suggest me some common packages for standard microarray
analysis, either from CRAN or Bioconductor?


Many 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

  

Look at: http://ihome.cuhk.edu.hk/~b400559/arraysoft_rpackages.html

Cheers, Andrej

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


Re: [R] ICC for Binary data

2006-01-19 Thread Renaud Lancelot
Brian,

Have a look at package aod on CRAN, and more specifically the
functions icc, donner and raoscott.

Best,

Renaud

2006/1/18, Brian Perron [EMAIL PROTECTED]:
 Hello R users:



 I am fairly new to R and am trying to figure out how to compute an intraclass 
 correlation (ICC) and/or design effect for binary data?  More specifically, I 
 am trying to determine the amount of clustering in a data set - that is, 
 whether certain treatment programs tend to work with more or less severe 
 clients.  The outcome variable is dichotomous (low severity / high severity) 
 and the grouping variable is the treatment program.  Any suggestions for some 
 R code or the appropriate R package would be greatly appreciated.



 Thanks,

 Brian

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



--
Renaud LANCELOT
Département Elevage et Médecine Vétérinaire (EMVT) du CIRAD
Directeur adjoint chargé des affaires scientifiques

CIRAD, Animal Production and Veterinary Medicine Department
Deputy director for scientific affairs

Campus international de Baillarguet
TA 30 / B (Bât. B, Bur. 214)
34398 Montpellier Cedex 5 - France
Tél   +33 (0)4 67 59 37 17
Secr. +33 (0)4 67 59 39 04
Fax   +33 (0)4 67 59 37 95

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


Re: [R] se.fit in predict.nls

2006-01-19 Thread Prof Brian Ripley
I think you first need to understand how you would compute the standard 
errors.  Since the model is non-linear, it is hard to see how this could 
be done accurately.  If the parameters are estimated with negligible error 
compared to the non-linearity (and you can explore that since profiling 
gives you an idea of the variability), you can use local linearization to 
do this. If not, you can simulate.


On Thu, 19 Jan 2006, Manuel Gutierrez wrote:


Sorry to be so persistent but I really need to get
some measure of the error in the predictions of my nls
model.


That is not what se.fit would tell you.  It gives you a measure of the 
variability in the fitted mean curve at one point.  If that is large 
compared to the variability about the true mean curve, you are likely to 
have trouble finding it (and the standard error may not an adequarte 
summary as it is likely to be an asymmetric distribution).



I've tried to find out what predict.nls does and I've
got down to
MiModelo$m$predict
function (newdata = list(), qr = FALSE)
{
   eval(form[[3]], as.list(newdata), env)
}
environment: 0x88a076c
But I can not find what is form.


You really do need to understand all the code, and lexical scoping.


Any help, please.
Manuel


Manuel Gutierrez wrote:

The option se.fit in predict.nls is currently

ignored.

Is there any other function available to calculate

the

error in the predictions?
Thanks,
Manuel





__
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.

__
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



--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Re: [R] packages about microarray analysis

2006-01-19 Thread Sean Davis



On 1/19/06 5:36 AM, Vincent Deng [EMAIL PROTECTED] wrote:

 Dear R-helpers,
 
 Can anybody suggest me some common packages for standard microarray
 analysis, either from CRAN or Bioconductor?

You did look at the Bioconductor project?  The vast majority of those
packages are for microarray analysis.  If you need more specific help, I
would suggest using the bioconductor mailing list.

Sean

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


Re: [R] R Commenting Style

2006-01-19 Thread Kevin E. Thorpe
I don't know if this is what you're referring to, but in ESS the number 
of octothorpes (#) affects the indentation in the emacs buffer. If I 
remember right, ### puts it at the beginning of the line, ## the current 
indentation level (eg. in a function) and # further right.

Paul Roebuck wrote:

I seem to remember reading somewhere about some style
guide regarding R the number of comment characters (#)
prior to the comment meaning something.

Anyone know to what I'm referring? Where?



-- 
Kevin E. Thorpe
Biostatistician/Trialist, Knowledge Translation Program
Assistant Professor, Department of Public Health Sciences
Faculty of Medicine, University of Toronto
email: [EMAIL PROTECTED]  Tel: 416.946.8081  Fax: 416.946.3297

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


[R] Minimizing mahalanobis distance to negative orthant

2006-01-19 Thread DED (David George Edwards)
Hi

I have the following problem: given x (px1) and S (pXp positive definite), find 
y such that y_i=0 (i=1..p) minimizing the
mahalanobis distance (x-y)'S^{-1}(x-y). 

Has anyone worked on this problem? Tips or R code would be appreciated.

David



David Edwards
Principal scientist
Biostatistics

Novo Nordisk A/S
Novo Allé
2880 Bagsvaerd
Denmark
+45   (phone)

This e-mail (including any attachments) is intended for the addressee(s) stated 
above only and may contain confidential information protected by law. You are 
hereby notified that any unauthorised reading, disclosure, copying or 
distribution of this e-mail or use of information contained herein is strictly 
prohibited and may violate rights to proprietary information. If you are not an 
intended recipient, please return this e-mail to the sender and delete it 
immediately hereafter. Thank you.


[[alternative HTML version deleted]]

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

[R] empirical maximum likelihood estimation

2006-01-19 Thread Dominik Heinzmann
Dear R-users

Problem:

Given the following system of ordinary differential euqations

dM/dt = (-n)*M-h*M
dS/dt = n*M-h*S+u*R
dA/dt = h*S-q*A
dI/dt = q*A-p*I
dJ/dt = h*M-v*J
dR/dt=p*I+v*J-u*R

where M,S,A,I,J,R are state variables and n,h,u,q,p,v parameters.

I'm able to calculate the likelihood value based on the solutions 
M,S,A,I,J,R of the ODE's given the data, but without an explicit formula.

How can I now optimize the loglikelihood with respect to the parameter 
n,h,u,q,p,v? Is there any functions available in R for dealing with such 
empirical likelihood problems?

Thanks a lot for your support.

-- 
Dominik Heinzmann
Master of Science in Mathematics, EPFL
Ph.D. student in Biostatistics
Institute of Mathematics
University of Zurich

Winterthurerstrasse 190
CH-8057 Zürich
Office: Y36L90

E-Mail  : [EMAIL PROTECTED]
Phone   : +41-(0)44-635 5858
Fax : +41-(0)1-63 55705
Homepage: http://www.math.unizh.ch/user/heinzmann

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


Re: [R] Tobit estimation?

2006-01-19 Thread Achim Zeileis
On Thu, 19 Jan 2006 14:05:58 +0530 Ajay Narottam Shah wrote:

 Folks,
 
 Based on
   http://www.biostat.wustl.edu/archives/html/s-news/1999-06/msg00125.html
 
 I thought I should experiment with using survreg() to estimate tobit
 models.

I've been working on a convenience interface to survreg() that makes it
particularly easy to fit tobit models re-using the survreg()
infrastructure. The package containing the code will hopefully be
release soon - anyone who wants a devel snapshot, please contact me
off-list.
Ajay, I'll send you the code in a separate mail.

Best,
Z

 I start by simulating a data frame with 100 observations from a tobit
 model
 
  x1 - runif(100)
  x2 - runif(100)*3
  ystar - 2 + 3*x1 - 4*x2 + rnorm(100)*2
  y - ystar
  censored - ystar = 0
  y[censored] - 0
  D - data.frame(y, x1, x2)
  head(D)
   y x1x2
 1 0.000 0.86848630 2.6275703
 2 0.000 0.88675832 1.7199261
 3 2.7559349 0.38341782 0.6247869
 4 0.000 0.02679007 2.4617981
 5 2.2634588 0.96974450 0.4345950
 6 0.6563741 0.92623096 2.4983289
 
  # Estimate it
  library(survival)
  tfit - survreg(Surv(y, y0, type='left') ~ x1 + x2,
   data=D, dist='gaussian', link='identity')
 
 It says:
 
   Error in survreg.control(...) : unused argument(s) (link ...)
   Execution halted
 
 My competence on library(survival) is zero. Is it still the case that
 it's possible to be clever and estimate the tobit model using
 library(survival)?
 
 I also saw the two-equation setup in the micEcon library. I haven't
 yet understood when I would use that and when I would use a straight
 estimation of a censored regression by MLE. Can someone shed light on
 that? My situation is: Foreign investment on the Indian stock
 market. Lots of firms have zero foreign investment. But many do have
 foreign investment. I thought this is a natural tobit situation.
 
 -- 
 Ajay Shah
 http://www.mayin.org/ajayshah
 [EMAIL PROTECTED]
 http://ajayshahblog.blogspot.com *(:-? - wizard who doesn't know the
 answer.
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html


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


Re: [R] Minimizing mahalanobis distance to negative orthant

2006-01-19 Thread Prof Brian Ripley
On Thu, 19 Jan 2006, DED (David George Edwards) wrote:

 I have the following problem: given x (px1) and S (pXp positive 
 definite), find y such that y_i=0 (i=1..p) minimizing the mahalanobis 
 distance (x-y)'S^{-1}(x-y).

 Has anyone worked on this problem? Tips or R code would be appreciated.

If I read this correctly (some spaces would help) you want

y such that y = 0 and y minimizes (x-y)'Q(x-y) for a symmetric pos def Q.

That is a quadratic program, so see package quadprog.

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

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


Re: [R] R Commenting Style

2006-01-19 Thread Romain Francois
Le 19.01.2006 11:19, Paul Roebuck a écrit :

I seem to remember reading somewhere about some style
guide regarding R the number of comment characters (#)
prior to the comment meaning something.

Anyone know to what I'm referring? Where?
  

Hi,

If you edit your R code with eclipse + statET plugin 
(http://www.walware.de/goto/statet)
you can associate task tags to your comments, ie :
# TODO : bla bla
# FIXME : replace that for loop by some vectorized incantation
# BUG :
... you can create new task tags according to your taste ...

so that the comments are managed by a separate window. Pretty useful.

Romain


-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
mixmod 1.7 is released : http://www-math.univ-fcomte.fr/mixmod/index.php
+---+
| Romain FRANCOIS - http://francoisromain.free.fr   |
| Doctorant INRIA Futurs / EDF  |
+---+

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


Re: [R] empirical maximum likelihood estimation

2006-01-19 Thread Prof Brian Ripley

Look at optim, or mle in package stats4.

There are a lot of similar problems addressed in R: few real-world 
likelihoods have `an explicit formula'.  One quite similar example is 
ARIMA fitting.


On Thu, 19 Jan 2006, Dominik Heinzmann wrote:


Dear R-users

Problem:

Given the following system of ordinary differential euqations

dM/dt = (-n)*M-h*M
dS/dt = n*M-h*S+u*R
dA/dt = h*S-q*A
dI/dt = q*A-p*I
dJ/dt = h*M-v*J
dR/dt=p*I+v*J-u*R

where M,S,A,I,J,R are state variables and n,h,u,q,p,v parameters.

I'm able to calculate the likelihood value based on the solutions
M,S,A,I,J,R of the ODE's given the data, but without an explicit formula.

How can I now optimize the loglikelihood with respect to the parameter
n,h,u,q,p,v? Is there any functions available in R for dealing with such
empirical likelihood problems?

Thanks a lot for your support.

--
Dominik Heinzmann
Master of Science in Mathematics, EPFL
Ph.D. student in Biostatistics
Institute of Mathematics
University of Zurich

Winterthurerstrasse 190
CH-8057 Zürich
Office: Y36L90

E-Mail  : [EMAIL PROTECTED]
Phone   : +41-(0)44-635 5858
Fax : +41-(0)1-63 55705
Homepage: http://www.math.unizh.ch/user/heinzmann

__
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



--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Re: [R] princomp() with missing values in panel data?

2006-01-19 Thread Henric Nilsson
ivo welch said the following on 2006-01-18 14:56:

 thank you.  I am still not sure how to get the scores in princomp, though:
 
 ds= as.data.frame( cbind(rnorm(10),rnorm(10)) )
 names(ds)=c(x1,x2)
 ds[5,]=c(NA,NA)
 pc= princomp( formula = ~ ds$x1 + ds$x2, na.action=na.omit)
 ds$pc1 = pc$scores[,1]  #-- error, scores has 9 obs, ds has 10 obs
 
 is there an elegant method to do this, or do I need to learn how to operate

Prof Ripley told you how to do it: `na.action = na.exclude'.

 with pc$loadings?  (may I also humbly suggest that the default behavior or
 $scores should be to contain NA in row 5?)

Choosing sensible defaults in the case of NAs is a tricky business.

Personally, I'd like the default to be `na.fail', so that I don't miss 
out on NAs if I've been sloppy while screening the data. Genrally, just 
ignoring missings and analysing the data as if it were complete may lead 
to seriously biased results.

 Incidentally, R is a lot cleverer than I understand.  pc$loadings by itself

Sometimes R is almost too clever, and I end up feeling humliated when 
finding out that I'm the stupid one... ;-)


HTH,
Henric



 gives me wonderfully intuitive output, with names, text, different
 components---but I can still use p$loadings[,2].  I presume that the array
 operator on the loadings object is overloaded.  very nice.
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

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


Re: [R] html excel file

2006-01-19 Thread Petr Pikal
Hi
your question is a bit cryptic. What file you want to read?

xls or some exported file from Excel?

There is many different ways how to read data into R.

See
read.table, RODBC, R data Import Export Manual

I personally use

in Excel 
select the data with header and
Ctrl-C

in R

myfile - read.delim(clipboard)

HTH
Petr





On 19 Jan 2006 at 10:38, Stefan Semmeling wrote:

From:   Stefan Semmeling [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Date sent:  Thu, 19 Jan 2006 10:38:18 +0100
Subject:[R] html excel file

 hallo,
 
 i have a problem reading in the above mentioned kind of a file.
 does anybody know an easy way how to read it in?
 i can save it as a text file that looks like:
 
 Datum des Fixings
 Restlaufzeit
 
 
 1 Jahr
 2 Jahre
 3 Jahre
 4 Jahre
 5 Jahre
 6 Jahre
 7 Jahre
 8 Jahre
 9 Jahre
 10 Jahre
 12 Jahre
 15 Jahre
 13.01.06
 2.819
 2.983
 3.073
 3.137
 3.194
 3.247
 3.302
 3.355
 3.409
 3.459
 3.548
 3.649
 12.01.06
 2.847
 3.013
 3.102
 3.164
 3.217
 3.268
 3.322
 3.373
 3.426
 3.475
 3.564
 3.665
 ...
 
 after skipping the first four lines i want to read it in while the
 first 12 lines are the heades the next is the date followed by the
 singel values...(these lines are always repeated)
 
 it is supposed to look like 
 
   123456789101215
 datum1abcdefghij   k  l  
 datum2abcdefghij k  l 
  ...
 
 i tried to read it in as a normal excel file but it didn´t work out
 the way it was supposed to
 
 thank you for helping!!!
 
 stefan
 
 __
 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

Petr Pikal
[EMAIL PROTECTED]

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


[R] Can't load Matrix 0.995-1 for lme4

2006-01-19 Thread Martin Henry H. Stevens
Dear useRs,
I can no longer run lme4 because I think I upgraded lme4 without  
being able to upgrade Matrix.

I am using:
Mac OS 10.4.4
R v. 2.2.1 (updated from 2.2.0 this morning)
lme4 v. 0.995-1

I tried to use the RGUI  to load the package source of Matrix 0.995-1  
and it seemed to be progressing quite well and then it failed  
providing this message:

make: *** [Matrix.so] Error 1
ERROR: compilation failed for package 'Matrix'

I could not find a binary of Matrix =0.995-1 on any of the URL  
respositoires that I investigated (us,uk,at,au).

I would very grateful for any ideas or assistance.

Cheers,
Hank


Dr. Martin Henry H. Stevens, Assistant Professor
338 Pearson Hall
Botany Department
Miami University
Oxford, OH 45056

Office: (513) 529-4206
Lab: (513) 529-4262
FAX: (513) 529-4243
http://www.cas.muohio.edu/~stevenmh/
http://www.muohio.edu/ecology/
http://www.muohio.edu/botany/
E Pluribus Unum

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


Re: [R] html excel file

2006-01-19 Thread roger bos
Read ?scan very carefully and play with the settings.  What makes your file
difficult is that it is multi line, meaning that the headings have carriage
returns between them instead of being one line separated with spaces or tabs
or commas.  Can you change the way the file is outputted?  If not, you will
have to play with scan to get the file in.  Anything is possible, but it
looks like it will be tricky.

HTH,
Roger



On 1/19/06, Stefan Semmeling [EMAIL PROTECTED] wrote:

 hallo,

 i have a problem reading in the above mentioned kind of a file.
 does anybody know an easy way how to read it in?
 i can save it as a text file that looks like:

 Datum des Fixings
 Restlaufzeit


 1 Jahr
 2 Jahre
 3 Jahre
 4 Jahre
 5 Jahre
 6 Jahre
 7 Jahre
 8 Jahre
 9 Jahre
 10 Jahre
 12 Jahre
 15 Jahre
 13.01.06
 2.819
 2.983
 3.073
 3.137
 3.194
 3.247
 3.302
 3.355
 3.409
 3.459
 3.548
 3.649
 12.01.06
 2.847
 3.013
 3.102
 3.164
 3.217
 3.268
 3.322
 3.373
 3.426
 3.475
 3.564
 3.665
 ...

 after skipping the first four lines i want to read it in while the first
 12
 lines are the heades
 the next is the date followed by the singel values...(these lines are
 always
 repeated)

 it is supposed to look like

  123456789101215
 datum1abcdefghij k  l
 datum2abcdefghij k  l
 ...

 i tried to read it in as a normal excel file but it didn´t work out the
 way
 it was supposed to

 thank you for helping!!!

 stefan

 __
 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


[[alternative HTML version deleted]]

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

Re: [R] princomp() with missing values in panel data?

2006-01-19 Thread Prof Brian Ripley
On Thu, 19 Jan 2006, Henric Nilsson wrote:

 ivo welch said the following on 2006-01-18 14:56:

 thank you.  I am still not sure how to get the scores in princomp, though:

 ds= as.data.frame( cbind(rnorm(10),rnorm(10)) )
 names(ds)=c(x1,x2)
 ds[5,]=c(NA,NA)
 pc= princomp( formula = ~ ds$x1 + ds$x2, na.action=na.omit)
 ds$pc1 = pc$scores[,1]  #-- error, scores has 9 obs, ds has 10 obs

 is there an elegant method to do this, or do I need to learn how to operate

 Prof Ripley told you how to do it: `na.action = na.exclude'.

 with pc$loadings?  (may I also humbly suggest that the default behavior or
 $scores should be to contain NA in row 5?)

 Choosing sensible defaults in the case of NAs is a tricky business.

 Personally, I'd like the default to be `na.fail', so that I don't miss
 out on NAs if I've been sloppy while screening the data. Genrally, just
 ignoring missings and analysing the data as if it were complete may lead
 to seriously biased results.

I tend to agree (and so does S).  You can achieve this with 
options(na.action=na.fail), almost everywhere.

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

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


Re: [R] Can't load Matrix 0.995-1 for lme4

2006-01-19 Thread Peter Dalgaard
Martin Henry H. Stevens [EMAIL PROTECTED] writes:

 Dear useRs,
 I can no longer run lme4 because I think I upgraded lme4 without  
 being able to upgrade Matrix.
 
 I am using:
 Mac OS 10.4.4
 R v. 2.2.1 (updated from 2.2.0 this morning)
 lme4 v. 0.995-1
 
 I tried to use the RGUI  to load the package source of Matrix 0.995-1  
 and it seemed to be progressing quite well and then it failed  
 providing this message:
 
 make: *** [Matrix.so] Error 1
 ERROR: compilation failed for package 'Matrix'

You're chopping too much of the output there. This gives no
information as to why it failed. Missing tools or compile error?

 I could not find a binary of Matrix =0.995-1 on any of the URL  
 respositoires that I investigated (us,uk,at,au).

Someone needs to build it... Delays appear to be slightly larger for
Mac than for Windows (which is still 1 revision out of sync with the
sources, though).
 
 I would very grateful for any ideas or assistance.

You *did* read section 5.2 of the MacOSX FAQ, didn't you?

 Cheers,
 Hank
 
 
 Dr. Martin Henry H. Stevens, Assistant Professor
 338 Pearson Hall
 Botany Department
 Miami University
 Oxford, OH 45056
 
 Office: (513) 529-4206
 Lab: (513) 529-4262
 FAX: (513) 529-4243
 http://www.cas.muohio.edu/~stevenmh/
 http://www.muohio.edu/ecology/
 http://www.muohio.edu/botany/
 E Pluribus Unum
 
 __
 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
 

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

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


Re: [R] html excel file

2006-01-19 Thread Peter Dalgaard
roger bos [EMAIL PROTECTED] writes:

 Read ?scan very carefully and play with the settings.  What makes your file
 difficult is that it is multi line, meaning that the headings have carriage
 returns between them instead of being one line separated with spaces or tabs
 or commas.  Can you change the way the file is outputted?  If not, you will
 have to play with scan to get the file in.  Anything is possible, but it
 looks like it will be tricky.

I'd try reading the whole thing as a character vector 

x - scan(, what=)

then 

M - matrix(x[-(1:3)], byrow=TRUE)

cn - M[1,-1]
rn - M[-1,1]
n - M[-1,-1]
mode(n) - numeric
dimnames(n) - list(rn,cn)
 
and then (possibly) data.frame(n)

[Notice that this is only partially tested, so no guarantees]

 HTH,
 Roger
 
 
 
 On 1/19/06, Stefan Semmeling [EMAIL PROTECTED] wrote:
 
  hallo,
 
  i have a problem reading in the above mentioned kind of a file.
  does anybody know an easy way how to read it in?
  i can save it as a text file that looks like:
 
  Datum des Fixings
  Restlaufzeit
 
 
  1 Jahr
  2 Jahre
  3 Jahre
  4 Jahre
  5 Jahre
  6 Jahre
  7 Jahre
  8 Jahre
  9 Jahre
  10 Jahre
  12 Jahre
  15 Jahre
  13.01.06
  2.819
  2.983
  3.073
  3.137
  3.194
  3.247
  3.302
  3.355
  3.409
  3.459
  3.548
  3.649
  12.01.06
  2.847
  3.013
  3.102
  3.164
  3.217
  3.268
  3.322
  3.373
  3.426
  3.475
  3.564
  3.665
  ...
 
  after skipping the first four lines i want to read it in while the first
  12
  lines are the heades
  the next is the date followed by the singel values...(these lines are
  always
  repeated)
 
  it is supposed to look like
 
   123456789101215
  datum1abcdefghij k  l
  datum2abcdefghij k  l
  ...
 
  i tried to read it in as a normal excel file but it didn´t work out the
  way
  it was supposed to
 
  thank you for helping!!!
 
  stefan
 
  __
  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
 
 
   [[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

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


[R] obtaining ROC curve from Nearest Shrunken Centroids (pamr)

2006-01-19 Thread [EMAIL PROTECTED]
Hello,

I have binary labels from a nearest shrunken centroids prediction 
(package pamr). I need to obtain a ROC curve for this test. What is the 
easiest way to obtain one?

Paolo Sonego

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


[R] Creating dipole field

2006-01-19 Thread Laura Quinn
Hello,

I'm looking to perform some statistical analysis on some idealised data
cases, and was wondering if someone could point me in the direction of how
to create a simple dipole field within R? I basically require a
rectangular grid with a distinct high/low pressure dipole.

Any pointers appreciated, thank you!

Laura Quinn
Institute of Atmospheric Science
School of Earth and Environment
University of Leeds
Leeds
LS2 9JT

tel: +44 113 343 1596
fax: +44 113 343 6716
mail: [EMAIL PROTECTED]

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


Re: [R] Tobit estimation?

2006-01-19 Thread roger koenker
For adventurous, but skeptical souls who lack faith in the usual
Gaussian tobit assumptions, I could mention that there is new
fcen  method for the quantreg rq() function that implements
Powell's tobit estimator using an algorithm of Bernd Fitzenberger.


url:www.econ.uiuc.edu/~rogerRoger Koenker
email[EMAIL PROTECTED]Department of Economics
vox: 217-333-4558University of Illinois
fax:   217-244-6678Champaign, IL 61820


On Jan 19, 2006, at 6:04 AM, Achim Zeileis wrote:

 On Thu, 19 Jan 2006 14:05:58 +0530 Ajay Narottam Shah wrote:

 Folks,

 Based on
   http://www.biostat.wustl.edu/archives/html/s-news/1999-06/ 
 msg00125.html

 I thought I should experiment with using survreg() to estimate tobit
 models.

 I've been working on a convenience interface to survreg() that  
 makes it
 particularly easy to fit tobit models re-using the survreg()
 infrastructure. The package containing the code will hopefully be
 release soon - anyone who wants a devel snapshot, please contact me
 off-list.
 Ajay, I'll send you the code in a separate mail.

 Best,
 Z

 I start by simulating a data frame with 100 observations from a tobit
 model

 x1 - runif(100)
 x2 - runif(100)*3
 ystar - 2 + 3*x1 - 4*x2 + rnorm(100)*2
 y - ystar
 censored - ystar = 0
 y[censored] - 0
 D - data.frame(y, x1, x2)
 head(D)
   y x1x2
 1 0.000 0.86848630 2.6275703
 2 0.000 0.88675832 1.7199261
 3 2.7559349 0.38341782 0.6247869
 4 0.000 0.02679007 2.4617981
 5 2.2634588 0.96974450 0.4345950
 6 0.6563741 0.92623096 2.4983289

 # Estimate it
 library(survival)
 tfit - survreg(Surv(y, y0, type='left') ~ x1 + x2,
   data=D, dist='gaussian', link='identity')

 It says:

   Error in survreg.control(...) : unused argument(s) (link ...)
   Execution halted

 My competence on library(survival) is zero. Is it still the case that
 it's possible to be clever and estimate the tobit model using
 library(survival)?

 I also saw the two-equation setup in the micEcon library. I haven't
 yet understood when I would use that and when I would use a straight
 estimation of a censored regression by MLE. Can someone shed light on
 that? My situation is: Foreign investment on the Indian stock
 market. Lots of firms have zero foreign investment. But many do have
 foreign investment. I thought this is a natural tobit situation.

 -- 
 Ajay Shah
 http://www.mayin.org/ajayshah
 [EMAIL PROTECTED]
 http://ajayshahblog.blogspot.com *(:-? - wizard who doesn't know the
 answer.

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


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

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


[R] factor or not factor that is a question

2006-01-19 Thread Petr Pikal
Dear all

I encountered strange problem with split factor. I tried to use

boxplot(split(, factor)) but I got an error message

 split(test$asar,kvartaly)
Error in split(x, f) : second argument must be a factor

 str(kvartaly)
 Factor w/ 8 levels 1Q.04,2Q.04,..: 1 1 1 1 1 1 1 1 1 1 ...
 str(test$asar)
 num [1:731] 16.8 16.6 16.6 16.4 16.7 ...
 is.factor(kvartaly)
[1] TRUE


I used formula interface
boxplot(formula) which worked OK. 

What can be wrong with my factor kvartaly? Where to look? Why it is 
not accepted by split?

W2000
 version
 _  
platform i386-pc-mingw32
arch i386   
os   mingw32
system   i386, mingw32  
status  
major2  
minor2.1
year 2005   
month12 
day  20 
svn rev  36812  
language R  
 

Best regards.
Petr Pikal
[EMAIL PROTECTED]

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


Re: [R] Plotting an lme( ) object

2006-01-19 Thread Henric Nilsson
Greg Tarpinian said the following on 2006-01-18 23:37:

 I apologize for the second posting, my other email address
 died today.
 
 I am using R for Windows, version 2.2.  Here is my code:
 
   plot(FOO.lme4, resid(.,type = p) ~ fitted(.) | GROUP, 
id = 0.05, adj = -0.3, 
idLabels = FOO$value,
main = Pearson Residuals vs. Fitted Values, by Group,
between = list(x = .5, y = .5))
 
 The plot looks fine, but the adj = -0.3 option seems to have
 no effect on the labels that are added to identify potential
 outliers.  I would like to offset the FOO$value text that is
 currently being displayed right on top of several pearson
 residuals.  How can I do this?

I just checked the code for `plot.lme', and it builds a panel function 
that uses the `adj' argument of the `ltext'. Unfortunately, according to 
the help page for `ltext' (from the Details section),

... For 'ltext', only values 0, .5 and 1 for 'adj' have any effect.

It wouldn't categorize this as a bug in R, since R's `ltext' function 
behaves according to its documentation. But it sure is irritating.

I've CC:ed Deepayan Sarkar, maintainer of the lattice package, and 
hopefully he's able to advise or, even better, extend `ltext' to accept 
a wider range of `adj' values.


HTH,
Henric





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

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


[R] how to select a node in dendrogram/tree

2006-01-19 Thread Zhesi He
Dear R-users,

Can someone help me select a node/ nodes in a dendrogram or tree, like 
colouring the ones that are selected?

Also, I'm quite interested in any kind of interactive expandable 
dendrogram (like showing different levels of details at a time). I have 
a pretty large dataset and I really want to interact with the graph.

Thanks indeed.

___

Zhesi He
Computational Biology Laboratory, University of York
York YO10 5YW, U.K.
Phone:  +44-(0)1904-328279
Email:  [EMAIL PROTECTED]

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


[R] aggregating variables with pca

2006-01-19 Thread Christian Jones

hello R_team

having perfomed a PCA on my fitted model with the function:

data- na.omit(dataset) 

data.pca-prcomp(data,scale =TRUE),

I´ve decided to aggregate two variables that are highly correlated.

My first question is:

How can I combine the two variables into one new predictor?

and secondly:

How can I predict with the newly created variable in a new dataset? 

Guess I need the predict and new data command but I´m having problems with 
the syntax and the help function was not sufficient on this issue.

many thanks in advance

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

Re: [R] R Commenting Style

2006-01-19 Thread Martin Maechler
 Kevin == Kevin E Thorpe [EMAIL PROTECTED]
 on Thu, 19 Jan 2006 06:26:31 -0500 writes:

Kevin I don't know if this is what you're referring to, but in ESS the 
number 
Kevin of octothorpes (#) affects the indentation in the emacs buffer. If I 
Kevin remember right, ### puts it at the beginning of the line, ## the 
current 
Kevin indentation level (eg. in a function) and # further right.

That's correct, thank you, Kevin,
and it's further supported by ESS in emacs,
e.g., if you comment a region (M-;) two  # are used
automatically.

There's also a little not well-known function
 M-x ess-fix-comments 
with documentation string
 Fix ess-mode buffer so that single-line comments start with at least `##'.
and ess-fix-comments is implicitly called by the function
  M-x ess-MM-fix-src
which I use all the time when I get source files from some
people in order to ``clean them'' to my taste...

Note that a current (development) version of the ESS manual is
also only at the ESS website,
specifically,
http://ess.r-project.org/Manual/ess.html
where the section on indenting (and the comments) is
http://ess.r-project.org/Manual/ess.html#Indenting

I have exceptionally broken the rule of crossposting, and am
sending this to ESS-help mailing list as well, just to make sure
it'll be seen (and found) there as well.

Martin Maechler, ETH Zurich

Kevin Paul Roebuck wrote:

 I seem to remember reading somewhere about some style
 guide regarding R the number of comment characters (#)
 prior to the comment meaning something.
 
 Anyone know to what I'm referring? Where?

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


[R] help on statistics and code

2006-01-19 Thread david v
Hi,
I need some advise on statistics. I have written the code below. What i'm 
trying to do here is that i read 1000 distance matrices derived from the 
same original data set. Afterwards I wan to create a consensus matix out of 
those 1000 distance matrices to see the relevance of the original matrix.
Is that correct ?? should i be doing something else ?

library(stats)
library(ade4)
library(cluster)
library(ape)

nb_runs - 1000
first_matrix=TRUE

#Reading 1000 distance matrices
for (i in 1:nb_runs)
{
infile=input_matrix
infile-paste(infile,i,sep=_)
cat(\nReading ,infile,)
data-read.table(infile,header=FALSE,sep=\t,row.names=1)


#
# First matrix we read
if (first_matrix)
{
first_matrix=FALSE
Mdist=dist.binary(data,method=1,diag=TRUE)
}
else {
#the other 999 matrices
dis-dist.binary(data,method=1,diag=TRUE)
Mdist - Mdist+dis
}
#Get the consensus matrix based on 1000 matrices
Matallp-(Mdist/nb_runs )
clust-hclust(Matall)
...
Is that correct ?? the code works properly.

Thanks for your help

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


Re: [R] html excel file

2006-01-19 Thread Erich Neuwirth


On Do, 19.01.2006, 10:38, Stefan Semmeling wrote:
 hallo,

 i have a problem reading in the above mentioned kind of a file.

One way of transferring data between R and Excel is using the
RExcel package contained in R(D)COM server available from CRAN
in category Other.

The package rcom (available from CRAN) can turn R into a COM server
for Excel and with a little bit of VBA programming it is possible
to transfer data both ways also.

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


[R] Using svm.plot with mlbench.spirals.

2006-01-19 Thread Joshua Gilbert
Hi.

I'm trying to plot a pair of intertwined spirals and an svm that
separates them. I'm having some trouble. Here's what I tried.

 library(mlbench)
 library(e1071)
Loading required package: class
 raw - mlbench.spirals(200,2)
 spiral - data.frame(class=as.factor(raw$classes), x=raw$x[,1], y=raw$x[,2])
 m - svm(class~., data=spiral)
 plot(m, spiral)
Error in -x$index : invalid argument to unary operator

So we delve into e1071:::plot.svm. When I run the code in plot.svm
everything is fine up until
 points(formula, data = data[-x$index, ], pch = dataSymbol,
 col = symbolPalette[colind[-x$index]])
That gives me the same error message, Error in -x$index : invalid
argument to unary operator. The weird thing is that I can run either
of the those statements in isolation
data[-x$index, ]
symbolPalette[colind[-x$index]]
and neither gives me an error. I looked in the two points functions I
can see (points.default and points.formula) but neither calls x$index.

I was following along the documentation for plot.svm, which has a
simple example (that works)
## a simple example
library(MASS)
data(cats)
m - svm(Sex~., data = cats)
plot(m, cats)

I don't see what the difference between their example and mine.

Can anyone help me?


Thank you,
Josh.

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


Re: [R] empirical maximum likelihood estimation

2006-01-19 Thread Martin Maechler
 BDR == Prof Brian Ripley [EMAIL PROTECTED]
 on Thu, 19 Jan 2006 12:38:12 + (GMT) writes:

BDR Look at optim, or mle in package stats4.
BDR There are a lot of similar problems addressed in R: few real-world 
BDR likelihoods have `an explicit formula'.  One quite similar example is 
BDR ARIMA fitting.

Further note the package   'nlmeODE'
which efficiently addresses a problem very similar to yours.

Martin Maechler, ETH Zurich

BDR On Thu, 19 Jan 2006, Dominik Heinzmann wrote:

 Dear R-users
 
 Problem:
 
 Given the following system of ordinary differential euqations
 
 dM/dt = (-n)*M-h*M
 dS/dt = n*M-h*S+u*R
 dA/dt = h*S-q*A
 dI/dt = q*A-p*I
 dJ/dt = h*M-v*J
 dR/dt=p*I+v*J-u*R
 
 where M,S,A,I,J,R are state variables and n,h,u,q,p,v parameters.
 
 I'm able to calculate the likelihood value based on the solutions
 M,S,A,I,J,R of the ODE's given the data, but without an explicit formula.
 
 How can I now optimize the loglikelihood with respect to the parameter
 n,h,u,q,p,v? Is there any functions available in R for dealing with such
 empirical likelihood problems?
 
 Thanks a lot for your support.
 
 -- 
 Dominik Heinzmann
 Master of Science in Mathematics, EPFL
 Ph.D. student in Biostatistics
 Institute of Mathematics
 University of Zurich
 
 Winterthurerstrasse 190
 CH-8057 Zürich
 Office: Y36L90
 
 E-Mail  : [EMAIL PROTECTED]
 Phone   : +41-(0)44-635 5858
 Fax : +41-(0)1-63 55705
 Homepage: http://www.math.unizh.ch/user/heinzmann
 
 __
 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
 

BDR -- 
BDR Brian D. Ripley,  [EMAIL PROTECTED]
BDR Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
BDR University of Oxford, Tel:  +44 1865 272861 (self)
BDR 1 South Parks Road, +44 1865 272866 (PA)
BDR Oxford OX1 3TG, UKFax:  +44 1865 
272595__
BDR R-help@stat.math.ethz.ch mailing list
BDR https://stat.ethz.ch/mailman/listinfo/r-help
BDR PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html

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


[R] (no subject)

2006-01-19 Thread Marta Colombo
Good evening,
I am Marta Colombo, student at Milan's Politecnico.
Thank you very much for your kindness, this mailing list is really useful.
 I am using the function kde2d for two-dimensional kernel density estimation 
and I'd like to know something more about this kind of density estimator. In 
particular I'd like to know: what bandwidth is used ?
Thank you in advance for your attention

Marta Colombo

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


[R] function kde2d

2006-01-19 Thread Marta Colombo
Good evening,
I am Marta Colombo, student at Milan's Politecnico.
Thank you very much for your kindness, this mailing list is really useful.
 I am using the function kde2d for two-dimensional kernel density estimation 
and I'd like to know something more about this kind of density estimator. In 
particular I'd like to know: what bandwidth is used ?
Thank you in advance for your attention

Marta Colombo

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


[R] Downloads -- possible bug?

2006-01-19 Thread Elizabeth Purdom
Hi,
When I go to the CRAN page to download a new version of R, there are not 
the same versions available depending on which mirror I pick. When I go to 
http://cran.cnr.berkeley.edu/, for example, I get 2.2.1, but if I go 
http://cran.stat.ucla.edu/ the option is 2.2.0 (I'm downloading the Windows 
base file). Neither refreshing nor clearing my cache changes it. For future 
reference, I'd like to know if this is a mistake or if different mirrors 
are just updated at different times?
Thanks,
Elizabeth Purdom

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


Re: [R] function kde2d

2006-01-19 Thread Prof Brian Ripley
Do you mean the one in package MASS?  If so, you need to consult the 
reference on its help page (although the bandwidth is actually given on 
the help page).

It is courteous to credit other people's work in contributed packages.

The author of MASS::kde2d

On Thu, 19 Jan 2006, Marta Colombo wrote:

 Good evening,
 I am Marta Colombo, student at Milan's Politecnico.
 Thank you very much for your kindness, this mailing list is really useful.
 I am using the function kde2d for two-dimensional kernel density
estimation and I'd like to know something more about this kind of
density estimator. In particular I'd like to know: what bandwidth is used ?
 Thank you in advance for your attention

 Marta Colombo

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

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


Re: [R] Downloads -- possible bug?

2006-01-19 Thread Uwe Ligges
Elizabeth Purdom wrote:

 Hi,
 When I go to the CRAN page to download a new version of R, there are not 
 the same versions available depending on which mirror I pick. When I go to 
 http://cran.cnr.berkeley.edu/, for example, I get 2.2.1, but if I go 
 http://cran.stat.ucla.edu/ the option is 2.2.0 (I'm downloading the Windows 
 base file). Neither refreshing nor clearing my cache changes it. For future 
 reference, I'd like to know if this is a mistake or if different mirrors 
 are just updated at different times?

Looks like http://cran.stat.ucla.edu/ has not been synced for a couple 
of months, since Kurt Hornik's *daily* check has the date 08-Oct-2005 on 
that mirror. Fritz?

Uwe


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

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


Re: [R] Downloads -- possible bug?

2006-01-19 Thread Peter Dalgaard
Elizabeth Purdom [EMAIL PROTECTED] writes:

 Hi,
 When I go to the CRAN page to download a new version of R, there are not 
 the same versions available depending on which mirror I pick. When I go to 
 http://cran.cnr.berkeley.edu/, for example, I get 2.2.1, but if I go 
 http://cran.stat.ucla.edu/ the option is 2.2.0 (I'm downloading the Windows 
 base file). Neither refreshing nor clearing my cache changes it. For future 
 reference, I'd like to know if this is a mistake or if different mirrors 
 are just updated at different times?
 Thanks,
 Elizabeth Purdom

It depends on the mirroring sites' policy and maintenance. 

UCLA apparently hasn't updated since October, which is quite extreme.
My guess would be that it is a local bug rather than deliberate
policy.



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


[R] matrix export

2006-01-19 Thread Eric Pante
Dear listers,

I need to export a distance matrix in the following format :

a 0.0 1.0 0.2 1.0 1.0
b 1.0 0.0 1.0 1.0 1.0
c 0.2 1.0 0.0 1.0 1.0
d 1.0 1.0 1.0 0.0 1.0
e 1.0 1.0 1.0 1.0 0.0

I tried write.matrix() from the MASS library, which gives:

a b c d e
0.0 1.0 0.2 1.0 1.0
1.0 0.0 1.0 1.0 1.0
0.2 1.0 0.0 1.0 1.0
1.0 1.0 1.0 0.0 1.0
1.0 1.0 1.0 1.0 0.0

Does anyone know of an R trick to change the location of the headers 
?or do I need to do this externally, through perl or bash ?

Thanks in advance for your help,
Eric


Eric Pante

College of Charleston, Grice Marine Laboratory
205 Fort Johnson Road, Charleston SC 29412


On ne force pas la curiosite, on l'eveille ...
Daniel Pennac

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


[R] [R-pkgs] RSQLite

2006-01-19 Thread David James
Version 0.4-1 of the RSQLite package has been uploaded to CRAN.
RSQLite embeds the SQLite engine in R (see http://www.sqlite.org)

Changes include:

* Fixed problems exporting/importing NA's 

* An new experimental dbWriteTable() method to create SQLite tables
  from simple files (delimited unquoted fields), e.g., 
  dbWriteTable(con, table_name, file_name, ...)
  methods?dbWriteTable   ## see documentation for details

* dbConnect() now accepts values for the cache_size and synchronous 
  to tune/improve SQLite performance (see methods?dbConnect for details).

Thanks to Seth Falcon, Ronggui Huang, and Charles Loboz for their
patches, suggestions, bug reports and testing.

-- 
David

___
R-packages mailing list
[EMAIL PROTECTED]
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


[R] gam

2006-01-19 Thread I.Szentirmai
Dear R users,

I'm new to both R and to this list and would like to get 
advice on how to build generalized additive models in R. 
Based on the description of gam, which I found on the R 
website, I specified the following model:
model1-gam(ST~s(MOWST1),family=binomial,data=strikes.S),
in which ST is my binary response variable and MOWST1 is a 
categorical independent variable.

I get the following error message:
Error in smooth.construct.tp.smooth.spec(object, data, 
knots) :
 NA/NaN/Inf in foreign function call (arg 1)
In addition: Warning messages:
1: argument is not numeric or logical: returning NA in: 
mean.default(xx)
2: - not meaningful for factors in: Ops.factor(xx, 
shift[i])

I would greatly appreciate if someone could tell me what I 
did wrong. Can I use categorical independents in gam at 
all?

Many thanks,
Istvan

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


[R] Editing Partial Correlation Matrix

2006-01-19 Thread Mark Kimsey
Hi,
I created a matrix of correlation coefficients and their respective 
scatterplots using the commands hetcor() and panel.cor().  Can I edit this 
matrix?  I would like to have the scale values display at the top, as opposed 
to the alternating top-bottom scale approach.  Also, I would like to increase 
the font size of the graphic for print purposes.  Any help on how to accomplish 
this would be greatly appreciated!
Thanks,
Mark
Here is the code I am using for this analysis:
data - read.table(X:/GWRclip/corrmatrix.txt, header = T) 
ASHDEP - data [,1]
ELE - data [,2]
SLP - data [,3]
ASP - data [,4]
PLCU - data [,5]
PRCU - data [,6]
CTI - data [,7]
STI - data [,8]
SPI - data [,9]
data - data.frame(ASHDEP, ELE, SLP, ASP, PLCU, PRCU, CTI, STI, SPI)
hetcor(data) # Pearson, polychoric, and polyserial correlations, 2-step est.
hetcor(ASHDEP, ELE, SLP, ASP, PLCU, PRCU, CTI, STI, SPI, ML=TRUE) 
# Pearson, polychoric, polyserial correlations, ML est.

panel.cor - function(x, y, digits=2, prefix=, cex.cor) { 
usr - par(usr); on.exit(par(usr)) 
par(usr = c(0,1,0,1)) 
r - (cor(x, y)) 
txt - format(c(r, 0.123456789), digits=digits)[1] 
txt - paste(prefix, txt, sep=) 
if(missing(cex.cor))  
text(0.5, 0.5, txt) 
} 
pairs( data[c(1, 2:9 )], main = Partial Correlation Coefficients for Selected 
Soil-Terrain Attributes, 
   upper.panel=panel.smooth, lower.panel=panel.cor ) 

 
Mark Kimsey 
Research Assistant 
Intermountain Forest Tree Nutrition Cooperative 
University of Idaho 
Moscow, Idaho 83844-1133 
 
Work: 208.885.7520 
Mobile: 509.330.0640 
Fax: 208.885.7442 


[[alternative HTML version deleted]]

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


Re: [R] matrix export

2006-01-19 Thread Eric Pante
Thanks, Bert

write.table won't do the trick, because distance matrices in R are 
presented as lower triangular matrices. write.table cannot coerce 
class dist into a data.frame.

maybe there is a way to transform the lower triangular matrix into a 
full matrix, and then use write.table ?

cheers, Eric

On Jan 19, 2006, at 1:38 PM, Berton Gunter wrote:

 Just use write.table() from the base package with row.names=TRUE (the
 default).

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

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



 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Eric Pante
 Sent: Thursday, January 19, 2006 10:09 AM
 To: r-help@stat.math.ethz.ch
 Subject: [R] matrix export

 Dear listers,

 I need to export a distance matrix in the following format :

 a 0.0 1.0 0.2 1.0 1.0
 b 1.0 0.0 1.0 1.0 1.0
 c 0.2 1.0 0.0 1.0 1.0
 d 1.0 1.0 1.0 0.0 1.0
 e 1.0 1.0 1.0 1.0 0.0

 I tried write.matrix() from the MASS library, which gives:

 a b c d e
 0.0 1.0 0.2 1.0 1.0
 1.0 0.0 1.0 1.0 1.0
 0.2 1.0 0.0 1.0 1.0
 1.0 1.0 1.0 0.0 1.0
 1.0 1.0 1.0 1.0 0.0

 Does anyone know of an R trick to change the location of the headers
 ?or do I need to do this externally, through perl or bash ?

 Thanks in advance for your help,
 Eric


 Eric Pante
 
 College of Charleston, Grice Marine Laboratory
 205 Fort Johnson Road, Charleston SC 29412
 

  On ne force pas la curiosite, on l'eveille ...
  Daniel Pennac

 __
 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



Eric Pante

College of Charleston, Grice Marine Laboratory
205 Fort Johnson Road, Charleston SC 29412


On ne force pas la curiosite, on l'eveille ...
Daniel Pennac

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


Re: [R] matrix export

2006-01-19 Thread Sean Davis



On 1/19/06 2:05 PM, Eric Pante [EMAIL PROTECTED] wrote:

 Thanks, Bert
 
 write.table won't do the trick, because distance matrices in R are
 presented as lower triangular matrices. write.table cannot coerce
 class dist into a data.frame.
 
 maybe there is a way to transform the lower triangular matrix into a
 full matrix, and then use write.table ?

Did you try as.matrix()?

From the dist() help page:

 'as.dist()' is a generic function.  Its default method handles
 objects inheriting from class 'dist', or coercible to matrices
 using 'as.matrix()'.


Sean

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


[R] change fitted line colour in lme() trellis plot?

2006-01-19 Thread Bill Simpson
If I used a groupedData object, if I do 
fit-lme(blah)
then
plot(augPred(fit))
produces a nice trellis plot of the data along with the fitted lines

However I find that the lines and the data points are in the same colour
(light blue against a medium grey background). Is there a way to make
the lines in a different colour (e.g. black)? It would also be nice if
the line were plotted after the points so it is visible (I have a lot of
points and the line is obscured).

I have looked at par().

Thanks very much for any help.

Bill

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


Re: [R] Canonical Variance Analysis by any other name?

2006-01-19 Thread Patrick Connolly
On Thu, 19-Jan-2006 at 08:35AM +, Prof Brian Ripley wrote:

| Canonical variates or canonical variance?
| 

It was canonical variance I was asked about and I wasn't careful
enough getting the Genstat quote to make sure I was referring to the
same thing.  It seems SAS uses the term Canonical Variance Analysis
and the reference mentioned for it is:

Dixon, W. H., and M. B. Brown [eds.]. 1979 Biomedical computer
programs P-series. University of California Press, Los Angeles, CA.

Does anyone know for sure if they are the same thing?  It appears to
me that someone misheard variates as variance, but that might not
be the case.  Perhaps SAS likes to use different terminology.

Thank you Brian for the wikipedia link.  It doesn't have anything
relating to canonical variance analysis which seems to support my
suspicions.


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

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


Re: [R] Plotting an lme( ) object

2006-01-19 Thread Deepayan Sarkar
On 1/19/06, Henric Nilsson [EMAIL PROTECTED] wrote:
 Greg Tarpinian said the following on 2006-01-18 23:37:

  I apologize for the second posting, my other email address
  died today.
 
  I am using R for Windows, version 2.2.  Here is my code:
 
plot(FOO.lme4, resid(.,type = p) ~ fitted(.) | GROUP,
 id = 0.05, adj = -0.3,
 idLabels = FOO$value,
 main = Pearson Residuals vs. Fitted Values, by Group,
 between = list(x = .5, y = .5))
 
  The plot looks fine, but the adj = -0.3 option seems to have
  no effect on the labels that are added to identify potential
  outliers.  I would like to offset the FOO$value text that is
  currently being displayed right on top of several pearson
  residuals.  How can I do this?

 I just checked the code for `plot.lme', and it builds a panel function
 that uses the `adj' argument of the `ltext'. Unfortunately, according to
 the help page for `ltext' (from the Details section),

 ... For 'ltext', only values 0, .5 and 1 for 'adj' have any effect.

 It wouldn't categorize this as a bug in R, since R's `ltext' function
 behaves according to its documentation. But it sure is irritating.

 I've CC:ed Deepayan Sarkar, maintainer of the lattice package, and
 hopefully he's able to advise or, even better, extend `ltext' to accept
 a wider range of `adj' values.

The grid.text argument 'just' does support numeric values like 'adj'
now, but it didn't when ltext was originally written (or at least I
was under the impression that it didn't). I have updated ltext
accordingly, which in future releases of lattice should support other
values of adj. I wasn't planning any updates for R 2.2.x, but I can if
anyone needs this desperately enough.

Deepayan
--
http://www.stat.wisc.edu/~deepayan/

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


[R] Dynamic Programming in R

2006-01-19 Thread Arnab mukherji
Hi R users,

I am looking to numerically solve a dynamic program in the R environment. I was 
wondering if there were people out there who had expereinced success at using R 
for such applications. I'd rather continue in R than learn Mathlab.

A concern that has been cited that may discourage R use for solving dynamic 
programs is its memory handling abilities.  A senior researcher had a lot of 
trouble with R becuase on any given run it would eat up all the computers 
memory and need to start using the hard disk. Yet, the memory needed was not 
substantial - saving the worksapce, exiting and recalling would noticebly start 
of tthe progam at a much lower memory use, level and a quick deteroration in a 
few thousand iterations.

Is this a problem other people have come across? Perhaps, its a problem already 
fixed, since the researcher was working on this in 2002 (he claimed he had 
tried it on windows, mac, and unix versions to check). 

Thanks.

Arnab

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


Re: [R] change fitted line colour in lme() trellis plot?

2006-01-19 Thread Deepayan Sarkar
On 1/19/06, Bill Simpson [EMAIL PROTECTED] wrote:
 If I used a groupedData object, if I do
 fit-lme(blah)
 then
 plot(augPred(fit))
 produces a nice trellis plot of the data along with the fitted lines

 However I find that the lines and the data points are in the same colour
 (light blue against a medium grey background). Is there a way to make
 the lines in a different colour (e.g. black)?

plot(augPred(fit), col.line = 'black')

 It would also be nice if
 the line were plotted after the points so it is visible (I have a lot of
 points and the line is obscured).

The order is hard-coded in the panel function:

 plot(augPred(fit))$panel
function (x, y, subscripts, groups, ...)
{
if (grid)
panel.grid()
orig - groups[subscripts] == original
panel.xyplot(x[orig], y[orig], ...)
panel.xyplot(x[!orig], y[!orig], ..., type = l)
}

You can change it by supplying your own panel function, e.g.

plot(augPred(fit), col.line = black,
 panel =
 function (x, y, subscripts, groups, ...) {
 panel.grid()
 orig - groups[subscripts] == original
 panel.xyplot(x[orig], y[orig], ...)
 panel.xyplot(x[!orig], y[!orig], ..., type = l)
 })

Deepayan

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


Re: [R] change fitted line colour in lme() trellis plot?

2006-01-19 Thread Deepayan Sarkar
On 1/19/06, Deepayan Sarkar [EMAIL PROTECTED] wrote:
 On 1/19/06, Bill Simpson [EMAIL PROTECTED] wrote:
  If I used a groupedData object, if I do
  fit-lme(blah)
  then
  plot(augPred(fit))
  produces a nice trellis plot of the data along with the fitted lines
 
  However I find that the lines and the data points are in the same colour
  (light blue against a medium grey background). Is there a way to make
  the lines in a different colour (e.g. black)?

 plot(augPred(fit), col.line = 'black')

  It would also be nice if
  the line were plotted after the points so it is visible (I have a lot of
  points and the line is obscured).

 The order is hard-coded in the panel function:

  plot(augPred(fit))$panel
 function (x, y, subscripts, groups, ...)
 {
 if (grid)
 panel.grid()
 orig - groups[subscripts] == original
 panel.xyplot(x[orig], y[orig], ...)
 panel.xyplot(x[!orig], y[!orig], ..., type = l)
 }

Actually, this is already what you want, so you shouldn't need to do anything.

Deepayan

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


Re: [R] Dynamic Programming in R

2006-01-19 Thread Berton Gunter
1. I have no experience in dynamic programming (so you may want to ignore
the rest of this message)

2. Your message is vague (to me) -- more specifics about what you want to do
might result in a better answer.

3. R has become **much** better at loop management since 2002

4. Nevertheless, there are undoubtedly still situations where R may require
an unacceptably large amount of memory overhead. Recursion is one, I
believe.

Usually the best advice is: try it and see.

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

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Arnab mukherji
 Sent: Thursday, January 19, 2006 1:55 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] Dynamic Programming in R
 
 Hi R users,
 
 I am looking to numerically solve a dynamic program in the R 
 environment. I was wondering if there were people out there 
 who had expereinced success at using R for such applications. 
 I'd rather continue in R than learn Mathlab.
 
 A concern that has been cited that may discourage R use for 
 solving dynamic programs is its memory handling abilities.  A 
 senior researcher had a lot of trouble with R becuase on any 
 given run it would eat up all the computers memory and need 
 to start using the hard disk. Yet, the memory needed was not 
 substantial - saving the worksapce, exiting and recalling 
 would noticebly start of tthe progam at a much lower memory 
 use, level and a quick deteroration in a few thousand iterations.
 
 Is this a problem other people have come across? Perhaps, its 
 a problem already fixed, since the researcher was working on 
 this in 2002 (he claimed he had tried it on windows, mac, and 
 unix versions to check). 
 
 Thanks.
 
 Arnab
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html


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


Re: [R] Dynamic Programming in R

2006-01-19 Thread François Pinard
[Arnab mukherji]

A concern that has been cited that may discourage R use for solving
dynamic programs is its memory handling abilities.

For a dynamic programming problem defined over N steps, one usually 
needs a N*N matrix, so problems should be tractable for N being not too 
big.  In those I studied, CPU time usually was the scarse resource.
As extreme paths were known to be very unlikely, this (and memory as 
well) could be alleviated somehow by limiting the solution search into 
bands (more or less wide) following the diagonal of the solution matrix.  
I also had some success in splitting big problems into a sequence of 
smaller subproblems, and recursively: such approximations are likely not 
acceptable in the general case.

I would guess that most dynamic programming problems have their own 
specific artifacts and speed-up techniques, a universal solution might 
be uneasy.  Who knows (I'm not sure): R might well offer a powerful 
environment for building a dynamic programming framework.

-- 
François Pinard   http://pinard.progiciels-bpi.ca

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


[R] Loop through factors without changing to numerics

2006-01-19 Thread Chia, Yen Lin
Hi all,

 

If I want to write a for loop to loop through a set of factors, which
are not coded in 1,2,3, for e.g in character, possible to write the for
loop without changing  it to categorical variables?  I saw the manual
mentions for loop will take a list, but I'm not sure how to create a
list here.  Any input will be appreciated.  Thanks.

 

Yen Lin


[[alternative HTML version deleted]]

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


Re: [R] Loop through factors without changing to numerics

2006-01-19 Thread Francisco J. Zagmutt
An example would have helped to give you a better answer.  You can use 
characters in the seq argument of the for loop.  i.e

x=letters[1:4]
x
[1] a b c d

for(i in x) {print(i)}
[1] a
[1] b
[1] c
[1] d


Is this what you were looking for?

Francisco


From: Chia, Yen Lin [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Subject: [R] Loop through factors without changing to numerics
Date: Thu, 19 Jan 2006 16:42:00 -0800

Hi all,



If I want to write a for loop to loop through a set of factors, which
are not coded in 1,2,3, for e.g in character, possible to write the for
loop without changing  it to categorical variables?  I saw the manual
mentions for loop will take a list, but I'm not sure how to create a
list here.  Any input will be appreciated.  Thanks.



Yen Lin


   [[alternative HTML version deleted]]

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

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


Re: [R] Dynamic Programming in R

2006-01-19 Thread Gabor Grothendieck
The lpSolve package can handle integer programming problems.

Here is an example of using dynamic programming in R from
first principles in another setting:

http://tolstoy.newcastle.edu.au/R/help/06/01/18845.html

On 1/19/06, Arnab mukherji [EMAIL PROTECTED] wrote:
 Hi R users,

 I am looking to numerically solve a dynamic program in the R environment. I 
 was wondering if there were people out there who had expereinced success at 
 using R for such applications. I'd rather continue in R than learn Mathlab.

 A concern that has been cited that may discourage R use for solving dynamic 
 programs is its memory handling abilities.  A senior researcher had a lot of 
 trouble with R becuase on any given run it would eat up all the computers 
 memory and need to start using the hard disk. Yet, the memory needed was not 
 substantial - saving the worksapce, exiting and recalling would noticebly 
 start of tthe progam at a much lower memory use, level and a quick 
 deteroration in a few thousand iterations.

 Is this a problem other people have come across? Perhaps, its a problem 
 already fixed, since the researcher was working on this in 2002 (he claimed 
 he had tried it on windows, mac, and unix versions to check).

 Thanks.

 Arnab

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


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


Re: [R] Plotting an lme( ) object

2006-01-19 Thread Greg Tarpinian
Based on the suggestions, the following yielded 
satisfactory results:


plot(FOO.lme4, resid(.,type = p) ~ fitted(.) | GROUP, 
 id = 0.05, adj = 1, 
 idLabels = paste( round(FOO$VALUE,1), 
   rep( ,length(FOO$VALUE)) ),
 main = Pearson Residuals vs. Fitted Values, by GROUP,
 between = list(x = .5, y = .5))


Using paste() to hardcode an extra space provided me with
the necessary graphical offsets.

Regards,

 Greg



--- Deepayan Sarkar [EMAIL PROTECTED] wrote:

 On 1/19/06, Henric Nilsson [EMAIL PROTECTED] wrote:
  Greg Tarpinian said the following on 2006-01-18 23:37:
 
   I apologize for the second posting, my other email address
   died today.
  
   I am using R for Windows, version 2.2.  Here is my code:
  
 plot(FOO.lme4, resid(.,type = p) ~ fitted(.) | GROUP,
  id = 0.05, adj = -0.3,
  idLabels = FOO$value,
  main = Pearson Residuals vs. Fitted Values, by Group,
  between = list(x = .5, y = .5))
  
   The plot looks fine, but the adj = -0.3 option seems to have
   no effect on the labels that are added to identify potential
   outliers.  I would like to offset the FOO$value text that is
   currently being displayed right on top of several pearson
   residuals.  How can I do this?
 
  I just checked the code for `plot.lme', and it builds a panel function
  that uses the `adj' argument of the `ltext'. Unfortunately, according to
  the help page for `ltext' (from the Details section),
 
  ... For 'ltext', only values 0, .5 and 1 for 'adj' have any effect.
 
  It wouldn't categorize this as a bug in R, since R's `ltext' function
  behaves according to its documentation. But it sure is irritating.
 
  I've CC:ed Deepayan Sarkar, maintainer of the lattice package, and
  hopefully he's able to advise or, even better, extend `ltext' to accept
  a wider range of `adj' values.
 
 The grid.text argument 'just' does support numeric values like 'adj'
 now, but it didn't when ltext was originally written (or at least I
 was under the impression that it didn't). I have updated ltext
 accordingly, which in future releases of lattice should support other
 values of adj. I wasn't planning any updates for R 2.2.x, but I can if
 anyone needs this desperately enough.
 
 Deepayan
 --
 http://www.stat.wisc.edu/~deepayan/


__
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