[R] Fitting Pattern-Mixture Models

2007-09-05 Thread Abdus Sattar
Dear R-user:
 
Do you know any R package that could be use for fitting a Pattern-Mixture 
models (PMM) please? I would appreciate if you could suggest me a R package for 
fitting PMM. 
 
Thank you very much, 
 
Sincerely, 
 
Sattar


   

Got a little couch potato? 
Check out fun summer activities for kids.

idscs=bz 
[[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] Embedding Audio Files in Interactive Graphs

2007-09-05 Thread Paul Murrell
Hi


Michael Lawrence wrote:
 On 9/4/07, Sam Ferguson [EMAIL PROTECTED]  wrote:
 Thanks for your reply Bruno.

 No - as I said, I know how to do that - the movie15 and the
 multimedia package are basically the same, and it is relatively
 straightforward to get an audio file into a pdf with them. However,
 real interactivity is not easily achieved in latex IMO (as it's not
 its purpose). At least I'm hoping for a bit more flexibility.

 R seems like a better place to do interactivity, and with the field
 of information visualisation pointing out that interactivity is a
 very useful element for investigation of data it seems that clicking
 around graphical displays may become more and more popular in time.
 In my field I'm interested in audio data, and so simple interactive
 visual and auditory displays would be great. A (very useful) start
 would be 5 separate waveform plots that would play their appropriate
 sounds when clicked. More complex figures could plot in a 2d space
 and allow selection of data points or ranges perhaps.

 I love R for graphics and for Sweave though, and would like to use it
 if possible - ideally it would be to produce a figure that included
 the appropriate audiofiles and interactive scripts, which could then
 be incorporated into a latex document \includegraphics. However, from
 the deafening silence on this list it seems like I may be attempting
 to push a square block through a round hole unfortunately. Seems I am
 back to Matlab and handle graphics - but it won't do this properly
 either.
 
 
 Lots of things can be embedded into PDF documents, like javascript, flash
 and svg. Maybe it would be feasible to use the gridSVG package to output
 some graphics as svg with javascript to play the sounds and embed that into
 a pdf?


The short answer is that R cannot do this sort of thing and is unlikely 
to be able to do it anytime soon.

The basic problem is that core R graphics has no concept of animation, 
audio, hyperlinks, etc AND there is no way to access these features on 
devices that do have these concepts (e.g., PDF).  It would be nice to 
change that, but it is a large redesign problem that is not anywhere 
near the top of anyone's todo list (to my knowledge).

As Michael mentioned, the gridSVG package allows you to draw using the 
grid package and access some of the fancier SVG features (including 
embedding scripts).  It has its own problems of course, but may be worth 
trying.

Paul


 Cheers
 Sam


 On 03/09/2007, at 5:39 PM, Bruno C.. wrote:

 Are you asking on how to include an  audio file into a pdf?
 This is already feasible via latex and the movie 15 package ;)

 Ciao

 Hi R-ers,

 I'm wondering if anyone has investigated a method for embedding audio
 files in R graphs (pdf format), and allowing their playback to be
 triggered interactively (by clicking on a graph element for
 instance).

 I know how to do this in latex pdfs with the multimedia package, but
 it seems that R would provide a more appropriate platform for many
 reasons.

 Thanks for any help you can provide.
 Sam Ferguson
 Faculty of Architecture, Design and Planning
 The University of Sydney

 __
 R-help@stat.math.ethz.ch 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.


 --
 Leggi GRATIS le tue mail con il telefonino i-mode™ di Wind
 http://i-mode.wind.it/

 --
 Sam Ferguson
 Faculty of Architecture
 The University of Sydney
 [EMAIL PROTECTED]
 +61 2 93515910
 0410 719535

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

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


-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
[EMAIL PROTECTED]
http://www.stat.auckland.ac.nz/~paul/

__
R-help@stat.math.ethz.ch 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] [Lattice] Incrase the height of strips in Trellis plots

2007-09-05 Thread Frede Aakmann Tøgersen
This should give you something close to what you want:


xyplot(Petal.Length ~ Petal.Width | Species, iris,
   strip = strip.custom(par.strip.text = list(cex = 2)),
   par.settings = list(layout.heights=list(strip=1.45)))

The par.settings argument alters locally the default par settings of lattice 
plots, see e.g. ?trellis.par.get and the ?xyplot about the par.settings 
argument.

A closer inspection (try using strip = 2 or numbers less than 1.45 in stead of 
strip = 1.45) of the figure reveals that there are some problems with vertical 
alignment of the strip text, i.e. not centered. 

To remedy this I think that you have to use you own strip function. You may be 
able to build you own function by altering the default strip function, see 
?lattice.options and try lattice.options() at the command prompt. However this 
may be more difficult than it seems at first. Perhaps some one more familiar 
with the lattice package can solve this.
 

Best regards

Frede Aakmann Tøgersen
Scientist


UNIVERSITY OF AARHUS
Faculty of Agricultural Sciences
Dept. of Genetics and Biotechnology
Blichers Allé 20, P.O. BOX 50
DK-8830 Tjele

Phone:   +45 8999 1900
Direct:  +45 8999 1878

E-mail:  [EMAIL PROTECTED]
Web:   http://www.agrsci.org

This email may contain information that is confidential.
Any use or publication of this email without written permission from Faculty of 
Agricultural Sciences is not allowed.
If you are not the intended recipient, please notify Faculty of Agricultural 
Sciences immediately and delete this email.


 

 -Oprindelig meddelelse-
 Fra: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] På vegne af Bernd Weiss
 Sendt: 5. september 2007 06:48
 Til: r-help@stat.math.ethz.ch
 Emne: [R] [Lattice] Incrase the height of strips in Trellis plots
 
 Dear all,
 
 I wonder how to increase the height of strips via 
 strip.default or strip.custom. The following example 
 hopefully illustrates the difficulty I am facing:
 
 library(lattice)
 xyplot(Petal.Length ~ Petal.Width | Species, iris,
 strip = strip.custom(par.strip.text = list(cex = 2)))
 
 Thanks for any advice,
 
 Bernd
 
 
  version
_
 platform   i386-pc-mingw32
 arch   i386
 os mingw32
 system i386, mingw32
 status
 major  2
 minor  5.1
 year   2007
 month  06
 day27
 svn rev42083
 language   R
 version.string R version 2.5.1 (2007-06-27)
 
 __
 R-help@stat.math.ethz.ch 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] How to extract part of an array?

2007-09-05 Thread Lauri Nikkinen
Hi,

How can I extract part of an array? I would like to extract table
Supported from this array. If this is not possible, how do I convert
array to list? I'm sorry this is not an reproducible example.

 spl - tapply(temp$var1, list(temp$var2, temp$var3, temp$var3), mean)
 spl
, , Supported

   07   08
A68.38710 71.48387
B21.67742 20.83871
C55.74194 61.12903
AL L 26.19816 27.39631

, , Not_supported

 07   08
ANA 82.38710
BNA 24.0
CNA 68.77419
ALL  NA 29.97984

-Lauri

__
R-help@stat.math.ethz.ch 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] capture.out(system())?

2007-09-05 Thread Gustaf Rydevik
On 9/4/07, Werner Wernersen [EMAIL PROTECTED] wrote:
 Hi,

 I am trying to capture the console output of program I
 call via system() but that always returns only
 character(0).

 For example:
 capture.output(system(pdflatex out.tex) )

 will yield:
 character(0)

 and the output still written to the R console.

 Is there a command for intercepting this output?

 Thank you!
   Werner


?sink()


-- 
Gustaf Rydevik, M.Sci.
tel: +46(0)703 051 451
address:Essingetorget 40,112 66 Stockholm, SE
skype:gustaf_rydevik

__
R-help@stat.math.ethz.ch 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] [Lattice] Incrase the height of strips in Trellis plots

2007-09-05 Thread Bernd Weiss
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Frede Aakmann Tøgersen schrieb:
 This should give you something close to what you want:
 
 
 xyplot(Petal.Length ~ Petal.Width | Species, iris,
strip = strip.custom(par.strip.text = list(cex = 2)),
par.settings = list(layout.heights=list(strip=1.45)))
 
 The par.settings argument alters locally the default par settings of lattice 
 plots, see e.g. ?trellis.par.get and the ?xyplot about the par.settings 
 argument.
 
 A closer inspection (try using strip = 2 or numbers less than 1.45 in stead 
 of strip = 1.45) of the figure reveals that there are some problems with 
 vertical alignment of the strip text, i.e. not centered. 
 
 To remedy this I think that you have to use you own strip function. You may 
 be able to build you own function by altering the default strip function, see 
 ?lattice.options and try lattice.options() at the command prompt. However 
 this may be more difficult than it seems at first. Perhaps some one more 
 familiar with the lattice package can solve this.


Perfect! Thank you very much,

Bernd


-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG3l5cUsbvfbd00+ERAh1qAJ4tw3ZiIYnI+UF6FJeLT1xRMep/VACfR+I1
R14RJkdaFBNFqVc6kibyaRk=
=W41I
-END PGP SIGNATURE-

__
R-help@stat.math.ethz.ch 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 non-linear least squares in R

2007-09-05 Thread Yu (Warren) Wang
Hi, everyone,
My question is: It's not every time that you can get a converged 
result from the nls function. Is there any solution for me to get a 
reasonable result? For example:

x - c(-0.06,-0.04,-0.025,-0.015,-0.005,0.005,0.015,0.025,0.04,0.06)

y - 
c(1866760,1457870,1314960,1250560,1184850,1144920,1158850,1199910,1263850,1452520)

fitOup- nls(y ~ constant + A*(x-MA)^4 + B*(x-MA)^2, 
start=list(constant=1000, A=1, B=-100, MA=0), 
control=nls.control(maxiter=100, minFactor=1/4096), trace=TRUE)

 

 For this one, I cannot get the converged result, how can I reach it? To 
use another funtion or to modify some settings for nls?

Thank you very much!

Yours,

Warren

__
R-help@stat.math.ethz.ch 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] [Lattice] Incrase the height of strips in Trellis plots

2007-09-05 Thread deepayan . sarkar
On 9/5/07, Frede Aakmann Tøgersen [EMAIL PROTECTED] wrote:
 This should give you something close to what you want:


 xyplot(Petal.Length ~ Petal.Width | Species, iris,
strip = strip.custom(par.strip.text = list(cex = 2)),
par.settings = list(layout.heights=list(strip=1.45)))

 The par.settings argument alters locally the default par settings of lattice
 plots, see e.g. ?trellis.par.get and the ?xyplot about the par.settings
 argument.

Another possibility that predates par.settings (but is basically equivalent) is

xyplot(Petal.Length ~ Petal.Width | Species, iris,
   par.strip.text = list(lines = 2, cex = 2))

-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] Robust linear models and unequal variance

2007-09-05 Thread Geertje Van der Heijden
Thanks for your reply, Bert - it was really helpful!

1. I have used a non-parametric test of variance (fligner.test) to test
whether the variances of my groups were equal or not, and they weren't.

2. Just quickly to see if I understand the weighting part - I calculate
the variance of my different group (I have two factors, so I presume
calculating it for all different combinations of these two factors
separately) and use a weight 1/variance for each of these groups in the
GLM. Right?

3. OK

4. Unfortunately my group sizes are dissimilar, with most groups being
approximately equal sample size and one group having a much higher
sample size - so best thing to do is use weights than?

Thanks again,
Geertje



Geertje van der Heijden
PhD student
Tropical Ecology
School of Geography
University of Leeds
Leeds LS2 9JT

Tel: (+44)(0)113 3433345 
Email: [EMAIL PROTECTED]


