[R] Starting R within an VBA makro

2007-06-11 Thread Maja Schröter
Hello everybody,

at work I want to start R within an VBA program. 

First I calculate something in Excel 2003.

After that I want to start within my VBA makro R wich should start an R file, 
say i.g, superplot.R  which plots me the data well.

So is it possible?

Maybe something like that:

sub test()

  'calculate something

 start R superplot.R 

end test()

Thank you so much.

Kindly regards,

Maja


-- 
Pt! Schon vom neuen GMX MultiMessenger gehört?
Der kanns mit allen: http://www.gmx.net/de/go/multimessenger

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


Re: [R] Tools For Preparing Data For Analysis

2007-06-11 Thread Chris Evans
(Ted Harding) sent the following  at 10/06/2007 09:28:

... much snipped ...

 (As is implicit in many comments in Robert's blog, and indeed also
 from many postings to this list over time and undoubtedly well
 known to many of us in practice, a lot of the problems with data
 files arise at the data gathering and entry stages, where people
 can behave as if stuffing unpaired socks and unattributed underwear
 randomly into a drawer, and then banging it shut).

And they look surprised when pointing a statistician at the chest of
drawers doesn't result in a cut price display worthy of Figleaf (or
Victoria's Secret I think for those of you in N.America) and get them
their degree, doctorate, latest publication ...

Ah me, how wonderfully, wonderfully ... sadly, accurate!

Thanks Ted, great thread and I'm impressed with EpiData that I've
discovered through this. I'd still like something that is even more
integrated with R but maybe some day, if EpiData go fully open source as
I think they are doing (A full conversion plan to secure this and
convert the software to open-source has been made (See complete
description of license and principles). at http://www.epidata.dk/ but
the link to http://www.epidata.dk/about.htm doesn't exactly clarify this
I don't think.  But I can hope.)

Thanks, yet again, to everyone who creates and contributes to the R
system and this list: wonderful!

C


-- 
Chris Evans [EMAIL PROTECTED] Skype: chris-psyctc
Professor of Psychotherapy, Nottingham University;
Consultant Psychiatrist in Psychotherapy, Notts PDD network;
Research Programmes Director, Nottinghamshire NHS Trust;
*If I am writing from one of those roles, it will be clear. Otherwise*
*my views are my own and not representative of those institutions*

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


[R] GMM estimation

2007-06-11 Thread Sebastian Kruk
Dear everyone:

I have to finish my thesis to graduate as Bs. in Economics.

I choose to estimate a New Keynesian Phillips Curve (NKPC) for Uruguay
using Generalized Moment Method (GMM).

I do not know programming or R but I  would like to use it.

Should I use gee, geepack or gam?

Thanks in advance,

Sebastián.

***

¡Hola todos!

Para terminiar mi licenciatura en Economía debo hacer un trabajo de
investigación monográfico.

Elegi como tema la estimación de la curva de Phillips de los Nuevos
Keynesianos (CPNK).

No se programar ni conosco el lenguaje R pero me gustaria usarlo para
estimar la CPNK usando el método generalizado de los momentos (MGM).

¿Debería usar el paquete gee, geepack o gam?

Gracias a todos.

Sebastián.

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


[R] generalized moment method

2007-06-11 Thread Sebastian Kruk
Dear everyone:

I have to finish my thesis to graduate as Bs. in Economics.

I choose to estimate a New Keynesian Phillips Curve (NKPC) for Uruguay
using Generalized Moment Method (GMM).

I do not know programming or R but I  would like to use it.

Should I use gee, geepack or gam?

Thanks in advance,

Sebastián.

***

¡Hola todos!

Para terminiar mi licenciatura en Economía debo hacer un trabajo de
investigación monográfico.

Elegi como tema la estimación de la curva de Phillips de los Nuevos
Keynesianos (CPNK).

No se programar ni conosco el lenguaje R pero me gustaria usarlo para
estimar la CPNK usando el método generalizado de los momentos (MGM).

¿Debería usar el paquete gee, geepack o gam?

Gracias a todos.

Sebastián.

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


[R] Textpad help

2007-06-11 Thread Mary Royerr
I have installed textpad and tried running R code. But it gives me the
following error message.



The filename, directory name, or volume label syntax is incorrect.

Tool completed with exit code 1


Can you provide any help? I am not a technical person. So the help in detail
will be appreciated.
Thx

[[alternative HTML version deleted]]

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


Re: [R] icc from GLMM?

2007-06-11 Thread Gregor Gorjanc
Shinichi Nakagawa S.Nakagawa at sheffield.ac.uk writes:
... 
 I am a little confused which one to trust and use. Or there are no easy form
 to do this? I am guessing formula would change depending on what distribution
 you use and what link function as well? I want to calculate icc from GLMM with
 Poisson with log link function and also binomial with logit function. Could
 anybody help me please?

Yes, you are right that ICC depends on assumed data distribution. While ICC is
very handy in linear models it is not the case in GLMM. I suggest you take a
look at the references bellow. There is also some online material by the same
authors. Additionally, I remember that there were lively discussions about ICC
on multilevel list at

http://www.jiscmail.ac.uk/lists/multilevel.html

Best wishes, Gregor

@Article{Goldstein:2002,
  author =   {Goldstein, H. and Browne, W. and Rabash, J.},
  title ={Partitioning variation in multilevel models},
  journal =  {Understanding Statistics},
  year = {2002},
  volume =   {1},
  number =   {4},
  pages ={223--231},
  keywords = {variance ratio, variance partition coefficient,
  intra-unit correlation, intra-class correlation, normal
  models, discrete models, random coefficient models}
}

@Article{Browne:2005,
  author =   {Browne, W. J. and Subramanian, S. V. and Jones, K. and
  Goldstein, H.},
  title ={Variance partitioning in multilevel logistic models that
  exhibit overdispersion},
  journal =  {J. R. Stat. Soc. A Stat. Soc.},
  year = {2005},
  volume =   {168},
  number =   {3},
  pages ={599--613},
  doi =  {10./j.1467-985X.2004.00365.x},
  checked =  {[2006-04-16]},
  keywords = {heritability, ratios, intra-class correlation,
  intra-unit correlation, simulation, linearization, latent
  variable approach},
}

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


Re: [R] Starting R within an VBA makro

2007-06-11 Thread Roger Bivand

On Mon, 11 Jun 2007, Maja Schröter wrote:


Hello everybody,

at work I want to start R within an VBA program.

First I calculate something in Excel 2003.

After that I want to start within my VBA makro R wich should start an R 
file, say i.g, superplot.R which plots me the data well.


So is it possible?


http://cran.r-project.org/contrib/extra/dcom/00ReadMe.html

and

RSiteSearch(Excel VBA)





Maybe something like that:

sub test()

 'calculate something

start R superplot.R

end test()

Thank you so much.

Kindly regards,

Maja





--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: [EMAIL PROTECTED]
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] epitools and R 2.5

2007-06-11 Thread Pietro Bulian
At work after updating to R 2.5 I get an error using epitab from package 
epitools, when at home  (R 2.4) I get no error. Could someone help me?

Thanks
Pietro Bulian

Servizio di Onco-Ematologia Clinico-Sperimentale
I.R.C.C.S. Centro di Riferimento Oncologico
Via Franco Gallini 2
33081 Aviano (PN) - Italy

phone: +39 0434 659 412
fax: +39 0434 659 409
e-mail: [EMAIL PROTECTED]


(at work)
epitab(matrix(c(227,473,74,126),2))
the part of the args list of 'list' being evaluated was:
   (tab = tab, measure = oddsratio, conf.level = conf.level, pvalue = 
pvalue, )
Error in epitab(matrix(c(227, 473, 74, 126), 2)) :
element 5 is empty

R.version
   _
platform   i386-pc-mingw32
arch   i386
os mingw32
system i386, mingw32
status
major  2
minor  5.0
year   2007
month  04
day23
svn rev41293
language   R
version.string R version 2.5.0 (2007-04-23)

Package: epitools
Version: 0.4-8
Date: 2007-05-10
Title: Epidemiology Tools
Author: Tomas Aragon [EMAIL PROTECTED]
Maintainer: Tomas Aragon [EMAIL PROTECTED]
Depends: R (= 2.1.0)
Description: A package of analytic tools for epidemiologists.
License: GPL version 2 or newer
URL: http://www.epitools.net
Packaged: Thu May 10 01:55:28 2007; Tomas
Built: R 2.5.0; ; 2007-05-10 14:22:09; windows

(at home)
 epitab(matrix(c(227,473,74,126),2))
Warning: a final empty element has been omitted

the part of the args list of 'list' being evaluated was:

(tab = tab, measure = oddsratio, conf.level = conf.level, pvalue = pvalue, )

$tab

Outcome

Predictor Disease1 p0 Disease2 p1 oddsratio lower upper p.value

Exposed1 227 0.3242857 74 0.37 1.000 NA NA NA

Exposed2 473 0.6757143 126 0.63 0.8171533 0.5887731 1.134120 0.2348794

$measure

[1] wald

$conf.level

[1] 0.95

$pvalue

[1] fisher.exact



 R.version

_

platform i386-pc-mingw32

arch i386

os mingw32

system i386, mingw32

status

major 2

minor 4.1

year 2006

month 12

day 18

svn rev 40228

language R



Package: epitools

Title: Epidemiology Tools

Version: 0.4-7

Date: 2005-03-20

Author: Tomas Aragon

Description: Basic tools for applied epidemiology.

Maintainer: Tomas Aragon [EMAIL PROTECTED]

License: GPL version 2 or newer

URL: http://www.epitools.net

Packaged: Sun Mar 20 16:30:07 2005; Tomas

Built: R 2.4.0; ; 2006-10-03 22:02:05; windows

version.string R version 2.4.1 (2006-12-18)

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


Re: [R] epitools and R 2.5

2007-06-11 Thread Prof Brian Ripley
On Mon, 11 Jun 2007, Pietro Bulian wrote:

 At work after updating to R 2.5 I get an error using epitab from package
 epitools, when at home  (R 2.4) I get no error. Could someone help me?

The maintainer: this is a long-standing bug in the package.
But you have enough information from the error message to correct the bug 
and rebuild the package yourself.

There are no such versions of R as '2.5' and '2.4' (see the posting 
guide), but R 2.4.0 did give a warning on your example.

Note that you are using different versions of epitools in your two 
locations, a difference you failed to mention and which may be important.



 Thanks
 Pietro Bulian

 Servizio di Onco-Ematologia Clinico-Sperimentale
 I.R.C.C.S. Centro di Riferimento Oncologico
 Via Franco Gallini 2
 33081 Aviano (PN) - Italy

 phone: +39 0434 659 412
 fax: +39 0434 659 409
 e-mail: [EMAIL PROTECTED]


 (at work)
 epitab(matrix(c(227,473,74,126),2))
 the part of the args list of 'list' being evaluated was:
   (tab = tab, measure = oddsratio, conf.level = conf.level, pvalue =
 pvalue, )
 Error in epitab(matrix(c(227, 473, 74, 126), 2)) :
element 5 is empty

 R.version
   _
 platform   i386-pc-mingw32
 arch   i386
 os mingw32
 system i386, mingw32
 status
 major  2
 minor  5.0
 year   2007
 month  04
 day23
 svn rev41293
 language   R
 version.string R version 2.5.0 (2007-04-23)

 Package: epitools
 Version: 0.4-8
 Date: 2007-05-10
 Title: Epidemiology Tools
 Author: Tomas Aragon [EMAIL PROTECTED]
 Maintainer: Tomas Aragon [EMAIL PROTECTED]
 Depends: R (= 2.1.0)
 Description: A package of analytic tools for epidemiologists.
 License: GPL version 2 or newer
 URL: http://www.epitools.net
 Packaged: Thu May 10 01:55:28 2007; Tomas
 Built: R 2.5.0; ; 2007-05-10 14:22:09; windows

 (at home)
 epitab(matrix(c(227,473,74,126),2))
 Warning: a final empty element has been omitted

 the part of the args list of 'list' being evaluated was:

 (tab = tab, measure = oddsratio, conf.level = conf.level, pvalue = pvalue, )

 $tab

 Outcome

 Predictor Disease1 p0 Disease2 p1 oddsratio lower upper p.value

 Exposed1 227 0.3242857 74 0.37 1.000 NA NA NA

 Exposed2 473 0.6757143 126 0.63 0.8171533 0.5887731 1.134120 0.2348794

 $measure

 [1] wald

 $conf.level

 [1] 0.95

 $pvalue

 [1] fisher.exact



 R.version

 _

 platform i386-pc-mingw32

 arch i386

 os mingw32

 system i386, mingw32

 status

 major 2

 minor 4.1

 year 2006

 month 12

 day 18

 svn rev 40228

 language R



 Package: epitools

 Title: Epidemiology Tools

 Version: 0.4-7

 Date: 2005-03-20

 Author: Tomas Aragon

 Description: Basic tools for applied epidemiology.

 Maintainer: Tomas Aragon [EMAIL PROTECTED]

 License: GPL version 2 or newer

 URL: http://www.epitools.net

 Packaged: Sun Mar 20 16:30:07 2005; Tomas

 Built: R 2.4.0; ; 2006-10-03 22:02:05; windows

 version.string R version 2.4.1 (2006-12-18)

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


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

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


[R] Looking for R-code for non-negative matrix factorization in the presence of Gaussian or Poisson noise

2007-06-11 Thread christian.ritter

Hi all,

Has any of you implemented code for non-negative matrix factorization to solve

Y=T P' +E; dim(Y)=n,p ; dim(T)=n,nc; dim (P)=(p,nc); dim(E)=n,p

where T and P must be non-negative and E either Gaussian or Poisson noise. 

I'm looking for two variants:

1. Easy (I think), T is known (that is we just want to solve the general 
inverse problem)

2. Harder (?), T is unknown (under some restrictions) [as an intermediate, we 
may want to fix nc]

Solutions/suggestions welcome

Have a nice day,


Christian Ritter
Senior Statistical Consultant
Analytical and Statistical Services
Shell Coordination Centre S.A.
Monnet Centre International Laboratory, Avenue Jean Monnet 1, B-1348 
Louvain-La-Neuve, Belgium

Tel: +32 10 477  349 Fax: +32 10 477 219
Email: [EMAIL PROTECTED]
Internet: http://www.analyticalsolutions4u.eu


[[alternative HTML version deleted]]

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


Re: [R] Lines in dotchart dotplot ?

2007-06-11 Thread John Kane

--- [EMAIL PROTECTED] wrote:

 On 6/9/07, John Kane [EMAIL PROTECTED] wrote:
  Is it possible to use dotchart or dotplot and set
 the
  lines in such a way that they only extend from the
  left y-axis to the data point?
 
 Yes (sort of) in dotplot at least. E.g.,
 
 dotplot(VADeaths, groups = FALSE, type = c(p,
 h))
 dotplot(VADeaths, groups = FALSE, type = c(p,
 h), origin = 0)
 
 -Deepayan
 

Ah, that is quite nice, not exactly what I remember
from Cleveland but it should do quite nicely.

  Thank you very much

  I seem to remember that Wm Cleveland did this in
 his
  1985 book  The elements of graphing data.
 
  In cases where one has a true starting or O point
 on
  the x-scale this layout seems to be very effective
 in
  displaying some data.
 
  I know that I can do it by simple ploting lines
 and
  points but a more polished function than I am
 likely
  to produce would be nice.
 
  Thanks

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


[R] system() and R BATCH

2007-06-11 Thread Meinhard Ploner
If I start from within R a new R batch job by using something like

system(R CMD BATCH --no-save --quiet Rin.txt Rout.txt,
intern=FALSE, ignore.stderr=TRUE, wait=FALSE, input=NULL)

the job runs fine and smooth.
However, when, for any reason, I put twice ctrl+C in the calling R,  
it kills me the called batch job, too. This is not what I wanted. Ctrl 
+C is usually rather used to stop a loop etc. Why it stops the called  
batch jobs, too?

What can be the solution for me - avoiding the called batch jobs to  
be killable from the calling R process?

Best regards
Meinhard


PS system: MacOS 10.4.9 Intel, R 2.5.0

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


Re: [R] Textpad help

