[R] R, Coda, and OpenBUGS

2009-10-07 Thread Bill Halteman

Hi All,

  I am trying to figure out how to use R-Coda with the output from 
OpenBugs. I have installed and loaded the packages BRugs and R2WinBUGS.  
I have successfully run a simple Bayes model in WinBUGS using R2WinBUGS' 
bugs and have used read.bugs to build the coda object.  I can 
successfully switch to OpenBugs and run the same model and get the basic 
summary back.  However, I cannot build the coda object.  From what I 
have read read.openbugs should do the trick.  However, I have 
discovered the current version of OpenBUGS (v 3.03) doesn't write any 
output files in spite of setting codaPkg=TRUE in the bugs call.  
Str(openbugs.object) reveals a large collection of elements, one of 
which is an array that contains the MCMC chains.  Is there a function to 
build the coda object?


Thanks in advance for any suggestions,

Bill Halteman

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] rpois formula

2009-10-07 Thread nedmt60

Hi all,

It's been a while since i've used R and I can't remember how to do the
following:

i have

a = rpois (10, x)
b = rpois (10, y)

what is the code to show that ab, ba and a=b to show just the number of
occurances?
at the moment when I type ab I get a nice long list of true or false.

so i'm hoping to have the following

ab
 35000
ba
 25000
a=b
 4

thanks in advance
-- 
View this message in context: 
http://www.nabble.com/rpois-formula-tp25774389p25774389.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] power?

2009-10-07 Thread SNN

Hi,

I have used multiple linear regression on a data set and one if the
regressor was significant with a p-value =0.01

I need to calculate the power for a multiple linear regression. i.e. do I
have enough power to believe the above p-value?



 
-- 
View this message in context: 
http://www.nabble.com/power--tp25776305p25776305.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] power?

2009-10-07 Thread Simon Blomberg
The short answer is Yes. If you reject the null hypothesis based on that
p-value, then by definition you had enough power to do that. This is
because there is a precise inverse relationship between the p-value and
the observed power, once you fix the effect size and the sample size.
In other words, your post-hoc power analysis would be a simple
re-statement of the p-value. There is no extra information that can be
gained from such an analysis. See:

The American Statistician, February 2001, Vol. 55, No. 1, pp 19-24

Don't bother with your power analysis, unless you are planning a new
experiment.

Simon.

On Tue, 2009-10-06 at 13:49 -0700, SNN wrote:
 Hi,
 
 I have used multiple linear regression on a data set and one if the
 regressor was significant with a p-value =0.01
 
 I need to calculate the power for a multiple linear regression. i.e. do I
 have enough power to believe the above p-value?
 
 
 
  


-- 
Simon Blomberg, BSc (Hons), PhD, MAppStat. 
Lecturer and Consultant Statistician 
School of Biological Sciences
The University of Queensland 
St. Lucia Queensland 4072 
Australia
Room 320 Goddard Building (8)
T: +61 7 3365 2506
http://www.uq.edu.au/~uqsblomb
email: S.Blomberg1_at_uq.edu.au

Policies:
1.  I will NOT analyse your data for you.
2.  Your deadline is your problem.

Statistics is the grammar of science - Karl Pearson

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] gnu ODBC driver for ORACLE in WinXP platform?

2009-10-07 Thread Prof Brian Ripley

On Tue, 6 Oct 2009, Kenneth Roy Cabrera Torres wrote:


Hi R users and Dr. Uwe Ligges:

I read on the ROracle pre-compiled binary README file that:


Hmm, that is from the CRAN README on Windows pre-compiled binary 
packages: there is no 'ROracle pre-compiled binary' (for Windows or 
Mac OS X) on CRAN.



Although the package ROracle passes make check, it seems to be
dangerous to distribute it:
I do not have the software available this package depends on.

Why it is dangerous to use ROracle for windows?
What software does ROracle depends on in windows platform?


Oracle (just like every other platform)!  I believe the statement is 
out-of-date: ROracle seems not to build with current versions of R. 
But the main issues were


(a) It needs to link against Oracle's client software, and that 
depends on the particular version of Oracle.  Bitter experience 
suggests that you need to build such packages from the sources against 
the client software installed on your machine to get reliable service 
from them.


(b) The package does no actual tests in its examples.  It may appear 
to build but not work in practice, since nothing is tested in the 
build process.



Is there a GNU solution for an ODBC driver on windows XP platform
for ORACLE for use it with RODBC?


What does GNU have to do with this?  RODBC works with Oracle with 
Oracle's own Windows drivers, and a test suite for Oracle is in the 
sources.  Now, that has been tested against only a couple of versions 
of Oracle, but ODBC is a well-documented API and Oracle's ODBC driver 
writers should always be complying with it.


If perchance by 'GNU' you meant 'GPL' or 'Open Source' then

- Oracle is proprietary, although there are 'free as in beer'
  versions.

- the most open you can be is to communicate with it via an open API,
  and ODBC is such (and I think the only one supported by Oracle).



Thank you for your help.


It does seem churlish to be asking why the hard-working volunteers 
have *not* provided you with a binary version of a package, and such 
queries are more common than thanks for those that *are* provided 
(something like 20x as many).




Kenneth


--
Brian D. Ripley,  rip...@stats.ox.ac.uk
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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] RExcel

2009-10-07 Thread Benjamin Ward
Hello-

I am a Graduate Assistant for an instructor who has written programs for
statistics calculations such as binomial distributions and regressions.

The programs had worked with no problem in Excel 2003. Now we are trying to
use it with Excel 2007, and we are having some trouble.

I have downloaded RandFriends and have ran the binomial distribution
process in 2007 Excel and have received an error that says: Compile error
in hidden module: UFDBinomial

However, ther are two demo excel files in the RExcel file called RdemoDens.
When I open the first RDemoDens excel file, I can run the processes and they
work fine. When I run the second RDemoDens excel file, or a blank excel 2007
file, the processes do not work and I get the error message.

I am trying to figure out what is different about the first RDemoDens excel
file that allows the calculations to process correctly. I am thinking that
something in the macro library in the demo must be different than what is in
a blank excel document. I just cannot seem to figure out what it is.

One thing that I did notice is that there are two different RExcel files in
the RExcel folder. One is labled RExcel and one is labed RExcel 2007.
What are the difference between these two RExcel files? I am not sure if
this has anything to do with the problem, but perhaps the excel demo in
which our calculations work uses the correct RExcel file while a regular
excel 2007 document does not call the correct one.

If anyone has an idea about what might be happening here, or who else I
could ask about the situation, I would appreciate any input.

Thanks,

Ben Ward

[[alternative HTML version deleted]]

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


[R] R-beta: adjusting y-axis scale with multiple lines in plot

2009-10-07 Thread Marko Lõoke


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Saving tkrplot/Clearing contents on frames/tkProgressBar

2009-10-07 Thread c...@wcs


1) How do i save tkrplots?do the Jpeg,png commands used for saving plots of
RGui work for tkrplots?
2)How do I embed tkProgressBar onto a frame.I do not want that to appear in
separate window?
3)Is it possible to insert a StatusBar at the bottom of the window.(My
window has three frames)?
4)My window has three frames.There is a button 'RUN' on the first frame
.when I run, a table and a plot are displayed in the second frame.I change
some parameters and 'RUN' again..then the new table and plot get appended in
the second frame.I do not want this to happen.I want the older results to be
overwritten by the new results.How or which command do I use ?
I am new to R and experimenting with RTcltk package.Please advise !

-- 
View this message in context: 
http://www.nabble.com/Saving-tkrplot-Clearing-contents-on-frames-tkProgressBar-tp25781456p25781456.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] gnu ODBC driver for ORACLE in WinXP platform?

2009-10-07 Thread Uwe Ligges



Prof Brian Ripley wrote:

On Tue, 6 Oct 2009, Kenneth Roy Cabrera Torres wrote:


Hi R users and Dr. Uwe Ligges:

I read on the ROracle pre-compiled binary README file that:


Hmm, that is from the CRAN README on Windows pre-compiled binary 
packages: there is no 'ROracle pre-compiled binary' (for Windows or Mac 
OS X) on CRAN.



Although the package ROracle passes make check, it seems to be
dangerous to distribute it:
I do not have the software available this package depends on.

Why it is dangerous to use ROracle for windows?
What software does ROracle depends on in windows platform?


Oracle (just like every other platform)!  I believe the statement is 
out-of-date: ROracle seems not to build with current versions of R. But 
the main issues were



Indeed, the statement is out of date. I haven't tried to build it for 
years now. Will change that part of the ReadMe.

Thanks to Brian for the comprehensive answer.

Best,
Uwe Ligges






(a) It needs to link against Oracle's client software, and that depends 
on the particular version of Oracle.  Bitter experience suggests that 
you need to build such packages from the sources against the client 
software installed on your machine to get reliable service from them.


(b) The package does no actual tests in its examples.  It may appear to 
build but not work in practice, since nothing is tested in the build 
process.



Is there a GNU solution for an ODBC driver on windows XP platform
for ORACLE for use it with RODBC?


What does GNU have to do with this?  RODBC works with Oracle with 
Oracle's own Windows drivers, and a test suite for Oracle is in the 
sources.  Now, that has been tested against only a couple of versions of 
Oracle, but ODBC is a well-documented API and Oracle's ODBC driver 
writers should always be complying with it.


If perchance by 'GNU' you meant 'GPL' or 'Open Source' then

- Oracle is proprietary, although there are 'free as in beer'
  versions.

- the most open you can be is to communicate with it via an open API,
  and ODBC is such (and I think the only one supported by Oracle).



Thank you for your help.


It does seem churlish to be asking why the hard-working volunteers have 
*not* provided you with a binary version of a package, and such queries 
are more common than thanks for those that *are* provided (something 
like 20x as many).




Kenneth




__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 output profile plots for groups using lattice package

2009-10-07 Thread Peter Ehlers

see below

George Kalema wrote:

Dear R users,
I am trying to have an xyplot of a data set which has the following
variables:
case (n=10,20,30)
parameter (parm=a,b)
group (grp=g1,g2)
y (y values)
x (x=2,4,8)

My plot should be parameter by case such that I have 2 rows (each row= each
parameter) and 3 columns (each column=each case). My R-code is as follows
but I am not able to get what I want to:

tp1.sim - xyplot(y~ x | case + parm , group=group, data = data, lty = 1:4 ,
pch = 1:4)
print(tp1.sim)

How can I have two lines (for g1 and g2) in each plot (each box)?

include the type=b argument


How do I label the x-axis with only values 2, 4, 8?

include the scales= argument or make x a factor


How do I label each column with the corresponding case number?

make 'case' a factor

The following should do what you want:

xyplot(y ~ x | factor(case) + parm, group=group, data=data,
type='b', lty=1:2, pch=1:2,
scales=list(x=list(at=c(2,4,8)))
)

I don't understand why you want 4 line types/point chars.

 -Peter Ehlers



My hypothetical data set is as follows:

parm x case y group
a 2 10 0.03 g1
b 2 10 0.02 g1
a 4 10 0.03 g1
b 4 10 0.02 g1
a 8 10 0.03 g1
b 8 10 0.02 g1
a 2 20 0.03 g1
b 2 20 0.02 g1
a 4 20 0.03 g1
b 4 20 0.02 g1
a 8 20 0.03 g1
b 8 20 0.02 g1
a 2 30 0.03 g1
b 2 30 0.02 g1
a 4 30 0.03 g1
b 4 30 0.02 g1
a 8 30 0.03 g1
b 8 30 0.02 g1
a 2 10 0.13 g2
b 2 10 0.12 g2
a 4 10 0.13 g2
b 4 10 0.12 g2
a 8 10 0.13 g2
b 8 10 0.12 g2
a 2 20 0.13 g2
b 2 20 0.12 g2
a 4 20 0.13 g2
b 4 20 0.12 g2
a 8 20 0.13 g2
b 8 20 0.12 g2
a 2 30 0.13 g2
b 2 30 0.12 g2
a 4 30 0.13 g2
b 4 30 0.12 g2
a 8 30 0.13 g2
b 8 30 0.12 g2

Many thanks in advance for your response.

George

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Is there a recent book on Q-Q plot and data visualization in general?

2009-10-07 Thread Paul Hiemstra

Hi,

See page 335 for a qq plot in the third edition of the book.

cheers,
Paul

Peng Yu wrote:

Hi,

I checked the 3rd edition of this book. But I don't find Q-Q plot.
Would you please take a look of the table of content below and let me
know if the same section is available in the 3rd edition?

http://www.amazon.com/Plane-Answers-Complex-Questions-Theory/dp/0387953612/ref=sr_1_1?ie=UTF8s=booksqid=1254856526sr=8-1#reader

Regards,
Peng

On Tue, Oct 6, 2009 at 9:50 AM, Paul Hiemstra p.hiems...@geo.uu.nl wrote:
  

Hi Peng Yu,

Chapter 13 of the following book provides a good description of the
assumption done when using regression and other techniques. It also
discusses the QQplot.

@BOOK{Christensen1996,
 title = {Plane Answers to Complex Questions: The Theory of Linear Models},
 publisher = {Springer, New York},
 year = {1996},
 author = {Ronald Christensen},
 edition = {Second},
 note = {496p},
}

cheers,
Paul

Peng Yu wrote:


Hi,

I want to look for some detailed explanation on the properties of Q-Q
plot and how the properties are derived.

In R, there is the following reference.
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S
Language. Wadsworth  Brooks/Cole.

Somebody also mentioned the following book chapter to me.
Chambers et al., Graphical methods for Data Analysis, Ch.6.

But both books are old. I'm wondering if there is any more recent
(therefore, maybe better) books for Q-Q plot, and data visualization
in general.

Regards,
Peng

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

  

--
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone:  +3130 274 3113 Mon-Tue
Phone:  +3130 253 5773 Wed-Fri
http://intamap.geo.uu.nl/~paul





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



--
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone:  +3130 274 3113 Mon-Tue
Phone:  +3130 253 5773 Wed-Fri
http://intamap.geo.uu.nl/~paul

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


Re: [R] plot an arrow / add arrow to a line

2009-10-07 Thread Peter Ehlers

For nicer arrows, there are also the p.arrows() function in
pkg:sfsmisc and the Arrows() function in pkg:IDPmisc.

 -Peter Ehlers

Sarah Goslee wrote:

How about arrows() ?

On Tue, Oct 6, 2009 at 4:25 PM, Martin Batholdy batho...@googlemail.com wrote:

hi,

is it possible to end a line plotted with lines() with an arrow?
Or are there any other functions to add an arrow to plot?


thanks!



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] 'persp' query

2009-10-07 Thread Peter Ehlers

Certainly, you will want to set zlab=.
mtext() is quite flexible; you can control distance to the
axis with line=1.5, say. But remember that mtext()
is a 2-dim graphics function - it looks at your plot as
a 2-d plot. That's why I made the comment about your
z-axis having to be fairly close to vertical on the page.
Try the first example in ?persp and follow the call with
mtext(my z label, side=2). Because of the tilt of
the z-axis, this looks a bit strange (to me).

 -Peter Ehlers

Geoffrey William Heard wrote:

Much thanks David and Peter

I thought about mtext, but didn't try it, as was unsure what the
appropriate 'side' value would be. Any thoughts?

Cheers

Geoff

-Original Message-
From: Peter Ehlers [mailto:ehl...@ucalgary.ca] 
Sent: Wednesday, 7 October 2009 1:43 AM

To: David Winsemius
Cc: Geoffrey William Heard; r-help@r-project.org
Subject: Re: [R] 'persp' query



David Winsemius wrote:

On Oct 6, 2009, at 4:46 AM, Geoffrey William Heard wrote:


Hi All

I'm creating some 3-D plots using the function 'persp', and have a 
query regarding the ability to make changes to the label of the

z-axis.
There are two things I would like to do. First, the default setting 
places the label a little close to the axis for my liking. Is there 
any way of moving the label? I've tried adjustments with 'mgp' in 
'par', but without success. The second is to change the direction of 
the label. Currently it reads top to bottom, whereas I would like it 
to read bottom to top, as per a y-axis on a standard plot. Is there 
anyway of doing so?

?mtext   # and use the adj argument


Good idea. This works well if your z-axis is fairly vertical
on you plot.

  -Peter Ehlers




__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] RExcel

2009-10-07 Thread Erich Neuwirth

Please post this kind of questions to the rcom mailing list.
You can subscribe at rcom.univie.ac.at

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 mirroring CRAN

2009-10-07 Thread Rainer M Krug
Hi

this might be the wrong mailing list, but it also does not fit the dev list.

As we are planning to setup a mirror of CRAN, we would like to know the
approximate size of the mirror and the necessary bandwidth requirements to
keep it updated.

Thanks a lot in advance,

Rainer

-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Cell:   +27 - (0)83 9479 042
Fax:+27 - (0)86 516 2782
Fax:+49 - (0)721 151 334 888
email:  rai...@krugs.de

Skype:  RMkrug
Google: r.m.k...@gmail.com

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] two plots on the same axis