-Original Message-
From: Bert Gunter [mailto:[EMAIL PROTECTED] 
Sent: 04 September 2007 23:24
To: Geertje Van der Heijden; r-help@stat.math.ethz.ch
Subject: RE: [R] Robust linear models and unequal variance

Let me try a reply, although I wish others wiser than I had responded.

1. How do you know the variances are unequal? 

2. If you somehow know what the variances are (or at least their
relative sizes), you can use the weights arguments of the functions
you mentions to weight inversely proportional to variance (except not
for the MM method in
rlm() according to the docs.) 

3. That ranked regression is robust is a myth. It also does not deal
with the unequal variance situation. It is not a panacea for anything.
If you need robust regression use robust regression.

4. If group sizes are not too dissimilar, than whether you case weight
or not may not make much difference (alas, hard to tell a priori).
Especially to estimation.

The fundamental issue is that outliers and unequal variances must be
operationalized, otherwise they are confounded: outlier only has
meaning compared to what is expected from a specified distribution.
Outliers are no longer out when the variance is large. 

Also look at glm() with the quasi option if you wish to consider
fitting a heterogeneous variance structure to initialize a robust method
(which could, of course, be distorted by your outliers).


Bert Gunter
Genentech Nonclinical Statistics

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Geertje Van der
Heijden
Sent: Tuesday, September 04, 2007 10:55 AM
To: r-help@stat.math.ethz.ch
Subject: [R] Robust linear models and unequal variance

Hi all,

I have probably a basic question, but I can't seem to find the answer in
the literature or in the R-archives. 

I would like to do a robust ANCOVA (using either rlm or lmRob of the
MASS and robust packages) - my response variable deviates slightly from
normal and I have some outliers. The data consist of 2 factor
variables and 3-5 covariates (fdepending on the model). However, the
variance between my groups is not equal and I am not sure if it is
therefore appropriate to use a robust statistical method or if a
non-parametric analysis (i.e. ranked regression) might be better. If I
can still use a robust statistical method, which estimator is best to
use to deal with unequal variance? And if it is better to use a
non-parametric analysis, could anyone put me in the direction of the
right non-parametric method to use (the relationship between my response
variable and the covariates is linear)?

Any help on this would be greatly appreciated!

Many thanks,
Geertje


Geertje van der Heijden
PhD student
Tropical Ecology
School of Geography
University of Leeds
Leeds LS2 9JT

Tel: (+44)(0)113 3433345
Email: [EMAIL PROTECTED]



[[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] capture.out(system())?

2007-09-05 Thread Prof Brian Ripley
On Wed, 5 Sep 2007, Gustaf Rydevik wrote:

 On 9/4/07, Werner Wernersen [EMAIL PROTECTED] wrote:
 Hi,

 I am trying to capture the console output of program I
 call via system() but that always returns only
 character(0).

 For example:
 capture.output(system(pdflatex out.tex) )

 will yield:
 character(0)

 and the output still written to the R console.

 Is there a command for intercepting this output?

 Thank you!
   Werner


 ?sink()

That is used by capture.output() to capture R output, but this question is 
about output that never goes near R.

The answer is in ?system, but might depend on the unstated OS.  Arguments 
'intern' and 'show.output.on.console' are relevant.

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

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


Re: [R] question about non-linear least squares in R

2007-09-05 Thread Moshe Olshansky
Below is one possibility:

If you knew MA you would get a regular linear
least-squares for parameters A,B and constant which
can be easily solved. So now you can define a function
f(MA) which returns that value. Now you must minimize
that f - a function of one argument. It can have
several local minima and so you must be careful but I
believe that minimizing (even bad) function of one
argument should be easier than your original problem.

Regards,

Moshe.

P.S. if you do this I would be interested to know
whether this works.

--- Yu (Warren) Wang [EMAIL PROTECTED] wrote:

 Hi, everyone,
 My question is: It's not every time that you can
 get a converged 
 result from the nls function. Is there any solution
 for me to get a 
 reasonable result? For example:
 
 x -

c(-0.06,-0.04,-0.025,-0.015,-0.005,0.005,0.015,0.025,0.04,0.06)
 
 y - 

c(1866760,1457870,1314960,1250560,1184850,1144920,1158850,1199910,1263850,1452520)
 
 fitOup- nls(y ~ constant + A*(x-MA)^4 + B*(x-MA)^2,
 
 start=list(constant=1000, A=1,
 B=-100, MA=0), 
 control=nls.control(maxiter=100, minFactor=1/4096),
 trace=TRUE)
 
  
 
  For this one, I cannot get the converged result,
 how can I reach it? To 
 use another funtion or to modify some settings for
 nls?
 
 Thank you very much!
 
 Yours,
 
 Warren
 
 __
 R-help@stat.math.ethz.ch 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] Choosing the optimum lag order of ARIMA model

2007-09-05 Thread Megh Dal
Hi Leeds, Thanx for this reply. Actually I did not want to know whether any 
differentiation is needed or not. My question was that : what is the difference 
between two models :
   
  arima(data, c(2,1,2))
   
  and 
   
  arima(diff(data), c(2,0,2))
   
  If I am correct then those two models are same. Therefore I should get same 
results for both of the cases. Am I doing something wrong?

Leeds, Mark (IED) [EMAIL PROTECTED] wrote:
  you shouldn't just do a diff because the non diffed version gives you
an error. I don't know what that error means
but you definitely can't just ignore it and go to taking a difference.
Why don't you do an acf plot of the non diffed series and see 
if the acf doesn't die out quickly. If it doesn't, then it's probably
okay to assume you need to difference it.
if you check out the source of the function, that might gives hintsa
about what the error means.

Whayt you say below about looking at combinations is okay but remember
that picking a model is an art rather than
S science. Maybe an arima(2,1,2) is the best model based on model
selection and aic but it gives forecasts that
Are very poor. Parsimony ( fewer parameters ) is stressed by boix and
jenkins so, when in doubt,, choose a lower order model
when all else fails. The series may not have an perfect arima
represenation so nothing is going to be perfect.





-Original Message-
From: Megh Dal [mailto:[EMAIL PROTECTED] 
Sent: Saturday, September 01, 2007 1:20 AM
To: Leeds, Mark (IED)
Cc: r-help@stat.math.ethz.ch
Subject: RE: [R] Choosing the optimum lag order of ARIMA model

Hi Leed, I got your point. Hence if I see both acf and pacf vanish after
3 then I should try for all possible models and then choose that model
giving min aic?
i.e. (1,3), (3,1), (3,3), (2,3), (3,2), (1,2), (2,1), (1,1), and (2,2)?

And my second doubt is : for the particular dataset that I provided, I
got nothing when I run arima(data, order=c(2,1,2)) however
arima(diff(data), order=c(2,0,2)) gives no problem :

 arima(data, order=c(2,1,2))
Error in arima(data, order = c(2, 1, 2)) : 
non-stationary AR part from CSS
 arima(diff(data), order=c(2,0,2))
Call:
arima(x = diff(data), order = c(2, 0, 2))
Coefficients:
ar1 ar2 ma1 ma2 intercept
0.1093 -0.3111 -0.1438 0.0632 0.0157
s.e. 0.5378 0.4464 0.5661 0.4796 0.0111
sigma^2 estimated as 0.01329: log likelihood = 47.38, aic = -82.76


Can anyone tell me what is the wrong there?

Regars,

Leeds, Mark (IED) wrote:

what ripley says below is kind of related to what I said about p
and q
both being greater than 1 being very unlikely.
He's also right in that those rules only work in the sense
that, if
the acf drops off after q lags, then the
Implication is that p = 0
And if they pacf drops off after p lags, then it's implied that
q = 0.
when the model is mixed, it's more complicated and
Mixed models are more rare than common but they could end up
being the
best model. That's another place where
The aic can be used. In other words, if it looks like your acf
drops off
after 1 and your pacf drops off after
1, then it could be a p = 1 and q =1 model but then the aic
should be
checked against ( p =1 and q = 0 )
And p = 0 and q = 1 ) because the selection of p = 1 and q = 1
is really
flawed because the rules don't really
Hold when BOTH p and q are non zero.


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Prof
Brian Ripley
Sent: Friday, August 31, 2007 4:38 AM
To: Megh Dal
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Choosing the optimum lag order of ARIMA model

On Fri, 31 Aug 2007, Megh Dal wrote:

 Dear all R users,

 I am really struggling to determine the most appropriate lag
order of

 ARIMA model. My understanding is that, as for MA [q] model the
auto 
 correlation coeff vanishes after q lag, it says the MA order
of a 
 ARIMA model, and for a AR[p] model partial autocorrelation
vanishes 
 after p lags it helps to determine the AR lag. And most
appropriate 
 model choosed by this argument gives min AIC.

The last part is fallacious. Also, you are applying your rules
to
selecting the orders in ARMA models, and they apply only to pure
MA or
AR models.

The R test file src/library/stats/tests/ts-tests.R has an
example of
model selection by AIC.


 Now I considered following data :

 2.1948 2.2275 2.2669 2.2839 1.9481 2.1319 2.0238 2.3109 2.5727
2.5176
 2.5728 2.6828 2.8221 2.879 2.8828 2.9955 2.9906 2.9861 3.0452
3.068
 2.9569 3.0256 3.0977 2.985 2.9572 3.0877 3.1009 3.1149 2.8886
2.9631
 3.0325 2.9175 2.7231 2.7905 2.8493 2.8208 2.8156 2.9115 2.701
2.6928
 2.7881 2.723 2.7266 2.9494 3.113 3.0566 3.0358 3.05 3.0724
3.1365
 3.1083 3.0257 3.2211 3.4269 3.327 3.1205 2.9997 3.0201 3.0803
3.2059
 3.1997 3.038 3.1613 3.2802 3.2194

 ACF for 1st diff series:
 Autocorrelations of series 'diff(data1)', by lag
 0 1 2 3 4 5 6 7 8 9
10
 1.000 -0.022 -0.258 -0.016 0.066 0.034 0.035 -0.001 -0.089
0.028
0.222
 11 12 13 14 15 16 17 18
 -0.132 -0.184 -0.038 0.048 -0.026 -0.041 

Re: [R] Pie Chart Labels

2007-09-05 Thread Jim Lemon
Adam Green wrote:
 I am having trouble finding out how to adjust the position of labels on 
 pie charts.  For the small wedges, many of the labels overlap making it 
 impossible to read.  Is there any way to offset the labels so that they 
 don't overlap?
 
Hi Adam,
There are three ways to adjust the positions of labels on a 3D pie chart 
(I'm assuming it's 3D from the word wedges. If not, the following 
should still be useful).

The first is to change the position of the sectors by the start 
argument. Apart from being useful when very large sectors cause 
problems, changing the sector positions can sometimes alleviate minor 
crowding of the labels.

The second is to catch the return value of the pie3D function. This is 
the radial positions at which the labels have been placed. You can then 
alter this vector and pass it as the argument labelpos. In this way 
you can spread out the labels for small sectors.

Finally, you can leave out the labels when you call pie3D and manually 
place labels using the text function. The chart is drawn on a plot 
that spans -1 to 1 in both directions, so it is relatively easy to work 
out where the labels should be.

A word of warning - when I read, For the small wedges, many of the 
labels..., I felt that I should say that pie charts in general, and 3D 
ones in particular, are rarely successful with more than 4 or 5 sectors. 
In the R-news article that included pie3D, I included a pie chart that 
was very difficult for the viewer to extract the information that the 
creator intended. Depending upon what is to be represented, you might 
consider whether another method might be more successful.

Jim

__
R-help@stat.math.ethz.ch 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 extract part of an array?

2007-09-05 Thread Peter Dalgaard
Lauri Nikkinen wrote:
 Hi,

 How can I extract part of an array? I would like to extract table
 Supported from this array. If this is not possible, how do I convert
 array to list? I'm sorry this is not an reproducible example.

   
 spl - tapply(temp$var1, list(temp$var2, temp$var3, temp$var3), mean)
 spl
 
 , , Supported

07   08
 A68.38710 71.48387
 B21.67742 20.83871
 C55.74194 61.12903
 AL L 26.19816 27.39631

 , , Not_supported

  07   08
 ANA 82.38710
 BNA 24.0
 CNA 68.77419
 ALL  NA 29.97984

   
How about spl[,,Supported]?

-p

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

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


Re: [R] lattice xyplot with bty=l

2007-09-05 Thread Patrick Drechsler
Deepayan Sarkar [EMAIL PROTECTED] writes:

 On 9/4/07, Patrick Drechsler [EMAIL PROTECTED] wrote:

 what is the correct way of removing the top and right axes
 completely from a lattice xyplot? I would like to have a plot similar
 to using the bty=l option for traditional plots.

 There is no direct analog (and I think it would be weird in a
 multipanel plot). 

I agree that this is not very useful for multipanel plots.

 Combining a few different features, you can do:

 library(grid)

 xyplot(1:10 ~ 1:10, scales = list(col = black, tck = c(1, 0)),
par.settings = list(axis.line = list(col = transparent)),
axis = function(side, ...) {
if (side == left)
 grid.lines(x = c(0, 0), y = c(0, 1),
default.units = npc)
else if (side == bottom)
 grid.lines(x = c(0, 1), y = c(0, 0),
default.units = npc)
axis.default(side = side, ...)
})

 -Deepayan

Thank you very much Deepayan, this is exactly what I was looking for!

Cheers,

Patrick

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


Re: [R] integers

2007-09-05 Thread [EMAIL PROTECTED]
 On 9/4/07, Christoph Heibl [EMAIL PROTECTED] wrote:
 Hi list,

 The function is.integer tests if an object is of type integer:

 see e.g.:

 is.integer(12)  # FALSE
 is.real(12) # TRUE
 mode(12)# numeric

 But how can I test if a number is actually an integer? R seek is
 difficult to search in this case because it mainly yields entries
 about the integer()-function family.

 Thanks for any hint!
 Christoph Heibl
 ?mode
 r = 12
 is.integer(r)
[1] FALSE
 is.double(r)
[1] TRUE
 i = as.integer(r)
 storage.mode(r)
[1] double
 storage.mode(i)
[1] integer


Paolo Sonego

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


[R] Running geeglm unstructured corstr

2007-09-05 Thread Niccolò Bassani
Dear R users,
I've got a serious problem running some gee functions, and I really can't
fix it. My dataframe is made of several rows and columns (say 7600 x 15),
like the one below:

header inr  .   inside  group_cod
1 2.25   0   1
1 3.46   0   0
1 ..   1   0
1 ..   1...
1 ..  .  ...
   ..  .  ...
   ..  .  ...
   ..  .  ...
   ..  .  ...
   ..  .  ...
615  ..  .  ...
615  ..  .  ...
615  ..  .   ...

As you can see I've got several repeated measures, resulting in clusters (
i.e. ID) of different sizes. You can get a frame like this by running this
code:

header - rep.int(seq(1:615),sample(seq(1:19),size=615,replace=T))
inr - rlnorm(length(header),0.8434359,0.3268392)
group_cod - sample(c(0,1),size=length(header),replace=T)
inside - sample(c(0,1),size=length(header),replace=T)
gee.frame - data.frame(header,inr,group_cod,inside)

When I try running a longitudinal model with geeglm, the
corstr=unstructured option returns me an assertion failure of R itself (a
sort of error window), while the ar1 option for corstr returns a model only
with estimates, and no s.e. or wald test. Same is for the anova method. I
removed subjects with only one observation, but the problem's still the
same. This is the code used:

- for corstr= unstructured

geeglm.model- geeglm(inside~group_cod,family=binomial, data=gee.frame
,id=header,corstr=unstructured)

This model gives me an error (not the kind written in R-gui: simply the
program seems to stop not producing anything), and doesn't produce any
result, leading me to quit R. The same happens when I use a userdefined
matrix built with genZcor function using crostrv=4 (i.e. unstructured). My
initial thought was of problems because of highly unbalanced observations
and because of exceeding of correlation parameters to estimate, but
restricting cluster size did not result in any improvement.
Is there a problem with the code, or it could be due to the data?

- for costr= ar1

In my dataset I also have a variable weeks, that I use to specify waves in
the geeglm. When I use this, the output for an autoregressive gee model
gives me only the estimates, when I don't use it everything's alright. The
problem's that I have unbalanced observations, so the use of waves could
take this into account while estimating parameters. Is this a conflict
between these options, or what?