2007-06-11 Thread John Kane
Hi Mary,
You really have not given us much to go on.  An
example of the code that you were trying to run would
be a great help (as it says down below :  PLEASE do
read the posting guide. The point about code is
important.

However the first thing to check is your file path.
This is my first guess anyway.

Here is the entry in the R FAQ

As R uses C-style string handling, `\' is treated as
an escape character, so that for example one can enter
a newline as `\n'. When you really need a `\', you
have to escape it with another `\'.

Thus, in filenames use something like
c:\\data\\money.dat. You can also replace `\' by `/'
(c:/data/money.dat). 
--

I am not familiar with textpad but you might want to
have a look at tinn-r which is very closely integrated
with R as an alternative editor

--- Mary Royerr [EMAIL PROTECTED] wrote:

 I have installed textpad and tried running R code.
 But it gives me the
 following error message.
 
 
 
 The filename, directory name, or volume label syntax
 is incorrect.
 
 Tool completed with exit code 1
 
 
 Can you provide any help? I am not a technical
 person. So the help in detail
 will be appreciated.
 Thx
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained,
 reproducible code.


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


Re: [R] generalized moment method

2007-06-11 Thread Markus Jäntti
Sebastian Kruk wrote:
 Dear everyone:
 
 I have to finish my thesis to graduate as Bs. in Economics.
 
 I choose to estimate a New Keynesian Phillips Curve (NKPC) for Uruguay
 using Generalized Moment Method (GMM).
 
 I do not know programming or R but I  would like to use it.
 
 Should I use gee, geepack or gam?

Dear Sebastián -- neither geepack nor gam provide GMM estimators. GMM -- or at 
least minimum distance estimation techniques -- rely on fitting by linear or 
more often non-linear least squares functions of smaller parameter vectors to 
the empirical moments of your problem. R is a suitable tool for this, but there 
is AFAIK know general GMM package.

The details of our model would need to be known before any further advice can 
be 
given.

Regards,

Markus

 
 Thanks in advance,
 
 Sebastián.
 
 ***
 
 ¡Hola todos!
 
 Para terminiar mi licenciatura en Economía debo hacer un trabajo de
 investigación monográfico.
 
 Elegi como tema la estimación de la curva de Phillips de los Nuevos
 Keynesianos (CPNK).
 
 No se programar ni conosco el lenguaje R pero me gustaria usarlo para
 estimar la CPNK usando el método generalizado de los momentos (MGM).
 
 ¿Debería usar el paquete gee, geepack o gam?
 
 Gracias a todos.
 
 Sebastián.
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 


-- 
Markus Jantti
Abo Akademi University
[EMAIL PROTECTED]
http://www.iki.fi/~mjantti

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


[R] problem with xlsReadWrite package

2007-06-11 Thread hassen62
Hi friends,
I have installed R 2.4.0 in my pc. I have a file xls entitled dali following 
this directory:c://programfiles//R 2.4.0. Recently I have installed 
xlsreadwrite 1.3.2. but , when I wrote the following lines:
library(xlsReadWrite)
read.xls( file, colNames = TRUE, sheet = 1, type = data.frame,  from = 1, 
colClasses = NA )
I obtained from R console the following messages:
Error in library(xlsReadWrite)
impossible to find the functionread.xls.
Please help me, many thanks in advance.
[[alternative HTML version deleted]]

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


[R] problem with xlsReadWrite package

2007-06-11 Thread hassen62
Hi friends,
I have installed R 2.4.0 in my pc. I have a file xls entitled dali following 
this directory:c://programfiles//R 2.4.0. Recently I have installed 
xlsreadwrite 1.3.2. but , when I wrote the following lines:
library(xlsReadWrite)
read.xls( file, colNames = TRUE, sheet = 1, type = data.frame,  from = 1, 
colClasses = NA )
I obtained from R console the following messages:
Error in library(xlsReadWrite)
impossible to find the functionread.xls.
Please help me, many thanks in advance.
[[alternative HTML version deleted]]

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


[R] Error using mgcv package

2007-06-11 Thread spime

Hi all,

I need some solution in the following problem. The following error appears
when i use mgcv package for implementing GAM. But the same formula works
fine in gam package.

 model.gam - gam(formula = RES ~
 CAT01+s(NUM01,5)+CAT02+CAT03+s(NUM02,5)+CAT04+
+ CAT05+s(NUM03,5)+CAT06+CAT07+s(NUM04,5)+CAT08+s(NUM05,5)+CAT09+
+ CAT10+s(NUM06,5)+CAT11+NUM07+CAT12+CAT13,
+ family = binomial(link = logit), data = train.data,na.action = na.exclude,
+ control = list(epsilon = 0.001,bf.epsilon = 0.001, maxit = 50, 
+ bf.maxit = 10, trace = F))

Error in terms.formula(reformulate(term[i])) : 
invalid model formula in ExtractVars

And after deleting df's 

model.gam - gam(formula = RES ~ CAT01+s(NUM01)+CAT02+CAT03+s(NUM02)+CAT04+
+ CAT05+s(NUM03)+CAT06+CAT07+s(NUM04)+CAT08+s(NUM05)+CAT09+
+ CAT10+s(NUM06)+CAT11+NUM07+CAT12+CAT13,
+ family = binomial(link = logit), data = train.data)

Error in smooth.construct.tp.smooth.spec(object, data, knots) : 
A term has fewer unique covariate combinations than specified
maximum degrees of freedom
 

Can anybody show me some light in this case!!!

Thanks in advance.
-- 
View this message in context: 
http://www.nabble.com/Error-using-mgcv-package-tf3900783.html#a11058255
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] {spam?} Nonlinear Regression

2007-06-11 Thread Martin Henry H. Stevens
Hi tronter,

PLEASE do read the posting guide http://www.R-project.org/posting- 
guide.html
and provide commented, minimal, self-contained, reproducible code.

Hank
On Jun 7, 2007, at 5:50 PM, tronter wrote:


 Hello

 I followed the example in page 59, chapter 11 of the 'Introduction  
 to R'
 manual. I entered my own x,y data. I used the least squares. My  
 function has
 5 parameters: p[1], p[2], p[3], p[4], p[5]. I plotted the x-y data.  
 Then I
 used lines(spline(xfit,yfit)) to overlay best curves on the data while
 changing the parameters. My question is how do I calculate the  
 residual sum
 of squares. In the example they have the following:

 df - data.frame( x=x, y=y)

 fit - nls(y ~SSmicmen(s, Vm, K), df)

 fit


 In the second line how would I input my function? Would it be:

 fit - nls(y ~ myfunction(p[1], p[2], p[3], p[4], p[5]), df) where
 myfunction is the actual function? My function doesnt have a name,  
 so should
 I just enter it?

 Thanks

 -- 
 View this message in context: http://www.nabble.com/Nonlinear- 
 Regression-tf3886617.html#a11016968
 Sent from the R help mailing list archive at Nabble.com.

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

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


[R] Rounding?

2007-06-11 Thread BXC (Bendix Carstensen)
I was a bit puzzed by:

 formatC(6.65,format=f,digits=1)
[1] 6.6

So I experimented and found:

 formatC(6.6501,format=f,digits=1)
[1] 6.6
 formatC(6.651,format=f,digits=1)
[1] 6.7
   round(6.6501,1)
[1] 6.7
   round(6.651,1)
[1] 6.7
 version
   _   
platform   i386-pc-mingw32 
arch   i386
os mingw32 
system i386, mingw32   
status 
major  2   
minor  5.0 
year   2007
month  04  
day23  
svn rev41293   
language   R   
version.string R version 2.5.0 (2007-04-23)

My machine runs Windows NT.

Is this intended or just a Windows facility?
__

Bendix Carstensen
Senior Statistician

Steno Diabetes Center
Niels Steensens Vej 2-4
DK-2820 Gentofte
Denmark
+45 44 43 87 38 (direct)
+45 30 75 87 38 (mobile)
+45 44 43 73 13 (fax)
[EMAIL PROTECTED]   http://www.biostat.ku.dk/~bxc

This e-mail (including any attachments) is intended for the ...{{dropped}}

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


Re: [R] Tools For Preparing Data For Analysis