2009-10-07 Thread ogbos okike
Good morning. I wish to plot two data on the same axis. I tried plot(x,y,
type = l) for the first and tried to use lines or points(x,y, lty = 2, col
= 4) to add or plot the second data on alongside the first. However, what I
got was not encouraging.
I have attached the two data and would be pleased if anybody could be of
help.
Thank you
Best regards
Ogbos
05  1  1  3974.8
05  1  2  3967.2
05  1  3  3817.7
05  1  4  3789.4
05  1  5  3803.6
05  1  6  3831.4
05  1  7  3878.6
05  1  8  3861.5
05  1  9  3850.4
05  1 10  3855.0
05  1 11  3900.9
05  1 12  3952.2
05  1 13  3954.7
05  1 14  3942.9
05  1 15  3955.0
05  1 16  3934.1
05  1 17  3859.2
05  1 18  3530.9
05  1 19  3299.9
05  1 20  3398.1
05  1 21  3305.5
05  1 22  3457.7
05  1 23  3753.8
05  1 24  3846.8
05  1 25  3896.9
05  1 26  3914.3
05  1 27  3917.9
05  1 28  3910.1
05  1 29  3938.0
05  1 30  3975.7
05  1 31  3945.0
05  2  1  3952.3
05  2  2  3948.1
05  2  3  3946.7
05  2  4  3957.1
05  2  5  3968.9
05  2  6  3990.2
05  2  7  3980.0
05  2  8  3965.8
05  2  9  3952.8
05  2 10  3942.0
05  2 11  3938.9
05  2 12  3967.6
05  2 13  3986.9
05  2 14  3992.8
05  2 15  3982.8
05  2 16  3986.3
05  2 17  3972.5
05  2 18  3951.4
05  2 19  3929.4
05  2 20  3928.5
05  2 21  3939.6
05  2 22  3951.5
05  2 23  3950.2
05  2 24  3956.3
05  2 25  3970.4
05  2 26  3981.4
05  2 27  3994.2
05  2 28  3988.9
05  3  1  3997.1
05  3  2  4003.9
05  3  3  4011.0
05  3  4  4017.0
05  3  5  4003.2
05  3  6  3993.1
05  3  7  3996.8
05  3  8  3999.1
05  3  9  3988.6
05  3 10  4002.2
05  3 11  3997.9
05  3 12  3981.5
05  3 13  3996.8
05  3 14  4026.5
05  3 15  4025.5
05  3 16  4021.8
05  3 17  4016.5
05  3 18  4011.7
05  3 19  3975.9
05  3 20  3981.0
05  3 21  3961.2
05  3 22  3965.2
05  3 23  3981.5
05  3 24  3996.4
05  3 25  3981.9
05  3 26  3979.0
05  3 27  3976.5
05  3 28  3973.7
05  3 29  3959.5
05  3 30  3974.0
05  3 31  3980.2
05  4  1  3972.3
05  4  2  3982.2
05  4  3  4008.9
05  4  4  4007.0
05  4  5  4009.1
05  4  6  3990.5
05  4  7  4002.5
05  4  8  4027.3
05  4  9  4047.8
05  4 10  4039.4
05  4 11  4025.0
05  4 12  4025.3
05  4 13  4006.2
05  4 14  4013.0
05  4 15  4018.7
05  4 16  4031.2
05  4 17  4037.3
05  4 18  4053.2
05  4 19  4065.3
05  4 20  4065.5
05  4 21  4042.3
05  4 22  4004.8
05  4 23  3974.9
05  4 24  3995.5
05  4 25  4007.9
05  4 26  4005.5
05  4 27  4019.7
05  4 28  4030.3
05  4 29  4045.4
05  4 30  4031.4
05  5  1  3995.6
05  5  2  3978.2
05  5  3  3993.3
05  5  4  4018.4
05  5  5  4027.6
05  5  6  4006.0
05  5  7  3985.5
05  5  8  3993.1
05  5  9  3817.5
05  5 10  3849.4
05  5 11  3880.4
05  5 12  3896.8
05  5 13  3911.0
05  5 14  3922.4
05  5 15  3703.7
05  5 16  3703.8
05  5 17  3783.5
05  5 18  3809.5
05  5 19  3805.4
05  5 20  3837.9
05  5 21  3876.8
05  5 22  3898.2
05  5 23  3925.6
05  5 24  3954.2
05  5 25  3980.9
05  5 26  4007.8
05  5 27  4033.5
05  5 28  4035.3
05  5 29  3957.9
05  5 30  3948.2
05  5 31  3958.8
05  6  1  3973.1
05  6  2  3984.0
05  6  3  4010.9
05  6  4  4027.2
05  6  5  4040.0
05  6  6  4049.8
05  6  7  4027.3
05  6  8  4023.0
05  6  9  4033.8
05  6 10  4051.4
05  6 11  4063.6
05  6 12  4023.0
05  6 13  3998.4
05  6 14  3996.8
05  6 15  3962.9
05  6 16  3922.2
05  6 17  3919.3
05  6 18  3953.7
05  6 19  3994.4
05  6 20  4004.1
05  6 21  3999.8
05  6 22  3981.9
05  6 23  4058.7
05  6 24  4030.6
05  6 25  3999.0
05  6 26  4012.5
05  6 27  4034.3
05  6 28  4044.1
05  6 29  4042.9
05  6 30  4050.3
05  7  1  4049.5
05  7  2  4042.0
05  7  3  4055.2
05  7  4  4059.7
05  7  5  4075.2
05  7  6  4087.6
05  7  7  4083.7
05  7  8  4071.0
05  7  9  4098.5
05  7 10  4024.6
05  7 11  3967.0
05  7 12  3957.2
05  7 13  3896.8
05  7 14  3913.0
05  7 15  3928.0
05  7 16  3888.0
05  7 17  3684.0
05  7 18  3713.6
05  7 19  3820.1
05  7 20  3915.7
05  7 21  4011.0
05  7 22  4004.8
05  7 23  4003.7
05  7 24  3993.1
05  8  2  3927.9
05  8  3  3916.7
05  8  4  3950.6
05  8  5  3936.2
05  8  6  3900.1
05  8  7  3814.6
05  8  8  3861.2
05  8  9  3913.0
05  8 10  3925.0
05  8 11  3907.4
05  8 12  3943.5
05  8 13  3934.6
05  8 14  3938.9
05  8 15  3952.2
05  8 16  3956.1
05  8 17  3976.6
05  8 18  3998.5
05  8 19  4009.5
05  8 20  4007.0
05  8 21  3994.8
05  8 22  4009.2
05  8 23  4042.2
05  8 24  3942.1
05  8 25  3842.2
05  8 26  3907.3
05  8 27  3954.9
05  8 28  3967.2
05  8 29  4014.9
05  8 30  4013.2
05  8 31  3999.4
05  9  1  4007.0
05  9  2  3988.5
05  9  3  3947.2
05  9  4  3946.2
05  9  5  3945.7
05  9  6  3956.0
05  9  7  3980.1
05  9  8  4003.5
05  9  9  3975.5
05  9 10  3903.8
05  9 11  3544.0
05  9 12  3509.6
05  9 13  3463.4
05  9 14  3533.4
05  9 15  3523.9
05  9 16  3567.0
05  9 17  3657.8
05  9 18  3763.7
05  9 19  3805.4
05  9 20  3848.3
05  9 21  3874.8
05  9 22  3901.1
05  9 23  3911.2
05  9 24  3946.8
05  9 25  3927.6
05  9 26  3938.6
05  9 27  3960.8
05  9 28  3961.2
05  9 29  3981.9
05  9 30  3991.5
05 10  1  3987.1
05 10  2  4003.5
05 10  3  4026.8
05 10  4  4044.3
05 10  5  4050.2
05 10  6  4062.4
05 10  7  4069.4
05 10  8  4049.9

[R] Second y-axis --- alternative to par(new=

2009-10-07 Thread Rainer M Krug
Hi

is there an alternative to par(new), for ading data to a plot for a
different y-axis?
My problem with par(new=TRUE) is, that it re-defines all axis and labels (as
in example 1) and one has to use xlim=... to fix the x-axis.
I am looking for something, which simply resets the y-axis, so that a new
plot() (or points()/lines()) keeps the x-axis, but re-defines the y-axis.

Is there something available? I could re-scale the y-data to fit the
existing y-axis, but that would mean to define all the labels and tickmarks
for axis 4 manually.

HEre is an example about what I mean:

x1 - 1:10
y1 - runif(10)
x2 - 1:11
y2 - c(y1*100, 0)

## (1) Does not plot points where (x-axis) they should be
plot(x1, y1, type=l)
par(new=TRUE)
plot(x2, y2, type=p)
axis(4)

## (2) Does plot points where (x-axis) they should be
xlim - range(x1)
plot(x1, y1, type=l, xlim=xlim)
par(new=TRUE)
plot(x2, y2, type=p, xlim=xlim)
axis(4)

Cheers,


Rainer
-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Cell:   +27 - (0)83 9479 042
Fax:+27 - (0)86 516 2782
Fax:+49 - (0)721 151 334 888
email:  rai...@krugs.de

Skype:  RMkrug
Google: r.m.k...@gmail.com

[[alternative HTML version deleted]]

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


[R] Odp: two plots on the same axis

2009-10-07 Thread Petr PIKAL
Hi

You did not provide enough information of what and how you want to do the 
plot

 summary(temp)
   V1  V2   V3  V4 
 Min.   :5   Min.   : 1.000   Min.   : 1.00   Min.   :3300 
 1st Qu.:5   1st Qu.: 3.000   1st Qu.: 8.00   1st Qu.:3947 
 Median :5   Median : 6.000   Median :15.00   Median :3996 
 Mean   :5   Mean   : 6.513   Mean   :15.52   Mean   :3976 
 3rd Qu.:5   3rd Qu.:10.000   3rd Qu.:23.00   3rd Qu.:4053 
 Max.   :5   Max.   :12.000   Max.   :31.00   Max.   :4137 
 temp2-read.table(2006.txt)
 summary(temp2)
   V1  V2   V3  V4 
 Min.   :6   Min.   : 1.000   Min.   : 1.00   Min.   :4010 
 1st Qu.:6   1st Qu.: 3.000   1st Qu.: 9.00   1st Qu.:4190 
 Median :6   Median : 5.500   Median :16.00   Median :4225 
 Mean   :6   Mean   : 5.725   Mean   :16.04   Mean   :4213 
 3rd Qu.:6   3rd Qu.: 8.000   3rd Qu.:23.00   3rd Qu.:4248 
 Max.   :6   Max.   :11.000   Max.   :31.00   Max.   :4312

From summaries of your data you have 2 files with year no in first, month 
in second, day in third and some value in fourth column. The value from 
year 2006 is greater than the value in 2005. 

For accommodating all 4.column data you need to set correct range by ylim.
And if you use lines on non sorted values it can result in clump of lines. 
You could maybe consult ?aggregate and or ?supsmu

However only you know what you want as an x values and as an y values. 

Regards
Petr


r-help-boun...@r-project.org napsal dne 07.10.2009 10:12:24:

 Good morning. I wish to plot two data on the same axis. I tried 
plot(x,y,
 type = l) for the first and tried to use lines or points(x,y, lty = 2, 
col
 = 4) to add or plot the second data on alongside the first. However, 
what I
 got was not encouraging.
 I have attached the two data and would be pleased if anybody could be of
 help.
 Thank you
 Best regards
 Ogbos
 [příloha 2005.txt odstraněna uživatelem Petr PIKAL/CTCAP] [příloha 
2006.txt 
 odstraněna uživatelem Petr PIKAL/CTCAP] 
__
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] two plots on the same axis

2009-10-07 Thread baptiste auguie
Hi,

Your two data sets have a different year so I'm not sure what you want
to do with the x axis.

The code below plots both data sets on the same graph, with a range of
two years,


d1 - read.table(~/Downloads/2005.txt)
d2 - read.table(~/Downloads/2006.txt)


cleanup - function(d){
  names(d) - c(year, month, day, value)
  transform(d, date=as.Date(paste(0, year, month, day, sep=), %y%m%d))
}

d1 - cleanup(d1)
d2 - cleanup(d2)

d - rbind(d1, d2)
d - transform(d, year=factor(year))

with(d, plot(date,value))

# prettier with ggplot2
library(ggplot2)
qplot(date, value, data=d, colour=year)


HTH,

baptiste


2009/10/7 ogbos okike ogbos.ok...@gmail.com:
 Good morning. I wish to plot two data on the same axis. I tried plot(x,y,
 type = l) for the first and tried to use lines or points(x,y, lty = 2, col
 = 4) to add or plot the second data on alongside the first. However, what I
 got was not encouraging.
 I have attached the two data and would be pleased if anybody could be of
 help.
 Thank you
 Best regards
 Ogbos

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] communication of R Programs

2009-10-07 Thread wesley mathew
 Dear All

I am very beginner in R
I need to communicate between R programs.
I have one R program for writing data in XML File.
suppose I can execute same program in different R section for writing
different XML files
but another R program need to read these data after i wrote in XML file.
Could you please suggest which is the best method for this type of
communication in R Environment.
Thanks in advance!
Kind Regard
W. Mathew
-- 
Wesley C Mathew

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] 1st R Conferences in Spain!!

2009-10-07 Thread Usuario R
Hi all,

I would like to announce that the firsts *R Conferences for the Spanish R
community* will be taken place in University of Murcia  on 26 and 27th of
November.

You can have all the information in the web page:
http://www.ereros.org/where you can also subscribe and send your talk
proposals to this direction:
comunicaciones2...@ereros.org

If you need more information about the *R Conf 2009 in Spain*, you can
subscribe to the *R-help-es* mailing list: *
https://stat.ethz.ch/mailman/listinfo/r-help-es* or directly write to me.

Best regards!!!

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 with regexps

2009-10-07 Thread Luca Braglia
Hello everybody

I'd like to match exactly numbers from 1 to 27.
I've tried a character class like [1-27], but it matches 1,2 and 7.
How to tell R (pcre) to interpret 27 correctly?
Have been fastly looking throughout pcre man pages, without success.

Many thanks

Luca

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


[R] Odp: Second y-axis --- alternative to par(new=

2009-10-07 Thread Petr PIKAL
Hi

Try ?twoord.plot from plotrix package.

Regards
Petr



r-help-boun...@r-project.org napsal dne 07.10.2009 10:29:53:

 Hi
 
 is there an alternative to par(new), for ading data to a plot for a
 different y-axis?
 My problem with par(new=TRUE) is, that it re-defines all axis and labels 
(as
 in example 1) and one has to use xlim=... to fix the x-axis.
 I am looking for something, which simply resets the y-axis, so that a 
new
 plot() (or points()/lines()) keeps the x-axis, but re-defines the 
y-axis.
 
 Is there something available? I could re-scale the y-data to fit the
 existing y-axis, but that would mean to define all the labels and 
tickmarks
 for axis 4 manually.
 
 HEre is an example about what I mean:
 
 x1 - 1:10
 y1 - runif(10)
 x2 - 1:11
 y2 - c(y1*100, 0)
 
 ## (1) Does not plot points where (x-axis) they should be
 plot(x1, y1, type=l)
 par(new=TRUE)
 plot(x2, y2, type=p)
 axis(4)
 
 ## (2) Does plot points where (x-axis) they should be
 xlim - range(x1)
 plot(x1, y1, type=l, xlim=xlim)
 par(new=TRUE)
 plot(x2, y2, type=p, xlim=xlim)
 axis(4)
 
 Cheers,
 
 
 Rainer
 -- 
 Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation 
Biology,
 UCT), Dipl. Phys. (Germany)
 
 Centre of Excellence for Invasion Biology
 Natural Sciences Building
 Office Suite 2039
 Stellenbosch University
 Main Campus, Merriman Avenue
 Stellenbosch
 South Africa
 
 Cell:   +27 - (0)83 9479 042
 Fax:+27 - (0)86 516 2782
 Fax:+49 - (0)721 151 334 888
 email:  rai...@krugs.de
 
 Skype:  RMkrug
 Google: r.m.k...@gmail.com
 