In addition, I've built the empirical correlation structure. A 19x19
structure, thus with nrow=maximum cluster size. When I use this as zcor the
program gives me

 geeglm.fixed - geeglm(inside~weeks+group_cod+età,family=binomial, data=
frame.model,id=header,waves=weeks,zcor=corr.gee,corstr=userdefined)
*Errore in geese.fit(xx, yy, id, offset, soffset, w, waves = waves, zsca,  :

nrow(zcor) need to be equal sum(clusz * (clusz - 1) / 2) for
unstructured or userdefined corstr.*

I really don't understand the meaning of this: the correlation should have
number of rows equal to maximum cluster size. Also in the online help the
details say something about the dimension of Zcor, but I can't understand
the same...
I hope I've been clear.
Thanks in advance
niccolò

[[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] Choosing the optimum lag order of ARIMA model

2007-09-05 Thread Prof Brian Ripley
On Wed, 5 Sep 2007, Megh Dal wrote:

 Hi Leeds, Thanx for this reply. Actually I did not want to know whether 
 any differentiation is needed or not. My question was that : what is the 
 difference between two models :

  arima(data, c(2,1,2))

  and

  arima(diff(data), c(2,0,2))

  If I am correct then those two models are same. Therefore I should get 
 same results for both of the cases. Am I doing something wrong?

They are not the same.  Please do study the help page, and in particular 
the 'include.mean' argument.  One is a model for n observations and 
the other for n-1 observations, and how that affects the issue is 
discussed on the help page.  With the right options you will get similar 
but not identical results.

 arima(x, c(2,1,2), method=ML)

Coefficients:
  ar1  ar2  ma1 ma2
   0.0786  -0.3561  -0.0869  0.1272
s.e.  0.6135   0.4296   0.6564  0.4549

sigma^2 estimated as 0.01368:  log likelihood = 46.46,  aic = -82.92

 arima(diff(x), c(2,0,2), method=ML, include.mean=FALSE)

Coefficients:
  ar1  ar2  ma1 ma2
   0.0786  -0.3561  -0.0869  0.1272
s.e.  0.6135   0.4296   0.6564  0.4549

sigma^2 estimated as 0.01329:  log likelihood = 47.38,  aic = -82.76


And did you have permission to copy private (and impolite) messages from 
Mr Leeds to this list?  If you did, please say so in your own posting for 
the record.  Since I don't have such permission I have deleted them from 
this reply.

Professor Ripley

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

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


Re: [R] plotting

2007-09-05 Thread yoooooo

This looks like exactly what i want!! Thanks!



Jim Lemon-2 wrote:
 
 yoo wrote:
 Hi, let's say I have data
 
 x = c(1, 2, 10, 12)
 y = c(100, -20, 50, 25)
 
 if I go plot(x, y), then the default x-axis range goes from 1 to 12. Is
 there a way to change it so that the axis looks like:
 
 |-|-|-|
  1   2   10 12
 
 This doesn't seem reasonable but let's say I want to plot intraday graph
 with axis.POSIXct, my data is only from 8:30 to 4 every day and I have
 these
 data for days.. i don't want to see a straight line every night.. Is
 there a
 way I can do this? 
 
 Hi yoo,
 Have you looked at gap.plot (plotrix)?
 
 Jim
 
 __
 R-help@stat.math.ethz.ch 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.
 
 

-- 
View this message in context: 
http://www.nabble.com/plotting-tf4361709.html#a12497565
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] Different behavior of mtext

2007-09-05 Thread Greg Snow
You may also want to look at the cnvrt.coords function in the TeachingDemos 
package.  It may be a bit simpler than mixing grid and base.

-Original Message-
From: Sébastien [EMAIL PROTECTED]
To: Prof Brian Ripley [EMAIL PROTECTED]
Cc: R-help r-help@stat.math.ethz.ch
Sent: 9/3/07 7:46 PM
Subject: Re: [R] Different behavior of mtext

Thanks for the information on gridBase, I could solve my problem using 
the 'baseViewports' function and by replacing mtext by grid.text (with 
coordinates adjustments).

Sebastien

Prof Brian Ripley a écrit :
 On Mon, 3 Sep 2007, Sébastien wrote:

 Ok, the problem is clear now. I did not get that 'user-coordinates' 
 was refering to par(usr), when I read the help of mtext. If I may 
 ask you some additional questions:
 - you mentioned a missing unit() call ; at which point should it be 
 done in my code examples ?

 Before it is used.  The problem is that I believe more than one 
 package has a unit() function.

 - could you give me some advices or helpful links about how to set up 
 a grid viewport ? - and finally, probably a stupid question: is a 
 gridview automatically set up when a plotting function is called ?

 If you want to mix grid and base graphics, you need package gridBase, 
 but really I would not advise a beginner to be using grid directly 
 (that is, not via lattice to ggplot*).


 Sebastien

 PS: To answer to your final question, my goal is to center a block of 
 legend text on the device but to align the text to the left of this 
 block.

 Prof Brian Ripley a écrit :
 On Sun, 2 Sep 2007, Sébastien wrote:

 Dear R Users,

 I am quite surprised to see that mtext gives different results when it
 is used with 'pairs' and with plot'. In the two following codes, it
 seems that the 'at' argument in mtext doesn't consider the same 
 unit system.

 It is stated to be in 'user coordinates'.  Your code does not work 
 because unit() is missing.  If you mean the one from package grid, 
 npc is not user coordinates (and refers to a grid viewport which 
 you have not set up and coincidentally is the same as the initial 
 user coordinate system to which pairs() has reverted).

 Try par(usr) after your pairs() and plot() calls to see the 
 difference.
 Plotting a 2x2 array of plots _is_ different from plotting one, so 
 this should be as expected.

 Since centring is the default for 'adj', it is unclear what you are 
 trying to achieve here.

 I would appreciate your comments on this issue.

 Sebastien

 # Pairs

 mydata-data.frame(x=1:10,y=1:10)

 par(cex.main=1, cex.axis=1, cex.lab=1, lwd=1,
mar=c(5 + 5,4,4,2)+0.1)

 pairs(mydata,oma=c(5 + 5,4,4,2))

 mylegend-c(mylegend A,mylegend B,mylegend C,mylegend test)
 mylegend.width = strwidth(mylegend[which.max(nchar(mylegend))], 
 figure)

 for (i in 1:4) {
 mtext(text=mylegend[i],
side = 1,
line = 3+i,
at = unit((1-mylegend.width)/2,npc),# centers the
 legend at the bottom
adj=0,
padj=0)}

 # plot

 mydata-data.frame(x=1:10,y=1:10)

 par(cex.main=1, cex.axis=1, cex.lab=1, lwd=1,
mar=c(5 + 5,4,4,2)+0.1)

 plot(mydata,oma=c(5 + 5,4,4,2))

 mylegend-c(mylegend A,mylegend B,mylegend C,mylegend test)
 mylegend.width = strwidth(mylegend[which.max(nchar(mylegend))], 
 figure)

 for (i in 1:4) {
 mtext(text=mylegend[i],
side = 1,
line = 3+i,
at = unit((1-mylegend.width)/2,npc),# should
 center the legend at the bottom but doesn't do it !
adj=0,
padj=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] Help: how can i build a constrained non-linear model?

2007-09-05 Thread 维娜 缪

Dear all
I try to run the code as follows,
 
test.model-nls(y~exp(A)*(x-PMA)^4+exp(B)*(x-PMA)^2+Const,
data=test,
start=list(A=8,B=5,Const=10,PMA=0),
control=nls.control(maxiter = 50,minFactor=1/1048),
trace=TRUE)
 
But how can i build a selfSart, since i have much data ? 
Thanks for your help first!
Vina
 


From: [EMAIL PROTECTED]: [EMAIL PROTECTED]: Help: how can i build a constrained 
non-linear model?Date: Tue, 4 Sep 2007 07:53:41 +


DearI have a data.frame, and want to fit a constrained non-linear model:data:





x
y

-0.08
20.815

-0.065
19.8128

-0.05
19.1824

-0.03
18.7346

-0.015
18.3129

0.015
18.0269

0.03
18.4715

0.05
18.9517

0.065
19.4184

0.08
20.146

0
18.2947model:y~exp(a)*(x-m)^4+exp(b)*(x-m)^2+const I try to use nls() and set 
start=list(a=1,b=1,c=1,m=1), but which always give me a error message that  
Error in qr.solv(QR.B,cc): singular matrix 'a' in solve. How can i build a 
selfStart? or any suggestion! ThanksRegards,Vina

Invite your mail contacts to join your friends list with Windows Live Spaces. 
It's easy! Try it! 
_


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

2007-09-05 Thread excalibur

I want to interpole a functione by a spline interpolation and i want to know
if i can force, with any function or parameter, the interpolation to be
monotonic.

Thanks all
-- 
View this message in context: 
http://www.nabble.com/Spline-tf4384168.html#a12498336
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] length of a string

2007-09-05 Thread João Fadista
Dear all,
 
I would like to know how can I compute the length of a string in a dataframe. 
Example:
 
SEQUENCE   ID
TGCTCCCATCTCCACGGHR04FS00645
ACTGAACTCCCATCTCCAAT  HR0595847847
 
I would like to know how to compute the length of each SEQUENCE.
 

Best regards,
João Fadista

[[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] length of a string

2007-09-05 Thread Bill.Venables
sLengths - with(dataFrame, nchar(as.character(SEQUENCE))) 


Bill Venables
CSIRO Laboratories
PO Box 120, Cleveland, 4163
AUSTRALIA
Office Phone (email preferred): +61 7 3826 7251
Fax (if absolutely necessary):  +61 7 3826 7304
Mobile: +61 4 8819 4402
Home Phone: +61 7 3286 7700
mailto:[EMAIL PROTECTED]
http://www.cmis.csiro.au/bill.venables/ 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of João Fadista
Sent: Wednesday, 5 September 2007 11:51 PM
To: r-help@stat.math.ethz.ch
Subject: [R] length of a string

Dear all,
 
I would like to know how can I compute the length of a string in a dataframe. 
Example:
 
SEQUENCE   ID
TGCTCCCATCTCCACGGHR04FS00645
ACTGAACTCCCATCTCCAAT  HR0595847847
 
I would like to know how to compute the length of each SEQUENCE.
 

Best regards,
João Fadista

[[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] For loop with if else statement

2007-09-05 Thread Monica Pisica

Hans,
 
I think your problem is that you don't use the variable which takes different 
values in your if statement  your i changes values and has really nothing 
to do with your x variable (except the length part ). Also all the other 
variables need to be declared somehow - otherwise how can you store values in 
them???
 
So your first code may be something like that:
 
t=c(1,2)
for(i in 1:length(t)){
if (i==1) t[i]=i+1 else t[i]=i
}
 
 t[1] 2 2
and your second code:
 
a = c(1,2)
b=c(1,2)for(i in 1:2){if (i==1){a[i]=ib[i]=i-1} else{ 
a[i]=i+1b[i]=i}c-list(a=a,b=b)}
 c$a[1] 1 3 c$b[1] 0 2
 
Also when you have only 2 possible values for i i don't think the second if 
is necessary. I hope this helps a little, although my explanation is not 
necessarily the best.
 
Monica
 
-- Message: 16Date: Tue, 4 Sep 2007 15:59:54 
+0200From: Hans Ole ?rka [EMAIL PROTECTED]Subject: [R] For loop with if else 
statementTo: 'r-help@stat.math.ethz.ch' 
r-help@stat.math.ethz.chMessage-ID:[EMAIL PROTECTED]Content-Type: 
text/plain; charset=iso-8859-1 Hi,I try to make a simple for loop with a if 
else statement (First example - Below) and extend it to a more complex loop 
(Second example). However, my results #First example:x=c(1,2)t=for(i in 
1:length(x)){if (x==1){a=x+1}elseif (x==2){a=x}} Returned from R:Warning 
messages:1: the condition has length  1 and only the first element will be 
used in: if (x == 1) {2: the condition has length  1 and only the first 
element will be used in: if (x == 1) { t[1] 2 3 However, the result i had 
liked to get was t=c(2,2) i.e. using the first function (a=x+1) for x[1] and 
(a=x) for x[2]. I can remove the Warnings by making: if (x[i]==1) etc. but this!
  do not make the results any better.  #Second example:x=c(1,2)t-for(i in 
1:length(x)){if (x==1){a=xb=x-1}elseif (x==2){a=x+1b=x}b-list(a=a,b=b)} 
Returned from R:Warning messages:1: the condition has length  1 and only the 
first element will be used in: if (x == 1) {2: the condition has length  1 and 
only the first element will be used in: if (x == 1) { t$a[1] 1 2 $b[1] 0 1 The 
result i like to get are $a =c(1,3) and $b=c(0,2) Probably there are couple of 
things that I do wrong and I appreciate all help!  
_
Discover the new Windows Vista

[[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] length of a string

2007-09-05 Thread Jared O'Connell
How's this?

 x = data.frame(ID=c(asdf,asdfasdf),1:2)
 x
ID X1.2
1 asdf1
2 asdfasdf2
 nchar(as.character(x$ID))
[1] 4 8


Assuming ID is a factor, if not, you can remove the as.character().



On 9/5/07, João Fadista [EMAIL PROTECTED] wrote:

 Dear all,

 I would like to know how can I compute the length of a string in a
 dataframe. Example:

 SEQUENCE   ID
 TGCTCCCATCTCCACGGHR04FS00645
 ACTGAACTCCCATCTCCAAT  HR0595847847

 I would like to know how to compute the length of each SEQUENCE.


 Best regards,
 João Fadista

 [[alternative HTML version deleted]]


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



[[alternative HTML version deleted]]

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


Re: [R] length of a string

2007-09-05 Thread Chuck Cleland
João Fadista wrote:
 Dear all,
  
 I would like to know how can I compute the length of a string in a dataframe. 
 Example:
  
 SEQUENCE   ID
 TGCTCCCATCTCCACGGHR04FS00645
 ACTGAACTCCCATCTCCAAT  HR0595847847
  
 I would like to know how to compute the length of each SEQUENCE.

?nchar

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


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

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


Re: [R] length of a string

2007-09-05 Thread Paul Smith
On 9/5/07, João Fadista [EMAIL PROTECTED] wrote:
 I would like to know how can I compute the length of a string in a dataframe. 
 Example:

 SEQUENCE   ID
 TGCTCCCATCTCCACGGHR04FS00645
 ACTGAACTCCCATCTCCAAT  HR0595847847

 I would like to know how to compute the length of each SEQUENCE.

Maybe the following code?

 data
var1 var2
1   This is a string   12
2 This is another string   34
 nchar(data[,1])
[1] 16 22


Paul

__
R-help@stat.math.ethz.ch 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] length of a string

2007-09-05 Thread Henrique Dallazuanna
Hi,

sapply(levels(df[,SEQUENCE]), nchar)

Where 'df' is your data.frame

-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

On 05/09/07, João Fadista [EMAIL PROTECTED] wrote:

 Dear all,

 I would like to know how can I compute the length of a string in a
 dataframe. Example:

 SEQUENCE   ID
 TGCTCCCATCTCCACGGHR04FS00645
 ACTGAACTCCCATCTCCAAT  HR0595847847

 I would like to know how to compute the length of each SEQUENCE.


 Best regards,
 João Fadista

 [[alternative HTML version deleted]]


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



[[alternative HTML version deleted]]

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


Re: [R] length of a string

2007-09-05 Thread Ted Harding
On 05-Sep-07 13:50:57, João Fadista wrote:
 Dear all,
  
 I would like to know how can I compute the length of a string in a
 dataframe. Example:
  
 SEQUENCE   ID
 TGCTCCCATCTCCACGGHR04FS00645
 ACTGAACTCCCATCTCCAAT  HR0595847847
  
 I would like to know how to compute the length of each SEQUENCE.
  
 Best regards,
 João Fadista

  nchar(ACTGAACTCCCATCTCCAAT)
  [1] 20

seems to work. Find it, and related functions, with

  help.search(character)

As it happens, help.search(string) will not help!

Best wishes,
Ted.


E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 05-Sep-07   Time: 15:05:22
-- XFMail --

__
R-help@stat.math.ethz.ch 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] geotiff or tiff files with world files

2007-09-05 Thread Monica Pisica

Hi,
 
I have a matrix of data which i can vizualize as an image - for example. I 
would like to save this image as a geotiff file or at a tiff file with a world 
file which holds the projection of my data (ultimately the data represent a map 
of some sort). I know i can save the data as an ESRI grid, but i am not 
interested in that.
 
I wonder if anybody knows about any code which will help me do that.
 
Thanks in advance,
 
Monica
_

s. It's easy!

aspxmkt=en-us
[[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] length of a string

2007-09-05 Thread Benilton Carvalho
As long as you keep in mind Prof. Ripley's comment, you're going to  
be fine with nchar().

http://tolstoy.newcastle.edu.au/R/e2/devel/07/05/3450.html

Remember that what you want exactly is given by nchar(obj,  
type=chars), which is **NOT** the default on R 2.5.1 (only on  
R-2.6.0).

In your particular situation, assuming R-2.5.1, nchar(obj) works, but  
i'm afraid it's only a coincidence.

b

On Sep 5, 2007, at 11:05 AM, (Ted Harding) wrote:

 On 05-Sep-07 13:50:57, João Fadista wrote:
 Dear all,

 I would like to know how can I compute the length of a string in a
 dataframe. Example:

 SEQUENCE   ID
 TGCTCCCATCTCCACGGHR04FS00645
 ACTGAACTCCCATCTCCAAT  HR0595847847

 I would like to know how to compute the length of each SEQUENCE.

 Best regards,
 João Fadista

   nchar(ACTGAACTCCCATCTCCAAT)
   [1] 20

 seems to work. Find it, and related functions, with

   help.search(character)

 As it happens, help.search(string) will not help!

 Best wishes,
 Ted.

 
 E-Mail: (Ted Harding) [EMAIL PROTECTED]
 Fax-to-email: +44 (0)870 094 0861
 Date: 05-Sep-07   Time: 15:05:22
 -- XFMail --

 __
 R-help@stat.math.ethz.ch 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] multivariate ARMA simulation

2007-09-05 Thread hanwen zhang
Dear Sirs:
   
  I am trying to simulate a ARMA multivariate model using 
  AR-array(c(1,0.5,0,0.1,0,0.4,1,0.8),c(2,2,2))
mod- ARMA(A=AR, B=diag(1,2),C=NULL)
y-simulate(mod,sampleT=100)
  in the package dse1, but how can I specify the covariance matrix for the 
noise of the model? and does the above procedure use Gaussian white noise??
  Thank you 
  Hanwen Zhang 

   
-

[[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] Multiple xyplots

2007-09-05 Thread Tom Wright
Hi everyone,
I'm hoping you can give me some pointers. I have a requirement to draw 
multiple (103) xy line plots onto one output device. Ideally the plots 
should be displayed in a hexagonal grid (example at 
www.maladmin.com/example.jpg). I can calculate the locations for each 
waveform but am wondering how to create multiple plotting areas. I have 
come accross references to a package grid (which doesn't seem to be in 
my CRAN mirror probability.ca) and lattice but I'm not sure if I'm on 
the correct lines.
Any advice gratefully received.
Thanks
Tom

-- 
--Tom Wright

| Contact me:   |
| Skype: 0121 288 0756tomwright01)  |
| MSN: [EMAIL PROTECTED]|
| Jabber: [EMAIL PROTECTED]   |
| ICQ: 423913453|
|___|


Ever since prehistoric times, wise men have tried to understand what,
exactly, make people laugh.  That's why they were called wise men.
All the other prehistoric people were out puncturing each other with
spears, and the wise men were back in the cave saying: How about:
Would you please take my wife?  No.  How about: Here is my wife, please
take her right now.  No How about:  Would you like to take something?
My wife is available.  No.  How about ...
  -- Dave Barry, Why Humor is Funny

__
R-help@stat.math.ethz.ch 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] Q: selecting a name when it is known as a string

2007-09-05 Thread D. R. Evans
D. R. Evans said the following at 09/04/2007 04:14 PM :
 I am 100% certain that there is an easy way to do this, but after

I have reconsidered this and now believe it to be essentially impossible
(or at the very least remarkably difficult) although I don't understand why
it is so :-(

At least, I spent another two hours trying variations on the suggestions I
received, but still nothing worked properly.

It sure seems like it _ought_ to be easy, because of the following argument:

If I type an expression such as A - something then R is perfectly
capable of parsing the something and executing it and assigning the
result to A. So it seems to follow that it ought to be able to parse a
string that contains exactly the same sequence of characters (after all,
why should the R parsing engine care whether the input string comes from
the terminal or from a variable?) and therefore it should be possible to
assign something to a variable and then have R parse that variable
precisely as if it had been typed.

That was my logic as to why this ought to be easy, anyway. (And there was
the subsidiary argument that this is easy in the other languages I use, but
R is sufficiently different that I'm not certain that that argument carries
much force.)

It does seem that there are several ways to make the

  lo - loess(percent ~ ncms * ds, d, control=loess.control(trace.hat =
 'approximate'))

command work OK if the right hand side is in a character variable, but I
haven't been able to find a way to make

  grid - data.frame(expand.grid(ds=MINVAL:MAXVAL, ncms=MINCMS:MAXCMS))

work.

I always end up with a parse error or a complaint that 'newdata' does not
contain the variables needed when I perform the next task:

  plo - predict(lo, grid).

So I guess I have to stick with half a dozen compound if statements, all
of which do essentially the same thing :-(

__
R-help@stat.math.ethz.ch 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] bootstrap confidence intervals with previously existing bootstrap sample

2007-09-05 Thread Tim Hesterberg
On Tue, 4 Sep 2007, [EMAIL PROTECTED] wrote:
 I am new to R. I would like to calculate bootstrap confidence intervals
 using the BCa method for a parameter of interest. My situation is this: I
 already have a set of 1000 bootstrap replicates created from my original
 data set. I have already calculated the statistic of interest for each
 bootstrap replicate, and have also calculated the mean for this statistic
 across all the replicates. Now I would like to calculate Bca confidence
 intervals for this statistic. Is there a way to import my
 previously-calculated set of 1000 statistics into R, and then calculate
 bootstrap confidence intervals around the mean from this imported data?

 I have found the code for boot.ci in the manual for the boot package, but
 it looks like it requires that I first use the boot function, and then
 apply the output to boot.ci. Because my bootstrap samples already exist,
 I don't want to use boot, but just want to import the 1000 values I have
 already calculated, and then get R to calculate the mean and Bca confidence
 intervals based on these values. Is this possible?

Brian Ripley wrote:
Yes, it is possible but you will have to study the internal structure of 
an object of class boot (which is documented on the help page) and mimic 
it.  You haven't told us which type of bootstrap you used, which is one of 
the details you need to supply.

It might be slightly easier to work with function bcanon in package 
bootstrap, which you would need to edit to suit your purposes.

I don't know why you have picked on the BCa method: my experience is that 
if you need to correct the basic method you often need far more than 1000 
samples to get reliable results.

You can do the BCa, but you need to supply parameters:
z0: typically calculated from the fraction of bootstrap statistics 
that are = the original statistic
acceleration: based on the skewness of the empirical influence function,
typically calculated using the jackknife

I agree that you should do far more than 1000 samples.  The BCa uses
bootstrap quantiles that are adjusted based on the z0 and acceleration
parameters, and estimating z0 from the bootstrap samples magnifies
the Monte Carlo error.  You need roughly double as many bootstrap samples
as for the bootstrap percentile interval; e.g. 10^4 instead of 5000.

If computational expense is an issue, you might prefer bootstrap
tilting intervals, which require about 1/37 as many bootstrap samples
as the BCa for comparable Monte Carlo variability.

Quick overview of confidence intervals:

accuracycomments
t intervals 1/sqrt(n)   Using either formula or bootstrap 
standard error; poor in the presence
of skewness.
bootstrap percentile1/sqrt(n)   Good quick-and-dirty procedure.
Partial skewness correction.
Poor if the statistic is biased.
bootstrap t 1/n Good coverage, but interval
width can vary wildly when n is small.
BCa 1/n Current best overall, but you need
a lot of bootstrap samples, e.g. 10^4.
tilting 1/n Low Monte Carlo variability, so can 
use fewer bootstrap samples.  
Difficult to implement, and
requires that statistic can be
calculated with weights.

Advertisement 1: tilting is available in S+Resample, available free
from www.insightful.com/downloads/libraries

Advertisement 2: I talk about these more in my short course,
Bootstrap Methods and Permutation Tests
Oct 10-11 San Francisco, 3-4 Oct UK.
http://www.insightful.com/services/training.asp


| Tim Hesterberg   Senior Research Scientist   |
| [EMAIL PROTECTED]  Insightful Corp.|
| (206)802-23191700 Westlake Ave. N, Suite 500 |
| (206)283-8691 (fax)  Seattle, WA 98109-3044, U.S.A.  |
|  www.insightful.com/Hesterberg   |

__
R-help@stat.math.ethz.ch 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 obtain intercept statistics in anova withwithin-subject factors?

2007-09-05 Thread Greg Snow
Sorry, I did not think about the nested design (did not read carefully enough). 
 Another thing to try (untested) is to create a column of 1's and include that 
specifically and exclude the default intercept, then your column of 1's acts as 
the intercept, but a p-value is returned from it.

Note that sometimes the other terms may change their definition without an 
intercept.  I had success at one time (quite a while ago, so things could have 
changed) with specifying the formula as:O

Y ~ 1 + x1 + x2 + x3 -1

Which caused it to include the intercept, use that info when setting the dummy 
vars for x1-x3, then removed the intercept.  

Again this is all untested, just an idea to try.

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

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Sid Kouider
 Sent: Friday, August 31, 2007 3:19 PM
 To: r-help@stat.math.ethz.ch
 Subject: Re: [R] How to obtain intercept statistics in anova 
 withwithin-subject factors?
 
 Dear Greg,
 Thanks very much for you advice. 
 Unfortunately, although summary.lm applied on aov objects 
 indeed shows the intercept's statistics, this function does 
 not (seem to) work with within-participant designs. As soon 
 as I enter the info on the error term (see the example in my 
 first message), then summary.lm(aov_object) crashes (Error 
 in if (p == 0) { : argument is of length zero).
 -Sid
 
 
 
  Subject: RE: [R] (no subject)
  Date: Thu, 30 Aug 2007 13:43:19 -0600
  From: [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]; r-help@stat.math.ethz.ch
 
  Try calling summary.lm on your object (if it is an aov object then 
  summary
 calls summary.aov which does not show the intercept, but 
 calling summary.lm directly does give info on the intercept).
 
  --
  Gregory (Greg) L. Snow Ph.D.
  Statistical Data Center
  Intermountain Healthcare
  [EMAIL PROTECTED]
  (801) 408-8111
 
 
  -Message d'origine-
  De : Sid Kouider [mailto:[EMAIL PROTECTED] Envoyé : 
 jeudi 30 août 
  2007 16:54 À : '[EMAIL PROTECTED]'
  Objet : How to obtain intercept statistics in anova with 
  within-subject factors?
  
  Dear R users,
  I am looking for an easy (i.e., direct) way of obtaining 
 the F and p 
  values from the intercept in anovas with within-subject designs.
  My data are from a psychophysics experiment where I am using d' (d-
  prime) values obtained from 3 modalities of presentation in each 
  subject. I would like to know not only whether there is an 
 effect of 
  modality, but also whether the main effect is significant (meaning 
  that d'  0).
  I know that a t.test again the null mean would provide me 
 with similar 
  stats on the main effect, but I would like to get those 
 stats in an F 
  form, for consistency with the stats on the other factors 
 of interest.
  
  As far as I understand how R works, the function anova 
 provides you 
  with such information but it is restricted to between-group 
 analyses.
  For within-subject designs, one has to use summary(aov) 
 but stats on 
  the intercept are not included in the result of this 
 function. I have 
  pasted an example below. As one can see, only the Sum of Sq 
 and Mean 
  Sq are given for the main effect.
  
  Thank you for any advice you can provide, -Sid
  
  summary(aov(x~mod+Error(suj/(mod)), data=dp))
  
  Error: suj  Df  Sum Sq Mean Sq F value Pr(F)
  Residuals 10 19.5977  1.9598
  Error: suj:mod
  Df  Sum Sq Mean Sq F value  Pr(F)  mod
  2  8.2475  4.1237  4.2955 0.02806 *
  Residuals 20 19.2005  0.9600
  ---Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 
 ' ' 1 Error:
  Within
  Df Sum Sq Mean Sq F value Pr(F)Residuals 33 55.812   1.691
 
 
 __
 R-help@stat.math.ethz.ch 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] Multiple xyplots

2007-09-05 Thread deepayan . sarkar
On 9/5/07, Tom Wright [EMAIL PROTECTED] wrote:
 Hi everyone,
 I'm hoping you can give me some pointers. I have a requirement to draw
 multiple (103) xy line plots onto one output device. Ideally the plots
 should be displayed in a hexagonal grid (example at
 www.maladmin.com/example.jpg). I can calculate the locations for each
 waveform but am wondering how to create multiple plotting areas. I have
 come accross references to a package grid (which doesn't seem to be in
 my CRAN mirror probability.ca) and lattice but I'm not sure if I'm on
 the correct lines.
 Any advice gratefully received.

grid seems like the right choice to me (it comes bundled with R, so
it's not available as a separate package). Here's an example that may
give you a few hints:

library(grid)
grid.newpage()
for (i in 1:30)
grid.lines(x = 0:20/21, y = sin(70 * runif(1) * 0:20/21),
   vp = viewport(x = runif(1), y = runif(1), height =
0.05, width = 0.05))

See the package documentation, or Paul Murrell's book R Graphics for more.

-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] Monotone splines

2007-09-05 Thread servien remi
Hello, i have a little problem with R and i hope you can help me.
   
  I want to use splines to estimate a function but i want to force the 
interpolation to be monotone. Is this possible with R ?
   
  Thank you,
  Rémi.


-

[[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] question about non-linear least squares in R

2007-09-05 Thread apjaworski
Here is one way of getting a reasonable fit:

1.  Scale your y's by dividing all values by 1e6.
2.  Plot x vs. y.  The plot looks like a quadratic function.
3.  Fit a quadratic const. + B*x^2 - this a linear regression problem so
use lm.
4.  Plot the predictions.
5.  Eyball the necessary shift - MA is around 0.01.  Refit const. +
B*(x-.01)^2.  Should get const.=1.147 and B=139.144
6.  Use start=list(const.= 1.147, A=0, B=1.147, MA=.01).  nls should
converge in 4 iterations.

In general, good starting points may be crucial to nls convergence.
Scaling the y's to reasonable values also helps.

Hope this helps,

Andy

__
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-
E-mail: [EMAIL PROTECTED]
Tel:  (651) 733-6092
Fax:  (651) 736-3122


   
 Yu (Warren)  
 Wang 
 [EMAIL PROTECTED]  To 
 Sent by:  r-help@stat.math.ethz.ch  
 [EMAIL PROTECTED] r-help@stat.math.ethz.ch  
 at.math.ethz.chcc 
   
   Subject 
 09/05/2007 02:51  [R] question about non-linear least 
 AMsquares in R
   
   
   
   
   
   




Hi, everyone,
My question is: It's not every time that you can get a converged
result from the nls function. Is there any solution for me to get a
reasonable result? For example:

x - c(-0.06,-0.04,-0.025,-0.015,-0.005,0.005,0.015,0.025,0.04,0.06)

y -
c(1866760,1457870,1314960,1250560,1184850,1144920,1158850,1199910,1263850,1452520)


fitOup- nls(y ~ constant + A*(x-MA)^4 + B*(x-MA)^2,
start=list(constant=1000, A=1, B=-100, MA=0),
control=nls.control(maxiter=100, minFactor=1/4096), trace=TRUE)



 For this one, I cannot get the converged result, how can I reach it? To
use another funtion or to modify some settings for nls?

Thank you very much!

Yours,

Warren

__
R-help@stat.math.ethz.ch 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] ecological meaning of randomForest vegetation classification?

2007-09-05 Thread Christoph Muller
Hi, everyone,

I haven't found anything similar in the forum, so here's my problem (I'm no
expert in R nor statistics):

I have a data set of 59.000 cases with 9 variables each (fractional
coverage of 9 different plant types, such as deciduous broad-leaved
temperate trees or evergreen tropical trees etc.), which was generated by a
vegetation model.
In order to evaluate the quality of the vegetation model's output, I want
to compare it to a land-cover data set which has 23 different land-cover
types (such as needle leaved evergreen forest, dense broad-leaved forest,
barren, etc.).
A statistician advised me to use the randomForest package in R and using a
sub-set to generate the random Forest, I get a very good prediction for the
rest.
However, I need to evaluate how meaningful this classification is in an
ecological sense (boreal trees should not play a role in the definition of
tropical land-cover types, for example), otherwise I cannot judge the
quality of the vegetation model's output.

Unfortunately, randomForest gives me about 15.000 splits of which about
5000 are end branches (rough guess), so it's very hard and time-consuming
to check each single branch of one of the final trees for its ecological
meaning.
Is there any utility to summarize the characteristics of each of the 23
prediction classes? Such as land-cover class 1 has less than 5% of plant
types 1-5, 20-50% of plant type 7 and at least 30% of plant type 8.
Or is there a more suitable method to classify my data?

Thanks a lot in advance!

Christoph


Click on the following link for the Netherlands Environmental Assessment
Agency(MNP)mission and contact information:
http://www.mnp.nl/signature.html

Klik op de volgende link voor missie en contactinformatie van het
Milieu- en Natuurplanbureau (MNP): http://www.mnp.nl/signature.html

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


Re: [R] kendalls tau c

2007-09-05 Thread Uwe Ligges


Barbara Diane-Spillmann wrote:
 dear all,
 
 does anybody know if cor.test with method=kendall calculates kendalls 
 tau a b or c? I need to get p values for kendalls tau c...


May I ask what the difference between Kendall's tau a, b and c is? Any 
references?

Uwe Ligges


 thank you very much for any kind of hint.
 
 Barbara


__
R-help@stat.math.ethz.ch 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] Single plot multiple levels in x?

2007-09-05 Thread Richard Yanicky
Greg,


This is great, exactly what I was looking for.


Thanks. 


Rich

-Original Message-
From: Greg Snow [EMAIL PROTECTED]
Sent: Aug 31, 2007 2:55 PM
To: Richard Yanicky [EMAIL PROTECTED], Uwe Ligges [EMAIL PROTECTED]
Cc: r-help@stat.math.ethz.ch
Subject: RE: [R] Single plot multiple levels in x?

Try this code (with the mydf that you generate below):

library(TeachingDemos)

plot( c(0,5), c(0,1), xlab='State', ylab='ylab', axes=FALSE, type='n' )
axis(1, at= (1:5) - 0.5, labels=paste('state',1:5))
box()

for(i in 1:5){
   with( subset(mydf, State==i),
 subplot( plot(Position, `Pct Recurr`, col=i,
   yaxt=ifelse( i==1, 's', 'n' ), ylab='',xlab='',
cex.axis=0.5),
   x=c(i-1,i), y=c(0,1) )
   )
}


Is that close to what you want? 


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

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Richard Yanicky
 Sent: Thursday, August 30, 2007 11:37 AM
 To: Uwe Ligges
 Cc: r-help@stat.math.ethz.ch
 Subject: Re: [R] Single plot multiple levels in x?
 
 Uwe,
 
 
 Here is some code to create some data then a plot (The plot 
 was done in another package). The plot is included only to 
 reference the structure of the x-axis. I can't get R to do 
 something similar.
 
 
 State - seq (1:5);
 posi - seq (0.5,62525,199.233)
 
 mydf-NULL;
 
 for ( i in 1:5) {
 
 df1-data.frame(i,posi);
 
 mydf - rbind(mydf,df1); }   
 
 myy-rep(-100.01:100.01,length=nrow(mydf));
 
 mydf-cbind(mydf,myy);
 
 names(mydf) - c(State,Position,Pct Recurr);
 
 
 
 
 I would like to somehow:
 
 
 plot(c(mydf[,1],mydf[,2]),mydf[,3]) and end up with the 
 nested structure on the x-axis.
 
 Thanks,
 
 Richard
 
 
 -Original Message-
 From: Uwe Ligges [EMAIL PROTECTED]
 Sent: Aug 30, 2007 10:50 AM
 To: Richard Yanicky [EMAIL PROTECTED]
 Cc: r-help@stat.math.ethz.ch
 Subject: Re: [R] Single plot multiple levels in x?
 
 
 
 Richard Yanicky wrote:
  Uwe,
  
  I have looked into lattice and can't seem to make this 
 work. I can easily make multiple panels but this isn't what I 
 am looking to do. Any suggestions on which functions to use? 
 the axis function seems a natural place to start but I still 
 can't seem to make it happen.
 
 If lattice is not what you want, I do not understand what 
 you mean. Can 
 you give a more elaborated example, please?
 
 Uwe
 
 
  
  HELP!
  
  
  Richard
  
  -Original Message-
  From: Uwe Ligges [EMAIL PROTECTED]
  Sent: Aug 30, 2007 5:59 AM
  To: Richard Yanicky [EMAIL PROTECTED]
  Cc: r-help@stat.math.ethz.ch
  Subject: Re: [R] Single plot multiple levels in x?
 
 
 
  Richard Yanicky wrote:
  Plotting with 2 x axis?
 
 
  One axis inside another, for example salary within state,
 
 
 
 
  1-50 | 50 - 100 |  100+   |   1- 50 | 50 -100 | 
 100+ | ...  repeated bins for salary
 AL   !
AR ..  more states
 
  Sounds like the lattice package does exactly what you want, but 
  without any reproducible example.
 
  Uwe Ligges
 
 
 
  The values are all stored with a single data frame. I have tried 
  different things with the axis function and done many 
 searches for 
  plotting. Can't find a direct reference
 
 
  Thanks.
 
  Richard
 
  __
  R-help@stat.math.ethz.ch 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] level names with groupdedData object

2007-09-05 Thread Dean Sonneborn
How do I get a grouped data object to use the level names from the input 
data set?
first I gave the levels some names like this:

male -factor(male)

levels(male) - c(“Girls”,”Boys”)

Then I created a groupdedData object but the male variable in not part 
of the grouping formula.

Then I fit an lme and then use this code to create a plot:
plot(myfit.lme, resid(. , type=”p”) ~ fitted(.) | male , id=0.05, adj=-0.3 )

But the plot just used “Male” in both panels. How do I get the plot to 
used Girls Boys?

Thanks,

Dean

__
R-help@stat.math.ethz.ch 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] element wise opertation between a vector and a list

2007-09-05 Thread Greg Snow
 ?mapply
 mapply('+', a, b, SIMPLIFY=FALSE)
 colSums(mapply('+', a, b))

Hope this helps,

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

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Yongwan Chun
 Sent: Monday, September 03, 2007 12:36 AM
 To: r-help@stat.math.ethz.ch
 Subject: [R] element wise opertation between a vector and a list
 
 I want to try to get a result of element wise addition 
 between a vector and a list. It can be done with for 
 statement. In order to reducing computing time, I have tried 
 to avoid for state. If anybody give me an idea, I would 
 apprecite it much.
 
 for example, with a  b as below lines,
 
 a- list(c(1,3),c(1,2),c(2,3))
 b-c(10,20,30)
 
 I would like to have a list (like d) or a vector (like e) 
 as below.
 
 d-list(c((1+10),(3+10)),c((1+20),(2+20)),c((2+30),(3+30)))
 e- c((1+10)+(3+10),(1+20)+(2+20),(2+30)+(3+30))
 
 Thanks,
 
 
 Yongwan Chun
 
 __
 R-help@stat.math.ethz.ch 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] list element to matrix

2007-09-05 Thread dverzi
I have created a list of matrices using sapply or lapply and wish to extract 
each of the matrices as a matrix.  Some of them are 2x2, 3x3, etc.

I can do this one at a time as:

M1-as.matrix(D[[1]])

How can repeat this process for an unknown number of entries in the list?  In 
other words, how shall I index M1?

Diana

__
R-help@stat.math.ethz.ch 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] ecological meaning of randomForest vegetation classification? [Broadcast]