2007-06-11 Thread Barry Rowlingson
Chris Evans wrote:

 Thanks Ted, great thread and I'm impressed with EpiData that I've
 discovered through this. I'd still like something that is even more
 integrated with R but maybe some day, if EpiData go fully open source as
 I think they are doing (A full conversion plan to secure this and
 convert the software to open-source has been made (See complete
 description of license and principles). at http://www.epidata.dk/ but
 the link to http://www.epidata.dk/about.htm doesn't exactly clarify this
 I don't think.  But I can hope.)
 
 Thanks, yet again, to everyone who creates and contributes to the R
 system and this list: wonderful!

  Perhaps what we need is an XML standard for describing record-oriented 
data and its validation? This could then be used to validate a set of 
records and possibly also to build input forms with built-in validation 
for new records.

  You could then write R code that did 'check this data frame against 
this XML description and tell me the invalid rows'. Or Python code.

  This is the kind of thing that is traditionally built using a database 
front-end, but keeping the description in XML means that alternate 
interfaces (web forms, standalone programs using Qt or GTK libraries) 
can be used on the same description set.

  I had a quick search to see if this kind of thing exists already, but 
google searches for 'data entry verification' indicate that I should 
really pay some people in India to do that kind of thing for me...

Barry

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


Re: [R] Rounding?

2007-06-11 Thread jim holtman
your number 6.6501 is to large to fit in a floating point
number.  It takes 56 bits and there are only 54 in a real number so the
system see it as 6.65 and does the rounding to an even digit; 6.6

6.651 does fit into a real number (takes 54 bits) and this will
now round to 6.7


On 6/11/07, BXC (Bendix Carstensen) [EMAIL PROTECTED] wrote:

 I was a bit puzzed by:

  formatC(6.65,format=f,digits=1)
 [1] 6.6

 So I experimented and found:

  formatC(6.6501,format=f,digits=1)
 [1] 6.6
  formatC(6.651,format=f,digits=1)
 [1] 6.7
round(6.6501,1)
 [1] 6.7
round(6.651,1)
 [1] 6.7
  version
   _
 platform   i386-pc-mingw32
 arch   i386
 os mingw32
 system i386, mingw32
 status
 major  2
 minor  5.0
 year   2007
 month  04
 day23
 svn rev41293
 language   R
 version.string R version 2.5.0 (2007-04-23)

 My machine runs Windows NT.

 Is this intended or just a Windows facility?
 __

 Bendix Carstensen
 Senior Statistician

 Steno Diabetes Center
 Niels Steensens Vej 2-4
 DK-2820 Gentofte
 Denmark
 +45 44 43 87 38 (direct)
 +45 30 75 87 38 (mobile)
 +45 44 43 73 13 (fax)
 [EMAIL PROTECTED]   http://www.biostat.ku.dk/~bxc

 This e-mail (including any attachments) is intended for the ...{{dropped}}

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




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

[[alternative HTML version deleted]]

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


Re: [R] Rounding?

2007-06-11 Thread jim holtman
A good reference is:

*What Every Computer Scientist Should Know About Floating-Point*
*...*http://docs.sun.com/source/806-3568/ncg_goldberg.html

http://docs.sun.com/source/806-3568/ncg_goldberg.html


On 6/11/07, BXC (Bendix Carstensen) [EMAIL PROTECTED] wrote:

 I was a bit puzzed by:

  formatC(6.65,format=f,digits=1)
 [1] 6.6

 So I experimented and found:

  formatC(6.6501,format=f,digits=1)
 [1] 6.6
  formatC(6.651,format=f,digits=1)
 [1] 6.7
round(6.6501,1)
 [1] 6.7
round(6.651,1)
 [1] 6.7
  version
   _
 platform   i386-pc-mingw32
 arch   i386
 os mingw32
 system i386, mingw32
 status
 major  2
 minor  5.0
 year   2007
 month  04
 day23
 svn rev41293
 language   R
 version.string R version 2.5.0 (2007-04-23)

 My machine runs Windows NT.

 Is this intended or just a Windows facility?
 __

 Bendix Carstensen
 Senior Statistician

 Steno Diabetes Center
 Niels Steensens Vej 2-4
 DK-2820 Gentofte
 Denmark
 +45 44 43 87 38 (direct)
 +45 30 75 87 38 (mobile)
 +45 44 43 73 13 (fax)
 [EMAIL PROTECTED]   http://www.biostat.ku.dk/~bxc

 This e-mail (including any attachments) is intended for the ...{{dropped}}

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




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

[[alternative HTML version deleted]]

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


[R] simultaneous computing

2007-06-11 Thread Markus Schmidberger
Hello,

which possibilities are available in R for simultaneous or parallel 
computing?
I only could find biopara 
(http://cran.r-project.org/src/contrib/Descriptions/biopara.html)

Are there other possibilities?
Are there special groups working on simultaneous computing with R?

Thanks
Markus

-- 
Dipl.-Tech. Math. Markus Schmidberger

Ludwig-Maximilians-Universität München
IBE - Institut für medizinische Informationsverarbeitung,
Biometrie und Epidemiologie

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


[R] Selecting all values smaller than X in a dataframe

2007-06-11 Thread Christoph Scherber
Dear R users,

I have a correlation matrix for a dataframe called synth, for which I 
now want to select only those cells that have correlations larger than 
+/-0.6:

synth=data.frame(x=rnorm(10,1),y=rnorm(10,2),z=rnorm(10,0.5))

w=cor(synth,use=pairwise.complete.obs)
w=as.data.frame(w)
w[,sapply(w,abs(w),,0.6)]

The problem is that using sapply with  or  doesn´t seem to work.

How could I solve this problem?

Thank you very much in advance for your help!

Best wishes
Christoph

(I am using R 2.5.0 on Windows XP).



--
Christoph Scherber
DNPW, Agroecology
University of Goettingen
Waldweg 26
D-37073 Goettingen

+49-(0)551-39-8807

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


Re: [R] simultaneous computing

2007-06-11 Thread Mike Lawrence
There's RMPI
tutorial: http://ace.acadiau.ca/math/ACMMaC/Rmpi/index.html


On 11-Jun-07, at 9:11 AM, Markus Schmidberger wrote:

 Hello,

 which possibilities are available in R for simultaneous or parallel
 computing?
 I only could find biopara
 (http://cran.r-project.org/src/contrib/Descriptions/biopara.html)

 Are there other possibilities?
 Are there special groups working on simultaneous computing with R?

 Thanks
 Markus

 --  
 Dipl.-Tech. Math. Markus Schmidberger

 Ludwig-Maximilians-Universität München
 IBE - Institut für medizinische Informationsverarbeitung,
 Biometrie und Epidemiologie

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

--
Mike Lawrence
Graduate Student, Department of Psychology, Dalhousie University

Website: http://myweb.dal.ca/mc973993
Public calendar: http://icalx.com/public/informavore/Public

The road to wisdom? Well, it's plain and simple to express:
Err and err and err again, but less and less and less.
- Piet Hein

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


[R] Recoding

2007-06-11 Thread David Scott

I want to do some recoding of variables: code Age into groups and recode a 
factor into a smaller number of levels.

There are a couple of options for recode functions, in the car package and 
in memisc, and I think in gmisc.

Does anyone have any opinions on the the easiest, most reliable approach 
for these problems?

David Scott

_
David Scott Department of Statistics, Tamaki Campus
The University of Auckland, PB 92019
Auckland 1142,NEW ZEALAND
Phone: +64 9 373 7599 ext 86830 Fax: +64 9 373 7000
Email:  [EMAIL PROTECTED]

Graduate Officer, Department of Statistics
Director of Consulting, Department of Statistics

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


Re: [R] Selecting all values smaller than X in a dataframe

2007-06-11 Thread Vladimir Eremeev


Christoph Scherber-2 wrote:
 
 Dear R users,
 
 I have a correlation matrix for a dataframe called synth, for which I 
 now want to select only those cells that have correlations larger than 
 +/-0.6:
 
 synth=data.frame(x=rnorm(10,1),y=rnorm(10,2),z=rnorm(10,0.5))
 
 w=cor(synth,use=pairwise.complete.obs)
 w=as.data.frame(w)
 w[,sapply(w,abs(w),,0.6)]
 
 The problem is that using sapply with  or  doesn´t seem to work.
 
 How could I solve this problem?
 
 

If you want to extract correlations with absolute value 0.6, then simply
use w[abs(w)0.6]

Please, reread the help(sapply). You give some extra arguments to this
function.
The first goes the vector, the second goes the function, and then -
additional arguments to the function.
Probably, you wanted w[sapply(abs(w),,0.6)]
This gives the same result.

-- 
View this message in context: 
http://www.nabble.com/Selecting-all-values-smaller-than-X-in-a-dataframe-tf3901238.html#a11059804
Sent from the R help mailing list archive at Nabble.com.

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


[R] Odp: Selecting all values smaller than X in a dataframe

2007-06-11 Thread Petr PIKAL
Hi

[EMAIL PROTECTED] napsal dne 11.06.2007 14:09:45:

 Dear R users,
 
 I have a correlation matrix for a dataframe called synth, for which I 
 now want to select only those cells that have correlations larger than 
 +/-0.6:
 
 synth=data.frame(x=rnorm(10,1),y=rnorm(10,2),z=rnorm(10,0.5))
 
 w=cor(synth,use=pairwise.complete.obs)
 w=as.data.frame(w)

Why? Better is tu use

abs(w).6

and/or

which(abs(w).6, arr.ind=T)

or, if you want actual values just

w[abs(w).6]

Regards

Petr

 w[,sapply(w,abs(w),,0.6)]
 
 The problem is that using sapply with  or  doesn´t seem to work.
 
 How could I solve this problem?
 
 Thank you very much in advance for your help!
 
 Best wishes
 Christoph
 
 (I am using R 2.5.0 on Windows XP).
 
 
 
 --
 Christoph Scherber
 DNPW, Agroecology
 University of Goettingen
 Waldweg 26
 D-37073 Goettingen
 
 +49-(0)551-39-8807
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] simultaneous computing

2007-06-11 Thread Luke Tierney
The package snow available from CRAN is one possibility.

Best,

luke

On Mon, 11 Jun 2007, Markus Schmidberger wrote:

 Hello,

 which possibilities are available in R for simultaneous or parallel
 computing?
 I only could find biopara
 (http://cran.r-project.org/src/contrib/Descriptions/biopara.html)

 Are there other possibilities?
 Are there special groups working on simultaneous computing with R?

 Thanks
 Markus



-- 
Luke Tierney
Chair, Statistics and Actuarial Science
Ralph E. Wareham Professor of Mathematical Sciences
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

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


Re: [R] Looking for R-code for non-negative matrix factorization in the presence of Gaussian or Poisson noise

2007-06-11 Thread Thomas Lumley
On Mon, 11 Jun 2007, [EMAIL PROTECTED] wrote:


 Hi all,

 Has any of you implemented code for non-negative matrix factorization to 
 solve

 Y=T P' +E; dim(Y)=n,p ; dim(T)=n,nc; dim (P)=(p,nc); dim(E)=n,p

 where T and P must be non-negative and E either Gaussian or Poisson noise.

 I'm looking for two variants:

 1. Easy (I think), T is known (that is we just want to solve the general 
 inverse problem)

This is non-negative least squares, a quadratic programming problem, for 
which there is code (at least if n and nc are not too big)


 2. Harder (?), T is unknown (under some restrictions) [as an 
 intermediate, we may want to fix nc]


Even with fixed nc this is Distinctly Non-trivial. It often isn't 
identifiable, for a start.

I've encountered this problem in air pollution source apportionment, where 
people use an algorithm due to Paatero (1999) JCGS 8:854-8, which is a 
conjugate gradient algorithm that handles the constraints by creative 
abuse of preconditioning.  The algorithm seems fairly well-behaved, 
although the statistical properties of the estimates are not 
well-understood [at least, I don't understand them, and I have simulations 
that appear to contradict the views of people who claim to understand 
them].

The difficulty probably depends on the size of the problem -- the air 
pollution problems have n~1000, p~20, nc~7, or larger.

-thomas

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


Re: [R] Selecting all values smaller than X in a dataframe

2007-06-11 Thread Ingo Michaelis
Christoph Scherber Christoph.Scherber at agr.uni-goettingen.de writes:

 
 Dear R users,
 
 I have a correlation matrix for a dataframe called synth, for which I 
 now want to select only those cells that have correlations larger than 
 +/-0.6:
 
 synth=data.frame(x=rnorm(10,1),y=rnorm(10,2),z=rnorm(10,0.5))
 
 w=cor(synth,use=pairwise.complete.obs)
 w=as.data.frame(w)
 w[,sapply(w,abs(w),,0.6)]
 

Dear Christoph,

just change the last command to

w[abs(w)0.6]


Best wishes
Ingo

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


Re: [R] Recoding

2007-06-11 Thread David Barron
I've used the one in car with no problems.  For grouping a continuous
variable you might also consider cut.

On 11/06/07, David Scott [EMAIL PROTECTED] wrote:

 I want to do some recoding of variables: code Age into groups and recode a
 factor into a smaller number of levels.

 There are a couple of options for recode functions, in the car package and
 in memisc, and I think in gmisc.

 Does anyone have any opinions on the the easiest, most reliable approach
 for these problems?

 David Scott

 _
 David Scott Department of Statistics, Tamaki Campus
 The University of Auckland, PB 92019
 Auckland 1142,NEW ZEALAND
 Phone: +64 9 373 7599 ext 86830 Fax: +64 9 373 7000
 Email:  [EMAIL PROTECTED]

 Graduate Officer, Department of Statistics
 Director of Consulting, Department of Statistics

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



-- 
=
David Barron
Said Business School
University of Oxford
Park End Street
Oxford OX1 1HP

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


[R] biplot package II

2007-06-11 Thread terra
Dear all,

I've been learning biplot (Gabriel, 1971) and some days ago I sent for
this list a procedural function with invitation for a collaborative package.
Jari Oksanen made some suggestions and I agree with all.

So, I reworked the function under the object-oriented programming
(OOP/S3). I think it is now a good frame for more resources.

Below it is the function and a small script to learn it:

#===
# Name   : biplot.s
# Author : Jose Claudio Faria (DCET/USC/BRAZIL)
# Date (dd/mm/yy): 9/6/2007 13:33:48
# Version: v1.1
# Aim: 2d and 3d (under scaterplot3d and rgl packages) biplot
# Mail   : [EMAIL PROTECTED]
#===
# Arguments:
# x Data (frame or matrix: objects in lines variables in columns)
#   or a object of the class 'prcomp'.
# lambda.iniFirst eigenvalue to be considered (default is 1)
# lambda.endLatest eigenvalue to be considered
#   (default is 2 to 2d or 3 to 3d)
# centerEither a logical value or a numeric vector of length equal
#   to the number of columns of x (TRUE is the default).
# scale Either a logical value or a numeric vector of length equal
#   to the number of columns of x (FALSE is the default).
# weightWay of factorize: 'equal', 'objects', 'variables'
#   ('equal' is the default).
# plot  Logical to produce or not a graphical representation of
#   biplot (TRUE is the default).
# rgl.use   If TRUE the 3d scatter will be under the rgl environment, in
#   another way the scatterplot3d will be used ( the default).
# aspect3d  Apparent ratios of the x, y, and z axes of the bounding box.
# clear3d   Logical to clear or not a 3d graphical representation of
#   biplot before to make a new (TRUE is the default).
# simple.axes   Whether to draw simple axes (TRUE or FALSE).
# box   Whether to draw a box (the default is FALSE).
# spheres   Logical to represent objects as spheres (FALSE is the default).
# sphere.factor Relative size factor of sphere representing points; the
#   default size is dependent on the scale of observations.
# col.obj   Color of spheres or labels of objects.
# col.var   Color of lines and labels of variables.
# var.factorFactor of expansion/reduction of length lines of the variables.
#   graphical variables representation (=1, 1 is the default).
# cex   Character expansion (for while valid only to graphics and
#   scatterplot3d, not to rgl, packages).
#===
# Require   'rgl' and 'scatterplot3d' packages.
#===

# check the necessary packages
necessary = c('rgl', 'scatterplot3d')
if(!all(necessary %in% installed.packages()[, 'Package']))
   install.packages(c('rgl', 'scatterplot3d'), dep = T)

# Plot 2d with 'graphics' packages
plot.biplot.2d = function(scores,
   g,
   hl,
   lambda.ini,
   lambda.end,
   col.obj,
   col.var,
   var.factor,
   cex)
{
   plot(scores,
xlab=paste('PC', lambda.ini, sep=''),
ylab=paste('PC', lambda.end, sep=''),
type='n')
   text(x=g[,1], y=g[,2],
labels=rownames(g),
cex=cex, col=col.obj)
   arrows(x0=0, y0=0,
  x1=hl[,1]*var.factor, y1=hl[,2]*var.factor,
  length=0.1, angle=20,
  col=col.var)
   text(x=hl[,1]*var.factor, y=hl[,2]*var.factor,
labels = rownames(hl),
cex=cex, col=col.var)
}

# Plot 3d with 'scatterplot3d' package
plot.biplot.3d.default = function(scores,
   g,
   hl,
   lambda.ini,
   lambda.end,
   col.obj,
   col.var,
   var.factor,
   spheres,
   box,
   cex)
{
   require(scatterplot3d)
   graph = scatterplot3d(scores,
 type = if(spheres) 'p' else 'n',
 xlab=paste('PC', lambda.ini, sep=''),
 ylab=paste('PC', lambda.ini+1, sep=''),
 zlab=paste('PC', lambda.end, sep=''),
 grid=F,
 box=box,
 cex.symbols=cex,
 color=col.obj,
 pch=20)
if(!spheres)
  

[R] Gini coefficient in R

2007-06-11 Thread MICHELE DE MEO
If I use the Ineq library and the Gini function in this way:

Gini(c(100,0,0,0))

I obtain the result 0.75 instead of 1 (that is the perfect inequality).

I think Gini's formula in Ineq is based on a formula as reported here:
http://mathworld.wolfram.com/GiniCoefficient.html

but in the case of perfect inequality:

x_1=...=x_n-1 =0

x_n0

these formula are equal to 1 - 1/n, not to 1.

I don't know where I'm wrong


-- 
Michele De Meo
http://micheledemeo.blogspot.com/

[[alternative HTML version deleted]]

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


Re: [R] Gini coefficient in R

2007-06-11 Thread Dimitris Rizopoulos
try this version instead:

gini - function(x, unbiased = TRUE, na.rm = FALSE){
if (!is.numeric(x)){
warning('x' is not numeric; returning NA)
return(NA)
}
if (!na.rm  any(na.ind - is.na(x)))
stop('x' contain NAs)
if (na.rm)
x - x[!na.ind]
n - length(x)
mu - mean(x)
N - if (unbiased) n * (n - 1) else n * n
ox - x[order(x)]
dsum - drop(crossprod(2 * 1:n - n - 1,  ox))
dsum / (mu * N)
}



gini(c(100,0,0,0))


I hope it helps.

Best,
Dimitris


Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
 http://www.student.kuleuven.be/~m0390867/dimitris.htm


- Original Message - 
From: MICHELE DE MEO [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Sent: Monday, June 11, 2007 4:13 PM
Subject: [R] Gini coefficient in R


 If I use the Ineq library and the Gini function in this way:

Gini(c(100,0,0,0))

 I obtain the result 0.75 instead of 1 (that is the perfect 
 inequality).

 I think Gini's formula in Ineq is based on a formula as reported 
 here:
 http://mathworld.wolfram.com/GiniCoefficient.html

 but in the case of perfect inequality:

 x_1=...=x_n-1 =0

 x_n0

 these formula are equal to 1 - 1/n, not to 1.

 I don't know where I'm wrong


 -- 
 Michele De Meo
 http://micheledemeo.blogspot.com/

 [[alternative HTML version deleted]]

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


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

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


Re: [R] Rounding?

2007-06-11 Thread Peter Dalgaard
jim holtman wrote:
 your number 6.6501 is to large to fit in a floating point
 number.  It takes 56 bits and there are only 54 in a real number so the
 system see it as 6.65 and does the rounding to an even digit; 6.6

 6.651 does fit into a real number (takes 54 bits) and this will
 now round to 6.7

   
Actually, a bit more insidious than that because 6.65 does not have an
exact binary representation. Hence

 round(66.5)
[1] 66
 round(6.65,1)
[1] 6.7
 round(0.665,2)
[1] 0.66

Notice that these are from Linux and differ from what you get on Windows.

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

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


[R] design package

2007-06-11 Thread Qin Qin
Hi all:

I tried to install design package for R used under the window. But it dose 
not work.  Here is the message from R. 

library(Design)
Error in library(Design) : 'Design' is not a valid package -- installed  
2.0.0?

I did not find 2.x version of Design package for window 95. I installed 
one of two zip files available in the internet. 
Please let me know what's wrong?

Thanks,
Qin
[[alternative HTML version deleted]]

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


Re: [R] p-value from GEE why factor 2*pnorm?

2007-06-11 Thread Carmen Meier
I got an answer for the other question (thank you)

But there is another question  (I am afraid this is a basic question ...)

In this tread there is a hint hwo to calculate the p-vlue of an GEE:
 _http://finzi.psych.upenn.edu/R/Rhelp02a/archive/74150.html_ 

 Then, get the P values using a normal approximation for the 
 distribution of z:

 / 2 * pnorm(abs(coef(summary(fm1))[,5]), lower.tail = FALSE) / 
 (Intercept) TPTLD  0. 0.04190831 

1. why is the result multiplicated  with 2? There is a P-value between 1 and 2
with the results below and multiplicated with 2: 

2*pnorm(c(1.8691945,0.5882351,2.4903091,1.9287802,2.3172983,2.2092593,2.2625959,1.6395695),
lower.tail =TRUE)  

Regards Carmen

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


Re: [R] p-value from GEE why factor 2*pnorm?

2007-06-11 Thread Benilton Carvalho
the recommendation was to use lower.tail=FALSE.

b

On Jun 11, 2007, at 11:21 AM, Carmen Meier wrote:

 I got an answer for the other question (thank you)

 But there is another question  (I am afraid this is a basic  
 question ...)

 In this tread there is a hint hwo to calculate the p-vlue of an GEE:
 _http://finzi.psych.upenn.edu/R/Rhelp02a/archive/74150.html_

 Then, get the P values using a normal approximation for the
 distribution of z:

 / 2 * pnorm(abs(coef(summary(fm1))[,5]), lower.tail = FALSE) /
 (Intercept) TPTLD  0. 0.04190831

 1. why is the result multiplicated  with 2? There is a P-value  
 between 1 and 2
 with the results below and multiplicated with 2:

 2*pnorm(c 
 (1.8691945,0.5882351,2.4903091,1.9287802,2.3172983,2.2092593,2.2625959 
 ,1.6395695),
 lower.tail =TRUE)

 Regards Carmen

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


Re: [R] p-value from GEE why factor 2*pnorm?

2007-06-11 Thread Carmen Meier
Benilton Carvalho schrieb:
 the recommendation was to use lower.tail=FALSE.

 b

 O
but then the results are significant and this does not match the 
observation.
The results are matching the observations if the formula is

pnorm(c(1.8691945,0.5882351,2.4903091,1.9287802,2.3172983,2.2092593,2.2625959,1.6395695),
lower.tail =TRUE) 

so I have any unknown problem  anywhere :-(

REgards Carmen

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


[R] lmekin() function in kinship package

2007-06-11 Thread Qiong Yang
Hi,

I had a problem with the lmekin() in kinship package: 
lmekin() can not be wrapped into another function

library(kinship)
#creat an example dataset
xx-rnorm(100)
yy-rnorm(100)
id-1:100  
test.dat-as.data.frame(cbind(xx,yy,id))
rm(xx,yy,id)
a-bdsmatrix(rep(10,10),rep(block,10),dimnames=list(c(1:100),c(1:100)))  
#100x100 block (n=10) diagonal matrix to indicate the correlation between the 
100 observations

#this works, call lmekin directly
lmekin(yy~xx,random=~1|id,data=test.dat,varlist=a,na.action=na.omit)

#this doesn't work, wrap into another function

fo-function(x,y,z,data)lmekin(y~x,random=~1|z,data=test.dat,varlist=a,na.action=na.omit)
fo(xx,yy,id)

Error in eval(expr, envir, enclos) : Object y not found

I did line by line debug within lmekin(). I found the problem was from 
line #25
m - eval(m, sys.parent())

Here is the print(m) result before this line
[1] model.frame(data = data, na.action = na.omit, formula = y ~ x +z)

I will appreciate anyone help me figure out why data cannot be passed 
to the arguments when lmekin() is wrapped into another function? And what can 
be done
to fix it? 


Thanks

Qiong

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


[R] autoregressive spectral density estimate by andrews' plug-in method?

2007-06-11 Thread Martin Ivanov
Hello!
I would like to ask if there is in R a function that estimates the spectral 
density function of a stochastic series at frequency zero by the plug-in 
method, advocated by Andrews in his paper Heteroscedasticity and 
Autocorrelation Consistent Covariance Matrix Estimation, Econometrica, 
59,817-858. I saw R has functions that employ Andrews' plug-in method using an 
AR(1) approximation for the estimation of the variance-covariance matrix in 
linear models. They come with the sandwich package. The so called meat is 
actually the estimate of the spectral density matrix of the model coefficients 
at frequency zero. However, I have a time series of length 160 and I need to 
estimate its spectral density via Andrews methodology. Any suggestions will be 
appreciated.
Excuse me if I am asking something obvious.

Regards,
Martin

-
Нека музиката бъде с теб! 
http://musicidol.btv.bg/

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


Re: [R] open .r files with double-click

2007-06-11 Thread Bert Gunter
However, do note (on Windows) that you can use an external text/programming
editors (see CRAN's listings)and can register .r / .R files to open
automatically in the chosen editor when clicked on.At least some of these
editors (eg TINN-R) can be configured to automatically and simultaneously
open the RGUI, too, I believe -- but someone may correct me on this.

Bert Gunter
Nonclinical Statistics
7-7374

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Duncan Murdoch
Sent: Saturday, June 09, 2007 4:29 AM
To: [EMAIL PROTECTED]
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] open .r files with double-click

On 08/06/2007 2:52 PM, [EMAIL PROTECTED] wrote:
 Hi Folks,
 On Windows XP, R 2.5.0.
 
 After reading the Installation for Windows and Windows FAQs,
 I cannot resolve this.
 
 I set file types so that Rgui.exe will open .r files.
 
 When I try to open a .r file by double-clicking, R begins to launch,
 but I get an error message saying
 
 Argument 'C:\Documents and Settings\Zoology\My Documents\trial.r'
_ignored_
 
 I click OK, and then R GUI opens, but not the script file.
 
 Is there a way to change this?

Not currently. See the appendix Invoking R of the Introduction manual 
for the current command line parameters, which don't include open a 
script.  This would be a reasonable addition, and I'll add it at some 
point, sooner if someone else comes up with a convincing argument for 
the right command line parameter to do this.

It would be better if clicking on a second script opened a new window in 
the same session, but that takes more work; not sure I'll get to this.

Duncan Murdoch

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

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


Re: [R] p-value from GEE why factor 2*pnorm?

2007-06-11 Thread Robert A LaBudde
At 11:21 AM 6/11/2007, Carmen wrote:
snip
In this tread there is a hint hwo to calculate the p-vlue of an GEE:
  _http://finzi.psych.upenn.edu/R/Rhelp02a/archive/74150.html
 
  Then, get the P values using a normal approximation for the
  distribution of z:
 
  / 2 * pnorm(abs(coef(summary(fm1))[,5]), lower.tail = FALSE) /
  (Intercept) TPTLD  0. 0.04190831

1. why is the result multiplicated  with 2? There is a P-value between 1 and 2
with the results below and multiplicated with 2:

2*pnorm(c(1.8691945,0.5882351,2.4903091,1.9287802,2.3172983,2.2092593,2.2625959,1.6395695),
lower.tail =TRUE)

1. The given in the thread mentioned was:

 2 * pnorm(abs(coef(summary(fm1))[,5]), lower.tail = FALSE)

2. The reason for the 2 at the front is to make it an equal-tails 
or 2-sided confidence interval. Pedantically, you should use 1.96 
instead of 2.0 for consistency, but 2.0 = 1.96 rounded to one decimal place.

3. This is what is usually called a Wald type confidence interval, 
as it is simply the normal quantile (+/- 1.96) multiplied by the 
standard error of estimate to get the +/- widths for the interval. 
These would be added to the estimate itself to get the final Wald 
confidence interval, which obviously assumes a normal distribution applies.



Robert A. LaBudde, PhD, PAS, Dpl. ACAFS  e-mail: [EMAIL PROTECTED]
Least Cost Formulations, Ltd.URL: http://lcfltd.com/
824 Timberlake Drive Tel: 757-467-0954
Virginia Beach, VA 23464-3239Fax: 757-467-2947

Vere scire est per causas scire

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


Re: [R] Fwd: Using odesolve to produce non-negative solutions

2007-06-11 Thread Jeremy Goldhaber-Fiebert
Hi Spencer,

Thank you for your response. I also did not see anything on the lsoda help page 
which is the reason that I wrote to the list.

From your response, I am not sure if I asked my question clearly.

I am modeling a group of people (in a variety of health states) moving through 
time (and getting infected with an infectious disease). This means that the 
count of the number of people in each state should be positive at all times. 

What appears to happen is that lsoda asks for a derivative at a given point in 
time t and then adjusts the state of the population. However, perhaps due to 
numerical instability, it occasionally lower the population count below 0 for 
one of the health states (perhaps because it's step size is too big or 
something). 

I have tried both the logarithm trick and also changing the relative and 
absolute tolerance inputs but I still get the problem for certain combinations 
of parameters and initial conditions. 

It occurs both under MS Windows XP Service Pack 2 and on a Linux cluster so I 
am pretty sure it is not platform specific.

My real question to the group is if there is not a work around in lsoda are 
there other ode solvers in R that will allow the constraint of solutions to the 
ODEs remain non-negative?

Best regards,
Jeremy
  

 Spencer Graves [EMAIL PROTECTED] 6/8/2007 9:51 AM 
On the 'lsoda' help page, I did not see any option to force some 
or all parameters to be nonnegative. 

  Have you considered replacing the parameters that must be 
nonnegative with their logarithms?  This effective moves the 0 lower 
limit to (-Inf) and seems to have worked well for me in the past.  
Often, it can even make the log likelihood or sum of squares surface 
more elliptical, which means that the standard normal approximation for 
the sampling distribution of parameter estimates will likely be more 
accurate. 

  Hope this helps. 
  Spencer Graves
p.s.  Your example seems not to be self contained.  If I could have 
easily copied it from your email and run it myself, I might have been 
able to offer more useful suggestions. 

Jeremy Goldhaber-Fiebert wrote:
 Hello,

 I am using odesolve to simulate a group of people moving through time and 
 transmitting infections to one another. 

 In Matlab, there is a NonNegative option which tells the Matlab solver to 
 keep the vector elements of the ODE solution non-negative at all times. What 
 is the right way to do this in R?

 Thanks,
 Jeremy

 P.S., Below is a simplified version of the code I use to try to do this, but 
 I am not sure that it is theoretically right 

 dynmodel - function(t,y,p) 
 { 
 ## Initialize parameter values

   birth - p$mybirth(t)
   death - p$mydeath(t)
   recover - p$myrecover
   beta - p$mybeta
   vaxeff - p$myvaxeff
   vaccinated - p$myvax(t)

   vax - vaxeff*vaccinated/100

 ## If the state currently has negative quantities (shouldn't have), then 
 reset to reasonable values for computing meaningful derivatives

   for (i in 1:length(y)) {
   if (y[i]0) {
   y[i] - 0
   }
   }

   S - y[1]
   I - y[2]
   R - y[3]
   N - y[4]

   shat - (birth*(1-vax)) - (death*S) - (beta*S*I/N)
   ihat - (beta*S*I/N) - (death*I) - (recover*I)
   rhat - (birth*(vax)) + (recover*I) - (death*R)

 ## Do we overshoot into negative space, if so shrink derivative to bring 
 state to 0 
 ## then rescale the components that take the derivative negative

   if (shat+S0) {
   shat_old - shat
   shat - -1*S
   scaled_transmission - (shat/shat_old)*(beta*S*I/N)
   ihat - scaled_transmission - (death*I) - (recover*I)
   
   }   
   if (ihat+I0) {
   ihat_old - ihat
   ihat - -1*I
   scaled_recovery - (ihat/ihat_old)*(recover*I)
   rhat - scaled_recovery +(birth*(vax)) - (death*R)
   
   }   
   if (rhat+R0) {
   rhat - -1*R
   }   

   nhat - shat + ihat + rhat

   if (nhat+N0) {
   nhat - -1*N
   }   

 ## return derivatives

   list(c(shat,ihat,rhat,nhat),c(0))

 }

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


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


Re: [R] design package

2007-06-11 Thread Uwe Ligges
Which version of R

For R-2.5.0, Design (with D, not d) does not pass the checks under 
Windows. Hence there is no Windows version for R-2.5.0 currently 
available on CRAN.


For older versions of R (down to R-1.7.x):
Please either use the Windows binary version, r.g. by typing
install.packages(Design)
of the package or compile from sources yourself. Look like you just 
uncompressed some source package without installing it.


Qin Qin wrote:
 Hi all:
 
 I tried to install design package for R used under the window. But it dose 
 not work.  Here is the message from R. 
 
 library(Design)
 Error in library(Design) : 'Design' is not a valid package -- installed  
 2.0.0?

The error message means R, not the package.


 I did not find 2.x version of Design package for window 95. I installed 
 one of two zip files available in the internet. 

Is the really Windows 95?


Uwe Ligges


 Please let me know what's wrong?
 
 Thanks,
 Qin
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] p-value from GEE why factor 2*pnorm?

2007-06-11 Thread Benilton Carvalho
Well, AFAIK, the definition of a p-value is the probability of  
observing something at least as extreme as the observed data.

If you observed z, and Z follows a std-normal

p-value = P( Z  -abs(z) ) + P( Z  abs(z) )
   = 2*P ( Z  abs(z) )
   = 2*pnorm(z, lower.tail=FALSE)

try z=0 (you should get 1) and z=1.96 (you should get 5%)

b

On Jun 11, 2007, at 11:34 AM, Carmen Meier wrote:

 Benilton Carvalho schrieb:
 the recommendation was to use lower.tail=FALSE.

 b

 O
 but then the results are significant and this does not match the
 observation.
 The results are matching the observations if the formula is

 pnorm(c 
 (1.8691945,0.5882351,2.4903091,1.9287802,2.3172983,2.2092593,2.2625959 
 ,1.6395695),
 lower.tail =TRUE)

 so I have any unknown problem  anywhere :-(

 REgards Carmen

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


[R] how to ignore error messages?

2007-06-11 Thread Jianping Jin
Dear group:

I wrote a code to iterate a non-linear fit with a set of data. The entire 
process didn't implemented to the end because an error message, singular 
gradient. I knew that some sub-sets (columns) do not fit my formula well 
and may result in parameters going to infinity. It is pretty hard to remove 
those sub sets before running the code since that will take a lot of time.

I added some logic assessments prior to running nonlinear fit. It helped 
but some exceptions still existed. I am wondering if there is any way in R 
by which I can continue to run the entire code to the end by ignoring the 
error message?

Greatly appreciate your help,

Jianping

##
Jianping Jin Ph.D.
Bioinformatics scientist
Center for Bioinformatics
Room 3133 Bioinformatics building
CB# 7104
University of Chapel Hill
Chapel Hill, NC 27599
Phone: (919)843-6105
FAX:   (919)843-3103
E-Mail: [EMAIL PROTECTED]

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


[R] history in R.app on Mac

2007-06-11 Thread Weiwei Shi
hi,

I am really confused by history function in R.app for Mac:

Here is some test from command-line:
 ls()
character(0)
 ls()
character(0)
 ls()
character(0)
 history()
ls()
ls()
ls()
history()

That is what I expected. But from R.app, it does not show anything.

   _
platform   i386-apple-darwin8.9.1
arch   i386
os darwin8.9.1
system i386, darwin8.9.1
status
major  2
minor  5.0
year   2007
month  04
day23
svn rev41293
language   R
version.string R version 2.5.0 (2007-04-23)

Thanks,



-- 
Weiwei Shi, Ph.D
Research Scientist
GeneGO, Inc.

Did you always know?
No, I did not. But I believed...
---Matrix III

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


Re: [R] Fwd: Using odesolve to produce non-negative solutions

2007-06-11 Thread Martin Henry H. Stevens
Hi Jeremy,
First, setting hmax to a small number could prevent a large step, if  
you think that is a problem. Second, however, I don't see how you can  
get a negative population size when using the log trick. I would  
think that that would prevent completely any negative values of N  
(i.e. e^-10  0). Can you explain? or do you want to a void that  
trick? The only other solver I know of is rk4 and it is not recommended.
Hank
On Jun 11, 2007, at 11:46 AM, Jeremy Goldhaber-Fiebert wrote:

 Hi Spencer,

 Thank you for your response. I also did not see anything on the  
 lsoda help page which is the reason that I wrote to the list.

 From your response, I am not sure if I asked my question clearly.

 I am modeling a group of people (in a variety of health states)  
 moving through time (and getting infected with an infectious  
 disease). This means that the count of the number of people in each  
 state should be positive at all times.

 What appears to happen is that lsoda asks for a derivative at a  
 given point in time t and then adjusts the state of the population.  
 However, perhaps due to numerical instability, it occasionally  
 lower the population count below 0 for one of the health states  
 (perhaps because it's step size is too big or something).

 I have tried both the logarithm trick and also changing the  
 relative and absolute tolerance inputs but I still get the problem  
 for certain combinations of parameters and initial conditions.

 It occurs both under MS Windows XP Service Pack 2 and on a Linux  
 cluster so I am pretty sure it is not platform specific.

 My real question to the group is if there is not a work around in  
 lsoda are there other ode solvers in R that will allow the  
 constraint of solutions to the ODEs remain non-negative?

 Best regards,
 Jeremy


 Spencer Graves [EMAIL PROTECTED] 6/8/2007 9:51 AM 
 On the 'lsoda' help page, I did not see any option to force some
 or all parameters to be nonnegative.

   Have you considered replacing the parameters that must be
 nonnegative with their logarithms?  This effective moves the 0 lower
 limit to (-Inf) and seems to have worked well for me in the past.
 Often, it can even make the log likelihood or sum of squares surface
 more elliptical, which means that the standard normal approximation  
 for
 the sampling distribution of parameter estimates will likely be more
 accurate.

   Hope this helps.
   Spencer Graves
 p.s.  Your example seems not to be self contained.  If I could have
 easily copied it from your email and run it myself, I might have been
 able to offer more useful suggestions.

 Jeremy Goldhaber-Fiebert wrote:
 Hello,

 I am using odesolve to simulate a group of people moving through  
 time and transmitting infections to one another.

 In Matlab, there is a NonNegative option which tells the Matlab  
 solver to keep the vector elements of the ODE solution non- 
 negative at all times. What is the right way to do this in R?

 Thanks,
 Jeremy

 P.S., Below is a simplified version of the code I use to try to do  
 this, but I am not sure that it is theoretically right

 dynmodel - function(t,y,p)
 {
 ## Initialize parameter values

  birth - p$mybirth(t)
  death - p$mydeath(t)
  recover - p$myrecover
  beta - p$mybeta
  vaxeff - p$myvaxeff
  vaccinated - p$myvax(t)

  vax - vaxeff*vaccinated/100

 ## If the state currently has negative quantities (shouldn't  
 have), then reset to reasonable values for computing meaningful  
 derivatives

  for (i in 1:length(y)) {
  if (y[i]0) {
  y[i] - 0
  }
  }

  S - y[1]
  I - y[2]
  R - y[3]
  N - y[4]

  shat - (birth*(1-vax)) - (death*S) - (beta*S*I/N)
  ihat - (beta*S*I/N) - (death*I) - (recover*I)
  rhat - (birth*(vax)) + (recover*I) - (death*R)

 ## Do we overshoot into negative space, if so shrink derivative to  
 bring state to 0
 ## then rescale the components that take the derivative negative

  if (shat+S0) {
  shat_old - shat
  shat - -1*S
  scaled_transmission - (shat/shat_old)*(beta*S*I/N)
  ihat - scaled_transmission - (death*I) - (recover*I)
  
  }   
  if (ihat+I0) {
  ihat_old - ihat
  ihat - -1*I
  scaled_recovery - (ihat/ihat_old)*(recover*I)
  rhat - scaled_recovery +(birth*(vax)) - (death*R)
  
  }   
  if (rhat+R0) {
  rhat - -1*R
  }   

  nhat - shat + ihat + rhat

  if (nhat+N0) {
  nhat - -1*N
  }   

 ## return derivatives

  list(c(shat,ihat,rhat,nhat),c(0))

 }

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

Re: [R] how to ignore error messages?

2007-06-11 Thread Xiaohui
see ?try

Jianping Jin wrote:
 Dear group:

 I wrote a code to iterate a non-linear fit with a set of data. The entire 
 process didn't implemented to the end because an error message, singular 
 gradient. I knew that some sub-sets (columns) do not fit my formula well 
 and may result in parameters going to infinity. It is pretty hard to remove 
 those sub sets before running the code since that will take a lot of time.

 I added some logic assessments prior to running nonlinear fit. It helped 
 but some exceptions still existed. I am wondering if there is any way in R 
 by which I can continue to run the entire code to the end by ignoring the 
 error message?

 Greatly appreciate your help,

 Jianping

 ##
 Jianping Jin Ph.D.
 Bioinformatics scientist
 Center for Bioinformatics
 Room 3133 Bioinformatics building
 CB# 7104
 University of Chapel Hill
 Chapel Hill, NC 27599
 Phone: (919)843-6105
 FAX:   (919)843-3103
 E-Mail: [EMAIL PROTECTED]

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



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


Re: [R] how to ignore error messages?

2007-06-11 Thread Dieter Menne
Jianping Jin jjin at email.unc.edu writes:
...
 I wrote a code to iterate a non-linear fit with a set of data. The entire 
 process didn't implemented to the end because an error message, singular 
 gradient. I knew that some sub-sets (columns) do not fit my formula well 
 and may result in parameters going to infinity. It is pretty hard to remove 
 those sub sets before running the code since that will take a lot of time.
 
 I added some logic assessments prior to running nonlinear fit. It helped 
 but some exceptions still existed. I am wondering if there is any way in R 
 by which I can continue to run the entire code to the end by ignoring the 
 error message?
...

?try

Or, even easier, use nlsList in nlme, which does exactly what you want, handling
convergence errors graciously.

Dieter

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


Re: [R] history in R.app on Mac

2007-06-11 Thread Rob J Goedman
If you click on the history icon in the toolbar in R.app you will see  
them. Or up and down arrows.
R.app implements some extra features, such as multiline command  
retrieval.

Through preference settings you can control if you want to see just a  
single ls() or multiple, etc.

Rob

On Jun 11, 2007, at 9:18 AM, Weiwei Shi wrote:

 hi,

 I am really confused by history function in R.app for Mac:

 Here is some test from command-line:
 ls()
 character(0)
 ls()
 character(0)
 ls()
 character(0)
 history()
 ls()
 ls()
 ls()
 history()

 That is what I expected. But from R.app, it does not show anything.

_
 platform   i386-apple-darwin8.9.1
 arch   i386
 os darwin8.9.1
 system i386, darwin8.9.1
 status
 major  2
 minor  5.0
 year   2007
 month  04
 day23
 svn rev41293
 language   R
 version.string R version 2.5.0 (2007-04-23)

 Thanks,



 -- 
 Weiwei Shi, Ph.D
 Research Scientist
 GeneGO, Inc.

 Did you always know?
 No, I did not. But I believed...
 ---Matrix III

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

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


Re: [R] Fwd: Using odesolve to produce non-negative solutions

2007-06-11 Thread Spencer Graves
in line

Martin Henry H. Stevens wrote:
 Hi Jeremy,
 First, setting hmax to a small number could prevent a large step, if 
 you think that is a problem. Second, however, I don't see how you can 
 get a negative population size when using the log trick. 
SG:  Can lsoda estimate complex or imaginary parameters? 

 I would think that that would prevent completely any negative values 
 of N (i.e. e^-10  0). Can you explain? or do you want to a void 
 that trick? The only other solver I know of is rk4 and it is not 
 recommended.
 Hank
 On Jun 11, 2007, at 11:46 AM, Jeremy Goldhaber-Fiebert wrote:

 Hi Spencer,

 Thank you for your response. I also did not see anything on the lsoda 
 help page which is the reason that I wrote to the list.

 From your response, I am not sure if I asked my question clearly.

 I am modeling a group of people (in a variety of health states) 
 moving through time (and getting infected with an infectious 
 disease). This means that the count of the number of people in each 
 state should be positive at all times.

 What appears to happen is that lsoda asks for a derivative at a given 
 point in time t and then adjusts the state of the population. 
 However, perhaps due to numerical instability, it occasionally lower 
 the population count below 0 for one of the health states (perhaps 
 because it's step size is too big or something).

 I have tried both the logarithm trick
snip

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


Re: [R] Fwd: Using odesolve to produce non-negative solutions

2007-06-11 Thread Martin Henry H. Stevens
Hi Spencer,
I have copied Woody Setzer. I have no idea whether lsoda can estimate  
parameters that could take imaginary values.
Hank
On Jun 11, 2007, at 12:52 PM, Spencer Graves wrote:

 in line

 Martin Henry H. Stevens wrote:
 Hi Jeremy,
 First, setting hmax to a small number could prevent a large step, if
 you think that is a problem. Second, however, I don't see how you can
 get a negative population size when using the log trick.
 SG:  Can lsoda estimate complex or imaginary parameters?
Hmm. I have no idea.

 I would think that that would prevent completely any negative values
 of N (i.e. e^-10  0). Can you explain? or do you want to a void
 that trick? The only other solver I know of is rk4 and it is not
 recommended.
 Hank
 On Jun 11, 2007, at 11:46 AM, Jeremy Goldhaber-Fiebert wrote:

 Hi Spencer,

 Thank you for your response. I also did not see anything on the  
 lsoda
 help page which is the reason that I wrote to the list.

 From your response, I am not sure if I asked my question clearly.

 I am modeling a group of people (in a variety of health states)
 moving through time (and getting infected with an infectious
 disease). This means that the count of the number of people in each
 state should be positive at all times.

 What appears to happen is that lsoda asks for a derivative at a  
 given
 point in time t and then adjusts the state of the population.
 However, perhaps due to numerical instability, it occasionally lower
 the population count below 0 for one of the health states (perhaps
 because it's step size is too big or something).

 I have tried both the logarithm trick
 snip

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



Dr. Hank 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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] history in R.app on Mac

2007-06-11 Thread Weiwei Shi
got it. Thanks. I was always trying to find it at menu and did not
expect that in my toolbar :)

I just assumed that any tool icon should also be shown on menu, which
is just a routine to me.

-w

On 6/11/07, Rob J Goedman [EMAIL PROTECTED] wrote:
 If you click on the history icon in the toolbar in R.app you will see
 them. Or up and down arrows.
 R.app implements some extra features, such as multiline command
 retrieval.

 Through preference settings you can control if you want to see just a
 single ls() or multiple, etc.

 Rob

 On Jun 11, 2007, at 9:18 AM, Weiwei Shi wrote:

  hi,
 
  I am really confused by history function in R.app for Mac:
 
  Here is some test from command-line:
  ls()
  character(0)
  ls()
  character(0)
  ls()
  character(0)
  history()
  ls()
  ls()
  ls()
  history()
 
  That is what I expected. But from R.app, it does not show anything.
 
 _
  platform   i386-apple-darwin8.9.1
  arch   i386
  os darwin8.9.1
  system i386, darwin8.9.1
  status
  major  2
  minor  5.0
  year   2007
  month  04
  day23
  svn rev41293
  language   R
  version.string R version 2.5.0 (2007-04-23)
 
  Thanks,
 
 
 
  --
  Weiwei Shi, Ph.D
  Research Scientist
  GeneGO, Inc.
 
  Did you always know?
  No, I did not. But I believed...
  ---Matrix III
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-
  guide.html
  and provide commented, minimal, self-contained, reproducible code.




-- 
Weiwei Shi, Ph.D
Research Scientist
GeneGO, Inc.

Did you always know?
No, I did not. But I believed...
---Matrix III

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


[R] Problem with RSVGTipsDevice

2007-06-11 Thread mister_bluesman

Hi there.

I am still trying to get the RSVGTipsDevice to work, yet I can not.

I have copied the first example from RSVGTipsDevice documentation:

library(RSVGTipsDevice)
devSVGTips(C:\\svgplot1.svg, toolTipMode=1,
title=SVG example plot 1: shapes and points, tooltips are title + 1 line)
plot(c(0,10),c(0,10), type=n, xlab=x, ylab=y,
main=Example SVG plot with title + 1 line tips (mode=1))
setSVGShapeToolTip(title=A rectangle, desc=that is yellow)
rect(1,1,4,6, col='yellow')
setSVGShapeToolTip(title=1st circle with title only)
points(5.5,7.5,cex=20,pch=19,col='red')
setSVGShapeToolTip(title=A triangle, desc=big and green)
polygon(c(3,6,8), c(3,6,3), col='green')
# no tooltips on these points
points(2:8, 8:2, cex=3, pch=19, col='black')
# tooltips on each these points
invisible(sapply(1:7, function(x)
{setSVGShapeToolTip(title=paste(point, x))
points(x+1, 8-x, cex=3, pch=1, col='black')}))
dev.off()

This results in the following output:

http://www.nabble.com/file/p11064573/svgplot1.svg svgplot1.svg 

It opens but when I try and hover over the triangle, for example, I do not
get a topptip box appear. I have tried opening the file though firefox, and
XP IE - and on more than one computer yet it does not work. Do I need to
install something else as well?

Many thanks
-- 
View this message in context: 
http://www.nabble.com/Problem-with-RSVGTipsDevice-tf3902760.html#a11064573
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Weighted least squares

2007-06-11 Thread Tim Hesterberg
As John noted, there are different kinds of weights, and 
different terminology:
* inverse-variance weights (accuracy weights)
* case weights (frequencies, counts)
* sampling weights (selection probability weights)

I'll add:
* inverse-variance weights, where var(y for observation) = 1/weight
  (as opposed to just being inversely proportional to the weight)
* weights used as part of an algorithm (e.g. for robust estimation,
  or glm's using iteratively-reweighted least-squares).

For linear regression, the type of weights don't affect regression
coefficient calculation, but do affect inferences such as standard errors
for the regression coefficients, degrees of freedom for variance
estimates, etc.  

lm() inferences assume the first type.  
Other formulae are appropriate for inferences for types 2-4.
Combinations of types 1-4 require other formulae; this gets nontrivial.
For the 5th type, inferences need to be handled by the algorithm that
is using weighted linear regression.

Tim Hesterberg

John Fox wrote:
I think that the problem is that the term weights has different meanings,
which, although they are related, are not quite the same. 

The weights used by lm() are (inverse-)variance weights, reflecting the
variances of the errors, with observations that have low-variance errors
therefore being accorded greater weight in the resulting WLS regression.
What you have are sometimes called case weights, and I'm unaware of a
general way of handling them in R, although you could regenerate the
unaggregated data. As you discovered, you get the same coefficients with
case weights as with variance weights, but different standard errors.
Finally, there are sampling weights, which are inversely proportional to
the probability of selection; these are accommodated by the survey package. 

To complicate matters, this terminology isn't entirely standard.

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


Re: [R] Fwd: Using odesolve to produce non-negative solutions

2007-06-11 Thread Ravi Varadhan
Spencer,

Lsoda does not estimate any parameters (nlmeODE does parameter
estimation).  It just computes the solution trajectory, at discrete times,
of a dynamical systems (i.e. set of differential equations).  It only works
with real numbers, as far as I know.


Ravi.


---

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: [EMAIL PROTECTED]

Webpage:  http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html

 





-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Spencer Graves
Sent: Monday, June 11, 2007 12:53 PM
To: Martin Henry H. Stevens
Cc: Jeremy Goldhaber-Fiebert; r-help@stat.math.ethz.ch
Subject: Re: [R] Fwd: Using odesolve to produce non-negative solutions

in line

Martin Henry H. Stevens wrote:
 Hi Jeremy,
 First, setting hmax to a small number could prevent a large step, if 
 you think that is a problem. Second, however, I don't see how you can 
 get a negative population size when using the log trick. 
SG:  Can lsoda estimate complex or imaginary parameters? 

 I would think that that would prevent completely any negative values 
 of N (i.e. e^-10  0). Can you explain? or do you want to a void 
 that trick? The only other solver I know of is rk4 and it is not 
 recommended.
 Hank
 On Jun 11, 2007, at 11:46 AM, Jeremy Goldhaber-Fiebert wrote:

 Hi Spencer,

 Thank you for your response. I also did not see anything on the lsoda 
 help page which is the reason that I wrote to the list.

 From your response, I am not sure if I asked my question clearly.

 I am modeling a group of people (in a variety of health states) 
 moving through time (and getting infected with an infectious 
 disease). This means that the count of the number of people in each 
 state should be positive at all times.

 What appears to happen is that lsoda asks for a derivative at a given 
 point in time t and then adjusts the state of the population. 
 However, perhaps due to numerical instability, it occasionally lower 
 the population count below 0 for one of the health states (perhaps 
 because it's step size is too big or something).

 I have tried both the logarithm trick
snip

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

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


Re: [R] Problem with RSVGTipsDevice

2007-06-11 Thread Mark Difford

Hi Mister_Bluesman,

Sorry to sadden you further, but your example svg works perfectly on my
machine (R 2.5 running on Vista).  All the ToolTips display.  Perhaps it's
your browser [setup]: I'm using Opera 9.20 (Build 8771).

HTH,

Mark Difford.


mister_bluesman wrote:
 
 Hi there.
 
 I am still trying to get the RSVGTipsDevice to work, yet I can not.
 
 I have copied the first example from RSVGTipsDevice documentation:
 
 library(RSVGTipsDevice)
 devSVGTips(C:\\svgplot1.svg, toolTipMode=1,
 title=SVG example plot 1: shapes and points, tooltips are title + 1
 line)
 plot(c(0,10),c(0,10), type=n, xlab=x, ylab=y,
 main=Example SVG plot with title + 1 line tips (mode=1))
 setSVGShapeToolTip(title=A rectangle, desc=that is yellow)
 rect(1,1,4,6, col='yellow')
 setSVGShapeToolTip(title=1st circle with title only)
 points(5.5,7.5,cex=20,pch=19,col='red')
 setSVGShapeToolTip(title=A triangle, desc=big and green)
 polygon(c(3,6,8), c(3,6,3), col='green')
 # no tooltips on these points
 points(2:8, 8:2, cex=3, pch=19, col='black')
 # tooltips on each these points
 invisible(sapply(1:7, function(x)
 {setSVGShapeToolTip(title=paste(point, x))
 points(x+1, 8-x, cex=3, pch=1, col='black')}))
 dev.off()
 
 This results in the following output:
 
  http://www.nabble.com/file/p11064573/svgplot1.svg svgplot1.svg 
 
 It opens but when I try and hover over the triangle, for example, I do not
 get a topptip box appear. I have tried opening the file though firefox,
 and XP IE - and on more than one computer yet it does not work. Do I need
 to install something else as well?
 
 Many thanks
 

-- 
View this message in context: 
http://www.nabble.com/Problem-with-RSVGTipsDevice-tf3902760.html#a11065021
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Problem with RSVGTipsDevice

2007-06-11 Thread Mark Difford

Mister_Bluesman,

Perhaps I should have been more precise: your included svgplot1.svg displays
fine...!


mister_bluesman wrote:
 
 Hi there.
 
 I am still trying to get the RSVGTipsDevice to work, yet I can not.
 
 I have copied the first example from RSVGTipsDevice documentation:
 
 library(RSVGTipsDevice)
 devSVGTips(C:\\svgplot1.svg, toolTipMode=1,
 title=SVG example plot 1: shapes and points, tooltips are title + 1
 line)
 plot(c(0,10),c(0,10), type=n, xlab=x, ylab=y,
 main=Example SVG plot with title + 1 line tips (mode=1))
 setSVGShapeToolTip(title=A rectangle, desc=that is yellow)
 rect(1,1,4,6, col='yellow')
 setSVGShapeToolTip(title=1st circle with title only)
 points(5.5,7.5,cex=20,pch=19,col='red')
 setSVGShapeToolTip(title=A triangle, desc=big and green)
 polygon(c(3,6,8), c(3,6,3), col='green')
 # no tooltips on these points
 points(2:8, 8:2, cex=3, pch=19, col='black')
 # tooltips on each these points
 invisible(sapply(1:7, function(x)
 {setSVGShapeToolTip(title=paste(point, x))
 points(x+1, 8-x, cex=3, pch=1, col='black')}))
 dev.off()
 
 This results in the following output:
 
  http://www.nabble.com/file/p11064573/svgplot1.svg svgplot1.svg 
 
 It opens but when I try and hover over the triangle, for example, I do not
 get a topptip box appear. I have tried opening the file though firefox,
 and XP IE - and on more than one computer yet it does not work. Do I need
 to install something else as well?
 
 Many thanks
 

-- 
View this message in context: 
http://www.nabble.com/Problem-with-RSVGTipsDevice-tf3902760.html#a11065061
Sent from the R help mailing list archive at Nabble.com.

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


[R] debugger library. Error?

2007-06-11 Thread Jose Quesada
Hi, running the following example code (taken from the docs) will prodice
an error in my system (R 2.5.0, win):
library(debug)
mtrace(glm) # turns tracing on
names( tracees) # glm
check.for.tracees( package:base) # glm
glm(stupid.args) # voila le debugger
 Error in all.levs[[j]] : subscript out of bounds

It happens with any function, I just posted one form the example.

Thanks,
-J
-- 
Jose Quesada, PhD.
http://www.andrew.cmu.edu/~jquesada

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


Re: [R] Fwd: Using odesolve to produce non-negative solutions

2007-06-11 Thread Ravi Varadhan
Hi Jeremy,

A smaller step size may or may not help.  If the issue is simply truncation
error, that is the error involved in discretizing the differential
equations, then a smaller step size would help.  If, however, the true
solution to the differential equation is negative, for some t, then the
numerical solution should also be negative.  If the negative solution does
not make sense, then the system of equation needs to be examined to see when
and why negative solutions arise.  Perhaps, I am just making this up - there
needs to be a dampening function that slows down the trajectory as it
approaches zero from its initial value. It is also possible that only
certain regions of the parameter space (note that initial conditions are
also parameters) are allowed in the sense that only there the solution is
feasible for all t.  So, in your example, the parameters might not be
realistic.  In short, if you are sure that the numerical solution is
accurate, then you need to go back to your system of equations and analyze
them carefully.  


Ravi.



---

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: [EMAIL PROTECTED]

Webpage:  http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html

 





-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jeremy
Goldhaber-Fiebert
Sent: Monday, June 11, 2007 11:47 AM
To: Spencer Graves
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Fwd: Using odesolve to produce non-negative solutions

Hi Spencer,

Thank you for your response. I also did not see anything on the lsoda help
page which is the reason that I wrote to the list.

From your response, I am not sure if I asked my question clearly.

I am modeling a group of people (in a variety of health states) moving
through time (and getting infected with an infectious disease). This means
that the count of the number of people in each state should be positive at
all times. 

What appears to happen is that lsoda asks for a derivative at a given point
in time t and then adjusts the state of the population. However, perhaps due
to numerical instability, it occasionally lower the population count below 0
for one of the health states (perhaps because it's step size is too big or
something). 

I have tried both the logarithm trick and also changing the relative and
absolute tolerance inputs but I still get the problem for certain
combinations of parameters and initial conditions. 

It occurs both under MS Windows XP Service Pack 2 and on a Linux cluster so
I am pretty sure it is not platform specific.

My real question to the group is if there is not a work around in lsoda are
there other ode solvers in R that will allow the constraint of solutions to
the ODEs remain non-negative?

Best regards,
Jeremy
  

 Spencer Graves [EMAIL PROTECTED] 6/8/2007 9:51 AM 
On the 'lsoda' help page, I did not see any option to force some 
or all parameters to be nonnegative. 

  Have you considered replacing the parameters that must be 
nonnegative with their logarithms?  This effective moves the 0 lower 
limit to (-Inf) and seems to have worked well for me in the past.  
Often, it can even make the log likelihood or sum of squares surface 
more elliptical, which means that the standard normal approximation for 
the sampling distribution of parameter estimates will likely be more 
accurate. 

  Hope this helps. 
  Spencer Graves
p.s.  Your example seems not to be self contained.  If I could have 
easily copied it from your email and run it myself, I might have been 
able to offer more useful suggestions. 

Jeremy Goldhaber-Fiebert wrote:
 Hello,

 I am using odesolve to simulate a group of people moving through time and
transmitting infections to one another. 

 In Matlab, there is a NonNegative option which tells the Matlab solver to
keep the vector elements of the ODE solution non-negative at all times. What
is the right way to do this in R?

 Thanks,
 Jeremy

 P.S., Below is a simplified version of the code I use to try to do this,
but I am not sure that it is theoretically right 

 dynmodel - function(t,y,p) 
 { 
 ## Initialize parameter values

   birth - p$mybirth(t)
   death - p$mydeath(t)
   recover - p$myrecover
   beta - p$mybeta
   vaxeff - p$myvaxeff
   vaccinated - p$myvax(t)

   vax - vaxeff*vaccinated/100

 ## If the state currently has negative quantities (shouldn't have), then
reset to reasonable values for computing meaningful derivatives

   for (i in 1:length(y)) {
   if (y[i]0) {
   y[i] - 0
   }
   }

   S - y[1]
   I - y[2]
   R - y[3]
   N - y[4]

   shat - 

Re: [R] Fwd: Using odesolve to produce non-negative solutions

2007-06-11 Thread Jeremy Goldhaber-Fiebert
Hi Ravi,

Thanks for your response. I tried this in Berkeley Madonna and in Matlab. In 
Berkeley Madonna I did not have the problem (RK4 solver). In Matlab (ode45 
solver), I had the problem if I did not use their NonNegative option. My 
thought was that NonNegative uses something like an additional piece of logic 
in modifying step size (maybe something like: if stepsize * derivative + 
current condition is negative, then reduce step size), but I don't know.

My original application was to generate ode output for a variety of unknown 
parameters, comparing the output to observed data and thereby using a 
likelihood-based approach to identify unknown parameter combinations that are 
most consistent with observed data given the uncertainty. First, I wanted to 
get a sense of how the model performed over a range of parameters that seem 
plausible based on literature review. I had originally thought to do this in 
Matlab and built a little proof of concept searching program, but given that R 
is free and has many other great packages for doing optimization and 
statistical analysis (and is easy to setup which is great for cluster computing 
situations), I thought it would be better to do it in R. When I did this, I got 
negative values and hence sent to the list.

Once again, thanks for your help. Not sure if this clarification email will 
generate other suggestions or thoughts.

Best,
Jeremy

 Ravi Varadhan [EMAIL PROTECTED] 6/11/2007 2:11 PM 
Hi Jeremy,

A smaller step size may or may not help.  If the issue is simply truncation
error, that is the error involved in discretizing the differential
equations, then a smaller step size would help.  If, however, the true
solution to the differential equation is negative, for some t, then the
numerical solution should also be negative.  If the negative solution does
not make sense, then the system of equation needs to be examined to see when
and why negative solutions arise.  Perhaps, I am just making this up - there
needs to be a dampening function that slows down the trajectory as it
approaches zero from its initial value. It is also possible that only
certain regions of the parameter space (note that initial conditions are
also parameters) are allowed in the sense that only there the solution is
feasible for all t.  So, in your example, the parameters might not be
realistic.  In short, if you are sure that the numerical solution is
accurate, then you need to go back to your system of equations and analyze
them carefully.  


Ravi.



---

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: [EMAIL PROTECTED] 

Webpage:  http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html 

 





-Original Message-
From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of Jeremy
Goldhaber-Fiebert
Sent: Monday, June 11, 2007 11:47 AM
To: Spencer Graves
Cc: r-help@stat.math.ethz.ch 
Subject: Re: [R] Fwd: Using odesolve to produce non-negative solutions

Hi Spencer,

Thank you for your response. I also did not see anything on the lsoda help
page which is the reason that I wrote to the list.

From your response, I am not sure if I asked my question clearly.

I am modeling a group of people (in a variety of health states) moving
through time (and getting infected with an infectious disease). This means
that the count of the number of people in each state should be positive at
all times. 

What appears to happen is that lsoda asks for a derivative at a given point
in time t and then adjusts the state of the population. However, perhaps due
to numerical instability, it occasionally lower the population count below 0
for one of the health states (perhaps because it's step size is too big or
something). 

I have tried both the logarithm trick and also changing the relative and
absolute tolerance inputs but I still get the problem for certain
combinations of parameters and initial conditions. 

It occurs both under MS Windows XP Service Pack 2 and on a Linux cluster so
I am pretty sure it is not platform specific.

My real question to the group is if there is not a work around in lsoda are
there other ode solvers in R that will allow the constraint of solutions to
the ODEs remain non-negative?

Best regards,
Jeremy
  

 Spencer Graves [EMAIL PROTECTED] 6/8/2007 9:51 AM 
On the 'lsoda' help page, I did not see any option to force some 
or all parameters to be nonnegative. 

  Have you considered replacing the parameters that must be 
nonnegative with their logarithms?  This effective moves the 0 lower 
limit to (-Inf) and seems to have worked well for me in the past.  
Often, it can even make the log likelihood or sum of squares surface 
more 

Re: [R] Problem with RSVGTipsDevice

2007-06-11 Thread mister_bluesman

Ah. Now that's intersting. It works in Opera. But do you get an annoying
'Null' label by the cursor when you place it over the svg file? 

MANY thanks





Mark Difford wrote:
 
 Mister_Bluesman,
 
 Perhaps I should have been more precise: your included svgplot1.svg
 displays fine...!
 
 
 mister_bluesman wrote:
 
 Hi there.
 
 I am still trying to get the RSVGTipsDevice to work, yet I can not.
 
 I have copied the first example from RSVGTipsDevice documentation:
 
 library(RSVGTipsDevice)
 devSVGTips(C:\\svgplot1.svg, toolTipMode=1,
 title=SVG example plot 1: shapes and points, tooltips are title + 1
 line)
 plot(c(0,10),c(0,10), type=n, xlab=x, ylab=y,
 main=Example SVG plot with title + 1 line tips (mode=1))
 setSVGShapeToolTip(title=A rectangle, desc=that is yellow)
 rect(1,1,4,6, col='yellow')
 setSVGShapeToolTip(title=1st circle with title only)
 points(5.5,7.5,cex=20,pch=19,col='red')
 setSVGShapeToolTip(title=A triangle, desc=big and green)
 polygon(c(3,6,8), c(3,6,3), col='green')
 # no tooltips on these points
 points(2:8, 8:2, cex=3, pch=19, col='black')
 # tooltips on each these points
 invisible(sapply(1:7, function(x)
 {setSVGShapeToolTip(title=paste(point, x))
 points(x+1, 8-x, cex=3, pch=1, col='black')}))
 dev.off()
 
 This results in the following output:
 
  http://www.nabble.com/file/p11064573/svgplot1.svg svgplot1.svg 
 
 It opens but when I try and hover over the triangle, for example, I do
 not get a topptip box appear. I have tried opening the file though
 firefox, and XP IE - and on more than one computer yet it does not work.
 Do I need to install something else as well?
 
 Many thanks
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Problem-with-RSVGTipsDevice-tf3902760.html#a11065835
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Fwd: Using odesolve to produce non-negative solutions

2007-06-11 Thread Setzer . Woodrow
By the way, if someone could forward the original question to me (I'm
subscribed to but not currently receiving R-help, as I found I was
spending too much time reading it!) I might think of something more
useful. (alternatively, when was it posted; I can find it on gmane,
too).

Woody
R. Woodrow Setzer, Ph. D.
National Center for Computational Toxicology
US Environmental Protection Agency
Mail Drop B205-01/US EPA/RTP, NC 27711
Ph: (919) 541-0128Fax: (919) 541-1194



 Martin Henry H.   
 Stevens   
 [EMAIL PROTECTED]To 
 .eduSpencer Graves
  [EMAIL PROTECTED]  
 06/11/2007 01:02cc 
 PM   Jeremy Goldhaber-Fiebert  
  [EMAIL PROTECTED],  
  R-Help
  r-help@stat.math.ethz.ch,   
  Woodrow Setzer/RTP/USEPA/[EMAIL 
PROTECTED]   
Subject 
  Re: [R] Fwd: Using odesolve to
  produce non-negative solutions










Hi Spencer,
I have copied Woody Setzer. I have no idea whether lsoda can estimate
parameters that could take imaginary values.
Hank
On Jun 11, 2007, at 12:52 PM, Spencer Graves wrote:

 in line

 Martin Henry H. Stevens wrote:
 Hi Jeremy,
 First, setting hmax to a small number could prevent a large step, if
 you think that is a problem. Second, however, I don't see how you can
 get a negative population size when using the log trick.
 SG:  Can lsoda estimate complex or imaginary parameters?
Hmm. I have no idea.

 I would think that that would prevent completely any negative values
 of N (i.e. e^-10  0). Can you explain? or do you want to a void
 that trick? The only other solver I know of is rk4 and it is not
 recommended.
 Hank
 On Jun 11, 2007, at 11:46 AM, Jeremy Goldhaber-Fiebert wrote:

 Hi Spencer,

 Thank you for your response. I also did not see anything on the
 lsoda
 help page which is the reason that I wrote to the list.

 From your response, I am not sure if I asked my question clearly.

 I am modeling a group of people (in a variety of health states)
 moving through time (and getting infected with an infectious
 disease). This means that the count of the number of people in each
 state should be positive at all times.

 What appears to happen is that lsoda asks for a derivative at a
 given
 point in time t and then adjusts the state of the population.
 However, perhaps due to numerical instability, it occasionally lower
 the population count below 0 for one of the health states (perhaps
 because it's step size is too big or something).

 I have tried both the logarithm trick
 snip

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



Dr. Hank 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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Fwd: Using odesolve to produce non-negative solutions

2007-06-11 Thread Setzer . Woodrow
Hi, all.
lsoda can certainly not handle complex parameters.  You can try (as Hank
suggested) limiting hmax.  You can also crank up relative and absolute
precision by specifying smaller values of  rtol and atol.  I've seen
similar problems in which the state variable becomes negative, with very
small absolute value, when theoretically, the system has a non-negative
solution.  This is certainly due to imprecision in the numerical
solution.  Have you tried including an analytic jacobian?  That could
improve the numeric properties of the solution.

Woody

R. Woodrow Setzer, Ph. D.
National Center for Computational Toxicology
US Environmental Protection Agency
Mail Drop B205-01/US EPA/RTP, NC 27711
Ph: (919) 541-0128Fax: (919) 541-1194



 Martin Henry H.   
 Stevens   
 [EMAIL PROTECTED]To 
 .eduSpencer Graves
  [EMAIL PROTECTED]  
 06/11/2007 01:02cc 
 PM   Jeremy Goldhaber-Fiebert  
  [EMAIL PROTECTED],  
  R-Help
  r-help@stat.math.ethz.ch,   
  Woodrow Setzer/RTP/USEPA/[EMAIL 
PROTECTED]   
Subject 
  Re: [R] Fwd: Using odesolve to
  produce non-negative solutions










Hi Spencer,
I have copied Woody Setzer. I have no idea whether lsoda can estimate
parameters that could take imaginary values.
Hank
On Jun 11, 2007, at 12:52 PM, Spencer Graves wrote:

 in line

 Martin Henry H. Stevens wrote:
 Hi Jeremy,
 First, setting hmax to a small number could prevent a large step, if
 you think that is a problem. Second, however, I don't see how you can
 get a negative population size when using the log trick.
 SG:  Can lsoda estimate complex or imaginary parameters?
Hmm. I have no idea.

 I would think that that would prevent completely any negative values
 of N (i.e. e^-10  0). Can you explain? or do you want to a void
 that trick? The only other solver I know of is rk4 and it is not
 recommended.
 Hank
 On Jun 11, 2007, at 11:46 AM, Jeremy Goldhaber-Fiebert wrote:

 Hi Spencer,

 Thank you for your response. I also did not see anything on the
 lsoda
 help page which is the reason that I wrote to the list.

 From your response, I am not sure if I asked my question clearly.

 I am modeling a group of people (in a variety of health states)
 moving through time (and getting infected with an infectious
 disease). This means that the count of the number of people in each
 state should be positive at all times.

 What appears to happen is that lsoda asks for a derivative at a
 given
 point in time t and then adjusts the state of the population.
 However, perhaps due to numerical instability, it occasionally lower
 the population count below 0 for one of the health states (perhaps
 because it's step size is too big or something).

 I have tried both the logarithm trick
 snip

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



Dr. Hank 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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Problem with RSVGTipsDevice

2007-06-11 Thread Mark Difford

Hi Mister_Bluesman,

Sadly it is; and it stays up (in what's probably a bold, sans serif),
lurking behind the ToolTip, when that comes up.

This is not my area of X, but any standard txt editor will open an svg file. 
If you search through your file you will find lots and lots of null
arguments to various functions.  It's likely that the problem lies there.

HTH,

Mark Difford.


mister_bluesman wrote:
 
 Ah. Now that's intersting. It works in Opera. But do you get an annoying
 'Null' label by the cursor when you place it over the svg file?
 
 MANY thanks
 

-- 
View this message in context: 
http://www.nabble.com/Problem-with-RSVGTipsDevice-tf3902760.html#a11066065
Sent from the R help mailing list archive at Nabble.com.

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


[R] R vs. Splus in Pharma/Devices Industry

2007-06-11 Thread Cody_Hamilton

Following up to some extent on Friday's discussion regarding the
'validation' of R, could I ask the list group's opinion on possible
advantages of R over Splus from a pharma/devices perspective?  I wish to
exclude the obvious price difference, which doesn’t seem to carry as much
weight as I would have thought.  Besides, I have noticed many former Splus
users gravitating towards R, and I suspect that the reasons are not purely
economic.

I can think of a few advantages of Splus:
1. SeqTrial (of course that means more $)
2. Tech support
3. The warm fuzzies that management seems to get from proprietary software

I can also think of a few advantages of R:
1. Based on my personal experiences, simulations requiring a lot of looping
seem to run faster.
2. R interfaces with BUGS, for example through BRUGS.
3. The wonderful help list!

As always, I am speaking for myself and not necessarily for Edwards
Lifesciences.

Regards,
   -Cody

Cody Hamilton, PhD
Edwards Lifesciences
[[alternative HTML version deleted]]

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


[R] Reading old S-plus dmp files

2007-06-11 Thread francogrex

I'm sorry that this question has been asked before but I ask it again because
in the archives I didn't see a solution. It's an old S-plus dmp file for a
hierarchical bayes linear model program written by DuMouchel and available
publicly and freely at:
ftp://ftp.research.att.com/dist/bayes-meta/hblm.dmp 
Only problem is that it cannot be read in R, even using the functions of the
library foreign to read dmp files. Does anyone know a workaround, maybe
hints about what parts of the file need to be modified so that it can be
read. I have read the documentations of the program, it seems a very
interesting program, it's a shame that I can't read it. Thanks.

-- 
View this message in context: 
http://www.nabble.com/Reading-old-S-plus-dmp-files-tf3903236.html#a11066203
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] R vs. Splus in Pharma/Devices Industry

2007-06-11 Thread Frank E Harrell Jr
[EMAIL PROTECTED] wrote:
 Following up to some extent on Friday's discussion regarding the
 'validation' of R, could I ask the list group's opinion on possible
 advantages of R over Splus from a pharma/devices perspective?  I wish to
 exclude the obvious price difference, which doesn’t seem to carry as much
 weight as I would have thought.  Besides, I have noticed many former Splus
 users gravitating towards R, and I suspect that the reasons are not purely
 economic.
 
 I can think of a few advantages of Splus:
 1. SeqTrial (of course that means more $)
 2. Tech support
 3. The warm fuzzies that management seems to get from proprietary software
 
 I can also think of a few advantages of R:
 1. Based on my personal experiences, simulations requiring a lot of looping
 seem to run faster.
 2. R interfaces with BUGS, for example through BRUGS.
 3. The wonderful help list!
 
 As always, I am speaking for myself and not necessarily for Edwards
 Lifesciences.
 
 Regards,
-Cody
 
 Cody Hamilton, PhD
 Edwards Lifesciences
   [[alternative HTML version deleted]]

A big one for us is plotmath (for clinical trial reports we put a lot of 
greek letters and subscripts on plots), and later we will consider 
migrating a lot of our stuff to the ggplot package which I don't think 
is available in S-Plus.  Lexical scoping is another advantage of R as is 
the ability to reference files on the internet.

Frank

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


-- 
Frank E Harrell Jr   Professor and Chair   School of Medicine
  Department of Biostatistics   Vanderbilt University

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


Re: [R] Fwd: Using odesolve to produce non-negative solutions

2007-06-11 Thread Ravi Varadhan
Hi Jeremy,

A smaller step size may or may not help.  If the issue is simply truncation
error, that is the error involved in discretizing the differential
equations, then a smaller step size would help.  If, however, the true
solution to the differential equation is negative, for some t, then the
numerical solution should also be negative.  If the negative solution does
not make sense, then the system of equation needs to be examined to see when
and why negative solutions arise.  Perhaps, I am just making this up - there
needs to be a barrier function that slows down the trajectory as it
approaches zero from its initial value. It is also possible that only
certain regions of the parameter space are allowed in the sense that only
there the solution is feasible for all t.  So, in your example, the
parameters might not be realistic.  In short, if you are sure that the
numerical solution is accurate, then you need to go back to your system of
equations and analyze them carefully.


Ravi.



---

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: [EMAIL PROTECTED]

Webpage:  http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html

 





-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Martin Henry H.
Stevens
Sent: Monday, June 11, 2007 1:03 PM
To: Spencer Graves
Cc: Jeremy Goldhaber-Fiebert; R-Help; [EMAIL PROTECTED]
Subject: Re: [R] Fwd: Using odesolve to produce non-negative solutions

Hi Spencer,
I have copied Woody Setzer. I have no idea whether lsoda can estimate  
parameters that could take imaginary values.
Hank
On Jun 11, 2007, at 12:52 PM, Spencer Graves wrote:

 in line

 Martin Henry H. Stevens wrote:
 Hi Jeremy,
 First, setting hmax to a small number could prevent a large step, if
 you think that is a problem. Second, however, I don't see how you can
 get a negative population size when using the log trick.
 SG:  Can lsoda estimate complex or imaginary parameters?
Hmm. I have no idea.

 I would think that that would prevent completely any negative values
 of N (i.e. e^-10  0). Can you explain? or do you want to a void
 that trick? The only other solver I know of is rk4 and it is not
 recommended.
 Hank
 On Jun 11, 2007, at 11:46 AM, Jeremy Goldhaber-Fiebert wrote:

 Hi Spencer,

 Thank you for your response. I also did not see anything on the  
 lsoda
 help page which is the reason that I wrote to the list.

 From your response, I am not sure if I asked my question clearly.

 I am modeling a group of people (in a variety of health states)
 moving through time (and getting infected with an infectious
 disease). This means that the count of the number of people in each
 state should be positive at all times.

 What appears to happen is that lsoda asks for a derivative at a  
 given
 point in time t and then adjusts the state of the population.
 However, perhaps due to numerical instability, it occasionally lower
 the population count below 0 for one of the health states (perhaps
 because it's step size is too big or something).

 I have tried both the logarithm trick
 snip

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



Dr. Hank 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
and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] Problem with RSVGTipsDevice

2007-06-11 Thread mister_bluesman

Ah. Now that's intersting. It works in Opera. But do you get an annoying
'Null' label by the cursor when you place it over the svg file?

MANY thanks
-- 
View this message in context: 
http://www.nabble.com/Problem-with-RSVGTipsDevice-tf3902760.html#a11065042
Sent from the R help mailing list archive at Nabble.com.

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


[R] Can I access the filename of the active editor window?

2007-06-11 Thread Paul Johnson
When I run a script from an open editor window (using Ctrl-A, Ctrl-R), I
would like the filename of the script to be automatically written into the
program output, to keep up with frequent version changes. Is there a way to
access the filename (+ path) of the open script (the active one, if there is
more than one editor window open)? 

 

I'm using R 2.4.1 on Windows XP.

 

Paul


[[alternative HTML version deleted]]

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


[R] Rearranging Capture History Data in R

2007-06-11 Thread cox
What code can i use to convert a table like this:

Tag#Date
1   1
2   1
3   1
4   1
2   2
4   2
1   3
2   3
4   4

Into one like this:

Tag 1 2 3 4 #Date header
1   1 0 0 1
2   1 1 1 0
3   1 0 0 0
4   1 1 0 1

Thanks,


Ben Cox
Research Assistant (M.S.)
Montana Cooperative Fishery Research Unit
301 Lewis Hall
Montana State University
Bozeman, MT 59717
(406)994-6643

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


[R] A Question about R

2007-06-11 Thread jwang
Hi Sir/Madam,

I'm a researcher in university of Guelph, Canada and now considering  
using R to do some data analysis. I'm wondering whether there is a  
library available in R that includes algorithms for archetypal  
analysis? This is a method quite similar to principal components  
analysis that is designed to find archetypes or pure types from  
multidimensional data.

Any help from you is greatly appreciated.

Thanks
Juan

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


Re: [R] Lines in dotchart dotplot ?

2007-06-11 Thread Deepayan Sarkar
On 6/11/07, John Kane [EMAIL PROTECTED] wrote:

 --- [EMAIL PROTECTED] wrote:

  On 6/9/07, John Kane [EMAIL PROTECTED] wrote:
   Is it possible to use dotchart or dotplot and set
  the
   lines in such a way that they only extend from the
   left y-axis to the data point?
 
  Yes (sort of) in dotplot at least. E.g.,
 
  dotplot(VADeaths, groups = FALSE, type = c(p,
  h))
  dotplot(VADeaths, groups = FALSE, type = c(p,
  h), origin = 0)
 
  -Deepayan
 

 Ah, that is quite nice, not exactly what I remember
 from Cleveland but it should do quite nicely.

You can do that too if you really want to:

dotplot(VADeaths, groups = FALSE, type = c(p, h), origin = 0,
panel = panel.xyplot, pch = 16, lty = 3, col = black)

-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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Fwd: Using odesolve to produce non-negative solutions

2007-06-11 Thread Ravi Varadhan
Jeremy,

You should examine the steady-state solution to your system of equations, by
setting the time-derivatives to zero and then solving/analyzing the
resulting algebraic equations.  This should give you some insights.  

Let us say you have 3 groups, A,B, and C, with initial conditions:
N_A(t=0) = N_{A0}, N_B(t=0) = N_{B0}, and N_C(t=0) = N_{C0}, and that people
transition in and out of these 3 states (one of the states could even be
absorbing, e.g. death), but it is true for any time t that N_A(t) + N_B(t) +
N_C(t) = N_{A0} + N_{B0} + N_{C0}.  Furthermore, you have 3 diff-equations
that describe the rate of change of N_A, N_B, and N_C, for t  0.  If it
happens that one of the N's, say N_A, becomes negative, you could set it
equal to zero.  But then you have to figure out how to re-adjust N_B and N_C
so that they add up to the initial total count.  After re-adjustment, you
also have to think about whether the resulting system of equations are
valid, when there are no A people.

Ravi. 



---

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: [EMAIL PROTECTED]

Webpage:  http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html

 





-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jeremy
Goldhaber-Fiebert
Sent: Monday, June 11, 2007 11:47 AM
To: Spencer Graves
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Fwd: Using odesolve to produce non-negative solutions

Hi Spencer,

Thank you for your response. I also did not see anything on the lsoda help
page which is the reason that I wrote to the list.

From your response, I am not sure if I asked my question clearly.

I am modeling a group of people (in a variety of health states) moving
through time (and getting infected with an infectious disease). This means
that the count of the number of people in each state should be positive at
all times. 

What appears to happen is that lsoda asks for a derivative at a given point
in time t and then adjusts the state of the population. However, perhaps due
to numerical instability, it occasionally lower the population count below 0
for one of the health states (perhaps because it's step size is too big or
something). 

I have tried both the logarithm trick and also changing the relative and
absolute tolerance inputs but I still get the problem for certain
combinations of parameters and initial conditions. 

It occurs both under MS Windows XP Service Pack 2 and on a Linux cluster so
I am pretty sure it is not platform specific.

My real question to the group is if there is not a work around in lsoda are
there other ode solvers in R that will allow the constraint of solutions to
the ODEs remain non-negative?

Best regards,
Jeremy
  

 Spencer Graves [EMAIL PROTECTED] 6/8/2007 9:51 AM 
On the 'lsoda' help page, I did not see any option to force some 
or all parameters to be nonnegative. 

  Have you considered replacing the parameters that must be 
nonnegative with their logarithms?  This effective moves the 0 lower 
limit to (-Inf) and seems to have worked well for me in the past.  
Often, it can even make the log likelihood or sum of squares surface 
more elliptical, which means that the standard normal approximation for 
the sampling distribution of parameter estimates will likely be more 
accurate. 

  Hope this helps. 
  Spencer Graves
p.s.  Your example seems not to be self contained.  If I could have 
easily copied it from your email and run it myself, I might have been 
able to offer more useful suggestions. 

Jeremy Goldhaber-Fiebert wrote:
 Hello,

 I am using odesolve to simulate a group of people moving through time and
transmitting infections to one another. 

 In Matlab, there is a NonNegative option which tells the Matlab solver to
keep the vector elements of the ODE solution non-negative at all times. What
is the right way to do this in R?

 Thanks,
 Jeremy

 P.S., Below is a simplified version of the code I use to try to do this,
but I am not sure that it is theoretically right 

 dynmodel - function(t,y,p) 
 { 
 ## Initialize parameter values

   birth - p$mybirth(t)
   death - p$mydeath(t)
   recover - p$myrecover
   beta - p$mybeta
   vaxeff - p$myvaxeff
   vaccinated - p$myvax(t)

   vax - vaxeff*vaccinated/100

 ## If the state currently has negative quantities (shouldn't have), then
reset to reasonable values for computing meaningful derivatives

   for (i in 1:length(y)) {
   if (y[i]0) {
   y[i] - 0
   }
   }

   S - y[1]
   I - y[2]
   R - y[3]
   N - y[4]

   shat - (birth*(1-vax)) - (death*S) - (beta*S*I/N)
   ihat - 

Re: [R] Rearranging Capture History Data in R

2007-06-11 Thread Benilton Carvalho
date = c(1, 1, 1, 1, 2, 2, 3, 3, 4)
tag = c(1, 2, 3, 4, 2, 4, 1, 2, 4)
table(factor(tag, levels=1:4), factor(date, levels=1:4))

(not sure how you got Tag 1/Date 4 = 1)


On Jun 11, 2007, at 3:11 PM, [EMAIL PROTECTED] wrote:

 What code can i use to convert a table like this:

 Tag#Date
 1   1
 2   1
 3   1
 4   1
 2   2
 4   2
 1   3
 2   3
 4   4

 Into one like this:

 Tag 1 2 3 4 #Date header
 1   1 0 0 1
 2   1 1 1 0
 3   1 0 0 0
 4   1 1 0 1

 Thanks,


 Ben Cox
 Research Assistant (M.S.)
 Montana Cooperative Fishery Research Unit
 301 Lewis Hall
 Montana State University
 Bozeman, MT 59717
 (406)994-6643

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

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


Re: [R] simultaneous computing

2007-06-11 Thread Ramon Diaz-Uriarte
Dear Markus,

You might want to check Rmpi, papply, snow, rpvm, and nws.

Best,

R.

On 6/11/07, Markus Schmidberger [EMAIL PROTECTED] wrote:
 Hello,

 which possibilities are available in R for simultaneous or parallel
 computing?
 I only could find biopara
 (http://cran.r-project.org/src/contrib/Descriptions/biopara.html)

 Are there other possibilities?
 Are there special groups working on simultaneous computing with R?

 Thanks
 Markus

 --
 Dipl.-Tech. Math. Markus Schmidberger

 Ludwig-Maximilians-Universität München
 IBE - Institut für medizinische Informationsverarbeitung,
 Biometrie und Epidemiologie

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



-- 
Ramon Diaz-Uriarte
Statistical Computing Team
Structural Biology and Biocomputing Programme
Spanish National Cancer Centre (CNIO)
http://ligarto.org/rdiaz

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


[R] selecting characters from a line of text

2007-06-11 Thread Tim Holland
Is there a way in R to select certain characters from a line of text?  I
have some data that is presently in a large number of text files, and I
would like to be able to select elements of each text file (elements are
always on the same line, in the same position) and organize them into a
table.  Is there a tool to select text in this way in R?  What I am looking
for would be somewhat similar to the left() and right() functions in Excel.
I have looked at the parse() and scan() functions, but don't think they can
do what I want (although I could be wrong).
Thank you,
Tim

[[alternative HTML version deleted]]

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


[R] ylim settings

2007-06-11 Thread Judith Flores
Hi,

I need to know what is the plus/minus adjustment
(proportion) that ylim applies if I have something
like this:

ylim=range(c(x,z))

   meaning what's the x-(proportion) and the z+
(proportion)?


Thank you,

Judith


  

Luggage? GPS? Comic books?

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


[R] Package update announcements

2007-06-11 Thread Martin Henry H. Stevens
Hi Folks,
I was wondering what everyone thought about adding a sentence to each  
package update announcement that described what the package did. R  
extensions are so numerous that it is difficult to keep up with them.  
Would it be appropriate to ask package developers to add a brief  
sentence about what the package does, when they announce updates?

I would benefit from such descriptions.

Cheers,
Hank

Dr. Hank 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
and provide commented, minimal, self-contained, reproducible code.


[R] Overlaying lattice graphs

2007-06-11 Thread Seb
Hello

I apologize in advance if this question has already be posted on the 
list, although I could not find a relevant thread in the archives.

I would like to overlay xyplots using different datasets for each plot. 
I typically work on the following data.frame (mydata) structure

mydata
DrugTimeObserved  Predicted
1   A0.05 10 10.2
2   A0.10 20 19.5
etc...
100 B0.05 11 12.7
101 B0.10 35 36
etc...

I want to plot the observed data as points and the predicted values as 
lines. If I use the following commands, I don't have the possibility to 
switch the y values from Observed for the scatterplot to Predicted for 
the line.

xyplot(Observed ~ Time | Drug, data = mydata, panel  =  function(x,y, ...){
+panel.xyplot(x,y,...)
+panel.xyplot(x,y,type=l,...)})

I wonder if this problem can be solved using the trellis.focus family 
commands but I have a hard time to understand how they work.

Please, let me know if a thread have already addressed this question. 
Otherwise, I would grateful for any hint, comments or info you can provide.

Thanks

Sebastien

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


Re: [R] ylim settings

2007-06-11 Thread Marc Schwartz
On Mon, 2007-06-11 at 13:57 -0700, Judith Flores wrote:
 Hi,
 
 I need to know what is the plus/minus adjustment
 (proportion) that ylim applies if I have something
 like this:
 
 ylim=range(c(x,z))
 
meaning what's the x-(proportion) and the z+
 (proportion)?
 
 
 Thank you,
 
 Judith

If I am correctly understanding your query, the answer is +/- 4% of the
range of values for the concatenated vectors, as you have it expressed
above, _IF_ par(yaxs) is set to the default value of 'r'.

If you set par(yaxs = i), then the y axis range is set to the min and
max values of the concatenated vectors.

See ?par for more information, specifically 'xaxs'.

HTH,

Marc Schwartz

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


Re: [R] Overlaying lattice graphs

2007-06-11 Thread Deepayan Sarkar
On 6/11/07, Seb [EMAIL PROTECTED] wrote:
 Hello

 I apologize in advance if this question has already be posted on the
 list, although I could not find a relevant thread in the archives.

 I would like to overlay xyplots using different datasets for each plot.
 I typically work on the following data.frame (mydata) structure

 mydata
 DrugTimeObserved  Predicted
 1   A0.05 10 10.2
 2   A0.10 20 19.5
 etc...
 100 B0.05 11 12.7
 101 B0.10 35 36
 etc...

 I want to plot the observed data as points and the predicted values as
 lines. If I use the following commands, I don't have the possibility to
 switch the y values from Observed for the scatterplot to Predicted for
 the line.

 xyplot(Observed ~ Time | Drug, data = mydata, panel  =  function(x,y, ...){
 +panel.xyplot(x,y,...)
 +panel.xyplot(x,y,type=l,...)})

 I wonder if this problem can be solved using the trellis.focus family
 commands but I have a hard time to understand how they work.

 Please, let me know if a thread have already addressed this question.
 Otherwise, I would grateful for any hint, comments or info you can provide.

There are several possible solutions. In your case, the simplest one
would be something like (see ?panel.superpose for explanation):

xyplot(Observed + Predicted ~ Time | Drug, data = mydata,
   type = c(p, l), distribute.type = TRUE)

This will work best if the Time values are ordered; otherwise you could use

type = c(p, a)

instead, which will be a little slower. Let us know if this doesn't
give you what you want, preferably with a reproducible example
illustrating why.

-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
and provide commented, minimal, self-contained, reproducible code.


[R] Rgobbi and colours question

2007-06-11 Thread mister_bluesman

Hi

I am using R to implement a multidimensional algorithm which maps places
based on the distances between each other. This is presented really well in
Rggobi. 

However, for each place plotted, I have another numerical statistic between
0 and 1 which I would like to represent by colouring the points in Rgobbi.
However I do not know how to do this.
 
The file I am using is called places.txt and has the following contents:

Chelt Exeter   London  Birm
Chelt   0   118 96  50
Exeter  118 0   118 163
London  96  118 0   118
Birm50  163 118 0

To plot these, the R code is as follows:

library(rggobi)
Places-read.table(C:\\places.txt)
Places.location - cmdscale(Places, k=2)
round(Places.location,0) 
g-ggobi(Places.location)

 
Now, for each point plotted I want to assign a colour to it based on the
statistic in a file called PlacesStats.txt which currently has the following
format:

0.1  0.3  0.4  0.5

With the values in order of the names of the places given above so that:

0.1 is assigned to Chelt
0.3 is assigned to Exeter
0.4 is assigned to London
0.7 is assigned to Birm

Ideally, I want a gradient of two colours so that say, 0 = blue and 1 = red
and values between are a mixture.

Any ideas on how I could do this? Would I need to change the PlacesStats.txt
file so that is reads:

Chelt 0.1
Exeter 0.3
London 0.4
Birm 0.7

for example?

I would be very grateful if anybody could help.

Many thanks
-- 
View this message in context: 
http://www.nabble.com/Rgobbi-and-colours-question-tf3904622.html#a11070461
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] selecting characters from a line of text

2007-06-11 Thread Stephen Tucker
Maybe substring() is what you're looking for? Some examples:

 substring(textstring,1,5)
[1] texts
 substring(textstring,3)
[1] xtstring
 substring(textstring,3,nchar(textstring))
[1] xtstring


--- Tim Holland [EMAIL PROTECTED] wrote:

 Is there a way in R to select certain characters from a line of text?  I
 have some data that is presently in a large number of text files, and I
 would like to be able to select elements of each text file (elements are
 always on the same line, in the same position) and organize them into a
 table.  Is there a tool to select text in this way in R?  What I am looking
 for would be somewhat similar to the left() and right() functions in Excel.
 I have looked at the parse() and scan() functions, but don't think they can
 do what I want (although I could be wrong).
 Thank you,
 Tim
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


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


[R] barplot and map overlay

2007-06-11 Thread Héctor Villalobos
Hi,

I wonder if it is possible with the graphics package to overlay one or several 
plots
(barplots, for example) over a map. Data for the map is in a data frame with the
latitude and longitude coordinates, and then:

 plot(map$long, map$lat, type =l)

produces the map. I want to put each barplot in specific locations on the map, 
namely
at the center of statistical squares.

I´ve seen an example in Paul Murrell´s R Graphics book that seems appropriate
(grid package), but a bit complicated.

Thanks a lot for any advice.

Héctor

--
Héctor Villalobos [EMAIL PROTECTED]
 CICIMAR - IPN
 A.P. 592. Col. Centro
 La Paz, Baja California Sur, MÉXICO. 23000
 Tels. (+52 612) 122 53 44; 123 46 58; 123 47 34  ext. 2425
 Fax.  (+52 612) 122 53 22


[[alternative HTML version deleted]]

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


[R] Components in the control list of optim()

2007-06-11 Thread Daniel Young
Because the function optim() does not return the
values of the components in the 'control' list, I am
seeking help to uncover the blackbox for some of these
components:

parscale: par/parscale is used for ndeps, but how does
optim() set parscale at the first place?
abstol: no default information given in the help file,
so what is it?
reltol: this one is clear in the help file, but if
both abstol and reltol are used as default, which one
does optim() take as the higher stopping criterion?

Two other related questions:
First, ndeps is used for the finite-difference
approximation, but is this forward, backward, or
central difference?
Second, if I minimize a function through optim (say,
BFGS), does abstol/reltol use the function value or
the estimated parameter values to assess convergence?

Many thanks,

Daniel


   

Pinpoint customers who are looking for what you sell.

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


Re: [R] Unable to load RMySQL

2007-06-11 Thread Joe W. Byers
All,

I have been down for the past two weeks moving from Tulsa to Houston for 
a new job.  I just got internet access yesterday at our new home.  I 
will be working on the RMySQL binary later this week if possible.  There 
is a hitch in compiling the binary.  I have the binaries for an older 
version of MySQL on which the R compilation worked.  A newer version of 
MySQL 5.0.37, I never was able to get the R binaries to compile.

I appreciate your patience here because I have a new job and my family 
and I are trying to organize our new home right now.

Thank you
Joe


Henric Nilsson (Public) wrote:
 Den Ti, 2007-02-13, 11:43 skrev Ravi S. Shankar:
 Hi R users,



 I am unable to load RMySQL. The zip file is not available which I guess
 is needed to load this pakage.
 
 Please read http://cran.r-project.org/bin/windows/contrib/2.4/ReadMe to
 find out why.
 
 I also tried extracting the package from RMySQL_0.5-11.tar.gz  and then
 pasted the package in the directory where R is loaded for which I am
 getting the following error message

 Error in library(RMySQL) : 'RMySQL' is not a valid package -- installed
  2.0.0?
 
 Did you really expect that to work?
 
 Any help would be welcome
 
 Joe Byers (http://bus.cba.utulsa.edu/byersj/Research.asp) kindly provides
 a Windows binary of RMySQL.
 
 
 HTH,
 Henric
 
 
 


 Thank you,



 Ravi




  [[alternative HTML version deleted]]

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


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


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


Re: [R] Textpad help

2007-06-11 Thread Mary Royerr
Thx for the response John and Jim.

I had heard before that textpad is a good editor for R codes and one can run
the R code from textpad itself and once we do that, the output is displayed
on the textpad itself. The reason I wanted to use textpad is to make use of
the syntax highlighting a la SAS.

So I installed textpad and according to the instructions given in
http://www.data-for-all.com/blog/?p=68  .  everything worked out fine until
I ran the following test code:


*setwd('C:/Temp/SampleR')
#
N-250
x-1:N
y-0.53*x +rnorm(x, 0.42*N, 0.14*N)
model1-lm(y~x)
print(summary(model1)) *

Once I submitted the R code using the SUBMIT R FILE in TOOLS from the
toolbar menu the following message displayed.


The filename, directory name, or volume label syntax is incorrect.

Tool completed with exit code 1



Now even If I run a simple code like *a-10;a* still the same message is
displayed.



I am kind of sure it is nothing wrong with the code but something is wrong
with the way the textpad installation. Any help? I am not a techie person.

Thx for your help

On 6/11/07, Mary Royerr [EMAIL PROTECTED] wrote:

 I have installed textpad and tried running R code. But it gives me the
 following error message.



 The filename, directory name, or volume label syntax is incorrect.

 Tool completed with exit code 1


 Can you provide any help? I am not a technical person. So the help in
 detail will be appreciated.
 Thx


[[alternative HTML version deleted]]

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


[R] question about data availale in .RData file using the biobase package

2007-06-11 Thread ramakanth reddy
Hi all

I am analyzing micro array data and I have R workspace images as my source of 
the data(.Rdata format).That was in the biobase package format,so I used some 
commands from the bio base package manual and could write the data into excel 
files.

The data I am working on is the cancer data.

I could get microarray information and recurrence information by using commands 
like

x-pData(oncogene)

y-exprs(oncogene)

I think the survival information should also be in the .RData file.How can i 
know what all information is available in the give file.

Please let me know any commands that show what type of information is available 
in the given file from a bio base package.


Thank You

rama kanth




  Download prohibited? No problem! To chat from any browser without 
download, Click Here: http://in.messenger.yahoo.com/webmessengerpromo.php

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


Re: [R] Textpad help

2007-06-11 Thread jim holtman
I use TextPad for editting but have not tried to use it to submit code.  I
use tinn-r which does the highlighting of the syntax and does submit to R
without any problems.

I will take a look at the link and see what happening when I try to use
TextPad for submission.


On 6/11/07, Mary Royerr [EMAIL PROTECTED] wrote:

 Thx for the response John and Jim.

 I had heard before that textpad is a good editor for R codes and one can
 run
 the R code from textpad itself and once we do that, the output is
 displayed
 on the textpad itself. The reason I wanted to use textpad is to make use
 of
 the syntax highlighting a la SAS.

 So I installed textpad and according to the instructions given in
 http://www.data-for-all.com/blog/?p=68  .  everything worked out fine
 until
 I ran the following test code:


 *setwd('C:/Temp/SampleR')
 #
 N-250
 x-1:N
 y-0.53*x +rnorm(x, 0.42*N, 0.14*N)
 model1-lm(y~x)
 print(summary(model1)) *

 Once I submitted the R code using the SUBMIT R FILE in TOOLS from the
 toolbar menu the following message displayed.


 The filename, directory name, or volume label syntax is incorrect.

 Tool completed with exit code 1



 Now even If I run a simple code like *a-10;a* still the same message is
 displayed.



 I am kind of sure it is nothing wrong with the code but something is wrong
 with the way the textpad installation. Any help? I am not a techie person.

 Thx for your help

 On 6/11/07, Mary Royerr [EMAIL PROTECTED] wrote:
 
  I have installed textpad and tried running R code. But it gives me the
  following error message.
 
 
 
  The filename, directory name, or volume label syntax is incorrect.
 
  Tool completed with exit code 1
 
 
  Can you provide any help? I am not a technical person. So the help in
  detail will be appreciated.
  Thx
 

[[alternative HTML version deleted]]

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




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

[[alternative HTML version deleted]]

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


Re: [R] Textpad help

2007-06-11 Thread jim holtman
I looked at the link and it would never work for me since with TextPad it
starts a new session with each submission.  With tinn-R it just sends it to
the current GUI session which makes debugging much easier since if an error
occurs you have the GUI to see exactly what was sent.  I would strongly
suggest that you use tinn-r since the TextPad way does not allow incremental
development.  Many of my scripts run for minutes to get to the point where I
want to test out some new code.  So I am not even going to try it since if
something does error out, you have no way of seeing what else in the
environment might be causing the problem.



On 6/11/07, Mary Royerr [EMAIL PROTECTED] wrote:

 Thx for the response John and Jim.

 I had heard before that textpad is a good editor for R codes and one can
 run
 the R code from textpad itself and once we do that, the output is
 displayed
 on the textpad itself. The reason I wanted to use textpad is to make use
 of
 the syntax highlighting a la SAS.

 So I installed textpad and according to the instructions given in
 http://www.data-for-all.com/blog/?p=68  .  everything worked out fine
 until
 I ran the following test code:


 *setwd('C:/Temp/SampleR')
 #
 N-250
 x-1:N
 y-0.53*x +rnorm(x, 0.42*N, 0.14*N)
 model1-lm(y~x)
 print(summary(model1)) *

 Once I submitted the R code using the SUBMIT R FILE in TOOLS from the
 toolbar menu the following message displayed.


 The filename, directory name, or volume label syntax is incorrect.

 Tool completed with exit code 1



 Now even If I run a simple code like *a-10;a* still the same message is
 displayed.



 I am kind of sure it is nothing wrong with the code but something is wrong
 with the way the textpad installation. Any help? I am not a techie person.

 Thx for your help

 On 6/11/07, Mary Royerr [EMAIL PROTECTED] wrote:
 
  I have installed textpad and tried running R code. But it gives me the
  following error message.
 
 
 
  The filename, directory name, or volume label syntax is incorrect.
 
  Tool completed with exit code 1
 
 
  Can you provide any help? I am not a technical person. So the help in
  detail will be appreciated.
  Thx
 

[[alternative HTML version deleted]]

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




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

[[alternative HTML version deleted]]

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


Re: [R] Rounding?

2007-06-11 Thread Prof Brian Ripley
On Mon, 11 Jun 2007, jim holtman wrote:

 your number 6.6501 is to large to fit in a floating point
 number.  It takes 56 bits and there are only 54 in a real number so the
 system see it as 6.65 and does the rounding to an even digit; 6.6

I'll take it you mean a IEC60559 double, which has 53 bits in its implied 
mantissa (it stores 52 and for normalized numbers the leading bit is 1 
and not stored).

 6.651 does fit into a real number (takes 54 bits) and this will
 now round to 6.7

All you can say quickly is that its representation is greater than 
6.65:

 6.651 - 6.65
[1] 8.881784e-16

But I don't think that is the explanation.  Remember that you are using 
binary arithmetic, so each of these numbers is stored with representation 
error.  As the exact number stored is not '6.65', round-to-even does not 
strictly apply.

I get

 formatC(6.65,format=f,digits=1)
[1] 6.7
 print(6.65, digits=2)
[1] 6.7
 print(66.5, digits=1) # round to even really does apply
[1] 66
 print(67.5, digits=1)
[1] 68

on (several of) my non-Windows systems, so I think this is a Windows 
quirk.  Remember the parsing and printing software has also to run in 
binary on a limited-precision machine, and it does tend to be less 
accurate on Windows than on other ix86 OSes.  (Windows software also tends 
not to implement round-to-even rules.)


 On 6/11/07, BXC (Bendix Carstensen) [EMAIL PROTECTED] wrote:

 I was a bit puzzed by:

 formatC(6.65,format=f,digits=1)
 [1] 6.6

 So I experimented and found:

 formatC(6.6501,format=f,digits=1)
 [1] 6.6
 formatC(6.651,format=f,digits=1)
 [1] 6.7
   round(6.6501,1)
 [1] 6.7
   round(6.651,1)
 [1] 6.7
 version
   _
 platform   i386-pc-mingw32
 arch   i386
 os mingw32
 system i386, mingw32
 status
 major  2
 minor  5.0
 year   2007
 month  04
 day23
 svn rev41293
 language   R
 version.string R version 2.5.0 (2007-04-23)

 My machine runs Windows NT.

 Is this intended or just a Windows facility?
 __

 Bendix Carstensen
 Senior Statistician

 Steno Diabetes Center
 Niels Steensens Vej 2-4
 DK-2820 Gentofte
 Denmark
 +45 44 43 87 38 (direct)
 +45 30 75 87 38 (mobile)
 +45 44 43 73 13 (fax)
 [EMAIL PROTECTED]   http://www.biostat.ku.dk/~bxc

 This e-mail (including any attachments) is intended for the ...{{dropped}}

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






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

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