[[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] 1st R Conferences in Spain!!

2009-10-07 Thread Usuario R
Hi all,

I am sending you again the links for the R Conferences in Spain, I think in
the previous message they where not correct:


Web page:  www.ereros.org

Email to send talk proposals:  comunicaciones2...@ereros.org

Information of the Spanish R community:
https://stat.ethz.ch/mailman/listinfo/r-help-es



Best regards!!




2009/10/7 Usuario R r.user.sp...@gmail.com

 Hi all,

 I would like to announce that the firsts *R Conferences for the Spanish R
 community* will be taken place in University of Murcia  on 26 and 27th of
 November.

 You can have all the information in the web page: http://www.ereros.org/where 
 you can also subscribe and send your talk proposals to this direction:
 comunicaciones2...@ereros.org

 If you need more information about the *R Conf 2009 in Spain*, you can
 subscribe to the *R-help-es* mailing list: *
 https://stat.ethz.ch/mailman/listinfo/r-help-es* or directly write to me.

 Best regards!!!



[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] previous.best in metaMDS

2009-10-07 Thread Gavin Simpson
On Tue, 2009-10-06 at 11:03 +0200, Kim Vanselow wrote:
 Dear R-community, dear Jari Oksanen!
 I use metaMDS (package vegan) to calculate NMDS.
 In a lot of papers I read that it is recommended to use previous best 
 solutions as a new starting configuration to get better results and to avoid 
 local minima.
 On the help page I found that a previous.best-command is already implemented 
 in metaMDS:
 metaMDS(comm, distance = bray, ...,plot = FALSE, previous.best,...)
 But unfortunately I did not manage to use it properly.
 When I run metaMDS without command previous.best I certainly get a result.
 I run it again with command previous.best and I get this message:
 Fehler in metaMDS(data...  : 
   object previous.best not found
 My question: How can I save the best solution and use it in the next NMDS.
 
 I also tried to type in the command: previous.best = TRUE
 Then I get the message:
 Starting from a previous solution
 Fehler in s0$stress : $ operator is invalid for atomic vectors
 
 Could you please help me?
 Thank you very much,
 Kim

That argument allows you to pass metaMDS the results of a previous call
to metaMDS, such that the function compares the new set of random starts
to the previously achieved best solution. For example;

require(vegan)
data(dune)
set.seed(123)
sol - metaMDS(dune)
sol - metaMDS(dune, previous.best = sol)

For this example, the first call to metaMDS converges to the same
solution twice within 5 iterations. The second call to metaMDS tells it
to compare with the solution found from the first call. A single
iteration is required to find a solution that is effectively the same as
the solution from the first call.

Note how this feature is used; we save the results of the metaMDS
function in object 'sol'. We then supply this object to the argument
'previous.best' on our subsequent call to metaMDS.

Does that help?

The example in ?metaMDS is quite terse and only covers the basic usage.
I'll see about adding some further examples to it for future versions.

G

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Second y-axis --- alternative to par(new=

2009-10-07 Thread Rainer M Krug
On Wed, Oct 7, 2009 at 11:28 AM, Petr PIKAL petr.pi...@precheza.cz wrote:

 Hi

 Try ?twoord.plot from plotrix package.


Thanks Petr - I was not aeware of this command.
But I would prefer a more general solution. An example on where I am using
is, to plot a histogram overlayed by its density estimate (easier to digest
for others then only a density estimate).

And a newY() (or par(newY=TRUE) command would enable exactly this.

Regards,

Rainer



 Regards
 Petr



 r-help-boun...@r-project.org napsal dne 07.10.2009 10:29:53:

  Hi
 
  is there an alternative to par(new), for ading data to a plot for a
  different y-axis?
  My problem with par(new=TRUE) is, that it re-defines all axis and labels
 (as
  in example 1) and one has to use xlim=... to fix the x-axis.
  I am looking for something, which simply resets the y-axis, so that a
 new
  plot() (or points()/lines()) keeps the x-axis, but re-defines the
 y-axis.
 
  Is there something available? I could re-scale the y-data to fit the
  existing y-axis, but that would mean to define all the labels and
 tickmarks
  for axis 4 manually.
 
  HEre is an example about what I mean:
 
  x1 - 1:10
  y1 - runif(10)
  x2 - 1:11
  y2 - c(y1*100, 0)
 
  ## (1) Does not plot points where (x-axis) they should be
  plot(x1, y1, type=l)
  par(new=TRUE)
  plot(x2, y2, type=p)
  axis(4)
 
  ## (2) Does plot points where (x-axis) they should be
  xlim - range(x1)
  plot(x1, y1, type=l, xlim=xlim)
  par(new=TRUE)
  plot(x2, y2, type=p, xlim=xlim)
  axis(4)
 
  Cheers,
 
 
  Rainer
  --
  Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
 Biology,
  UCT), Dipl. Phys. (Germany)
 
  Centre of Excellence for Invasion Biology
  Natural Sciences Building
  Office Suite 2039
  Stellenbosch University
  Main Campus, Merriman Avenue
  Stellenbosch
  South Africa
 
  Cell:   +27 - (0)83 9479 042
  Fax:+27 - (0)86 516 2782
  Fax:+49 - (0)721 151 334 888
  email:  rai...@krugs.de
 
  Skype:  RMkrug
  Google: r.m.k...@gmail.com
 
 [[alternative HTML version deleted]]
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.




-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Cell:   +27 - (0)83 9479 042
Fax:+27 - (0)86 516 2782
Fax:+49 - (0)721 151 334 888
email:  rai...@krugs.de

Skype:  RMkrug
Google: r.m.k...@gmail.com

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Second y-axis --- alternative to par(new=

2009-10-07 Thread Petr PIKAL
r-help-boun...@r-project.org napsal dne 07.10.2009 11:37:22:

 On Wed, Oct 7, 2009 at 11:28 AM, Petr PIKAL petr.pi...@precheza.cz 
wrote:
 
  Hi
 
  Try ?twoord.plot from plotrix package.
 
 
 Thanks Petr - I was not aeware of this command.
 But I would prefer a more general solution. An example on where I am 
using
 is, to plot a histogram overlayed by its density estimate (easier to 
digest
 for others then only a density estimate).

That is quite different from your example. I believe overlay of density 
curve over histogram was discussed several times e.g. 
http://tolstoy.newcastle.edu.au/R/e4/help/08/06/14198.html 

 
 And a newY() (or par(newY=TRUE) command would enable exactly this.

This is something beyond my knowledge and it could be that this need some 
deep redefining in base R graphics.

Regards
Petr

 
 Regards,
 
 Rainer
 
 
 
  Regards
  Petr
 
 
 
  r-help-boun...@r-project.org napsal dne 07.10.2009 10:29:53:
 
   Hi
  
   is there an alternative to par(new), for ading data to a plot for a
   different y-axis?
   My problem with par(new=TRUE) is, that it re-defines all axis and 
labels
  (as
   in example 1) and one has to use xlim=... to fix the x-axis.
   I am looking for something, which simply resets the y-axis, so that 
a
  new
   plot() (or points()/lines()) keeps the x-axis, but re-defines the
  y-axis.
  
   Is there something available? I could re-scale the y-data to fit the
   existing y-axis, but that would mean to define all the labels and
  tickmarks
   for axis 4 manually.
  
   HEre is an example about what I mean:
  
   x1 - 1:10
   y1 - runif(10)
   x2 - 1:11
   y2 - c(y1*100, 0)
  
   ## (1) Does not plot points where (x-axis) they should be
   plot(x1, y1, type=l)
   par(new=TRUE)
   plot(x2, y2, type=p)
   axis(4)
  
   ## (2) Does plot points where (x-axis) they should be
   xlim - range(x1)
   plot(x1, y1, type=l, xlim=xlim)
   par(new=TRUE)
   plot(x2, y2, type=p, xlim=xlim)
   axis(4)
  
   Cheers,
  
  
   Rainer
   --
   Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
  Biology,
   UCT), Dipl. Phys. (Germany)
  
   Centre of Excellence for Invasion Biology
   Natural Sciences Building
   Office Suite 2039
   Stellenbosch University
   Main Campus, Merriman Avenue
   Stellenbosch
   South Africa
  
   Cell:   +27 - (0)83 9479 042
   Fax:+27 - (0)86 516 2782
   Fax:+49 - (0)721 151 334 888
   email:  rai...@krugs.de
  
   Skype:  RMkrug
   Google: r.m.k...@gmail.com
  
  [[alternative HTML version deleted]]
  
   __
   R-help@r-project.org mailing list
   https://stat.ethz.ch/mailman/listinfo/r-help
   PLEASE do read the posting guide
  http://www.R-project.org/posting-guide.html
   and provide commented, minimal, self-contained, reproducible code.
 
 
 
 
 -- 
 Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation 
Biology,
 UCT), Dipl. Phys. (Germany)
 
 Centre of Excellence for Invasion Biology
 Natural Sciences Building
 Office Suite 2039
 Stellenbosch University
 Main Campus, Merriman Avenue
 Stellenbosch
 South Africa
 
 Cell:   +27 - (0)83 9479 042
 Fax:+27 - (0)86 516 2782
 Fax:+49 - (0)721 151 334 888
 email:  rai...@krugs.de
 
 Skype:  RMkrug
 Google: r.m.k...@gmail.com
 
[[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Second y-axis --- alternative to par(new=

2009-10-07 Thread Rainer M Krug
On Wed, Oct 7, 2009 at 11:53 AM, Petr PIKAL petr.pi...@precheza.cz wrote:

 r-help-boun...@r-project.org napsal dne 07.10.2009 11:37:22:

  On Wed, Oct 7, 2009 at 11:28 AM, Petr PIKAL petr.pi...@precheza.cz
 wrote:
 
   Hi
  
   Try ?twoord.plot from plotrix package.
  
  
  Thanks Petr - I was not aeware of this command.
  But I would prefer a more general solution. An example on where I am
 using
  is, to plot a histogram overlayed by its density estimate (easier to
 digest
  for others then only a density estimate).

 That is quite different from your example.


Well - in both cases, I want to overlay two graphs - in my example, it is a
line and a point plot, in the other a histogram and a density estimate.


 I believe overlay of density
 curve over histogram was discussed several times e.g.
 http://tolstoy.newcastle.edu.au/R/e4/help/08/06/14198.html

 Thanks - but if I want to have the histogram with counts (freq=TRUE), then
I have exactly the situation I was talking about - sorry for not being
clear:

x - rnorm(200)
hist(x, col = blue, freq = TRUE)
lines(density(x), col = red, lwd = 2)

i.e.
left y-axis (histogram): count
right y-axis (density estimate): probability density

 And a newY() (or par(newY=TRUE) command would enable exactly this.

 This is something beyond my knowledge and it could be that this need some
 deep redefining in base R graphics.


That's what I guess as well - let's see.

Rainer


 Regards
 Petr

 
  Regards,
 
  Rainer
 
 
 
   Regards
   Petr
  
  
  
   r-help-boun...@r-project.org napsal dne 07.10.2009 10:29:53:
  
Hi
   
is there an alternative to par(new), for ading data to a plot for a
different y-axis?
My problem with par(new=TRUE) is, that it re-defines all axis and
 labels
   (as
in example 1) and one has to use xlim=... to fix the x-axis.
I am looking for something, which simply resets the y-axis, so that
 a
   new
plot() (or points()/lines()) keeps the x-axis, but re-defines the
   y-axis.
   
Is there something available? I could re-scale the y-data to fit the
existing y-axis, but that would mean to define all the labels and
   tickmarks
for axis 4 manually.
   
HEre is an example about what I mean:
   
x1 - 1:10
y1 - runif(10)
x2 - 1:11
y2 - c(y1*100, 0)
   
## (1) Does not plot points where (x-axis) they should be
plot(x1, y1, type=l)
par(new=TRUE)
plot(x2, y2, type=p)
axis(4)
   
## (2) Does plot points where (x-axis) they should be
xlim - range(x1)
plot(x1, y1, type=l, xlim=xlim)
par(new=TRUE)
plot(x2, y2, type=p, xlim=xlim)
axis(4)
   
Cheers,
   
   
Rainer
--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
   Biology,
UCT), Dipl. Phys. (Germany)
   
Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa
   
Cell:   +27 - (0)83 9479 042
Fax:+27 - (0)86 516 2782
Fax:+49 - (0)721 151 334 888
email:  rai...@krugs.de
   
Skype:  RMkrug
Google: r.m.k...@gmail.com
   
   [[alternative HTML version deleted]]
   
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
   http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
  
  
 
 
  --
  Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
 Biology,
  UCT), Dipl. Phys. (Germany)
 
  Centre of Excellence for Invasion Biology
  Natural Sciences Building
  Office Suite 2039
  Stellenbosch University
  Main Campus, Merriman Avenue
  Stellenbosch
  South Africa
 
  Cell:   +27 - (0)83 9479 042
  Fax:+27 - (0)86 516 2782
  Fax:+49 - (0)721 151 334 888
  email:  rai...@krugs.de
 
  Skype:  RMkrug
  Google: r.m.k...@gmail.com
 
 [[alternative HTML version deleted]]
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.




-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Cell:   +27 - (0)83 9479 042
Fax:+27 - (0)86 516 2782
Fax:+49 - (0)721 151 334 888
email:  rai...@krugs.de

Skype:  RMkrug
Google: r.m.k...@gmail.com

[[alternative HTML version deleted]]

__

Re: [R] Plot

2009-10-07 Thread Jim Lemon

On 10/07/2009 01:05 AM, Ashta wrote:

Days- matrix(c(Monday, Tuesday, Wed, Thu, Fri, Sat,
Sun),7,1)

Hum-matrix(c(56,57,60,75,62,67,70),

Temp-matrix(c(76,77,81,95,82,77,83),
   

Hi Ashta,
Are you looking for something like this:

dht-data.frame(
 Days=c(Mon,Tue,Wed,Thu,Fri,Sat,Sun),
 Hum=c(56,57,60,75,62,67,70),
 Temp=c(76,77,81,95,82,77,83))
plot(dht$Hum,main=Temperature x Humidity plot,
 xlab=Day of week,ylab=Humidity,xaxt=n,type=n)
 text(1:7,dht$Hum,dht$Temp)
 axis(1,at=1:7,labels=dht$Days)

Jim

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Second y-axis --- alternative to par(new=

2009-10-07 Thread Petr PIKAL
Hi

Rainer M Krug r.m.k...@gmail.com napsal dne 07.10.2009 12:09:21:

 

 On Wed, Oct 7, 2009 at 11:53 AM, Petr PIKAL petr.pi...@precheza.cz 
wrote:
 r-help-boun...@r-project.org napsal dne 07.10.2009 11:37:22:
 
  On Wed, Oct 7, 2009 at 11:28 AM, Petr PIKAL petr.pi...@precheza.cz
 wrote:
 
   Hi
  
   Try ?twoord.plot from plotrix package.
  
  
  Thanks Petr - I was not aeware of this command.
  But I would prefer a more general solution. An example on where I am
 using
  is, to plot a histogram overlayed by its density estimate (easier to
 digest
  for others then only a density estimate).

 That is quite different from your example. 
 
 Well - in both cases, I want to overlay two graphs - in my example, it 
is a 
 line and a point plot, in the other a histogram and a density estimate.
  
 I believe overlay of density
 curve over histogram was discussed several times e.g.
 http://tolstoy.newcastle.edu.au/R/e4/help/08/06/14198.html
 
 Thanks - but if I want to have the histogram with counts (freq=TRUE), 
then I 
 have exactly the situation I was talking about - sorry for not being 
clear:
 
 x - rnorm(200) 
 hist(x, col = blue, freq = TRUE) 
 lines(density(x), col = red, lwd = 2) 
 
 i.e. 
 left y-axis (histogram): count
 right y-axis (density estimate): probability density

  And a newY() (or par(newY=TRUE) command would enable exactly this.

 This is something beyond my knowledge and it could be that this need 
some
 deep redefining in base R graphics.

 
 That's what I guess as well - let's see.


In the meantime, what about

x - rnorm(200) 
hist(x, col = blue, freq = TRUE) 
ddd-density(x)
lines(ddd$x, ddd$y*100, col = red, lwd = 2) 

and then add suitable y axis.

axis(4, at=pretty(ddd$y*100), labels=pretty(ddd$y), col=2)

Regards
Petr


 
 Rainer
  
 Regards
 Petr
 
 
  Regards,
 
  Rainer
 
 
 
   Regards
   Petr
  
  
  
   r-help-boun...@r-project.org napsal dne 07.10.2009 10:29:53:
  
Hi
   
is there an alternative to par(new), for ading data to a plot for 
a
different y-axis?
My problem with par(new=TRUE) is, that it re-defines all axis and
 labels
   (as
in example 1) and one has to use xlim=... to fix the x-axis.
I am looking for something, which simply resets the y-axis, so 
that
 a
   new
plot() (or points()/lines()) keeps the x-axis, but re-defines the
   y-axis.
   
Is there something available? I could re-scale the y-data to fit 
the
existing y-axis, but that would mean to define all the labels and
   tickmarks
for axis 4 manually.
   
HEre is an example about what I mean:
   
x1 - 1:10
y1 - runif(10)
x2 - 1:11
y2 - c(y1*100, 0)
   
## (1) Does not plot points where (x-axis) they should be
plot(x1, y1, type=l)
par(new=TRUE)
plot(x2, y2, type=p)
axis(4)
   
## (2) Does plot points where (x-axis) they should be
xlim - range(x1)
plot(x1, y1, type=l, xlim=xlim)
par(new=TRUE)
plot(x2, y2, type=p, xlim=xlim)
axis(4)
   
Cheers,
   
   
Rainer
--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
   Biology,
UCT), Dipl. Phys. (Germany)
   
Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa
   
Cell:   +27 - (0)83 9479 042
Fax:+27 - (0)86 516 2782
Fax:+49 - (0)721 151 334 888
email:  rai...@krugs.de
   
Skype:  RMkrug
Google: r.m.k...@gmail.com
   
   [[alternative HTML version deleted]]
   
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
   http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
  
  
 
 
  --
  Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
 Biology,
  UCT), Dipl. Phys. (Germany)
 
  Centre of Excellence for Invasion Biology
  Natural Sciences Building
  Office Suite 2039
  Stellenbosch University
  Main Campus, Merriman Avenue
  Stellenbosch
  South Africa
 
  Cell:   +27 - (0)83 9479 042
  Fax:+27 - (0)86 516 2782
  Fax:+49 - (0)721 151 334 888
  email:  rai...@krugs.de
 
  Skype:  RMkrug
  Google: r.m.k...@gmail.com
 
 [[alternative HTML version deleted]]
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.

 
 
 
 -- 
 Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation 
Biology, 
 UCT), Dipl. Phys. (Germany)
 
 Centre of Excellence for Invasion Biology
 Natural Sciences Building
 Office Suite 2039
 Stellenbosch 

Re: [R] rpois formula

2009-10-07 Thread Duncan Murdoch

nedmt60 wrote:

Hi all,

It's been a while since i've used R and I can't remember how to do the
following:

i have

a = rpois (10, x)
b = rpois (10, y)

what is the code to show that ab, ba and a=b to show just the number of
occurances?
at the moment when I type ab I get a nice long list of true or false.

so i'm hoping to have the following
  


 a = rpois (10, 2)
 b = rpois (10, 3)
 table(sign(a-b))

  -1 0 1
58712 16550 24738

Duncan Murdoch

ab
  

35000


ba
  

25000


a=b
  

4



thanks in advance



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Second y-axis --- alternative to par(new=

2009-10-07 Thread Rainer M Krug
On Wed, Oct 7, 2009 at 12:26 PM, Petr PIKAL petr.pi...@precheza.cz wrote:

 Hi

 Rainer M Krug r.m.k...@gmail.com napsal dne 07.10.2009 12:09:21:

 

  On Wed, Oct 7, 2009 at 11:53 AM, Petr PIKAL petr.pi...@precheza.cz
 wrote:
  r-help-boun...@r-project.org napsal dne 07.10.2009 11:37:22:
 
   On Wed, Oct 7, 2009 at 11:28 AM, Petr PIKAL petr.pi...@precheza.cz
  wrote:
  
Hi
   
Try ?twoord.plot from plotrix package.
   
   
   Thanks Petr - I was not aeware of this command.
   But I would prefer a more general solution. An example on where I am
  using
   is, to plot a histogram overlayed by its density estimate (easier to
  digest
   for others then only a density estimate).

  That is quite different from your example.
 
  Well - in both cases, I want to overlay two graphs - in my example, it
 is a
  line and a point plot, in the other a histogram and a density estimate.
 
  I believe overlay of density
  curve over histogram was discussed several times e.g.
  http://tolstoy.newcastle.edu.au/R/e4/help/08/06/14198.html
 
  Thanks - but if I want to have the histogram with counts (freq=TRUE),
 then I
  have exactly the situation I was talking about - sorry for not being
 clear:
 
  x - rnorm(200)
  hist(x, col = blue, freq = TRUE)
  lines(density(x), col = red, lwd = 2)
 
  i.e.
  left y-axis (histogram): count
  right y-axis (density estimate): probability density

   And a newY() (or par(newY=TRUE) command would enable exactly this.

  This is something beyond my knowledge and it could be that this need
 some
  deep redefining in base R graphics.

 
  That's what I guess as well - let's see.


 In the meantime, what about

 x - rnorm(200)
 hist(x, col = blue, freq = TRUE)
 ddd-density(x)
 lines(ddd$x, ddd$y*100, col = red, lwd = 2)

 and then add suitable y axis.

 axis(4, at=pretty(ddd$y*100), labels=pretty(ddd$y), col=2)


Yes - that definitely works.

I usually use the following approach: determine the xlims in advance, and
then set them manually for each plot:

x - rnorm(200)
xlim - trunc(range(x)) + c(-1, +1)

hist(x, col = blue, freq = TRUE, xlim=xlim)
par(new=TRUE)
plot(density(x), xlim=xlim, ann=FALSE, axes=FALSE)
axis(4)

But it is sometimes tricky to get the xlims for the plot.


 Regards
 Petr


 
  Rainer
 
  Regards
  Petr
 
  
   Regards,
  
   Rainer
  
  
  
Regards
Petr
   
   
   
r-help-boun...@r-project.org napsal dne 07.10.2009 10:29:53:
   
 Hi

 is there an alternative to par(new), for ading data to a plot for
 a
 different y-axis?
 My problem with par(new=TRUE) is, that it re-defines all axis and
  labels
(as
 in example 1) and one has to use xlim=... to fix the x-axis.
 I am looking for something, which simply resets the y-axis, so
 that
  a
new
 plot() (or points()/lines()) keeps the x-axis, but re-defines the
y-axis.

 Is there something available? I could re-scale the y-data to fit
 the
 existing y-axis, but that would mean to define all the labels and
tickmarks
 for axis 4 manually.

 HEre is an example about what I mean:

 x1 - 1:10
 y1 - runif(10)
 x2 - 1:11
 y2 - c(y1*100, 0)

 ## (1) Does not plot points where (x-axis) they should be
 plot(x1, y1, type=l)
 par(new=TRUE)
 plot(x2, y2, type=p)
 axis(4)

 ## (2) Does plot points where (x-axis) they should be
 xlim - range(x1)
 plot(x1, y1, type=l, xlim=xlim)
 par(new=TRUE)
 plot(x2, y2, type=p, xlim=xlim)
 axis(4)

 Cheers,


 Rainer
 --
 Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology,
 UCT), Dipl. Phys. (Germany)

 Centre of Excellence for Invasion Biology
 Natural Sciences Building
 Office Suite 2039
 Stellenbosch University
 Main Campus, Merriman Avenue
 Stellenbosch
 South Africa

 Cell:   +27 - (0)83 9479 042
 Fax:+27 - (0)86 516 2782
 Fax:+49 - (0)721 151 334 888
 email:  rai...@krugs.de

 Skype:  RMkrug
 Google: r.m.k...@gmail.com

[[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
   
   
  
  
   --
   Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
  Biology,
   UCT), Dipl. Phys. (Germany)
  
   Centre of Excellence for Invasion Biology
   Natural Sciences Building
   Office Suite 2039
   Stellenbosch University
   Main Campus, Merriman Avenue
   Stellenbosch
   South Africa
  
   Cell:   +27 - (0)83 9479 042
   Fax:+27 - (0)86 516 2782
   Fax:+49 - (0)721 151 334 888
   email:  rai...@krugs.de
  
   Skype:  

Re: [R] two plots on the same axis

2009-10-07 Thread Jim Lemon

On 10/07/2009 07:12 PM, ogbos okike wrote:

Good morning. I wish to plot two data on the same axis. I tried plot(x,y,
type = l) for the first and tried to use lines or points(x,y, lty = 2, col
= 4) to add or plot the second data on alongside the first. However, what I
got was not encouraging.
I have attached the two data and would be pleased if anybody could be of
help.

Hi Ogbos,
Try this:

plot(oo1$daymon,oo1[,4],
 main=Two years of something,type=l,col=blue,
 ylim=c(3300,4400))
 lines(oo2$daymon,oo2[,4],col=red)
legend(oo1$daymon[100],3600,c(2005,2006),
 col=c(4,2),lty=1)

Jim

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Second y-axis --- alternative to par(new=

2009-10-07 Thread Petr PIKAL
Hi

Rainer M Krug r.m.k...@gmail.com napsal dne 07.10.2009 12:40:39:

 

 On Wed, Oct 7, 2009 at 12:26 PM, Petr PIKAL petr.pi...@precheza.cz 
wrote:
 Hi
 
 Rainer M Krug r.m.k...@gmail.com napsal dne 07.10.2009 12:09:21:
 
 
 

snip

 In the meantime, what about
 
 x - rnorm(200)
 hist(x, col = blue, freq = TRUE)
 ddd-density(x)
 lines(ddd$x, ddd$y*100, col = red, lwd = 2)
 
 and then add suitable y axis.
 
 axis(4, at=pretty(ddd$y*100), labels=pretty(ddd$y), col=2)
 
 Yes - that definitely works.
 
 I usually use the following approach: determine the xlims in advance, 
and then
 set them manually for each plot:
 
 x - rnorm(200)
 xlim - trunc(range(x)) + c(-1, +1)
 
 hist(x, col = blue, freq = TRUE, xlim=xlim)

hhh - hist(x, col = blue, freq = TRUE)

gives you object from which you can extract limits for plotting maybe 
better then from original data and you do not need to call

 par(new=TRUE)

Regards
Petr

 plot(density(x), xlim=xlim, ann=FALSE, axes=FALSE)
 axis(4)
  
 But it is sometimes tricky to get the xlims for the plot.
 
 Regards
 Petr


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Grid on persp plot

2009-10-07 Thread Jesse Brown

Hello,

I have a persp plot that I am generating which shows a growth trend 
toward the 'rear' of the displayed box. I would like to have grid lines 
visible on the plot to give a reference to the amount the values are 
increasing.
I have tried rotating the plot 180 degrees to put the growth in the 
'front' of the box but then the underside of the mesh is shown and hides 
much of the other data. I have also tried using grid() but that only 
placed the lines on what would be the 2d space and didnt correspond to 
the displayed graph at all.

Is there a way to show grid lines within a persp plot?

For reference, these are the commands:

   x - unique(data$X)
   y - unique(data$Y)
   theta - 23
   phi - 10
   expand - 0.5
   col - lightblue
   shade - 0.75
   ticktype - detailed

   # ...

   persp (x,y,m.avg,theta=theta,phi=phi,
   expand=expand,col=col,shade=shade,ticktype=ticktype)


Thanks in advance,

jb

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Formatting outputs:(chronological object)

2009-10-07 Thread Subodh Acharya
Hello everyone,

I have a data generated in a way similar to the following

library(chron);library(zoo)
date- seq(as.Date(1990-01-01),, as.Date(2000-12-31), by = 1)
obs- zoo(rnorm(length(date), mean = 10, sd = 2.5), order.by = date)
monthly- function(date) as.Date(as.yearmon(Date))
result- data.frame ( Date = obs = aggregate(obs, monthly, sum))

Now,
I want to get the result data in the following format instead of the
 continuous table
Observation for year 1990,
1990-01-01 314.7547
1990-02-01 266.0105
1990-03-01 353.7275
1990-04-01 273.8321
1990-05-01 325.3691
1990-06-01 253.1501
1990-07-01 318.1684
1990-08-01 291.2097
1990-09-01 298.6409
1990-10-01 304.0167
1990-11-01 279.4668
1990-12-01 286.9456
Total for year 1990 = xxx

Observation for year 1991
1991-01-01 313.1515
1991-02-01 297.9274
1991-03-01 315.2565
1991-04-01 290.9797
1991-05-01 327.0480
1991-06-01 281.5030
1991-07-01 316.7332
1991-08-01 289.9122
1991-09-01 296.9334
1991-10-01 280.2053
1991-11-01 295.6098
1991-12-01 321.6451
Total for year 1991 = xxx


Any help would be highly appreciated

Thanks





-- 
Acharya, Subodh

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Second y-axis --- alternative to par(new=

2009-10-07 Thread Rainer M Krug
On Wed, Oct 7, 2009 at 1:48 PM, Petr PIKAL petr.pi...@precheza.cz wrote:

 Hi

 Rainer M Krug r.m.k...@gmail.com napsal dne 07.10.2009 12:40:39:

 

  On Wed, Oct 7, 2009 at 12:26 PM, Petr PIKAL petr.pi...@precheza.cz
 wrote:
  Hi
 
  Rainer M Krug r.m.k...@gmail.com napsal dne 07.10.2009 12:09:21:
 
  
 

 snip

  In the meantime, what about
 
  x - rnorm(200)
  hist(x, col = blue, freq = TRUE)
  ddd-density(x)
  lines(ddd$x, ddd$y*100, col = red, lwd = 2)
 
  and then add suitable y axis.
 
  axis(4, at=pretty(ddd$y*100), labels=pretty(ddd$y), col=2)
 
  Yes - that definitely works.
 
  I usually use the following approach: determine the xlims in advance,
 and then
  set them manually for each plot:
 
  x - rnorm(200)
  xlim - trunc(range(x)) + c(-1, +1)
 
  hist(x, col = blue, freq = TRUE, xlim=xlim)

 hhh - hist(x, col = blue, freq = TRUE)

 gives you object from which you can extract limits for plotting maybe
 better then from original data and you do not need to call

  par(new=TRUE)

 True.

Thanks a lot,

Rainer


 Regards
 Petr

  plot(density(x), xlim=xlim, ann=FALSE, axes=FALSE)
  axis(4)
 
  But it is sometimes tricky to get the xlims for the plot.
 
  Regards
  Petr
 




-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology,
UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Cell:   +27 - (0)83 9479 042
Fax:+27 - (0)86 516 2782
Fax:+49 - (0)721 151 334 888
email:  rai...@krugs.de

Skype:  RMkrug
Google: r.m.k...@gmail.com

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Save plot to text file

2009-10-07 Thread Henrique Dallazuanna
See ?recordPlot

On Wed, Oct 7, 2009 at 5:09 AM, Pradeep Raje raje.prad...@gmail.com wrote:
 Dear all:I am sorry if I have missed a solution posted earlier.
 My collaborator (sitting in a different time zone  and not on R) wants to
 re-plot the charts that I have obtained after some complex processing. There
 are thirty charts in all, of different types, and some are multi-plots
 (plot(new=T)).
 Is there a way to 'save' or 'dump just the x-y coordinates to a text/ASCII
 file, like x,y1,y2,y3 or even (x,y1), append (x,y2), append (x,y3)...
 Any help will be gratefully acknowledged.
 Thanks  warm regards,
 pradeep

        [[alternative HTML version deleted]]

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




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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 with regexps

2009-10-07 Thread Dieter Menne



Luca Braglia-2 wrote:
 
 I'd like to match exactly numbers from 1 to 27.
 

If you feel in masochistic mode, you can do it:

b = c(32,3,17,27,28,57,a13)
a = c(^([0-9]|[0-1][0-9]|2[0-7])$)

grep(a,b,value=TRUE)

A much more flexible way would be to isolate the numeric part first, and
test for the range in a seconde step.

Dieter


-- 
View this message in context: 
http://www.nabble.com/help-with-regexps-tp25783202p25783948.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Parameters of Beta distribution

2009-10-07 Thread Maithili Shiva
 
Supose I have a data pertaining to credit loss as
 
amounts - c(46839.50,31177.12,35696.69,21192.57,29200.91,42049.64,42422.19, 
44976.18, 32135.36,47936.57,27322.91,37359.09,43179.60, 48381.02, 45872.38, 
28057.30,44643.83,36156.33,16037.62, 45432.28)
 
I am trying to fit Beta distribution (two parameters distribution but where 
lower bound and upper bounds are NOT  0 and 1 respectively). For this I need to 
estimate the two parameters of Beta distribution. I found some code in VGAM 
pacakge but it deals with standard Beta distribution i.e. lower bound (say A) = 
0 and upper bound (say B) = 1.
 
How do I estimate the parameters of the Beta distribution for above data where 
A and B are not 0's?
 
Please guide.
 
Thanking you in advance
 
Maithili 


  Add whatever you love to the Yahoo! India homepage. Try now! 
http://in.yahoo.com/trynew
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] communication of R Programs

2009-10-07 Thread Dieter Menne



wesley mathew wrote:
 
 I have one R program for writing data in XML File.
 suppose I can execute same program in different R section for writing
 different XML files but another R program need to read these data after i
 wrote in XML file.
 

It is a bit unclear for me what you mean with 'R section, but the simplest
way out would be to generate a shell batch file to run one program

(Under windows)

rterm.exe --no-save  writexml.r
rterm.exe --no-save  thereport.r

If you need to pass parameters to the report writer, you could use

Sys.setenv
Sys.getenv

Dieter


-- 
View this message in context: 
http://www.nabble.com/communication-of-R-Programs-tp25783067p25783954.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] rpois formula

2009-10-07 Thread Peter Dalgaard
David Winsemius wrote:
 Or:
  a = rpois (10, 0.1)
  b = rpois (10, 0.15)
 
 table(ab, a==b, ba)

table(sign(b-a))

comes to mind too (and table(a,b) is illuminative).


-- 
   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
~~ - (p.dalga...@biostat.ku.dk)  FAX: (+45) 35327907

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


[R] [R-pkgs] Updates to rms package

2009-10-07 Thread Frank E Harrell Jr
The rms package, a replacement for the Design package, has been updated 
on CRAN.  The most major change is the addition of smooth calibration 
curves for externally (val.surv function) or internally (calibrate.cph, 
calibrate.psm) validating a survival model with right-censored data. 
The polspline package is used to estimate the survival probability at a 
fixed time point as a function of the predicted survival probability. 
Some user-requested plotting features have been added to bplot and 
plot.Predict.


Changes in version 2.1-0
   * Made Predict not return invisibly if predictors not specified
   * New option nlines for plot.Predict for getting line plots with 2 
categorical predictors
   * Added rename option to rbind.Predict to handle case where 
predictor name has changed between models

   * Added ties=mean to approx( ) calls that did not have ties= specified
   * Added nlevels argument to bplot to pass to contour
   * Added par argument to iLegend - list to pass to par().
   * Redirected ... argument to iLegend to image( ).
   * Fixed groupkm - was printing warning messages wrongly
   * Added new semiparametric survival prediction calibration curve 
method in val.surv for external validation; this is the first 
implementation of smooth calibration curves for survival probability 
validation with right-censored data

   * Fixed calibrate confidence limits from groupkm
   * Added smooth calibration curve using hare (polspline package) for 
calibrate.cph and calibrate.psm
   * Added display of predicted risks for cph and psm models even for 
the stratified KM method (old default)


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

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

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


Re: [R] R, Coda, and OpenBUGS

2009-10-07 Thread Frank E Harrell Jr
Have you tried the rjags package which uses the jags system?  It is much 
more integrated into R and works quite well.  It uses the same modeling 
language as BUGS.  It is also better supported than OpenBUGS.


Frank

Bill Halteman wrote:

Hi All,

  I am trying to figure out how to use R-Coda with the output from 
OpenBugs. I have installed and loaded the packages BRugs and R2WinBUGS.  
I have successfully run a simple Bayes model in WinBUGS using R2WinBUGS' 
bugs and have used read.bugs to build the coda object.  I can 
successfully switch to OpenBugs and run the same model and get the basic 
summary back.  However, I cannot build the coda object.  From what I 
have read read.openbugs should do the trick.  However, I have 
discovered the current version of OpenBUGS (v 3.03) doesn't write any 
output files in spite of setting codaPkg=TRUE in the bugs call.  
Str(openbugs.object) reveals a large collection of elements, one of 
which is an array that contains the MCMC chains.  Is there a function to 
build the coda object?


Thanks in advance for any suggestions,

Bill Halteman



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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Formatting outputs:(chronological object)

2009-10-07 Thread jim holtman
try this  --  the example you provided did not work, so I had to hack
together an example:

library(chron);library(zoo)
date- seq(as.Date(1990-01-01), as.Date(2000-12-31), by = 1)
obs-rnorm(length(date), mean = 10, sd = 2.5)
monthly- function(date) as.Date(as.yearmon(date))
obs - tapply(obs, monthly(date), sum)
obs.yr - split(obs, substring(names(obs), 1, 4))
for (i in names(obs.yr)){
cat(Observations for Year, i, '\n')
print(cbind(obs.yr[[i]]))
cat(Total for Year, i, sum(obs.yr[[i]]), '\n\n')
}

Observations for Year 1990
   [,1]
1990-01-01 336.1179
1990-02-01 279.0572
1990-03-01 314.8671
1990-04-01 281.0801
1990-05-01 288.1853
1990-06-01 325.3545
1990-07-01 334.3680
1990-08-01 314.9724
1990-09-01 300.5801
1990-10-01 324.7640
1990-11-01 307.5808
1990-12-01 300.1142
Total for Year 1990 3707.042

Observations for Year 1991
   [,1]
1991-01-01 314.4718
1991-02-01 269.0690
1991-03-01 309.8057
1991-04-01 287.8462
1991-05-01 337.0155
1991-06-01 299.6412
1991-07-01 310.2771
1991-08-01 271.6742
1991-09-01 293.7720
1991-10-01 301.3979
1991-11-01 294.1190
1991-12-01 310.4470
Total for Year 1991 3599.537


On Wed, Oct 7, 2009 at 8:11 AM, Subodh Acharya shoeb...@gmail.com wrote:
 Hello everyone,

 I have a data generated in a way similar to the following

 library(chron);library(zoo)
 date- seq(as.Date(1990-01-01),, as.Date(2000-12-31), by = 1)
 obs- zoo(rnorm(length(date), mean = 10, sd = 2.5), order.by = date)
 monthly- function(date) as.Date(as.yearmon(Date))
 result- data.frame ( Date = obs = aggregate(obs, monthly, sum))

 Now,
 I want to get the result data in the following format instead of the
  continuous table
 Observation for year 1990,
 1990-01-01 314.7547
 1990-02-01 266.0105
 1990-03-01 353.7275
 1990-04-01 273.8321
 1990-05-01 325.3691
 1990-06-01 253.1501
 1990-07-01 318.1684
 1990-08-01 291.2097
 1990-09-01 298.6409
 1990-10-01 304.0167
 1990-11-01 279.4668
 1990-12-01 286.9456
 Total for year 1990 = xxx

 Observation for year 1991
 1991-01-01 313.1515
 1991-02-01 297.9274
 1991-03-01 315.2565
 1991-04-01 290.9797
 1991-05-01 327.0480
 1991-06-01 281.5030
 1991-07-01 316.7332
 1991-08-01 289.9122
 1991-09-01 296.9334
 1991-10-01 280.2053
 1991-11-01 295.6098
 1991-12-01 321.6451
 Total for year 1991 = xxx


 Any help would be highly appreciated

 Thanks





 --
 Acharya, Subodh

        [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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 that you are trying to solve?

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


Re: [R] R, Coda, and OpenBUGS

2009-10-07 Thread Uwe Ligges



Bill Halteman wrote:

Hi All,

  I am trying to figure out how to use R-Coda with the output from 
OpenBugs. I have installed and loaded the packages BRugs and R2WinBUGS.  
I have successfully run a simple Bayes model in WinBUGS using R2WinBUGS' 
bugs and have used read.bugs to build the coda object.  I can 
successfully switch to OpenBugs and run the same model and get the basic 
summary back.  However, I cannot build the coda object.  From what I 
have read read.openbugs should do the trick.  However, I have 
discovered the current version of OpenBUGS (v 3.03) doesn't write any 
output files in spite of setting codaPkg=TRUE in the bugs call.  
Str(openbugs.object) reveals a large collection of elements, one of 
which is an array that contains the MCMC chains.  Is there a function to 
build the coda object?



For BRugs: Sure, the function is called buildMCMC(). From the examples 
of ?BRugs:


library(BRugs) # loading BRugs

## Now setting the working directory to the examples' one:
oldwd - getwd()
setwd(system.file(OpenBUGS, Examples, package=BRugs))

## some usual steps (like clicking in WinBUGS):
modelCheck(ratsmodel.txt)  # check model file
modelData(ratsdata.txt)# read data file
modelCompile(numChains=2)# compile model with 2 chains
modelInits(rep(ratsinits.txt, 2))  # read init data file
modelUpdate(1000)# burn in
samplesSet(c(alpha0, alpha)) # alpha0 and alpha should be monitored
modelUpdate(1000)# 1000 more iterations 


##  now let's construct a coda object
## (of class mcmc.list, to be precise)
## for BUGS node alpha:

alpha - buildMCMC(alpha)


Best,
Uwe Ligges



Thanks in advance for any suggestions,

Bill Halteman

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Parameters of Beta distribution

2009-10-07 Thread JLucke
Rescale your data x to  (x-A)/(B-A).




Maithili Shiva maithili_sh...@yahoo.com 
Sent by: r-help-boun...@r-project.org
10/07/2009 08:39 AM

To
r-help@r-project.org
cc

Subject
[R] Parameters of Beta distribution






 
Supose I have a data pertaining to credit loss as
 
amounts - 
c(46839.50,31177.12,35696.69,21192.57,29200.91,42049.64,42422.19, 
44976.18, 32135.36,47936.57,27322.91,37359.09,43179.60, 48381.02, 
45872.38, 28057.30,44643.83,36156.33,16037.62, 45432.28)
 
I am trying to fit Beta distribution (two parameters distribution but 
where lower bound and upper bounds are NOT  0 and 1 respectively). For 
this I need to estimate the two parameters of Beta distribution. I found 
some code in VGAM pacakge but it deals with standard Beta distribution 
i.e. lower bound (say A) = 0 and upper bound (say B) = 1.
 
How do I estimate the parameters of the Beta distribution for above data 
where A and B are not 0's?
 
Please guide.
 
Thanking you in advance
 
Maithili 


  Add whatever you love to the Yahoo! India homepage. Try now! 
http://in.yahoo.com/trynew
 [[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Prediction from BMA

2009-10-07 Thread Anthony Staines
Dear colleagues,

I am doing a little bit of work using the BMA package to examine
predictive models for types of pain - the outcome variable is a binary
(Yes/No) for the type of pain experienced by a patient.
Our observation is that BMA makes a lot of sense in this application, as
the data suggests that there are several well-fitting possible logistic
models, each with posterior probabilities close to 0.1, as well as a
straggle of somewhat less likely models.

I am unsure how best to produce predictions from the BMA output - i.e.
the posterior means of model coefficients. There isn't a predict.BMA or
similar, that I can see. What's the recommended way to produce
predictions (i.e. fitted values, or estimates from new data) from these
BMA models?

Best wishes,
Anthony Staines
-- 
Anthony Staines, Professor of Health Systems Research,
School of Nursing, Dublin City University, Dublin 9,Ireland.
Tel:- +353 1 700 7807. Mobile:- +353 86 606 9713

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Emacs + ESS + R installer

2009-10-07 Thread Frank Liu
Dear list,

I and some students built an Emacs + ESS + R installer, which allows
users to download and install the newest version of Emacs, ESS, and R
with little pain.The size of the installer is about 8Mb.

http://sourceforge.net/projects/emacs-for-r/

Please feel free to give me comments and suggestions. Thank you.

Frank Liu

-- 
Frank C.S. Liu
Assistant Professor,
Graduate Institute of Political ScienceE-mail: frankcs...@gmail.com
National Sun Yat-Sen UniversityOffice:+886.7.525.2000 #
804 Kaohsiung, Taiwan, R.O.C.  FAX:+886.7.525.5540

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 the second table from the factanal functions result's loadings part?

2009-10-07 Thread Moumita Das
Hi All,
Can someone help me?The way to do this may be very easy but i do not know.

*Question1:*

factanal() function produces the results in this way:--

*RESULTS:--*
*fact1- factanal(data_withNA,factors=1,rotation=none)
fact1$loadings*

Loadings:
Factor1
i1  0.784
i2  0.874
i3  0.786
i4  0.839
i5  0.778
i6  0.859
i7  0.850
i8  0.763
i9  0.810
i10 0.575
i11 0.745
i12 0.777
i13 0.674
i14 0.644
i15 0.796

  * Factor1
SS loadings  8.995
Proportion Var   0.600*

*How to access the second table* i.e the table other than the Loadings
table?

*Question2:---*
How to calculate the* initial communalities*?Is there any function in R?

I am getting Extraction communalities.

Results as generated by SPSS.
  CommunalitiesInitial Extraction  i1 .654 .614  i2 .781 .764  i3 .645
.617  i4 .695 .704  i5 .681 .605  i6 .747 .738  i7 .758 .722  i8 .607 .583
i9 .661 .657  i10 .409 .330  i11 .579 .554  i12 .668 .604  i13 .595 .454
i14 .521 .415  i15 .682 .634

-- 
Thanks
Moumita

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] communication of R Programs

2009-10-07 Thread Richard M. Heiberger

I don't understand the context of the question.
Since the data is already in R, you should use it from within
R.  What is the reason for translating it to XML and then back?
You take the risk of two levels of distortion.

I am guessing that you want continuity of your work over multiple
login sessions.  One technique for continuity is to save your workspace
at the end of each login.  Do that by saying yes to the save question
when you type q().  The next time you start R from the same directory,
the saved workspace will be re-loaded.  See ?q and ?save for details.

Rich

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


Re: [R] R, Coda, and OpenBUGS - Thanks!!

2009-10-07 Thread Bill Halteman

Worked perfectly.  Thanks very Much

Uwe Ligges wrote:



Bill Halteman wrote:

Hi All,

  I am trying to figure out how to use R-Coda with the output from 
OpenBugs. I have installed and loaded the packages BRugs and 
R2WinBUGS.  I have successfully run a simple Bayes model in WinBUGS 
using R2WinBUGS' bugs and have used read.bugs to build the coda 
object.  I can successfully switch to OpenBugs and run the same model 
and get the basic summary back.  However, I cannot build the coda 
object.  From what I have read read.openbugs should do the trick.  
However, I have discovered the current version of OpenBUGS (v 3.03) 
doesn't write any output files in spite of setting codaPkg=TRUE in 
the bugs call.  Str(openbugs.object) reveals a large collection 
of elements, one of which is an array that contains the MCMC chains.  
Is there a function to build the coda object?



For BRugs: Sure, the function is called buildMCMC(). From the examples 
of ?BRugs:


library(BRugs) # loading BRugs

## Now setting the working directory to the examples' one:
oldwd - getwd()
setwd(system.file(OpenBUGS, Examples, package=BRugs))

## some usual steps (like clicking in WinBUGS):
modelCheck(ratsmodel.txt)  # check model file
modelData(ratsdata.txt)# read data file
modelCompile(numChains=2)# compile model with 2 chains
modelInits(rep(ratsinits.txt, 2))  # read init data file
modelUpdate(1000)# burn in
samplesSet(c(alpha0, alpha)) # alpha0 and alpha should be 
monitored

modelUpdate(1000)# 1000 more iterations 


##  now let's construct a coda object
## (of class mcmc.list, to be precise)
## for BUGS node alpha:

alpha - buildMCMC(alpha)


Best,
Uwe Ligges



Thanks in advance for any suggestions,

Bill Halteman

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


[R] merging dataframes with an unequal number of variables

2009-10-07 Thread christiaan pauw
Hallo Everyone
I have the kind of problem that one should never have because one must
always plan well and communicate with your team. But now I haven't so here
is my problem.

I have data coming in on a daily basis from surveys in 10 towns. The
questionnaire has 62 variables but some of the regions have used older
versions of the questionnaire that have a few variables less. I want to
combine everything  a single dataframe on a daily basis. The problem is now
that i cannot rbind() the data because the number of variables do not
correspond. I have found that i can first subset all datasets to keep just
the variables that they all have in common but that is very unsatisfactory.
What I want to do is to use a complete list of variable names and look at
each data frame and create variable names where they are missing and fill it
with NAs. At least then I can merge the data and use the data that I have

short example

# Make a data frame with 4 variables

var1=c(1,2,3,4,5,6)

var2=c(a,b,a,b,a,a)

var3=c(1,NA,NA,2,3,NA)

var4=c(100,200,300,100,200,300)

df1=data.frame(cbind(var1,var2,var3,var4))


# Data frame 2 and three has two of the 4 variables and 4 has eveything

df2=df1[,c(1,2,4)]

df3=df1[,c(2,3,4)]

df4=df1


# I wanted to do this but it produces an error because the number of
variable differ

df=data.frame(rbind(df1,df2,df3,df4))


#I have figured out how to print the names of variable that do match the
'master' list (in this case df1):
# example with df3
names(df3[,na.omit(match(names(df1),names(df3)))])

#What I need is the name of the variable that each specific data frame does
NOT contain
# Something like this, but this gives an error

names(df1[-names(df3[,na.omit(match(names(df1),names(df3)))])])

thanks in advance

Christiaan

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] [ESS] Emacs + ESS + R installer

2009-10-07 Thread Stephen Eglen
Frank Liu frankcs...@gmail.com wrote:

 
 I and some students built an Emacs + ESS + R installer, which allows
 users to download and install the newest version of Emacs, ESS, and R
 with little pain.The size of the installer is about 8Mb.
 
 http://sourceforge.net/projects/emacs-for-r/
 
 Please feel free to give me comments and suggestions. Thank you.

sounds like a great idea - anything to reduce the barrier!  How does it
overlap/complement with what Vincent kindly provides:

http://vgoulet.act.ulaval.ca/en/ressources/emacs/

Installing that + R should get to the same position.  Vincent is
providing a great resource for win (and mac) users, and if there is
anyway of building on what he has done, it wuold be great.

Stephen

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] merging dataframes with an unequal number of variables

2009-10-07 Thread Gabor Grothendieck
See ?rbind.fill in the plyr package.

On Wed, Oct 7, 2009 at 9:32 AM, christiaan pauw cjp...@gmail.com wrote:
 Hallo Everyone
 I have the kind of problem that one should never have because one must
 always plan well and communicate with your team. But now I haven't so here
 is my problem.

 I have data coming in on a daily basis from surveys in 10 towns. The
 questionnaire has 62 variables but some of the regions have used older
 versions of the questionnaire that have a few variables less. I want to
 combine everything  a single dataframe on a daily basis. The problem is now
 that i cannot rbind() the data because the number of variables do not
 correspond. I have found that i can first subset all datasets to keep just
 the variables that they all have in common but that is very unsatisfactory.
 What I want to do is to use a complete list of variable names and look at
 each data frame and create variable names where they are missing and fill it
 with NAs. At least then I can merge the data and use the data that I have

 short example

 # Make a data frame with 4 variables

 var1=c(1,2,3,4,5,6)

 var2=c(a,b,a,b,a,a)

 var3=c(1,NA,NA,2,3,NA)

 var4=c(100,200,300,100,200,300)

 df1=data.frame(cbind(var1,var2,var3,var4))


 # Data frame 2 and three has two of the 4 variables and 4 has eveything

 df2=df1[,c(1,2,4)]

 df3=df1[,c(2,3,4)]

 df4=df1


 # I wanted to do this but it produces an error because the number of
 variable differ

 df=data.frame(rbind(df1,df2,df3,df4))


 #I have figured out how to print the names of variable that do match the
 'master' list (in this case df1):
 # example with df3
 names(df3[,na.omit(match(names(df1),names(df3)))])

 #What I need is the name of the variable that each specific data frame does
 NOT contain
 # Something like this, but this gives an error

 names(df1[-names(df3[,na.omit(match(names(df1),names(df3)))])])

 thanks in advance

 Christiaan

        [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] windows system file aux

2009-10-07 Thread christophe dutang
Hi all,

I just would like to notice a small problem of R on windows (XP at least).
If you execute the following lines
x - rexp(1000)
write.csv(x, file=aux.csv)
the R GUI just loops for ever... this is due to the fact on windows, users
can create a file or directory with the name aux or aux.*.

If you try to create a text file on windows aux.txt, it says you could not
do it.

Is it possible for the R GUI to catch this message? or just raise an error?

Thanks in advance

Christophe

-- 
Christophe DUTANG
Ph. D. student at ISFA

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Unable to load rjags

2009-10-07 Thread JLucke
I am trying to install rjags.  Although I can install the library, I 
cannot load the package.  See below.

Here is my session
 sessionInfo()
R version 2.9.2 (2009-08-24) 
i386-pc-mingw32 
locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United 
States.1252;LC_MONETARY=English_United 
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base 
other attached packages:
[1] coda_0.13-4 lattice_0.17-26
loaded via a namespace (and not attached):
[1] grid_2.9.2  tools_2.9.2

Here I install the rjags package

 utils:::menuInstallPkgs()
trying URL 
'http://lib.stat.cmu.edu/R/CRAN/bin/windows/contrib/2.9/rjags_1.0.3-10.zip'
Content type 'application/zip' length 308968 bytes (301 Kb)
opened URL
downloaded 301 Kb

package 'rjags' successfully unpacked and MD5 sums checked

The downloaded packages are in
C:\Documents and Settings\jlucke\Local 
Settings\Temp\RtmpRAkMZy\downloaded_packages
updating HTML package descriptions

BUT,
 library(rjags)
Error in fun(...) : Failed to locate JAGS 1.0.3 installation
Error : .onLoad failed in 'loadNamespace' for 'rjags'
Error: package/namespace load failed for 'rjags'

Any advice?

Joe 
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Second y-axis --- alternative to par(new=

2009-10-07 Thread cls59



Rainer M Krug-6 wrote:
 
 Thanks - but if I want to have the histogram with counts (freq=TRUE), then
 I have exactly the situation I was talking about - sorry for not being
 clear:
 
 x - rnorm(200)
 hist(x, col = blue, freq = TRUE)
 lines(density(x), col = red, lwd = 2)
 
 i.e.
 left y-axis (histogram): count
 right y-axis (density estimate): probability density
 
 

When adding a second y-axis, I always rescale the plot with a call to
plot.window() rather than par(new=T). This rescales the plotting area while
still allowing low-level plotting functions like lines and points to be
executed:

x - rnorm(200)
hist(x, col = blue, freq = TRUE)

# recovering par('xaxp') uses the original x limits.
plot.window( xlim = range( par('xaxp')[1:2] ), ylim = range( density(x)$y ))

lines(density(x), col = red, lwd = 2)

Hope this helps!

-Charlie

-
Charlie Sharpsteen
Undergraduate
Environmental Resources Engineering
Humboldt State University
-- 
View this message in context: 
http://www.nabble.com/Second-y-axis-alternative-to-par%28new%3D-tp25782532p25787630.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] neural network arguments

2009-10-07 Thread CJ Rubio

hi everyone!

my inquiry with neural network is rather basic. i am just learning neural
network, particularly the VR bundle. i read the documentations for the said
bundle but still is struggling on understanding some arguments

- x is the matrix or data frame of x values for example
   does this mean data frame for training?

- y is the matrix or data frame of target values for example
   does this mean data frame for testing?

- would fitting the single-hidden-layer NN train and test my data? what does
fitting really do?


i know these are very basic questions but i just started exploring NN
packages.
thanks in advance for your help!
-- 
View this message in context: 
http://www.nabble.com/neural-network-arguments-tp25787734p25787734.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Second y-axis --- alternative to par(new=

2009-10-07 Thread cls59


cls59 wrote:
 
 
 # recovering par('xaxp') uses the original x limits.
 plot.window( xlim = range( par('xaxp')[1:2] ), ylim = range( density(x)$y
 )) 
 
 

Actually, I misspoke. I believe the following is the voodoo you want for
exactly recovering the original xlimit:


  plot.window( xlim = range( par('usr')[1:2] ), xaxs = 'i', ylim = range(
density(x)$y )) 


Basically, par('xaxp')[1:2] only returns the extreme values of the tick
marks on the original x-axis-- using these can still cause points not to
line up. par('usr')[1:2] returns the coordinates of the left and right edges
of the plot screen. setting xaxs to 'i' causes R to use the xlimit exactly
as given and not to pad it by 4% in an attempt to make it pretty.

Good luck!

-Charlie

-
Charlie Sharpsteen
Undergraduate
Environmental Resources Engineering
Humboldt State University
-- 
View this message in context: 
http://www.nabble.com/Second-y-axis-alternative-to-par%28new%3D-tp25782532p25787984.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Unable to load rjags

2009-10-07 Thread Uwe Ligges



jlu...@ria.buffalo.edu wrote:
I am trying to install rjags.  Although I can install the library, I 
cannot load the package.  See below.


Here is my session

sessionInfo()
R version 2.9.2 (2009-08-24) 
i386-pc-mingw32 
locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United 
States.1252;LC_MONETARY=English_United 
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

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

[1] coda_0.13-4 lattice_0.17-26
loaded via a namespace (and not attached):
[1] grid_2.9.2  tools_2.9.2

Here I install the rjags package


utils:::menuInstallPkgs()
trying URL 
'http://lib.stat.cmu.edu/R/CRAN/bin/windows/contrib/2.9/rjags_1.0.3-10.zip'

Content type 'application/zip' length 308968 bytes (301 Kb)
opened URL
downloaded 301 Kb

package 'rjags' successfully unpacked and MD5 sums checked

The downloaded packages are in
C:\Documents and Settings\jlucke\Local 
Settings\Temp\RtmpRAkMZy\downloaded_packages

updating HTML package descriptions

BUT,

library(rjags)

Error in fun(...) : Failed to locate JAGS 1.0.3 installation
Error : .onLoad failed in 'loadNamespace' for 'rjags'
Error: package/namespace load failed for 'rjags'

Any advice?



You need to install jags separately. The package contains rhe interface 
only.


Uwe Ligges

Joe 
	[[alternative HTML version deleted]]


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] princomp data input format

2009-10-07 Thread Jacob Kasper
I am trying do to a PCA analysis using princomp. I get a result, but I
wonder if I have the data in the correct format.
My data contains many stations where fish were sampled as well as
environmental information for each station (lat, lon, depth, temp and year).
the format is like this:
species 1| species 2 | species 3|...|lat | lon | depth | temp| year
1  3132  42   70   200
2  1988
4  34  0  43   54   4001
 1988
200  65  4  42   70   200
2  1989
1  32343   54   4000
 1989

with nearly 14,000 stations, each in its own row.

the result of running princomp(data,cor=T) is just a mess. How do I 'tell' r
what columns are species and what are environmental factors?

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] sinusoidal relationship

2009-10-07 Thread HAKAN DEMIRTAS
Hi,

Suppose x and y are vectors whose elements are known. I know that there is a 
sinusoidal relation between them. In other words,
y=a*sin(bx) where b is probably a function of pi. 

How do I find a and b in R?

Hakan
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Parameters of Beta distribution

2009-10-07 Thread Albyn Jones
Are A and B known?  That is, are there known upper and lower bounds
for this credit loss data?  If not, you need to think about how to
estimate those bounds.  Why do you believe the data have a beta distribution?

albyn


On Wed, Oct 07, 2009 at 09:03:31AM -0400, jlu...@ria.buffalo.edu wrote:
 Rescale your data x to  (x-A)/(B-A).
 
 
 
 
 Maithili Shiva maithili_sh...@yahoo.com 
 Sent by: r-help-boun...@r-project.org
 10/07/2009 08:39 AM
 
 To
 r-help@r-project.org
 cc
 
 Subject
 [R] Parameters of Beta distribution
 
 
 
 
 
 
  
 Supose I have a data pertaining to credit loss as
  
 amounts - 
 c(46839.50,31177.12,35696.69,21192.57,29200.91,42049.64,42422.19, 
 44976.18, 32135.36,47936.57,27322.91,37359.09,43179.60, 48381.02, 
 45872.38, 28057.30,44643.83,36156.33,16037.62, 45432.28)
  
 I am trying to fit Beta distribution (two parameters distribution but 
 where lower bound and upper bounds are NOT  0 and 1 respectively). For 
 this I need to estimate the two parameters of Beta distribution. I found 
 some code in VGAM pacakge but it deals with standard Beta distribution 
 i.e. lower bound (say A) = 0 and upper bound (say B) = 1.
  
 How do I estimate the parameters of the Beta distribution for above data 
 where A and B are not 0's?
  
 Please guide.
  
 Thanking you in advance
  
 Maithili 
 
 
   Add whatever you love to the Yahoo! India homepage. Try now! 
 http://in.yahoo.com/trynew
  [[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] sinusoidal relationship

2009-10-07 Thread Ravi Varadhan
I assume that you are trying to fit the sinusoidal model, with an error
term, to data:

y = a * sin(b*x) + error

Here you can use the `nls' function for non-linear least-squares.  

?nls

Here is an example:

a - 0.5

b - 0.2

x - seq(0, 10, length=100)

eps - rnorm(length(x), sd=0.1)

y - a*sin(b*x) + eps 

plot(x, y, type=p)

nls(y ~ a * sin(b*x), start=list(a=0.1, b=0.1))


Note that `nls' will fail to converge without the error term.

Best,
Ravi.  


---

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: rvarad...@jhmi.edu

Webpage:
http://www.jhsph.edu/agingandhealth/People/Faculty_personal_pages/Varadhan.h
tml

 





-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of HAKAN DEMIRTAS
Sent: Wednesday, October 07, 2009 11:28 AM
To: r-help@r-project.org
Subject: [R] sinusoidal relationship

Hi,

Suppose x and y are vectors whose elements are known. I know that there is a
sinusoidal relation between them. In other words,
y=a*sin(bx) where b is probably a function of pi. 

How do I find a and b in R?

Hakan
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] [ESS] Emacs + ESS + R installer

2009-10-07 Thread Vincent Goulet

Le mer. 7 oct. à 09:41, Stephen Eglen a écrit :


Frank Liu frankcs...@gmail.com wrote:



I and some students built an Emacs + ESS + R installer, which  
allows

users to download and install the newest version of Emacs, ESS, and R
with little pain.The size of the installer is about 8Mb.

http://sourceforge.net/projects/emacs-for-r/

Please feel free to give me comments and suggestions. Thank you.


sounds like a great idea - anything to reduce the barrier!  How does  
it

overlap/complement with what Vincent kindly provides:

http://vgoulet.act.ulaval.ca/en/ressources/emacs/

Installing that + R should get to the same position.  Vincent is
providing a great resource for win (and mac) users, and if there is
anyway of building on what he has done, it wuold be great.

Stephen


Ah, but I also have AUCTeX! ;-)

Will definitely have a look at Frank et al.'s offer.


Vincent Goulet, Full Professor
École d'actuariat
Université Laval, Québec
vincent.gou...@act.ulaval.ca   http://vgoulet.act.ulaval.ca

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Plotting 1 covariate, 3 factors

2009-10-07 Thread Paul Chatfield

I'm interested in plotting a y with an x factor as the combination of 2
factors and colour with respect to a third, which the code below does with
interaction.plot().  However, this is because I redefine the x to be 1
factor.  Is there a way of getting it to plot without redefining it, and
ideally to not join up the lines BETWEEN levels a and b, but just join those
between after and before for one level of f3.  I figure this could be done
by manually drawing over blank lines using ?lines but am not sure what the
coordinates would be and figured there is probably an easier way where
someone has dealt with this before.  Any thoughts greatly appreciated,

Paul

#

y-rnorm(36)
f1-rep(c(after,before), 18)
f2-rep(1:3,12)
f3-rep(1:2, each=18)

## Define new factor to be f1 and f3 for x axis - clumsy code, but gets its
done;

ff-numeric(length(y))
for (i in 1:length(y))
{if (f1[i]==a  f3[i]==1) ff[i]-1, a
else if(f1[i]==a  f3[i]==2) ff[i]-2, a
else if(f1[i]==b  f3[i]==1) ff[i]-1, b
else ff[i]-2, b}

## Plot of interest;

interaction.plot(ff,f2,y)
-- 
View this message in context: 
http://www.nabble.com/Plotting-1-covariate%2C-3-factors-tp25789442p25789442.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] plot an arrow / add arrow to a line

2009-10-07 Thread David Winsemius

RSearch is your friend! (Do we need an LMRSTFY.org?)

Had the OP used the RSearch facilities restricting the search to only  
functions, he would have found an astonishingly large number of  
functions (219) that mention arrows:


http://search.r-project.org/cgi-bin/namazu.cgi?query=arrowsmax=100result=normalsort=scoreidxname=functions


On Oct 7, 2009, at 3:33 AM, Peter Ehlers wrote:


For nicer arrows, there are also the p.arrows() function in
pkg:sfsmisc and the Arrows() function in pkg:IDPmisc.

-Peter Ehlers

Sarah Goslee wrote:

How about arrows() ?
On Tue, Oct 6, 2009 at 4:25 PM, Martin Batholdy batho...@googlemail.com 
 wrote:

hi,

is it possible to end a line plotted with lines() with an arrow?
Or are there any other functions to add an arrow to plot?


thanks!






David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] MCMClogit: normal intercept priors don't work

2009-10-07 Thread AlexanderDueDo

Dear R users,

I think that the question I posted yesterday was not specific enough.
Apologies for this.

The question should have been: why does MCMClogit stop working if I a) set a
normal prior for the intercept and b) remove all variables except for the
intercept as explanatory?

Example code:

simulatedCase - rbinom(100,1,0.5)
simDf - data.frame(CASE = simulatedCase)
posterior_m0 - MCMClogit(CASE ~ 1, data = simDf, b0 = 0, B0 = 1)

It should easily be possible to fit this model with the intercept part
around -0.2 or so, and, in fact, when I use flat priors with

posterior_m0 - MCMClogit(CASE ~ 1, data = simDf)

this works -- and -0.2 is easily allowed by a N(0,1) prior on the intercept,
so why doesn't this work any more? It this a bug, or am I simply overlooking
the most obvious error?

Best wishes,

Alexander Düdo


-- 
View this message in context: 
http://www.nabble.com/MCMClogit%3A-normal-intercept-priors-don%27t-work-tp25789993p25789993.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] 2 questions about mle() /optim() function in stats4

2009-10-07 Thread Muhtar Osman
Dear All,

There are two things about mle() that I wasn't so sure.

1) can mle() handle vector based parameter? say
ll-function(theta=rep(1,20)){..}
   I tried such function, it worked for optim but not for mle.

2) is there a general suggestion for the maximum number of parameters
allowed to use in mle() or optim()?

Thank you.
Regards,

MJO

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Power for Multiple regression?

2009-10-07 Thread SNN

Hi All,

I came across this problem which is more a statistical question, I am hoping
that some one can clarify this for me

Is there a rule of thumb to determine how large your sample size should be
before you perform multiple regression. I have search the web and I found
some online tools where you provide the Alpha level, number of predictors,
the effect size and the desired power.

I have googled the effect size and I found that the effect size= R2/(1-R2)
Where R2 is the coefficient of determination. 
I do not understand how to provide the effect size before doing the
regression and what it means? From my understanding, the power of a test is
the probability of rejecting a false null hypothesis. In this case what is
the hypothesis we are testing? Would the null be testing All the BETA
coefficients are ZERO simultaneously? Is it possible to look at the power to
test for each BETA separately? i.e H0: B=0 vr Ha: B not equal to 0

I appreciate your help

-- 
View this message in context: 
http://www.nabble.com/Power-for-Multiple-regression--tp25787420p25787420.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] power?

2009-10-07 Thread SNN

Thanks Simon for the help. 



Simon Blomberg-4 wrote:
 
 The short answer is Yes. If you reject the null hypothesis based on that
 p-value, then by definition you had enough power to do that. This is
 because there is a precise inverse relationship between the p-value and
 the observed power, once you fix the effect size and the sample size.
 In other words, your post-hoc power analysis would be a simple
 re-statement of the p-value. There is no extra information that can be
 gained from such an analysis. See:
 
 The American Statistician, February 2001, Vol. 55, No. 1, pp 19-24
 
 Don't bother with your power analysis, unless you are planning a new
 experiment.
 
 Simon.
 
 On Tue, 2009-10-06 at 13:49 -0700, SNN wrote:
 Hi,
 
 I have used multiple linear regression on a data set and one if the
 regressor was significant with a p-value =0.01
 
 I need to calculate the power for a multiple linear regression. i.e. do I
 have enough power to believe the above p-value?
 
 
 
  
 
 
 -- 
 Simon Blomberg, BSc (Hons), PhD, MAppStat. 
 Lecturer and Consultant Statistician 
 School of Biological Sciences
 The University of Queensland 
 St. Lucia Queensland 4072 
 Australia
 Room 320 Goddard Building (8)
 T: +61 7 3365 2506
 http://www.uq.edu.au/~uqsblomb
 email: S.Blomberg1_at_uq.edu.au
 
 Policies:
 1.  I will NOT analyse your data for you.
 2.  Your deadline is your problem.
 
 Statistics is the grammar of science - Karl Pearson
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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/power--tp25776305p25787766.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Simulate negative skewed, fat-tailed distribution

2009-10-07 Thread inquil

Hi guys

Is there a way in R to simulate/generate random numbers from a negative
skewed and fat
tailed distribution ? I would like to simulate a set of (discrete) data.

Regards,

Carlos


Carlos http://www.nabble.com/file/p25783889/graph.png graph.png 
-- 
View this message in context: 
http://www.nabble.com/Simulate-negative-skewed%2C-fat-tailed-distribution-tp25783889p25783889.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 with pchisq function

2009-10-07 Thread RwithC

I have some data in my C code, I want to execute chi-square test on those
data. I tried implementing pchisq() function making use of header files R.h,
Rhead.H and Rinternals.h, but it neither gave me the result nor threw any
errors. It just returned 0 or 1. 

Could you please help me how can I implement those functions ? 

I am attaching the test-code herewith. ( For test purposes, I have been
inputting the data here). 
http://www.nabble.com/file/p25788093/CforR.c CforR.c 
-- 
View this message in context: 
http://www.nabble.com/Help-with-pchisq-function-tp25788093p25788093.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] cforest regressions - mean of squared residuals

2009-10-07 Thread AnnieE

Hi there,

I haven't been able to locate a way to get at this information in the manual
or tutorial.  Does anybody know how to retrieve it?  Or amount of variance
explained?

Thanks,
Annie
-- 
View this message in context: 
http://www.nabble.com/cforest-regressions---mean-of-squared-residuals-tp25783906p25783906.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] choose.files limit?

2009-10-07 Thread Gunnar W. Schade

Howdy,

When I use the choose.files command to read files a large number of file 
names to a character vector inside a function, used to access these files 
one after the other, there appears to be a limit. I do not know whether it 
is arbitrary, but in this case the limit was 991 files. The file names are 
long. Does that matter? The error message that appears says that it cannot 
find file #992 (giving the file name), although it is certainly there (I 
tried changing which file is #992 and it did not matter).


Suggestions?

- Gunnar


---
Dr. Gunnar W. Schade
Assistant Professor
Texas AM University
Department of Atmospheric Sciences
1104 Eller OM Building
3150 TAMU
College Station, TX 77843-3150
USA

ph.: 979 845 0633
Fax: 979 862 4466

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] 2 questions about mle() /optim() function in stats4

2009-10-07 Thread Ben Bolker



Muhtar Osman wrote:
 
 Dear All,
 
 There are two things about mle() that I wasn't so sure.
 
 1) can mle() handle vector based parameter? say
 ll-function(theta=rep(1,20)){..}