2007-09-05 Thread Liaw, Andy
Hi Christoph,

I'm not exactly sure what you're looking for, but I'll take a stab
anyway.

The trees in a random forest is not designed to be interpreted as one
would
with an ordinary tree.  There are several things you may try to see if
they help you any.  One is the distribution of votes.  It looks like you
are
classifying each data point into one of many possible classes.  RF with
give
you the fraction of trees in the forest that classified the observation
as
a particular class (and the class with the highest fraction of votes is
the
predicted class).  Another is the partial dependence plot:  You can
use
plot(importance(rf.object)) to see which variables are the most
important,
and then use partialPlot() to examine their marginal effects.  These
offer
some clue of what the RF black box is doing, and hopefully will make
some
sense to you.

Best,
Andy 

From: Christoph Muller
 
 Hi, everyone,
 
 I haven't found anything similar in the forum, so here's my 
 problem (I'm no
 expert in R nor statistics):
 
 I have a data set of 59.000 cases with 9 variables each (fractional
 coverage of 9 different plant types, such as deciduous broad-leaved
 temperate trees or evergreen tropical trees etc.), which was 
 generated by a
 vegetation model.
 In order to evaluate the quality of the vegetation model's 
 output, I want
 to compare it to a land-cover data set which has 23 different 
 land-cover
 types (such as needle leaved evergreen forest, dense 
 broad-leaved forest,
 barren, etc.).
 A statistician advised me to use the randomForest package in 
 R and using a
 sub-set to generate the random Forest, I get a very good 
 prediction for the
 rest.
 However, I need to evaluate how meaningful this 
 classification is in an
 ecological sense (boreal trees should not play a role in the 
 definition of
 tropical land-cover types, for example), otherwise I cannot judge the
 quality of the vegetation model's output.
 
 Unfortunately, randomForest gives me about 15.000 splits of 
 which about
 5000 are end branches (rough guess), so it's very hard and 
 time-consuming
 to check each single branch of one of the final trees for its 
 ecological
 meaning.
 Is there any utility to summarize the characteristics of each 
 of the 23
 prediction classes? Such as land-cover class 1 has less than 
 5% of plant
 types 1-5, 20-50% of plant type 7 and at least 30% of plant type 8.
 Or is there a more suitable method to classify my data?
 
 Thanks a lot in advance!
 
 Christoph
 __
 __
 
 Click on the following link for the Netherlands Environmental 
 Assessment
 Agency(MNP)mission and contact information:
 http://www.mnp.nl/signature.html
 
 Klik op de volgende link voor missie en contactinformatie van het
 Milieu- en Natuurplanbureau (MNP): http://www.mnp.nl/signature.html
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 
 


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

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