I tried such function, it worked for optim but not for mle.
 

No.  mle2, in the bbmle package, can (sort of) handle these
kinds of functions.



 2) is there a general suggestion for the maximum number of parameters
 allowed to use in mle() or optim()?
 
 Thank you.
 Regards,
 
 MJO
 
 

It depends, but I would generally say that using this kind of
general-purpose
optimization with more than 10-20 (20-50?) parameters is likely to be
slow ... on the other hand, my data sets are rarely big enough to support
models like that.
-- 
View this message in context: 
http://www.nabble.com/2-questions-about-mle%28%29--optim%28%29-function-in-stats4-tp25790283p25790576.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Which JAGS interface to use?

2009-10-07 Thread Kevin Wright
Frank (or anyone else), can you offer any comments comparing runjags,
R2jags, rjags ?

I couldn't find any vignettes, nothing except a brief mention on Task Views.

Kevin


On Wed, Oct 7, 2009 at 7:48 AM, Frank E Harrell Jr f.harr...@vanderbilt.edu
 wrote:

 Have you tried the rjags package which uses the jags system?  It is much
 more integrated into R and works quite well.  It uses the same modeling
 language as BUGS.  It is also better supported than OpenBUGS.

 Frank

 Bill Halteman wrote:

 Hi All,

  I am trying to figure out how to use R-Coda with the output from
 OpenBugs. I have installed and loaded the packages BRugs and R2WinBUGS.  I
 have successfully run a simple Bayes model in WinBUGS using R2WinBUGS'
 bugs and have used read.bugs to build the coda object.  I can
 successfully switch to OpenBugs and run the same model and get the basic
 summary back.  However, I cannot build the coda object.  From what I have
 read read.openbugs should do the trick.  However, I have discovered the
 current version of OpenBUGS (v 3.03) doesn't write any output files in spite
 of setting codaPkg=TRUE in the bugs call.  Str(openbugs.object) reveals
 a large collection of elements, one of which is an array that contains the
 MCMC chains.  Is there a function to build the coda object?

 Thanks in advance for any suggestions,

 Bill Halteman


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


 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 1 covariate, 3 factors