[R] Lattice: key with expression function

2007-09-05 Thread Folkes, Michael
HI all,
I'm trying (unsuccessfully) to add the degree symbol to each line of
text in my legend (within xyplot).
Here is the line of code, which fails to interpret the expression
function:

auto.key =list(points =
FALSE,text=paste(levels(as.factor(divertSST2$temp)),expression(degree)).
..),

I just get:
7 degree
8 degree
9 degree

If I place 'expression' outside or just after the paste function it also
doesn't work.
Any suggestions are well received!
Thanks
Michael Folkes


[[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] rug() colors

2007-09-05 Thread Greg Snow
You could make multiple calls to the rug function using a different
color for each call.  Using tapply or by may automate this for you.
Another option would be to create your own rug using the segments
function (which will plot multiple colors).

Hope this helps,

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

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of 
 [EMAIL PROTECTED]
 Sent: Tuesday, September 04, 2007 12:00 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] rug() colors
 
 Hello,
 
 I have a simple question on rug().
 Currently there is only one color possible for the rug.
 Is it possible to plot a the rug with different colors, for 
 each rug item ?
 
 Thx.
 Bjoern
 
 __
 R-help@stat.math.ethz.ch 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] Lattice: key with expression function

2007-09-05 Thread deepayan . sarkar
On 9/5/07, Folkes, Michael [EMAIL PROTECTED] wrote:
 HI all,
 I'm trying (unsuccessfully) to add the degree symbol to each line of
 text in my legend (within xyplot).
 Here is the line of code, which fails to interpret the expression
 function:

 auto.key =list(points =
 FALSE,text=paste(levels(as.factor(divertSST2$temp)),expression(degree)).
 ..),

 I just get:
 7 degree
 8 degree
 9 degree

That's because

 paste(foo, expression(degree))
[1] foo degree


 If I place 'expression' outside or just after the paste function it also
 doesn't work.

auto.key = list(text = expression(paste(foo, degree)))

should work. I think the problem is that you want a vector of
expressions, and that's a bit harder to get. I'm not sure what the
best solution is, but if everything else fails, you could try using
parse(text=)

-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] Q: selecting a name when it is known as a string

2007-09-05 Thread Greg Snow
If your main goal is to do a loess fit, then make predictions from that,
then using the 'get' function may do what you want:

 tmp.var - get(ORDINATE)
 lo - loess(percent ~ ncms * tmp.var, d, ...
 grid - expand.grid(tmp.var=MINVAL:MAXVAL, ncms=MINCMS:MAXCMS)
 predict(lo, grid)

Here you stick with the name tmp.var so it matches between the formula
and the data frame, the predictions will be what you want.  If you also
want to print out some of the model summary then realize that it will
have tmp.var in place of ds or whatever (It may not be too much trouble
to change that name after the fact if that is what is important).

Hope this helps, 

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

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of D. R. Evans
 Sent: Tuesday, September 04, 2007 4:15 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] Q: selecting a name when it is known as a string
 
 I am 100% certain that there is an easy way to do this, but 
 after experimenting off and on for a couple of days, and 
 searching everywhere I could think of, I haven't been able to 
 find the trick.
 
 I have this piece of code:
 
 ...
   attach(d)
 
   if (ORDINATE == 'ds')
   { lo - loess(percent ~ ncms * ds, d, 
 control=loess.control(trace.hat =
 'approximate'))
 grid - data.frame(expand.grid(ds=MINVAL:MAXVAL, 
 ncms=MINCMS:MAXCMS)) ...
 
 then there several almost-identical if statements for 
 different values of ORDINATE. For example, the next if 
 statement starts with:
 
 ...
   if (ORDINATE == 'dsl')
   { lo - loess(percent ~ ncms * dsl, d, 
 control=loess.control(trace.hat =
 'approximate'))
 grid - data.frame(expand.grid(dsl=MINVAL:MAXVAL, 
 ncms=MINCMS:MAXCMS)) ...
 
 This is obviously pretty silly code (although of course it does work).
 
 I imagine that my question is obvious: given that I have a 
 variable, ORDINATE, whose value is a string, how do I 
 re-write statements such as the lo - and grid - 
 statements above so that they use ORDINATE instead of the 
 hard-coded names ds and dsl.
 
 I am almost sure (almost) that it has something to do with 
 deparse(), but I couldn't find the right incantation, and 
 the ?deparse() help left my head swimming.
 
 __
 R-help@stat.math.ethz.ch 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] Multiple xyplots

2007-09-05 Thread Greg Snow
Take a look at the my.symbols function in the TeachingDemos package.
The last example shows how to create a hexagonal grid and the 2nd to
last example shows how to plot several small line plots onto a larger
plot.  Combining these 2 examples should give you what you want.

Hope this helps,

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

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Tom Wright
 Sent: Wednesday, September 05, 2007 8:54 AM
 To: r-help@stat.math.ethz.ch
 Subject: [R] Multiple xyplots
 
 Hi everyone,
 I'm hoping you can give me some pointers. I have a 
 requirement to draw multiple (103) xy line plots onto one 
 output device. Ideally the plots should be displayed in a 
 hexagonal grid (example at www.maladmin.com/example.jpg). I 
 can calculate the locations for each waveform but am 
 wondering how to create multiple plotting areas. I have come 
 accross references to a package grid (which doesn't seem to 
 be in my CRAN mirror probability.ca) and lattice but I'm not 
 sure if I'm on the correct lines.
 Any advice gratefully received.
 Thanks
 Tom
 
 --
 --Tom Wright
 
 | Contact me:   |
 | Skype: 0121 288 0756tomwright01)  |
 | MSN: [EMAIL PROTECTED]|
 | Jabber: [EMAIL PROTECTED]   |
 | ICQ: 423913453|
 |___|
 
 
 Ever since prehistoric times, wise men have tried to 
 understand what, exactly, make people laugh.  That's why they 
 were called wise men.
 All the other prehistoric people were out puncturing each 
 other with spears, and the wise men were back in the cave 
 saying: How about:
 Would you please take my wife?  No.  How about: Here is my 
 wife, please take her right now.  No How about:  Would you 
 like to take something?
 My wife is available.  No.  How about ...
   -- Dave Barry, Why Humor is Funny
 
 __
 R-help@stat.math.ethz.ch 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] list element to matrix

2007-09-05 Thread Friedrich Schuster
You get the number of list elements with length(D), 
the dimensions of M1 with dim(M1)

see help with: 
?dim
?length

Hope this helps...


I have created a list of matrices using sapply or lapply and wish to 
extract each of the matrices as a matrix.  Some of them are 2x2, 3x3, etc.

I can do this one at a time as:

M1-as.matrix(D[[1]])

How can repeat this process for an unknown number of entries in the list?  In 
other words, how shall I index M1?


Diana

-- 

Friedrich Schuster
[EMAIL PROTECTED]
Tel.: +49 6221 737474
Tel.: +49 163 7374744

__
R-help@stat.math.ethz.ch 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] Q: selecting a name when it is known as a string

2007-09-05 Thread Tony Plate
For the column names of the result of expand.grid(), I would just assign 
them the values I wanted, like this:

  x - expand.grid(tmp=1:3,y=1:2)
  x
   tmp y
1   1 1
2   2 1
3   3 1
4   1 2
5   2 2
6   3 2
  colnames(x)[1] - whatever
  x
   whatever y
11 1
22 1
33 1
41 2
52 2
63 2
 

-- Tony Plate

D. R. Evans wrote:
 D. R. Evans said the following at 09/04/2007 04:14 PM :
 I am 100% certain that there is an easy way to do this, but after
 
 I have reconsidered this and now believe it to be essentially impossible
 (or at the very least remarkably difficult) although I don't understand why
 it is so :-(
 
 At least, I spent another two hours trying variations on the suggestions I
 received, but still nothing worked properly.
 
 It sure seems like it _ought_ to be easy, because of the following argument:
 
 If I type an expression such as A - something then R is perfectly
 capable of parsing the something and executing it and assigning the
 result to A. So it seems to follow that it ought to be able to parse a
 string that contains exactly the same sequence of characters (after all,
 why should the R parsing engine care whether the input string comes from
 the terminal or from a variable?) and therefore it should be possible to
 assign something to a variable and then have R parse that variable
 precisely as if it had been typed.
 
 That was my logic as to why this ought to be easy, anyway. (And there was
 the subsidiary argument that this is easy in the other languages I use, but
 R is sufficiently different that I'm not certain that that argument carries
 much force.)
 
 It does seem that there are several ways to make the
 
   lo - loess(percent ~ ncms * ds, d, control=loess.control(trace.hat =
 'approximate'))
 
 command work OK if the right hand side is in a character variable, but I
 haven't been able to find a way to make
 
   grid - data.frame(expand.grid(ds=MINVAL:MAXVAL, ncms=MINCMS:MAXCMS))
 
 work.
 
 I always end up with a parse error or a complaint that 'newdata' does not
 contain the variables needed when I perform the next task:
 
   plo - predict(lo, grid).
 
 So I guess I have to stick with half a dozen compound if statements, all
 of which do essentially the same thing :-(
 
 __
 R-help@stat.math.ethz.ch 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] Round Off Error Variance

2007-09-05 Thread Remund, Todd
I am trying to specify a round off error distribution, but I am not sure
what the variance of round off error would be for R.  Does anyone have a
suggestion?  Thanks

 

Todd Remund

(435) 863-8172

Science  Engineering

 

 


[[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 making array dataset inside a package

2007-09-05 Thread Wallace Hui
Hello

I have a question about how I can include an array dataset inside a  
package. In our package, one R function is designed to take an array  
of 2 rows * 2 columns * k levels as input data enter by the user,  
where k is positive integers. I am trying to include a 3-D array of  
2-by-2-by-8 as dataset in the package, so users can load the data  
using data(dataname). We prefer to load the data as dataset, rather  
than include the long syntax in the help file for users to copy and  
paste. I can generate array in R console using long chain of syntax  
like:arraydat=array(.omitted...)

However, I cannot figure a way to save the data in 3D array data frame format
using write(), write.table(), or use data.frame() etc. If I directly  
copy-paste the screen output to a text file. I cannot read it into R  
using like:

 arraydat=read.table(array.txt, header=TRUE)

This will give me a 2 rows by (2*k) columns two-dimension data set,  
and lost all level (or depth) structure for the purpose of our R  
function. The header is messed too.

I appreciate if any expert can tell me how to include/save array  
stucture in dataset in R, and also how to read it into R to preserve  
the header and array structure.

Thank you for your time.

__
R-help@stat.math.ethz.ch 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] Question about making array dataset inside a package

2007-09-05 Thread Kuhn, Max
Please read 

  http://cran.r-project.org/doc/manuals/R-exts.html 

especially Section 1.1.3. Use save to create an Rdata file.

Max

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Wallace Hui
Sent: Wednesday, September 05, 2007 4:18 PM
To: r-help@stat.math.ethz.ch
Subject: [R] Question about making array dataset inside a package

Hello

I have a question about how I can include an array dataset inside a  
package. In our package, one R function is designed to take an array  
of 2 rows * 2 columns * k levels as input data enter by the user,  
where k is positive integers. I am trying to include a 3-D array of  
2-by-2-by-8 as dataset in the package, so users can load the data  
using data(dataname). We prefer to load the data as dataset, rather  
than include the long syntax in the help file for users to copy and  
paste. I can generate array in R console using long chain of syntax  
like:arraydat=array(.omitted...)

However, I cannot figure a way to save the data in 3D array data frame
format
using write(), write.table(), or use data.frame() etc. If I directly  
copy-paste the screen output to a text file. I cannot read it into R  
using like:

 arraydat=read.table(array.txt, header=TRUE)

This will give me a 2 rows by (2*k) columns two-dimension data set,  
and lost all level (or depth) structure for the purpose of our R  
function. The header is messed too.

I appreciate if any expert can tell me how to include/save array  
stucture in dataset in R, and also how to read it into R to preserve  
the header and array structure.

Thank you for your time.

__
R-help@stat.math.ethz.ch 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.

--
LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{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] Lattice: key with expression function

2007-09-05 Thread Folkes, Michael
Thanks to Deepayan...again, for suggesting parse.
Here is how I added the degree symbol to a vector of text for my xyplot
legend:

auto.key =list(points = FALSE,text=parse(text =
paste(levels(as.factor(divertSST2$temp)), *degree, sep = ))), 

For me the tricky part was learning about adding the '*'.  I found that
in this suggestion:
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/78961.html

Michael Folkes

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: September 5, 2007 11:27 AM
To: Folkes, Michael
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Lattice: key with expression function


On 9/5/07, Folkes, Michael [EMAIL PROTECTED] wrote:
 HI all,
 I'm trying (unsuccessfully) to add the degree symbol to each line of 
 text in my legend (within xyplot). Here is the line of code, which 
 fails to interpret the expression
 function:

 auto.key =list(points = 
 FALSE,text=paste(levels(as.factor(divertSST2$temp)),expression(degree)
 ).
 ..),

 I just get:
 7 degree
 8 degree
 9 degree

That's because

 paste(foo, expression(degree))
[1] foo degree


 If I place 'expression' outside or just after the paste function it 
 also doesn't work.

auto.key = list(text = expression(paste(foo, degree)))

should work. I think the problem is that you want a vector of
expressions, and that's a bit harder to get. I'm not sure what the best
solution is, but if everything else fails, you could try using
parse(text=)

-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] list element to matrix

2007-09-05 Thread jim holtman
If they are already a matrix in the list, then you don't have to use
'as.matrix'; you can just say:

M1 - D[[1]]

Now the question is, what do you mean by how do you index M1?  Do you
want to go through the list applying a function to each matrix?  If
so, then just 'lapply'.  For example, to get the column means, you
would do:

mean.list - lapply(D, colMeans)

Can you explain in a little more detail the problem you are trying to solve.

On 9/5/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 I have created a list of matrices using sapply or lapply and wish to 
 extract each of the matrices as a matrix.  Some of them are 2x2, 3x3, etc.

 I can do this one at a time as:

 M1-as.matrix(D[[1]])

 How can repeat this process for an unknown number of entries in the list?  In 
 other words, how shall I index M1?

 Diana

 __
 R-help@stat.math.ethz.ch 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?

__
R-help@stat.math.ethz.ch 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] writing elements in list as a data frame

2007-09-05 Thread Srinivas Iyyer
Dear R-helpers, 
Lists in R are stumbling block for me.

I kindly ask you to help me able to write a
data-frame. 

I have a list of lists. 

 sls[1:2]
$Andromeda_maya1
   x   y
[1,] 369 103
[2,] 382 265
[3,] 317 471
[4,] 169 465
[5,] 577 333

$Andromeda_maya2
x   y
 [1,] 173 507
 [2,] 540 395
 [3,] 268 143
 [4,] 346 175
 [5,] 489  91
 
I want to be able to write a data.frame like the
following:
X   Y Name
369 103  Andromeda_maya1
382 265  Andromeda_maya1
317 471  Andromeda_maya1
169 465  Andromeda_maya1
577 333  Andromeda_maya1
173 507  Andromeda_maya2
540 395  Andromeda_maya2
268 143  Andromeda_maya2
346 175  Andromeda_maya2
489  91  Andromeda_maya2

Is there a way to convert this list-of-list into a
data.frame.

Thanks
srini

__
R-help@stat.math.ethz.ch 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] writing elements in list as a data frame