2009-10-07 Thread Richard M. Heiberger

## Paul

## I think you are looking for interaction2wt

y - rnorm(36)
f1 - rep(c(after, before), 18)
f2 - rep(1:3, 12)
f3 - rep(1:2, each=18)

## your definition of ff was faulty.  It gave a constant.
f3.f1 - interaction(f3, f1)
interaction.plot(f3.f1, f2, y)

f2 - factor(f2)
f3 - factor(f3)

## lattice would be better
xyplot(y ~ f2 | f3, groups=f2)


## if you don't have HH, you will need to install it and its dependencies
## install.packages(HH)
## You may need to close R and restart R

require(HH)
interaction2wt(y ~ f1 + f2 + f3)

position(f1) - c(1.5, 2.5)
position(f3) - c(1.5, 2.5)
interaction2wt(y ~ f1 + f2 + f3, box.ratio=.6)

## Rich

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Simulate negative skewed, fat-tailed distribution

2009-10-07 Thread Ravi Varadhan
Take a look at the `rstable' function in the stable package to simulate
random deviates from a stable distribution.

Ravi. 


---

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: rvarad...@jhmi.edu

Webpage:
http://www.jhsph.edu/agingandhealth/People/Faculty_personal_pages/Varadhan.h
tml

 





-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of inquil
Sent: Wednesday, October 07, 2009 6:56 AM
To: r-help@r-project.org
Subject: [R] Simulate negative skewed, fat-tailed distribution


Hi guys

Is there a way in R to simulate/generate random numbers from a negative
skewed and fat
tailed distribution ? I would like to simulate a set of (discrete) data.

Regards,

Carlos


Carlos http://www.nabble.com/file/p25783889/graph.png graph.png 
-- 
View this message in context:
http://www.nabble.com/Simulate-negative-skewed%2C-fat-tailed-distribution-tp
25783889p25783889.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 1 covariate, 3 factors

2009-10-07 Thread Douglas Bates
I'm not sure if this is exactly what you are looking for but I would
generally create an interaction plot using the lattice 'dotplot' with
type = c(p,a) so I get both the original data and the lines
joining the averages for the different factor levels.  I also prefer
the horizontal orientation to the vertical orientation.  Combining all
these variations produces something like

dotplot(f2 ~ y | f1, groups = f3, aspect = 0.2, layout = c(1,2), type
= c(p,a), pch = 21, strip = FALSE, strip.left = TRUE, auto.key =
list(columns = 2, lines = TRUE))

On Wed, Oct 7, 2009 at 11:00 AM, Paul Chatfield p.s.chatfi...@rdg.ac.uk wrote:

 I'm interested in plotting a y with an x factor as the combination of 2
 factors and colour with respect to a third, which the code below does with
 interaction.plot().  However, this is because I redefine the x to be 1
 factor.  Is there a way of getting it to plot without redefining it, and
 ideally to not join up the lines BETWEEN levels a and b, but just join those
 between after and before for one level of f3.  I figure this could be done
 by manually drawing over blank lines using ?lines but am not sure what the
 coordinates would be and figured there is probably an easier way where
 someone has dealt with this before.  Any thoughts greatly appreciated,

 Paul

 #

 y-rnorm(36)
 f1-rep(c(after,before), 18)
 f2-rep(1:3,12)
 f3-rep(1:2, each=18)

 ## Define new factor to be f1 and f3 for x axis - clumsy code, but gets its
 done;

 ff-numeric(length(y))
 for (i in 1:length(y))
 {if (f1[i]==a  f3[i]==1) ff[i]-1, a
 else if(f1[i]==a  f3[i]==2) ff[i]-2, a
 else if(f1[i]==b  f3[i]==1) ff[i]-1, b
 else ff[i]-2, b}

 ## Plot of interest;

 interaction.plot(ff,f2,y)
 --
 View this message in context: 
 http://www.nabble.com/Plotting-1-covariate%2C-3-factors-tp25789442p25789442.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] power? -- Wait a minute!

2009-10-07 Thread Bert Gunter
Whoa -- wait a minute here! The poster said that one of the regressors had
a P-value of .01, and asked if this was believable. One of how many? -- 3?
300? What about multiplicity? How was the regression model selected -- P
Values are essentially meaningless when computed **after** model selection.
And what does the design look like? -- is the regressor highly correlated
with others? 

So I would say the short answer is that the .01 P value is meaningless
without further information.

The longer answer is a rant on the misuse and (ir?)relevance of P values
hypothesis tests, and the like in scientific work, which I will spare you
all from. However, for those who may wonder about such ravings, have a look
at:

http://www.philosophynow.org/issue74/74pigliucci.htm


Cheers,

Bert Gunter
Genentech Nonclinical Biostatistics
 
 

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of SNN
Sent: Wednesday, October 07, 2009 7:31 AM
To: r-help@r-project.org
Subject: Re: [R] power?


Thanks Simon for the help. 



Simon Blomberg-4 wrote:
 
 The short answer is Yes. If you reject the null hypothesis based on that
 p-value, then by definition you had enough power to do that. This is
 because there is a precise inverse relationship between the p-value and
 the observed power, once you fix the effect size and the sample size.
 In other words, your post-hoc power analysis would be a simple
 re-statement of the p-value. There is no extra information that can be
 gained from such an analysis. See:
 
 The American Statistician, February 2001, Vol. 55, No. 1, pp 19-24
 
 Don't bother with your power analysis, unless you are planning a new
 experiment.
 
 Simon.
 
 On Tue, 2009-10-06 at 13:49 -0700, SNN wrote:
 Hi,
 
 I have used multiple linear regression on a data set and one if the
 regressor was significant with a p-value =0.01
 
 I need to calculate the power for a multiple linear regression. i.e. do I
 have enough power to believe the above p-value?
 
 
 
  
 
 
 -- 
 Simon Blomberg, BSc (Hons), PhD, MAppStat. 
 Lecturer and Consultant Statistician 
 School of Biological Sciences
 The University of Queensland 
 St. Lucia Queensland 4072 
 Australia
 Room 320 Goddard Building (8)
 T: +61 7 3365 2506
 http://www.uq.edu.au/~uqsblomb
 email: S.Blomberg1_at_uq.edu.au
 
 Policies:
 1.  I will NOT analyse your data for you.
 2.  Your deadline is your problem.
 
 Statistics is the grammar of science - Karl Pearson
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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/power--tp25776305p25787766.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Problem using with panel.average in Lattice package

2009-10-07 Thread Deepayan Sarkar
On Sun, Oct 4, 2009 at 3:20 PM, Peter Ehlers ehl...@ucalgary.ca wrote:
 Deepayan,

 Is something similar needed in the last example in ?xyplot? I don't
 see panel.linejoin producing any lines.

You are right (I never noticed because that example doesn't get run).
I'll hard-code the type=l in panel.average/linejoin.

-Deepayan


 Regards,
 Peter Ehlers

 Deepayan Sarkar wrote:

 On Fri, Oct 2, 2009 at 8:03 PM, Mark Dalphin mark.dalp...@peblnz.com
 wrote:

 Hi,

 I'm having a problem getting the panel.average function to work as I
 expect it to in a lattice plot. I wish to draw lines between the
 averages of groups of y-values at specific x-values. I have created a
 dataset below which is similar to my real data. I also show an example
 of using panel.loess in place of panel.average; it performs in a
 manner similar to what I want panel.average to do except it shows a
 loess line rather than a straight line connecting the means of the
 groups.

 Please see my coded examples, below.

 Regards,
 Mark Dalphin

 =
 My system information:

 library(lattice)
 print(sessionInfo())

 R version 2.9.1 (2009-06-26) i686-pc-linux-gnu
 locale:

 LC_CTYPE=en_NZ.UTF-8;LC_NUMERIC=C;LC_TIME=en_NZ.UTF-8;LC_COLLATE=en_NZ.UTF-8;
 LC_MONETARY=C;LC_MESSAGES=en_NZ.UTF-8;LC_PAPER=en_NZ.UTF-8;LC_NAME=C;

 LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_NZ.UTF-8;LC_IDENTIFICATION=C

 attached base packages:
 [1] stats     graphics  grDevices utils     datasets  methods   base
 other attached packages:
 [1] lattice_0.17-25

 loaded via a namespace (and not attached):
 [1] grid_2.9.1  tools_2.9.1

 ##--
 ## This dataset is too complicated, but it does show the type of plot I
 want.
 ##
 ## Create a fake qPCR dataset: Eight 96-well plates over 4 days (2 per
 day),
 ## 2 genes per plate (multiplexed), and 4 Hi positive control and
 ## 4 Lo positive controls per plate.
 ## Create the experimental data; by rights it is all identical, expect
 for
 ## experimental errors with in days and between days.
 ## For this simulation, each gene will be given a base value.
 ## In qPCR the higher the Ct value, the lower the concentration.
 library(lattice)  # Add for ease of cut-n-paste of this code
 date  - c('2009-09-07', '2009-09-08', '2009-09-10', '2009-09-14')
 probe - c('Gene.A1', 'Gene.A2', 'Gene.B1', 'Gene.B2')
 conc  - c('Lo', 'Hi')
 base.lo - c(Gene.A1=29, Gene.A2=25, Gene.B1=28, Gene.B2=31)
 base.hi - base.lo - 8
 day.err - c(Day.1=0, Day.2=1, Day.3=1.5, Day.4=1.0)

 d - data.frame()
 for(i in seq(along=date)) {
  for(j in seq(along=probe)) {
      for(k in seq(along=conc)) {
           d - rbind(d, data.frame(Date=rep(date[i], length=4),
                                   Probe=rep(probe[j], length=4),
                                   Conc=rep(conc[k], length=4),
                                   Ct=rnorm(4, sd=0.5) + (k-1)*8 +
 base.hi[j] + day.err[i]
                                   ))
      }
  }
 }
 d$Date - as.POSIXct(d$Date)

 ##--
 ## Example 1
 ## Print with LOESS line showing the 'means' for the groups.
 ## This is close, but I don't want a loess line; I want straight lines
 ## between mean values.
 print(xyplot(Ct ~ Date|Probe, group=Conc, data=d,
           panel=panel.superpose,
  panel.groups=function(x, y, ...) {
               panel.loess(x, y, ...)
               panel.xyplot(x, y, ...)
           },
           auto.key=TRUE))

 ##--
 ## Example 2
 ## Parallel construction to the loess example, above.
 ## Note the loss of the lines. The 'horizontal' default
 ## is different between 'panel.loess' and 'panel.average'.
 print(xyplot(Ct ~ Date|Probe, group=Conc, data=d,
           panel=panel.superpose,
           panel.groups=function(x, y, ...) {
               panel.average(x, y, horizontal=FALSE, ...)
               panel.xyplot(x, y, ...)
           },
           auto.key=TRUE))

 Unfortunately, the implicit type=p argument in panel.superpose is
 overriding the type=l in panel.average (may be it should be
 unmodifiable). So, you need

 print(xyplot(Ct ~ Date|Probe, group=Conc, data=d,
             panel=panel.superpose,
             panel.groups=function(x, y, ..., type) {
                 panel.average(x, y, ..., type = l, horizontal = FALSE)
                 panel.xyplot(x, y, ..., type = type)
             },
             auto.key=TRUE))

 It's more common to use the syntactic sugar provided by panel.xyplot:

 print(xyplot(Ct ~ Date|Probe, group=Conc, data=d,
             type = c(p, a),
             auto.key=TRUE))


 ##--
 ## Example 3
 ## Don't pass along the '...' to the panel.average. Now I
 ## get lines, but not matching colours to the points.
 print(xyplot(Ct ~ Date|Probe, group=Conc, data=d,
           panel=panel.superpose,
           

[R] error using predict() / fRegression-package

2009-10-07 Thread Gero Schwenk

Hello!
I'm puzzled by the following problem. It occurs while trying to predict 
responses in a test-dataset using a linear model fitted with regFit from 
the rMetrics fRegression-package.


All goes well when I call predict using the training dataset. However, 
a call using the test-dataset retuns an error message - telling me that 
the latter dataset provides variables of different type than the 
training set. But inspection of the structure of both dataframes shows, 
that the variables are still all of the type numeric. (See attached 
session protocol.)


Does anyone have an idea how to fix this? Any help would greatly be 
appreciated!

Kind regards,
Gero

 str(regdata)
'data.frame':89 obs. of  7 variables:
$ ret1 : num  0.0275 -0.01013 0.00569 -0.01582 0.0226 ...
$ lag(ret1): num  NA 0.0275 -0.01013 0.00569 -0.01582 ...
$ lag(ret2): num  NA 0.04072 -0.00509 0.02055 -0.01548 ...
$ lag(ret3): num  NA 0.05393 0.00299 0.02432 0.02251 ...
$ (lag(ret1)*lag(ret2)): num  NA 1.12e-03 5.16e-05 1.17e-04 2.45e-04 ...
$ (lag(ret1)*lag(ret3)): num  NA 1.48e-03 -3.03e-05 1.38e-04 -3.56e-04 ...
$ (lag(ret2)*lag(ret3)): num  NA 2.20e-03 -1.52e-05 5.00e-04 -3.48e-04 ...
 str(regdata.test)
'data.frame':23 obs. of  6 variables:
$ lag(ret1): num  NA 0.01554 0.01458 0.00333 0.01674 ...
$ lag(ret2): num  NA 0.01373 0 0.01331 0.00686 ...
$ lag(ret3): num  NA 0.0278 0.0152 0.0211 -0.0104 ...
$ (lag(ret1)*lag(ret2)): num  NA 2.13e-04 0.00 4.43e-05 1.15e-04 ...
$ (lag(ret1)*lag(ret3)): num  NA 4.32e-04 2.21e-04 7.03e-05 -1.75e-04 ...
$ (lag(ret2)*lag(ret3)): num  NA 3.82e-04 0.00 2.81e-04 -7.16e-05 ...
 ar1.xpred.fitted - regFit(ar1.xpred.model, data = regdata, use = lm)
 ar1.xpred.train.pred - predict(ar1.xpred.fitted, regdata, se.fit = 
FALSE)
 ar1.xpred.test.pred - predict(ar1.xpred.fitted, regdata.test, se.fit 
= FALSE)
Fehler: variable 'lag(ret1)' was fitted with type numeric but type 
nmatrix.1 was supplied

Zusätzlich: Warnmeldung:
'newdata' had 23 rows but variable(s) found have 89 rows


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Which JAGS interface to use?

2009-10-07 Thread Frank E Harrell Jr
We use it on Linux - here's our how-to: 
http://biostat.mc.vanderbilt.edu/JAGSInstallExample


Frank


Kevin Wright wrote:
Frank (or anyone else), can you offer any comments comparing runjags, 
R2jags, rjags ?


I couldn't find any vignettes, nothing except a brief mention on Task Views.

Kevin


On Wed, Oct 7, 2009 at 7:48 AM, Frank E Harrell Jr 
f.harr...@vanderbilt.edu mailto:f.harr...@vanderbilt.edu wrote:


Have you tried the rjags package which uses the jags system?  It is
much more integrated into R and works quite well.  It uses the same
modeling language as BUGS.  It is also better supported than OpenBUGS.

Frank


Bill Halteman wrote:

Hi All,

 I am trying to figure out how to use R-Coda with the output
from OpenBugs. I have installed and loaded the packages BRugs
and R2WinBUGS.  I have successfully run a simple Bayes model in
WinBUGS using R2WinBUGS' bugs and have used read.bugs to
build the coda object.  I can successfully switch to OpenBugs
and run the same model and get the basic summary back.  However,
I cannot build the coda object.  From what I have read
read.openbugs should do the trick.  However, I have discovered
the current version of OpenBUGS (v 3.03) doesn't write any
output files in spite of setting codaPkg=TRUE in the bugs
call.  Str(openbugs.object) reveals a large collection of
elements, one of which is an array that contains the MCMC
chains.  Is there a function to build the coda object?

Thanks in advance for any suggestions,

Bill Halteman


-- 
Frank E Harrell Jr   Professor and Chair   School of Medicine

Department of Biostatistics   Vanderbilt University


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





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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Need a vectorized way to avoid two nested FOR loops

2009-10-07 Thread Rama Ramakrishnan


Hi Friends,

I have a data frame d. Let vars be the column indices for a subset of  
the columns in d (e.g., vars - c(1,3,4,8))


For each row r in d, I want to collect all the other rows in d that  
match the values in row r for just the columns in vars.


The naive way to do this is to have a for loop stepping through each  
row in d, and within the loop have another loop going through all the  
rows again, checking for equality. This is quadratic in the number of  
rows and takes way too long. Is there a better, vectorized way to do  
this?


Thanks in advance!

Rama Ramakrishnan

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] graphics

2009-10-07 Thread McDonald, Grant



Dear Sir, 

I am using the following cos which creates a 3 panel figure on one image.  
However the legend function i am using only allows the legend to be placed 
within the axes of one of the graphs.

The plots however do not allow for a logend to be places within the axes do to 
the location of points on the graph.  I can add the legend later using imaging 
software such as paint but i lose resolution by doing this.

Is it possible to place the legend out side of figure axes on the white area 
around all three panels?
Any help would be greatly appreciated.

Thank you 
Grant



single-read.table(C:\\Grant\\hatchfirstonly.txt,header=T)
attach(single)
names(single)
par(mfrow=c(1,3))
maleage- factor(maleage, labels = c(Old,Young))
colors - c('gray', navyblue)
shapes - c(17,19)
proportion-(eggs1-unhatch1)/eggs1
plot(proportion~maleage, xlab= Age of Male , ylab = Proportion of Eggs 
Hatched)
plot(proportion~femweight, pch=shapes[maleage], col=colors[maleage],bg=gray, 
xlab= Female Weight (grams) , ylab =  Proportion of Eggs Hatched)
abline(lm(proportion~femweight))
plot(proportion~copdurationsecs, pch=shapes[maleage], 
col=colors[maleage],bg=gray, xlab= Copulation Duration (minutes) , ylab =  
Proportion of Eggs Hatched)
abline(lm(proportion~copdurationsecs))
legend(locator(1), as.character(levels(factor(maleage))),pch=shapes[maleage], 
col=colors[maleage])(levels(factor(maleage)))

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] is that possible to graph 4 dimention plot

2009-10-07 Thread Ryan
 
 Suppose there are 4 variables
 d is a function of a , b and c
 I want to know how a, b and c change will make d change
 It will be straightforward to see it if we can graph the d surface
 
 if d is only a function of a and b, I can use 'persp' to see the surface of
 d. I can easily see at what values of a and b, d will get the maxium or
 minium or multiple modes, etc
 
 But for 4 dimention graph, is there a way to show the surface of d
 Will use color help
 
 Thanks a lot

Not sure what your data looks like, but you might also 
consider looking at a 2 dimensional version.  See ?coplot
for example:

coplot(lat ~ long | depth * mag, data = quakes)

Or you can make 2 or 3-dimensional plots using the lattice 
package conditioning on some of the variables - e.g. d ~ a | b * c,
etc.  

If a, b, and c are continuous, you can use equal.count.  Here is
an uninteresting example, considering a, b, and c as points along
a grid:

a - b - c - seq(1:10)
dat - data.frame(expand.grid(a, b, c))
names(dat) - letters[1:3]

dat$d - with(dat, -(a-5)^2 - (b-5)^2 - (c-5)^2)

library(lattice)
# 2-d:
xyplot(d ~ a | equal.count(b)*equal.count(c), data=dat, type=l)
# etc.

# 3-d:
contourplot(d ~ a * b | equal.count(c), data=dat)
wireframe(d ~ a * b | equal.count(c), data=dat)

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] graphics

2009-10-07 Thread David Winsemius

On Oct 7, 2009, at 2:01 PM, McDonald, Grant wrote:


Dear Sir,

I am using the following cos which creates a 3 panel figure on one  
image.  However the legend function i am using only allows the  
legend to be placed within the axes of one of the graphs.


The plots however do not allow for a logend to be places within the  
axes do to the location of points on the graph.  I can add the  
legend later using imaging software such as paint but i lose  
resolution by doing this.


Is it possible to place the legend out side of figure axes on the  
white area around all three panels?

Any help would be greatly appreciated.


Doesn't mtext let you do what you want?

perhaps:

mtext(Desired Text, outer=TRUE)



single-read.table(C:\\Grant\\hatchfirstonly.txt,header=T)
attach(single)
names(single)
par(mfrow=c(1,3))
maleage- factor(maleage, labels = c(Old,Young))
colors - c('gray', navyblue)
shapes - c(17,19)
proportion-(eggs1-unhatch1)/eggs1
plot(proportion~maleage, xlab= Age of Male , ylab = Proportion of  
Eggs Hatched)
plot(proportion~femweight, pch=shapes[maleage],  
col=colors[maleage],bg=gray, xlab= Female Weight (grams) , ylab  
=  Proportion of Eggs Hatched)

abline(lm(proportion~femweight))
plot(proportion~copdurationsecs, pch=shapes[maleage],  
col=colors[maleage],bg=gray, xlab= Copulation Duration (minutes)  
, ylab =  Proportion of Eggs Hatched)

abline(lm(proportion~copdurationsecs))
legend(locator(1),  
as.character(levels(factor(maleage))),pch=shapes[maleage],  
col=colors[maleage])(levels(factor(maleage)))


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] graphics

2009-10-07 Thread Sarah Goslee
Hello,

On Wed, Oct 7, 2009 at 2:01 PM, McDonald, Grant
grant.mcdonal...@imperial.ac.uk wrote:



 Dear Sir,

Well, I'm not a sir but perhaps I can help anyway.

 Is it possible to place the legend out side of figure axes on the white area 
 around all three panels?
 Any help would be greatly appreciated.

Like this:

plot(1:10, 1:10)
par(xpd=NA)
legend(locator(), nothing, pch=1)

Or instead of locator(), a function that lets you use a mouse click to select
a point, you can use par(usr) to learn the current coordinate system,
and select a value outside of that range.

Sarah
-- 
Sarah Goslee
http://www.functionaldiversity.org

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] graphics

2009-10-07 Thread jim holtman
Here is another way of creating the legend using layout

layout(cbind(1,2), width=c(7,1))
plot(1:10,1:10)
# now create legend
old.par - par(mar=c(3, 0, 3, 0))
plot.new()
legend('left', legend=c('line 1', 'line 2'))
par(old.par)



On Wed, Oct 7, 2009 at 2:01 PM, McDonald, Grant
grant.mcdonal...@imperial.ac.uk wrote:



 Dear Sir,

 I am using the following cos which creates a 3 panel figure on one image.  
 However the legend function i am using only allows the legend to be placed 
 within the axes of one of the graphs.

 The plots however do not allow for a logend to be places within the axes do 
 to the location of points on the graph.  I can add the legend later using 
 imaging software such as paint but i lose resolution by doing this.

 Is it possible to place the legend out side of figure axes on the white area 
 around all three panels?
 Any help would be greatly appreciated.

 Thank you
 Grant



 single-read.table(C:\\Grant\\hatchfirstonly.txt,header=T)
 attach(single)
 names(single)
 par(mfrow=c(1,3))
 maleage- factor(maleage, labels = c(Old,Young))
 colors - c('gray', navyblue)
 shapes - c(17,19)
 proportion-(eggs1-unhatch1)/eggs1
 plot(proportion~maleage, xlab= Age of Male , ylab = Proportion of Eggs 
 Hatched)
 plot(proportion~femweight, pch=shapes[maleage], 
 col=colors[maleage],bg=gray, xlab= Female Weight (grams) , ylab =  
 Proportion of Eggs Hatched)
 abline(lm(proportion~femweight))
 plot(proportion~copdurationsecs, pch=shapes[maleage], 
 col=colors[maleage],bg=gray, xlab= Copulation Duration (minutes) , ylab = 
  Proportion of Eggs Hatched)
 abline(lm(proportion~copdurationsecs))
 legend(locator(1), as.character(levels(factor(maleage))),pch=shapes[maleage], 
 col=colors[maleage])(levels(factor(maleage)))

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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 that you are trying to solve?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Make a blank dataframe with given dimensions

2009-10-07 Thread Mark Na
Hi R-helpers,

I would like to make a blank dataframe, i.e. a dataframe without any rows.

I would like the blank dataframe (which is to be called merged) to have 0
rows and 32 columns. Once I've made the dataframe, I'll specify the column
names using:


names(merged)-c(GRIDCODE,paste(VALUE,0:3,sep=_),paste(VALUE,5:30,sep=_),AREA)

Then I'll add rows to it, using the loop (which is working fine).

Thanks for any help!

Mark

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Make a blank dataframe with given dimensions

2009-10-07 Thread Richard M. Heiberger

 tmp - data.frame(matrix(nrow=0, ncol=32))
 tmp
[1] X1  X2  X3  X4  X5  X6  X7  X8  X9  X10 X11 X12 X13 X14 X15 X16 X17 
X18 X19

[20] X20 X21 X22 X23 X24 X25 X26 X27 X28 X29 X30 X31 X32
0 rows (or 0-length row.names)
 names(tmp) - c(letters, LETTERS[1:6])
 tmp
[1] a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F
0 rows (or 0-length row.names)


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Why do I have the following error message?

2009-10-07 Thread LinZhongjun

Dear R-help lists:

Hello!

I ran WinBUGS under R using the function bugs.

But I kept having the following error message:

Error in FUN(X[[3L]], ...) : 
  .C(..): 'type' must be real for this format

Why did I have the error message?What's the problem?How to get rid of the error 
message?

Thank you very much for your help!

Best wishes
Zhongjun Lin
  
_
[[elided Hotmail spam]]

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Installing R on Suse 11.1 , cannot figure it out

2009-10-07 Thread Robert Wilkins
Can't figure out how the install works, it is certainly not automatic.
Also , the Install option on the R web site for Suse 11.1 does not work.
And the install software native to Suse, cannot figure out.

Does Suse have more problems installing software than Fedora or Ubuntu?
Or is this a hassle for any Linux distro? And Windows?

Rob

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Evaluating/comparing dynamic linear model

2009-10-07 Thread R_help Help
Hi,

I have two DLM model specifications (x[t] and y[t] are univariate):

MODEL1:
y[t] = b[t]x[t]+e[t], e[t] ~ N(0,v1^2)
b[t] = b[t-1]+eta[t], eta[t] ~ N(0,w1^2)

MODEL2:
y[t] = a[t]+e[t], e[t] ~ N(0,v2^2)
a[t] = a[t-1]+eta[t], eta[t] ~ N(0,w2^2)

I run the filter through data recursively to obtain state variables
for each model. However, how do I know if b[t]x[t] in MODEL1 is
different from MODEL2? In other words, how do I know if x[t] makes a
difference in explaining dynamic of y[t]?

Another question is that how do I compare MODEL1 and MODEL2? From
model specification point of view, how can one say that MODEL1 is
better than MODEL2? Any suggestion/reference would be greatly
appreciated. Thank you.

ac

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Installing R on Suse 11.1 , cannot figure it out

2009-10-07 Thread Cedrick W. Johnson

see below:

Robert Wilkins wrote:

Can't figure out how the install works, it is certainly not automatic.
Also , the Install option on the R web site for Suse 11.1 does not work.
And the install software native to Suse, cannot figure out.

Does Suse have more problems installing software than Fedora or Ubuntu?
  
Did you try installing the RPMS listed under your favorite CRAN mirror? 
(note, I didn't use the install links for the Readme file, I think you 
could grab these using 'wget'


http://streaming.stat.iastate.edu/CRAN/bin/linux/suse/11.1/RPMS/i586/R-base-2.9.0-2.1.i586.rpm
-and devel-
http://streaming.stat.iastate.edu/CRAN/bin/linux/suse/11.1/RPMS/i586/R-base-devel-2.9.0-2.1.i586.rpm

You may also have to compile R from source...


Or is this a hassle for any Linux distro? And Windows?
  
My windows installs have been relatively hassle-free (5 workstations). I 
just finished setting up a small cluster (3) of ubuntu R instances in 
under 30 minutes. So, your mileage may vary. I've found Ubuntu to be 
rather simple to install R instances.


Hope this helps
c


=
*Cedrick W. Johnson*
aolim) cedrickjcvgr
www.cedrickjohnson.com
*New York - Chicago*

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] To hell with OpenSuse, ditch it and go to Ubuntu

2009-10-07 Thread Robert Wilkins
this blog entry

http://www.viggie.com/blog/software/opensuse-ubuntu-usage-experience

, if credible , would seem to suggest that there is no good reason to
choose Suse.
I really don't have time for such nonsense, maybe I'll just reinstall as Ubuntu.

Also, noticed that GCC was not installed when Suse installed. That's
just weird, GCC is part of Linux.
And if you try to install GCC, the available options , are , again ,
thoroughly confusing.
It appears the Software-Install features of Suse are just not very robust.

Is Fedora any better?
Do you think that blog post is accurate in comparing Ubuntu and Suse?
Since Mandriva apparently has little market share or support in the
US, I guess I won't do with that.
So it's Ubuntu or Fedora.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Installing R on Suse 11.1 , cannot figure it out

2009-10-07 Thread Robert Wilkins
I believe i did last night: a cran site in Pittsburgh, with a
Install link that I believe you are referring to, it just didnt
work, unless you are referring to a different web site. The r site,
eventually leads to a list of install choices ( download from
different locations , such as michigan, pittsburgh, etc) Your example
is Iowa?

Not having GCC preinstalled ( C and Fortran ) might be a factor. When
you install LInux, it should just install GCC , just like that. I
mean, that's just wrong.

this blog post sheds some light maybe:
http://www.flexbeta.net/main/articles.php?action=showid=70perpage=1pagenum=5

When you install from source ( which I can't , because I can't figure
out how to install GCC) , does the source install have binary
dependencies?


On Wed, Oct 7, 2009 at 9:10 PM, Cedrick W. Johnson
cedr...@cedrickjohnson.com wrote:
 see below:

 Robert Wilkins wrote:

 Can't figure out how the install works, it is certainly not automatic.
 Also , the Install option on the R web site for Suse 11.1 does not work.
 And the install software native to Suse, cannot figure out.

 Does Suse have more problems installing software than Fedora or Ubuntu?


 Did you try installing the RPMS listed under your favorite CRAN mirror?
 (note, I didn't use the install links for the Readme file, I think you
 could grab these using 'wget'

 http://streaming.stat.iastate.edu/CRAN/bin/linux/suse/11.1/RPMS/i586/R-base-2.9.0-2.1.i586.rpm
 -and devel-
 http://streaming.stat.iastate.edu/CRAN/bin/linux/suse/11.1/RPMS/i586/R-base-devel-2.9.0-2.1.i586.rpm

 You may also have to compile R from source...

 Or is this a hassle for any Linux distro? And Windows?


 My windows installs have been relatively hassle-free (5 workstations). I
 just finished setting up a small cluster (3) of ubuntu R instances in under
 30 minutes. So, your mileage may vary. I've found Ubuntu to be rather simple
 to install R instances.

 Hope this helps
 c


 =
 *Cedrick W. Johnson*
 aolim) cedrickjcvgr
 www.cedrickjohnson.com
 *New York - Chicago*



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Simulate negative skewed, fat-tailed distribution

2009-10-07 Thread Kjetil Halvorsen
another possibility is to use skew-t distributions, from package:
fGarch, for instance.

Kjetil

On Wed, Oct 7, 2009 at 1:13 PM, Ravi Varadhan rvarad...@jhmi.edu wrote:
 Take a look at the `rstable' function in the stable package to simulate
 random deviates from a stable distribution.

 Ravi.

 
 ---

 Ravi Varadhan, Ph.D.

 Assistant Professor, The Center on Aging and Health

 Division of Geriatric Medicine and Gerontology

 Johns Hopkins University

 Ph: (410) 502-2619

 Fax: (410) 614-9625

 Email: rvarad...@jhmi.edu

 Webpage:
 http://www.jhsph.edu/agingandhealth/People/Faculty_personal_pages/Varadhan.h
 tml



 
 


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
 Behalf Of inquil
 Sent: Wednesday, October 07, 2009 6:56 AM
 To: r-help@r-project.org
 Subject: [R] Simulate negative skewed, fat-tailed distribution


 Hi guys

 Is there a way in R to simulate/generate random numbers from a negative
 skewed and fat
 tailed distribution ? I would like to simulate a set of (discrete) data.

 Regards,

 Carlos


 Carlos http://www.nabble.com/file/p25783889/graph.png graph.png
 --
 View this message in context:
 http://www.nabble.com/Simulate-negative-skewed%2C-fat-tailed-distribution-tp
 25783889p25783889.html
 Sent from the R help mailing list archive at Nabble.com.

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


  1   2   >