2007-09-05 Thread jim holtman
Try this:

 sls - list(a=matrix(sample(10), ncol=2, dimnames=list(NULL, c('x', 'y'))),
+ b=matrix(sample(16), ncol=2, dimnames=list(NULL, c('x', 'y'
 sls
$a
 x  y
[1,] 8  2
[2,] 9 10
[3,] 4  1
[4,] 5  7
[5,] 3  6

$b
  x  y
[1,]  4 14
[2,]  3 15
[3,] 16  5
[4,]  1  9
[5,]  8  7
[6,] 10  2
[7,] 12 13
[8,] 11  6

 # create output matrix
 do.call('rbind', lapply(names(sls), function(.name){
+ data.frame(sls[[.name]], Name=.name)
+ }))
x  y Name
1   8  2a
2   9 10a
3   4  1a
4   5  7a
5   3  6a
6   4 14b
7   3 15b
8  16  5b
9   1  9b
10  8  7b
11 10  2b
12 12 13b
13 11  6b




On 9/5/07, Srinivas Iyyer [EMAIL PROTECTED] wrote:
 Dear R-helpers,
 Lists in R are stumbling block for me.

 I kindly ask you to help me able to write a
 data-frame.

 I have a list of lists.

  sls[1:2]
 $Andromeda_maya1
   x   y
 [1,] 369 103
 [2,] 382 265
 [3,] 317 471
 [4,] 169 465
 [5,] 577 333

 $Andromeda_maya2
x   y
  [1,] 173 507
  [2,] 540 395
  [3,] 268 143
  [4,] 346 175
  [5,] 489  91

 I want to be able to write a data.frame like the
 following:
 X   Y Name
 369 103  Andromeda_maya1
 382 265  Andromeda_maya1
 317 471  Andromeda_maya1
 169 465  Andromeda_maya1
 577 333  Andromeda_maya1
 173 507  Andromeda_maya2
 540 395  Andromeda_maya2
 268 143  Andromeda_maya2
 346 175  Andromeda_maya2
 489  91  Andromeda_maya2

 Is there a way to convert this list-of-list into a
 data.frame.

 Thanks
 srini

 __
 R-help@stat.math.ethz.ch 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?

__
R-help@stat.math.ethz.ch 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] confidence intervals of proportions from complex surveys

2007-09-05 Thread Dirk Enzmann
This is partly an R and partly a general statistics question.

I'm trying to get confidence intervals of proportions (sometimes for 
subgroups) estimated from complex survey data. Because a function like 
prop.test() does not exist for the survey package I tried the following:

1) Define a survey object (PSU of clustered sample, population weights);
2) Use svyglm() of the package survey to estimate a binary logistic 
regression (family='binomial'): For the confidence interval of a single 
proportion regress the binary dependent variable on a constant (1), for 
confidence intervals of that variable for subgroups regress this 
variable on the groups (factor) variable;
3) Use predict() to obtain estimated logits and the respective standard 
errors (mod.dat specifiying either the constant or the subgroups):

pred=predict(model,mod.dat,type='link',se.fit=T)

and apply the following to obtain the proportion with its confidence 
intervals (for example, for conf.level=.95):

lo.e = pred[1:length(pred)]-qnorm((1+conf.level)/2)*SE(pred)
hi.e = pred[1:length(pred)]+qnorm((1+conf.level)/2)*SE(pred)
prop = 1/(1+exp(-pred[1:length(pred)]))
lo = 1/(1+exp(-lo.e))
hi = 1/(1+exp(-hi.e))

I think that in that way I get CI's based on asymptotic normality - 
either for a single proportion or split up into subgroups.

Question: Is this a correct or a defensible procedure? Or should I use a 
different approach? Note that this approach should also allow to 
estimate CI's for proportions of subgroups taking into account the 
complex survey design.

TIA,
Dirk


R version 2.5.1 Patched (2007-08-10 r42469)
i386-pc-mingw32

__
R-help@stat.math.ethz.ch 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: randomization t-test function already defined in R?

2007-09-05 Thread Karen.Green
Dear R Users,
 
I am hoping you can help me.
 
I have received code from a colleague who uses Matlab.  I need to
translate it into R.
 
I am wondering if there is a randomization t-test (from non-parametric
statistics) function already defined in R.
(In Matlab the function is randtest.m.)
 

**
QUESTION:  Is anyone aware of a randomization t-test function in R?

**

Thank you for your help,

Karen

---

 Karen M. Green, Ph.D.

 Research Investigator

 Drug Design Group

 Sanofi Aventis Pharmaceuticals

 1580 E. Hanley Blvd.

 Tucson, AZ  85737-9525

  USA 


[[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] question: randomization t-test function already defined in R?

2007-09-05 Thread Achim Zeileis
On Wed, 5 Sep 2007, [EMAIL PROTECTED] wrote:

 Dear R Users,

 I am hoping you can help me.

 I have received code from a colleague who uses Matlab.  I need to
 translate it into R.

 I am wondering if there is a randomization t-test (from non-parametric
 statistics) function already defined in R.
 (In Matlab the function is randtest.m.)

I don't know what randtest in MATLAB does exactly, but I guess that you 
might want to look at the function independence_test() in package coin. 
The distribution argument should probably set to use either exact or 
approximate p values.

hth,
Z

 
 **
 QUESTION:  Is anyone aware of a randomization t-test function in R?
 
 **

 Thank you for your help,

 Karen

 ---

 Karen M. Green, Ph.D.

 Research Investigator

 Drug Design Group

 Sanofi Aventis Pharmaceuticals

 1580 E. Hanley Blvd.

 Tucson, AZ  85737-9525

  USA


   [[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] change all . to 0 in a data.frame

2007-09-05 Thread Dieter Best
Hello,
  I read in a tab delimited text file via mydata = read.delim(myfile). The text 
file was originally an excel file where . was used in place of 0. Now all the 
columns which should be integers are factors. Any ideas how to change all the . 
to 0 and factors back to integer?
  Thanks a lot in advance for any suggestions,
  -- D

   
-

[[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] change all . to 0 in a data.frame

2007-09-05 Thread jim holtman
Here is one way.  You might want to read in the data with 'as.is=TRUE'
to prevent conversion to factors.

 x - data.frame(a=c(1,2,3,'.',5,'.'))
 str(x)
'data.frame':   6 obs. of  1 variable:
 $ a: Factor w/ 5 levels .,1,2,3,..: 2 3 4 1 5 1
 # replace '.' with zero; either readin with 'as.is=TRUE' or convert to 
 character
 x$a - as.character(x$a)
 x$a[x$a == '.'] - '0'
 x$a - as.numeric(x$a)
 str(x)
'data.frame':   6 obs. of  1 variable:
 $ a: num  1 2 3 0 5 0




On 9/5/07, Dieter Best [EMAIL PROTECTED] wrote:
 Hello,
  I read in a tab delimited text file via mydata = read.delim(myfile). The 
 text file was originally an excel file where . was used in place of 0. Now 
 all the columns which should be integers are factors. Any ideas how to change 
 all the . to 0 and factors back to integer?
  Thanks a lot in advance for any suggestions,
  -- D


 -

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

__
R-help@stat.math.ethz.ch 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] The variables combined in a table from other table and combination questions

2007-09-05 Thread leeznar
Dear All:
I need to have some data frame objects.
First aa object:
   pH  Formulation  time  Subject
[1]1.2  F   0   1
[2]7.4  S   1   2
[3]MF   2   3
[4] 3   4
[5] ni
Then, I need to produce 2*3(pH*formulation) different 
tables.  This table includes column of (pH,
Formulation, time  S1  S2  S3 …..Si) and S1= subject
1, S2=subject 2 and so on.  For example: bb1 table
   pH  Formulation  time  S1  S2  S3….Si
[1]1.2  F   0   
[2] 1   
[3] 2   
[4] 3   
[5] n   

For example: bb2 table
   pH  Formulation  time  S1  S2  S3….Si
[1]1.2  S   0   
[2] 1   
[3] 2   
[4] 3   
[5] n   


Moreover, the values of pH and Formulation column are
the combination questions.  The values of pH and
Formulation column should be the combinations such as
(1.2, F), (1.2, S), (1.2, MF), (7.4, F), (7.4, S),
(7.4, MF)
I am a beginner level in R and I have no idea how to
do this. Could any one please help me.  Thanks a
lot!!!

Best regrards
Hsin Ya Lee

__
R-help@stat.math.ethz.ch 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] Rggobi compilation error: display.c

2007-09-05 Thread Yuelin Li
On a ubuntu linux computer (Feisty, i386), I compile R and additional
packages from source.  The compiler is gcc 4.1.2.

The problem is, I can run sudo R and successfully compile all
packages (e.g., MASS, lattice) except rggobi.  The error seems to be
in display.c.  My ggobi is in /usr/local/, which R can find.  I don't
think this is a dependence issue because install.packages(...,
dependence=TRUE).  The script complains about not finding
/usr/local/lib/R/library/rggobi/libs/*, but that directory is there,
with one file rggobi.so (possibly from an earlier successful
compilation).

Any suggestions on what I am doing wrong?  Many thanks in advance.

Yuelin.


- R output ---
 install.packages(rggobi, repos = http://lib.stat.cmu.edu/R/CRAN;, 
 dependencies = TRUE, clean = TRUE)
trying URL 'http://lib.stat.cmu.edu/R/CRAN/src/contrib/rggobi_2.1.6.tar.gz'
Content type 'application/x-gzip' length 424483 bytes
opened URL
==
downloaded 414Kb

* Installing *source* package 'rggobi' ...
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for GGOBI... yes
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -std=gnu99 -I/usr/local/lib/R/include -I/usr/local/lib/R/include -g 
-DUSE_EXT_PTR=1 -D_R_=1 -I/usr/local/include/ggobi -I/usr/include/gtk-2.0 
-I/usr/include/libxml2 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 
-I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 
-I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12   
-I/usr/local/include-fpic  -g -O2 -c brush.c -o brush.o

[... snipped ...]

gcc -std=gnu99 -I/usr/local/lib/R/include -I/usr/local/lib/R/include -g 
-DUSE_EXT_PTR=1 -D_R_=1 -I/usr/local/include/ggobi -I/usr/include/gtk-2.0 
-I/usr/include/libxml2 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 
-I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 
-I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12   
-I/usr/local/include-fpic  -g -O2 -c dataset.c -o dataset.o
gcc -std=gnu99 -I/usr/local/lib/R/include -I/usr/local/lib/R/include -g 
-DUSE_EXT_PTR=1 -D_R_=1 -I/usr/local/include/ggobi -I/usr/include/gtk-2.0 
-I/usr/include/libxml2 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 
-I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 
-I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12   
-I/usr/local/include-fpic  -g -O2 -c display.c -o display.o
display.c: In function ‘RS_GGOBI_createDisplay’:
display.c:37: warning: passing argument 3 of ‘klass-createWithVars’ makes 
pointer from integer without a cast
display.c:37: warning: passing argument 4 of ‘klass-createWithVars’ from 
incompatible pointer type
display.c:37: warning: passing argument 5 of ‘klass-createWithVars’ from 
incompatible pointer type
display.c:37: error: too many arguments to function ‘klass-createWithVars’
display.c:39: warning: passing argument 4 of ‘klass-create’ from incompatible 
pointer type
display.c:39: error: too many arguments to function ‘klass-create’
make: *** [display.o] Error 1
chmod: cannot access `/usr/local/lib/R/library/rggobi/libs/*': No such file or 
directory
ERROR: compilation failed for package 'rggobi'
** Removing '/usr/local/lib/R/library/rggobi'
** Restoring previous '/usr/local/lib/R/library/rggobi'

__
R-help@stat.math.ethz.ch 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] element wise opertation between a vector and a list

2007-09-05 Thread Charles C. Berry
On Wed, 5 Sep 2007, Greg Snow wrote:

 ?mapply
 mapply('+', a, b, SIMPLIFY=FALSE)
 colSums(mapply('+', a, b))


or
sapply( a, sum ) + b * sapply( a, length )

or even

sapply( a, sum ) + b * 2

if all list components in 'a' are of length 2.


Then there are the do.call( cbind , a ) incantations.

Chuck


 Hope this helps,

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



 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Yongwan Chun
 Sent: Monday, September 03, 2007 12:36 AM
 To: r-help@stat.math.ethz.ch
 Subject: [R] element wise opertation between a vector and a list

 I want to try to get a result of element wise addition
 between a vector and a list. It can be done with for
 statement. In order to reducing computing time, I have tried
 to avoid for state. If anybody give me an idea, I would
 apprecite it much.

 for example, with a  b as below lines,

 a- list(c(1,3),c(1,2),c(2,3))
 b-c(10,20,30)

 I would like to have a list (like d) or a vector (like e)
 as below.

 d-list(c((1+10),(3+10)),c((1+20),(2+20)),c((2+30),(3+30)))
 e- c((1+10)+(3+10),(1+20)+(2+20),(2+30)+(3+30))

 Thanks,


 Yongwan Chun

 __
 R-help@stat.math.ethz.ch 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.


Charles C. Berry(858) 534-2098
 Dept of Family/Preventive Medicine
E mailto:[EMAIL PROTECTED]  UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

__
R-help@stat.math.ethz.ch 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.