Re: [R] prediction intervals (alpha and beta) for model average estimates from binomial glm and model.avg (library=dRedging)

2009-04-27 Thread Michelle Ensbey
Thanks for your swift reply

I'm sorry to say that I tried that, and it doesn't appear to work for 
predicting from the "model.avg" object (ouput). Model.avg is a model averaging 
function in dRedging. I am NOT trying to predict from the coefficients 
estimated directly from the glm.

For :
> fit1 <- glm(y~ dbh, family = binomial, data = data)

> fit2 <- glm(y~ dbh+vegperc, family = binomial, data = data)

> fit3 <- glm(y~ dbh, family = binomial, data = data)

##and the model averaging
> model.averaging <-model.avg(fit1,fit2,fit3, method="0")

##Then when trying to predict you get the error below I understand it is 
because it is not a glm (or other compatable object) but I thought maybe 
someone had come across and solved this problem already so I thought I'd check:

> predict(model.averaging)
OR
> predict(model.averaging,"Patch_Num")
Error in UseMethod("predict") : no applicable method for "predict"
##Comes up.
Does anyone have a function or code or has done this (for coefficients obtained 
from the model.avg function) in the past and can give advice.

Thanks again for your help, let me know if I've just missed something.
Cheers
M


-Original Message-
From: David Winsemius [mailto:dwinsem...@comcast.net] 
Sent: Friday, 24 April 2009 10:24 PM
To: Michelle Ensbey
Cc: r-help@r-project.org
Subject: Re: [R] prediction intervals (alpha and beta) for model average 
estimates from binomial glm and model.avg (library=dRedging)

In R, the predict family of functions provides that facility. If you  
want the code it will be in the particular function associated with  
the model type.

?predict
?predict.glm
# the example illustrates creation of prediction curves on the  
response scale for  a specific range of data.
# create the desired CI's by appropriate use of the se.fit value  
returned from the predict call.
# This is the code inside predict.glm that does the work when se.fit  
is set as TRUE in the predict call:

se.fit <- pred$se.fit
switch(type, response = {
 se.fit <- se.fit * abs(family(object)$mu.eta(fit))
 fit <- family(object)$linkinv(fit)
 }, link = , terms = )

-- 
David Winsemius

On Apr 24, 2009, at 3:03 AM, Michelle Ensbey wrote:

> Hi all,
>
> I was wondering if there is a function out there, or someone has  
> written code for making confidence intervals around model averaged  
> predictions (y~á+âx). The model average estimates are from the  
> dRedging library?
>
> It seems a common thing but I can't seem to find one via the search  
> engines
>
> Examples of the models are:
>
> fit1 <- glm(y~ dbh, family = binomial, data = data)
>
> fit2 <- glm(y~ dbh+vegperc, family = binomial, data = data)
>
> fit3 <- glm(y~ dbh, family = binomial, data = data)
>
> and the model averaging
>
> model.averaging <-model.avg(fit1,fit2,fit3, method="0")
>
> and the output (from model.avg) has the following items:  
> Coefficient, Variance, Standard error, adjusted standard error and  
> lower and upper confidence interval for each parameter (and  
> intercept).
>
> What I would like to do is make "prediction intervals". I know I  
> need to include covariance and variance. Please let me know if  
> anyone has a function or code to get these prediction intervals out  
> of this output.
>
> Thanks in advance for your help, and please advise me if you need  
> more information
>
> M
> michelle.ens...@nt.gov.au
>
> R version 2.8.1

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] [R-pkgs] New package: CHNOSZ

2009-04-27 Thread Jeffrey Dick

Dear R users,

A new package, CHNOSZ (version 0.8), is available on CRAN.

CHNOSZ is a package for thermodynamic calculations and analysis. 
Functions are available for calculating the standard Gibbs energies and 
other thermodynamic properties, and chemical affinities, of reactions 
between species contained in the thermodynamic database. The database 
includes standard thermodynamic properties and equations of state 
parameters for a variety of minerals and inorganic and organic aqueous 
species. The relative abundances of species in equilibrium can be drawn 
on activity diagrams as a function of temperature, pressure and/or 
chemical activities of basis species.


The documentation includes many examples taken from the literature, as 
well as calculations of the metastability relationships in systems of 
proteins. The protein examples were developed to explore the chemical 
features of thermophilic adaptation, subcellular localization, proteomic 
stress response, and microbial diversity. Calculation of the standard 
Gibbs energies of proteins is based on a published group additivity 
algorithm and is further supported in this package by the inclusion of 
data files for the amino acid compositions of selected proteins and of 
proteins in yeast and E. coli.


A paper describing some applications of the package can be found in 
Geochemical Transactions:


http://www.geochemicaltransactions.com/content/9/1/10

The project website highlights many of the example calculations. There 
is also an Rpad script available for download that presents basic 
functionality of the program in a browser interface. The website is 
located at:


http://www.chnosz.net

This release offers major enhancements over previous versions available 
on the project website. Chemical affinities of formation reactions can 
be calculated as a function of more than two variables, parallel 
processing of some computations is optionally carried out using the 
mclapply function of the multicore package, amino acid compositions of 
proteins can be read from FASTA files, protein stress response and 
richness calculations were added to the examples, and a mass transfer 
algorithm for reaction path modeling has been introduced.


Feedback about the package is appreciated.

Sincerely,

Jeff Dick

--
Jeffrey M. Dick
NSF Postdoctoral Fellow
School of Earth and Space Exploration
Arizona State University
Tempe, AZ 85287-1404

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


[R] Sub-saharan Africa R user forum

2009-04-27 Thread justin bem
A new forum on R for french speaker in sub-saharan africa

 http://aurass.forum-free.org
Justin BEM
BP 1917 Yaoundé
Tél (237) 76043774



  
[[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] How to create a graph layout?

2009-04-27 Thread Cuvelier Etienne
At 02:32 27/04/2009, Christian Bustamante wrote:
>I all,
>I want to create a graph layout in a 3x3 matrix like this:
>
>ylab  |__|  |__|   |__|
>   ___  ___   ___
>ylab  |__|  |__|   |__|
>   ___  ___   ___
>ylab  |__|  |__|   |__|
>xl xl xl
>
>With this layout, then I'll insert the 9 plots. How ca I create it?

see ?layout
# Example
layout(matrix(1:9,ncol=3, byrow=TRUE))
for(i in 1:9) plot(density(rnorm(1000)), main=paste("Graph N°",i))

Hope it helps.

Etienne



>-- 
>CdeB
>
>__
>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.


+ 
+ Cuvelier Etienne
+ Assistant 
+ FUNDP - Faculté d'Informatique  
+ rue Grandgagnage, 21   B-5000 Namur (Belgique)
+ tel: 32.81.72.49.75fax: 32.81.72.49.67
+ skype: cuvelier.etienne

THE TOP TEN REASONS TO BECOME A STATISTICIAN
 1. Deviation is considered normal.
 2. We feel complete and sufficient.
 3. We are "mean" lovers.
 4. Statisticians do it discretely and continuously.
 5. We are right 95% of the time.
 6. We can legally comment on someone's posterior distribution.
 7. We may not be normal but we are transformable.
 8. We never have to say we are certain.
 9. We are honestly significantly different.
10 No one wants our jobs.

__
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] MDL - Fayyad & Irani Discretization

2009-04-27 Thread Piotr Romański

Hey,

I'm looking for a function which provides a supervised Fayyad & Irani 
discretization (MDL). I've already found RWeka which has such a 
function. But is there anything else? I'd prefer to use sth lighter in 
my own package.


Regards,
Peter

__
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 install R really *locally*?

2009-04-27 Thread Uwe Ligges
Set you system up in a way that its R is started with some of the 
options reported by `R --help':


  --no-environ  Don't read the site and user environment files
  --no-site-fileDon't read the site-wide Rprofile
  --no-init-fileDon't read the .Rprofile or ~/.Rprofile files
  --no-restore-data Don't restore previously saved objects
  --no-restore-history  Don't restore the R history file
  --no-restore  Don't restore anything
  --vanilla Combine --no-save, --no-restore, --no-site-file,
  --no-init-file and --no-environ


Uwe Ligges


Oliver Kullmann wrote:

Hello,

my first attempt at installing version 2.9.0 failed
because I got an error
"Error in library(pspline) : there is no package called 'pspline'"

Later I realised that this comes from HOME/.RProfil, and removing
that files "solves" that problem.

However, I'm actually glad that this error happened, since it shows
a deeper problem (which is actually not solved yet):
My context is that I re-distribute R as a part of an open-source
library I develop, and this library (actually I call it a "research
environment") installs many things (like R and Maxima, gcc, git, ...),
and this all purely locally --- it shouldn't interfere with anything
the user has installed.

So my question is how can I tell R as installation time that it should
not look at any configuration files or other files whatsoever (so it should
for example ignore HOME/.RProfil)?

The installation instructions mention the variable "rhome", but I don't
understand what type of "home" is meant here. What I could need here
would be a redefinition of the user home-directory (to a local directory
in my installation), but I guess that is not meant with rhome.

Hope somebody can help here.

Oliver

__
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] How to get rid of loop?

2009-04-27 Thread Uwe Ligges



Ken-JP wrote:


The code below shows what I'm trying to get rid of.

If there is no way to get rid of the loop, I will try to use package( inline
).
I'm just curious as to whether there is a "vector way" of doing this
algorithm.



I don't see a vector way. If speed is an issue, I'd suggest to port this 
small part to C, it's very simple and may yield a considerable 
performance boost (untested). It can probably be used as a textbook 
example for code where porting to C make sense.


Best,
Uwe Ligges




#
-

set.seed(1)
x <- runif(100)
n <- length( x )
y <- rep(NA, n)
yprev <- 0;
for ( i in (1:n)) {
if ( x[i]>0.75 ) {
y[i] <- 1;
} else if ( x[i]<0.25 ) {
y[i] <- -1;
} else if ( yprev==1 & x[i]<0.5) {
y[i] <- 0;
} else if ( yprev==-1 & x[i]>0.5) {
y[i] <- 0;
} else {
y[i] <- yprev
}
yprev <- y[i];
}


y

  [1]  0  0  0  1 -1  1  1  1  1 -1 -1 -1  0  0  1  0  0  1  0  1  1 -1  0
-1 -1
 [26] -1 -1 -1  1  0  0  0  0 -1  1  1  1 -1  0  0  1  1  1  1  1  1 -1 -1 
0  0
 [51]  0  1  0 -1 -1 -1 -1  0  0  0  1  0  0  0  0  0  0  1 -1  1  0  1  0 
0  0
 [76]  1  1  0  1  1  0  0  0  0  1 -1  0 -1 -1 -1 -1 -1  0  1  1  1  0  0 
1  1





__
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] Bumps chart in R

2009-04-27 Thread Andreas Christoffersen
thank you kindly - will do :-)

Cheers

On Mon, Apr 27, 2009 at 1:21 AM, Gabor Grothendieck
 wrote:
> Have a look at plotweb in the bipartite package.
>
> On Sun, Apr 26, 2009 at 6:45 PM, Andreas Christoffersen
>  wrote:
>> Hi there,
>>
>> I would like to make a 'bumps chart' like the ones described e.g.
>> here: http://junkcharts.typepad.com/junk_charts/bumps_chart/
>>
>> Purpose: I'd like to plot the proportion of people in select countries
>> living for less then one USD pr day in 1994 and 2004 respectively. I
>> have already constructed a barplot - but I think a bumps chart would
>> be better
>>
>> # The barplot and data
>> countries <- c("U-lande", "Afrika syd for sahara", "Europa og
>> Centralasien", "Lantinamerika og Caribien","Mellemøstenog Nordafrika",
>> "Sydasien","ØStasien og stillehaveet", "Kina", "Brasilien")
>> poor_1990 <- c(28.7,46.7,0.5,10.2,2.3,43,29.8,33,14)
>> poor_2004 <- c(18.1,41.1,0.9,8.6,1.5,30.8,9.1,9.9,7.5)
>> poor <- cbind(poor_1990,poor_2004)
>> rownames(poor) <- countries
>> oldpar <- par(no.readonly=T)
>> par <- par(mar=c(15,5,5,1))
>> png("poor.png")
>> par <- par(mar=c(15,5,5,1))
>> barplot(t(poor[order(poor[,2]),]),beside=T,col=c(1,2),las=3,ylab="%
>> poor",main="Percent living for < 1 USD per day (1993
>> prices)",ylim=c(0,50))
>> legend("topleft",c("1990","2004"),fill=c(1,2),bty="n")
>> par(oldpar)
>> dev.off()
>>
>> I Guess I need to start with an normal plot? Something like the below
>> - but there is a loong way to go...
>>
>> # A meager start - how to finish my bumps chart
>> plot(c(rep(1,9),rep(2,9)),c(fattig_1990,fattig_2004),type="b",ann=F)
>>
>> Thankfull for any help.
>>
>> Cheers.
>>
>> Andreas
>>
>> __
>> 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] MDL - Fayyad & Irani Discretization

2009-04-27 Thread Hans W. Borchers

I have asked for this some years ago and did not got a positive hint.
To my knowledge this has not changed since then.

Brian Ripley proposed to use the 'rpart' algorithm for discretization.
I think I applied the RELIEF-F method at that time  and also wrote a
simplified Fayyad-Irani function on my own.

For RELIEF and other distretizing functions see the 'dprep' package.
On CRAN there is only a version for Linux available, for Windows see
the 'dprep' home page .
(But: I have not tried it out with R 2.9.0 !)

Hans Werner


Piotr Romański wrote:
> 
> Hey,
> 
> I'm looking for a function which provides a supervised Fayyad & Irani 
> discretization (MDL). I've already found RWeka which has such a 
> function. But is there anything else? I'd prefer to use sth lighter in 
> my own package.
> 
> Regards,
> Peter
> 
> __
> 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/MDL---Fayyad---Irani-Discretization-tp23252045p23252977.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] Scatterplot of two groups side-by-side?

2009-04-27 Thread Jim Lemon

nonu...@yahoo.de wrote:

Dear all

I'm realy new to R, so I hope you can help me, as I didn't find any solution in 
the common books.

Since some days I'm trying to create the following plot: A scatterplott showning two different groups 
side-by-side with according regression lines. Both datasets only have the same five factors, so the scatters 
will form a kind of column at each factor. When I use "scatterplot" (package "car"), then 
I can plot two groups in the same graph by using the command "groups", but the scatters of both 
groups are then plotted on top of eachother using different symbols and they can hardly be distingushed. How 
can I plot them side by side, so that the groups do not overlap? And how can I give different colours to the 
groups and the according regression line?(This is, what I got so far: 
http://img7.imageshack.us/img7/227/almostgood.jpg)

I tried to use the commands used in "boxplot", to solve this problem. In this commant, 
it's possible to plot different datasets side-by-side by defining the position of the bars 
(example: at = 1:5 - 0.4). A second boxplot-chart can then be added by adding the command 
"add=TRUE" to the line and defining another position. Both commands don't function within 
the scatterplot-command.

By the way: It's realy necessary to plott the data as scatters and not as boxplots. With the command 
"plot", I can not plot the data by groups (I tried it with the commands "subset" and 
"groups", but obviously, there is no way to do so).

  

Hi Karin,
I would use cluster.overplot in the plotrix package for the scattergram. 
This will adjust the positions of the points for the two groups so that 
they form little clusters instead of overplotting. You can color the two 
sets of points differently as well as use different symbols. Then by 
adding the two regression lines in the same two colors, you should have 
an easier to interpret plot.


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] Bumps chart in R

2009-04-27 Thread Andreas Christoffersen
> In statistics, a bumps chart is more commonly called a parallel
> coordinates plot.

Thank you. However - my understanding of the parallel coordinates plot
is that you have factors, not time, on the x axis. Also the 'bump
chart' i invision is best suited for only two different x categories.
But technically I guess you are right.

Cheers.

__
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] Bumps chart in R

2009-04-27 Thread Andreas Christoffersen
On Mon, Apr 27, 2009 at 2:23 AM, Mike Lawrence  wrote:
> Here's a ggplot2 based solution:

Wauw - thank you. I'm sure I need to understand gplot better. With
qplot I can make something similar - quite easy.

With your reformattet data:

#here's the data provided by Andreas
countries <- c("U-lande", "Afrika syd for sahara", "Europa og
Centralasien", "Lantinamerika og Caribien","Mellemøstenog
Nordafrika","Sydasien","ØStasien og stillehaveet", "Kina",
"Brasilien")
poor_1990 <- c(28.7,46.7,0.5,10.2,2.3,43,29.8,33,14)
poor_2004 <- c(18.1,41.1,0.9,8.6,1.5,30.8,9.1,9.9,7.5)

#reformat the data
data = data.frame(countries,poor_1990,poor_2004)
data = melt(data,id=c('countries'),variable_name='year')
levels(data$year) = c('1990','2004')

#make a new column to make the text justification easier
data$hjust = 1-(as.numeric(data$year)-1)

library(ggplot2)
qplot(year,value, data=data,label=countries, geom=c("line","text"),
group=countries, col=countries)

But I would like to have the text labels show only once - e.g. at 1990
- and also control the size of the text. In my crude qplot, setting
size=2 e.g. changes not only the text, but also the lines etc. I guess
I have to move from qplot to gplot.

__
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] Passing Bablok

2009-04-27 Thread botto
Hi,

 

is there any R-package providing a Passing Bablok regression procedure? 

This Question seems to have occurred once or twice before, but I never saw
an answer to the previous inquiries.

 

Best regards

 

Benjamin Otto

 

==

Benjamin Otto

University Hospital Hamburg-Eppendorf

Institute For Clinical Chemistry

Martinistr. 52

D-20246 Hamburg

 

Tel.: +49 40 7410 51908

Fax.: +49 40 7410 54971

==

 



-- 
Pflichtangaben gemäß Gesetz über elektronische Handelsregister und 
Genossenschaftsregister sowie das Unternehmensregister (EHUG):

Universitätsklinikum Hamburg-Eppendorf
Körperschaft des öffentlichen Rechts
Gerichtsstand: Hamburg

Vorstandsmitglieder:
Prof. Dr. Jörg F. Debatin (Vorsitzender)
Dr. Alexander Kirstein
Ricarda Klein
Prof. Dr. Dr. Uwe Koch-Gromus

[[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] how to send email with R

2009-04-27 Thread Thomas Loridan
Hi all

I can t seem to find a way to send an email using R

would anyone have a suggestion?

much appreciated

Thomas

-- 
Thomas Loridan
King's College email: thomas.lori...@kcl.ac.uk
webpage:http://geography.kcl.ac.uk/micromet/tloridan/index.htm

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

2009-04-27 Thread Wacek Kusnierczyk
Mario dos Reis wrote:
> I've been trough the R documentation for about half an hour and it's
> not clear to me how to do this:
>
> I need to format to character a series of integers from 1 to 1000, and
> I like them to look like
>
> "0001" "0002", "0059", "0123" and so on. Padded with zeroes to have
> four digits.
# dummy data
x = sample(100, 10)

# formatting
sprintf('%04d', x)

vQ

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

2009-04-27 Thread baptiste auguie

sprintf("%04.f", 2)

sapply(sample(1:1000,4), function(ii) sprintf("%04.f",ii))

?sprintf


HTH,

baptiste

On 27 Apr 2009, at 11:35, Mario dos Reis wrote:

I've been trough the R documentation for about half an hour and it's  
not

clear to me how to do this:

I need to format to character a series of integers from 1 to 1000,  
and I

like them to look like

"0001" "0002", "0059", "0123" and so on. Padded with zeroes to have  
four

digits.

Cheers!
Mario.

r-help-requ...@r-project.org wrote:

Send R-help mailing list submissions to
 r-help@r-project.org

To subscribe or unsubscribe via the World Wide Web, visit
 https://stat.ethz.ch/mailman/listinfo/r-help
or, via email, send a message with subject or body 'help' to
 r-help-requ...@r-project.org

You can reach the person managing the list at
 r-help-ow...@r-project.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of R-help digest..."


Today's Topics:

  1. Re: Changing gird marks in ggplot2 (ONKELINX, Thierry)
  2. Re: argument 'exclude' in function xtabs (Matthieu Lesnoff)
  3.  Question of "Quantile Regression for Longitudinal Data"
 (Helen Chen)
  4. Conditional plot labels (Christian Bustamante)
  5.  simulate arima model (Rebecca1117)
  6.  THE EQUIVALENT OF SQL INNER TABLE JOIN IN R (Nigel Birney)
  7. Scatterplot of two groups side-by-side? (nonu...@yahoo.de)
  8. Re: Nomogram with stratified cph in Design package (reneepark)
  9.  Stochastic Gradient Ascent for logistic regression (Tim LIU)
 10. Re: Question of "Quantile Regression for Longitudinal Data"
 (Tirthankar Chakravarty)
 11. Re: THE EQUIVALENT OF SQL INNER TABLE JOIN IN R
 (Gabor Grothendieck)
 12. Re: THE EQUIVALENT OF SQL INNER TABLE JOIN IN R (Peter Dalgaard)
 13. Re: 3 questions regarding matrix copy/shuffle/compares (Esmail)
 14. Re: Conditional plot labels (baptiste auguie)
 15. Re: Scatterplot of two groups side-by-side? (baptiste auguie)
 16. Help to select the raw in a data.frame with the max value
 (Alessandro)
 17. re moving entries from one vector that are in another  
(onyourmark)

 18. Is their any function can generate orthogonal tables(e.g.
 L_8(2^7) (dzuswxbylw)
 19. Re: dotplot: labeling coordinates for each point (Qifei Zhu)
 20. Re: Help to select the raw in a data.frame with the max value
 (Jorge Ivan Velez)
 21. Re: Nomogram with stratified cph in Design package
 (Frank E Harrell Jr)
 22. Problem installing packages (Jarek Jasiewicz)
 23. Re: 3 questions regarding matrix copy/shuffle/compares
 (David Winsemius)
 24. Re: issue building my own package... moving from Apple OS to
 Windows (Uwe Ligges)
 25. Re: Scatterplot of two groups side-by-side? (Stefan Grosse)
 26. Re: 3 questions regarding matrix copy/shuffle/compares (Esmail)
 27. R:  constrained optimization (mau...@alice.it)
 28. Re: Help to select the raw in a data.frame with the max value
 (David Winsemius)
 29. Re: Scatterplot of two groups side-by-side? (John Fox)
 30. Re: Problem installing packages (Uwe Ligges)
 31. Re: fclustindex, e1071 package (Uwe Ligges)
 32. Re: Overlapping parameters "k" in different functions in
 "ipred" (Uwe Ligges)
 33. Re: How to get rid of loop? (Uwe Ligges)
 34. Re: help with plotting results of lda (Uwe Ligges)
 35. Re: Problem installing packages (Jarek Jasiewicz)
 36. Re: 3 questions regarding matrix copy/shuffle/compares
 (David Winsemius)
 37. Re: Problem installing packages (Jarek Jasiewicz)
 38. Memory issues in R (Neotropical bat risk assessments)
 39. Re: 3 questions regarding matrix copy/shuffle/compares
 (hadley wickham)
 40. Re: 3 questions regarding matrix copy/shuffle/compares
 (David Winsemius)
 41. Re: 3 questions regarding matrix copy/shuffle/compares (Esmail)
 42. Re: 3 questions regarding matrix copy/shuffle/compares
 (hadley wickham)
 43. Re: 3 questions regarding matrix copy/shuffle/compares (Esmail)
 44. Re: 3 questions regarding matrix copy/shuffle/compares (Esmail)
 45. Re: Stochastic Gradient Ascent for logistic regression
 (Ravi Varadhan)
 46. Re: Problem installing packages (Uwe Ligges)
 47. Re: Memory issues in R (David Winsemius)
 48. Re: Memory issues in R (Stefan Grosse)
 49. Matching in R (dirk...@gmx.de)
 50. Re: help with plotting results of lda (Prof Brian Ripley)
 51. Install packages not working in latest version?
 (Neotropical bat risk assessments)
 52. Re: Install packages not working in latest version? (Uwe Ligges)
 53. comparing matrices (Esmail)
 54. doubt in vglm output (priyabrata panigrahi)
 55.  figure layout (hesicaia)
 56. Re: ANOVA/statistics question (drmh)
 57. Re: comparing matrices (ONKELINX, Thierry)
 58.  Problem with create a tree (Grze?)
 59. Re: THE EQUIVALENT OF SQL INNER TABLE JOIN IN R
 (Wacek Kusnierczyk)
 60. Re: Memory issues in R (David Winsemius)
 61. Re: comparing matrices (baptiste auguie)
 62. Re: Problem installing packages (Jarek Jasiewicz)
 63. Re: comparing matrices (David

[R] Formatting numbers

2009-04-27 Thread Mario dos Reis
I've been trough the R documentation for about half an hour and it's not 
clear to me how to do this:


I need to format to character a series of integers from 1 to 1000, and I 
like them to look like


"0001" "0002", "0059", "0123" and so on. Padded with zeroes to have four 
digits.


Cheers!
Mario.

r-help-requ...@r-project.org wrote:

Send R-help mailing list submissions to
r-help@r-project.org

To subscribe or unsubscribe via the World Wide Web, visit
https://stat.ethz.ch/mailman/listinfo/r-help
or, via email, send a message with subject or body 'help' to
r-help-requ...@r-project.org

You can reach the person managing the list at
r-help-ow...@r-project.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of R-help digest..."


Today's Topics:

   1. Re: Changing gird marks in ggplot2 (ONKELINX, Thierry)
   2. Re: argument 'exclude' in function xtabs (Matthieu Lesnoff)
   3.  Question of "Quantile Regression for Longitudinal Data"
  (Helen Chen)
   4. Conditional plot labels (Christian Bustamante)
   5.  simulate arima model (Rebecca1117)
   6.  THE EQUIVALENT OF SQL INNER TABLE JOIN IN R (Nigel Birney)
   7. Scatterplot of two groups side-by-side? (nonu...@yahoo.de)
   8. Re: Nomogram with stratified cph in Design package (reneepark)
   9.  Stochastic Gradient Ascent for logistic regression (Tim LIU)
  10. Re: Question of "Quantile Regression for Longitudinal Data"
  (Tirthankar Chakravarty)
  11. Re: THE EQUIVALENT OF SQL INNER TABLE JOIN IN R
  (Gabor Grothendieck)
  12. Re: THE EQUIVALENT OF SQL INNER TABLE JOIN IN R (Peter Dalgaard)
  13. Re: 3 questions regarding matrix copy/shuffle/compares (Esmail)
  14. Re: Conditional plot labels (baptiste auguie)
  15. Re: Scatterplot of two groups side-by-side? (baptiste auguie)
  16. Help to select the raw in a data.frame with the max value
  (Alessandro)
  17. re moving entries from one vector that are in another (onyourmark)
  18. Is their any function can generate orthogonal tables(e.g.
  L_8(2^7) (dzuswxbylw)
  19. Re: dotplot: labeling coordinates for each point (Qifei Zhu)
  20. Re: Help to select the raw in a data.frame with the max value
  (Jorge Ivan Velez)
  21. Re: Nomogram with stratified cph in Design package
  (Frank E Harrell Jr)
  22. Problem installing packages (Jarek Jasiewicz)
  23. Re: 3 questions regarding matrix copy/shuffle/compares
  (David Winsemius)
  24. Re: issue building my own package... moving from Apple OS to
  Windows (Uwe Ligges)
  25. Re: Scatterplot of two groups side-by-side? (Stefan Grosse)
  26. Re: 3 questions regarding matrix copy/shuffle/compares (Esmail)
  27. R:  constrained optimization (mau...@alice.it)
  28. Re: Help to select the raw in a data.frame with the max value
  (David Winsemius)
  29. Re: Scatterplot of two groups side-by-side? (John Fox)
  30. Re: Problem installing packages (Uwe Ligges)
  31. Re: fclustindex, e1071 package (Uwe Ligges)
  32. Re: Overlapping parameters "k" in different functions in
  "ipred" (Uwe Ligges)
  33. Re: How to get rid of loop? (Uwe Ligges)
  34. Re: help with plotting results of lda (Uwe Ligges)
  35. Re: Problem installing packages (Jarek Jasiewicz)
  36. Re: 3 questions regarding matrix copy/shuffle/compares
  (David Winsemius)
  37. Re: Problem installing packages (Jarek Jasiewicz)
  38. Memory issues in R (Neotropical bat risk assessments)
  39. Re: 3 questions regarding matrix copy/shuffle/compares
  (hadley wickham)
  40. Re: 3 questions regarding matrix copy/shuffle/compares
  (David Winsemius)
  41. Re: 3 questions regarding matrix copy/shuffle/compares (Esmail)
  42. Re: 3 questions regarding matrix copy/shuffle/compares
  (hadley wickham)
  43. Re: 3 questions regarding matrix copy/shuffle/compares (Esmail)
  44. Re: 3 questions regarding matrix copy/shuffle/compares (Esmail)
  45. Re: Stochastic Gradient Ascent for logistic regression
  (Ravi Varadhan)
  46. Re: Problem installing packages (Uwe Ligges)
  47. Re: Memory issues in R (David Winsemius)
  48. Re: Memory issues in R (Stefan Grosse)
  49. Matching in R (dirk...@gmx.de)
  50. Re: help with plotting results of lda (Prof Brian Ripley)
  51. Install packages not working in latest version?
  (Neotropical bat risk assessments)
  52. Re: Install packages not working in latest version? (Uwe Ligges)
  53. comparing matrices (Esmail)
  54. doubt in vglm output (priyabrata panigrahi)
  55.  figure layout (hesicaia)
  56. Re: ANOVA/statistics question (drmh)
  57. Re: comparing matrices (ONKELINX, Thierry)
  58.  Problem with create a tree (Grze?)
  59. Re: THE EQUIVALENT OF SQL INNER TABLE JOIN IN R
  (Wacek Kusnierczyk)
  60. Re: Memory issues in R (David Winsemius)
  61. Re: comparing matrices (baptiste auguie)
  62. Re: Problem installing packages (Jarek Jasiewicz)
  63. Re: comparing matrices (David Winsemius)
  64. Re: comparing matrices (Esmail)
  65. Re: comparing m

Re: [R] Matching in R

2009-04-27 Thread Gustaf Rydevik
On Sun, Apr 26, 2009 at 6:22 PM,   wrote:
> Dear R users,
>
> I am trying to do exact matching on a large dataset (500.000 obs), about 
> equal size of treatment and controll group, with replacement: As for the 
> moment I use the "Match" function of the "Matching" library. I match on 2 
> covariates and all observations in the treatment group have at least one 
> exact counterpart in the controllgroup. Now I want to introduce observation 
> weights. I set ties=FALSE, as I want exactly one by one matching: Is there a 
> way which makes that I draw randomly from the individuals in the 
> controllgroup which have the same values of covariates as the individual in 
> the treatmentgroup, setting the probabilities to be drawn proportional to the 
> weights of the individual in the CT? E.g. I have three individuals which all 
> have the same value for the covariates as the one observation I want to find 
> a partner for, and the first of the three individuals has a very large 
> weight: Now when drawing randomly among those three I want the probability 
> that the first one is dr!
>  awn to be very large.
>
> I'd really appreciate any suggestions: the "weights" option does not do the 
> job, this seems to work only if setting "ties=TRUE"
>
> Thanks
> Dirk
> --
>

Hi Dirk,

You don't give a sample dataset, and I've not used the Matching
library, so take my comments with a scoop of salt.
Looking at the help page for Match, it seems as if the option
"Weight.matrix" is what you're looking for. creating a "weight" column
in the treatment group with a constant, high value, including "weight"
in the matching, and giving that covariate a high importance might
work, no?

/Gustaf
-

Quote:

"Weight.matrix
This matrix denotes the weights the matching algorithm uses when
weighting each of the covariates in X—see the Weight option. This
square matrix should have as many columns as the number of columns of
the X matrix. This matrix is usually provided by a call to the
GenMatch function which finds the optimal weight each variable should
be given so as to achieve balance on the covariates.

For most uses, this matrix has zeros in the off-diagonal cells. This
matrix can be used to weight some variables more than others. For
example, if X contains three variables and we want to match as best as
we can on the first, the following would work well:
> Weight.matrix <- diag(3)
> Weight.matrix[1,1] <- 1000/var(X[,1])
> Weight.matrix[2,2] <- 1/var(X[,2])
> Weight.matrix[3,3] <- 1/var(X[,3])
This code changes the weights implied by the inverse of the variances
by multiplying the first variable by a 1000 so that it is highly
weighted. In order to enforce exact matching see the exact and caliper
options. "

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

__
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 get rid of loop? [SOLVED]

2009-04-27 Thread Ken-JP

Thanks, Uwe, Peter, and Ray, for taking the time to look into this.

Just to wrap up this thread, and so that others may benefit,
I tried writing both a R code version and an inline C version.

Tested on a 8GB Ubuntu 64amd box, R 2.81, the speed difference was:
104secs vs 0.534secs, or the C version was about 200 times faster.

#
-

require( inline )
require( RUnit )

set.seed(1)
x <- runif(1e+7)

.c.code <-
" SEXP res, inp;
int cnt = 0, i;
PROTECT(inp = AS_NUMERIC(p)); cnt++;
PROTECT(res = Rf_duplicate(inp)); cnt++;
int nx = INTEGER(GET_DIM(inp))[0], ny =
INTEGER(GET_DIM(inp))[1];
double* pdata = REAL(AS_NUMERIC(inp));
double* rdata = REAL(res); double last;
for (int y = 0; y < ny; y++) {
last = 0.0;
for (int x = 0; x < nx; x++) {
i = x + y*nx;
if ( pdata[i]>0.75 ) {
rdata[i] = 1.0;
} else if ( pdata[i]<0.25 ) {
rdata[i] = -1.0;
} else if ( last==1 && pdata[i]<0.5 ) {
rdata[i] = 0.0;
} else if ( last==-1 && pdata[i]>0.5 ) {
rdata[i] = 0.0;
} else {
rdata[i] = last;
}
last = rdata[i];
}
}

UNPROTECT(cnt);
return res;";
.c.code.raw <- cfunction(signature(p="matrix"), .c.code);
# NOTE: I converted to matrix because I actually want to do many columns,
one at a time
ccode <- function( x ) { as.vector( .c.code.raw( p=as.matrix( x ) )); }

rcode <- function( x ) {
n <- length( x )
y <- rep(NA, n)
yprev <- 0;
for ( i in (1:n)) {
if ( x[i]>0.75 ) {
y[i] <- 1;
} else if ( x[i]<0.25 ) {
y[i] <- -1;
} else if ( yprev==1 & x[i]<0.5) {
y[i] <- 0;
} else if ( yprev==-1 & x[i]>0.5) {
y[i] <- 0;
} else {
y[i] <- yprev
}
yprev <- y[i];
}
y;
}

system.time( r.result <- rcode( x ));
system.time( c.result <- ccode( x ));
checkEquals( r.result, c.result );


-- 
View this message in context: 
http://www.nabble.com/How-to-get-rid-of-loop--tp23226779p23253747.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] series at low freq expanded into high freq

2009-04-27 Thread Murali.MENON
Folks,
 
If I have a series mm of, say, monthly observations, and a series dd of
daily dates, what's a good way of expanding mm such that corresponding
to each day in dd within the corresponding month in mm, the values of mm
are repeated?
 
So e.g., if I have mm:
 
mm <- c(15, 10, 12, 13, 11)
names(mm)<-c("Nov 2008",   "Dec 2008",  "Jan 2009",   "Feb 2009",   "Mar
2009")
library(zoo)
mm <- zoo(mm, order.by = as.yearmon(names(mm), format="%b %Y"))
 
And days:
 
dd <- as.Date(c("03/11/2008", "05/11/2008",
"04/01/2009","02/02/2009","17/02/2009","13/03/2009","14/03/2009","18/03/
2009", "26/03/2009"), format="%d/%m/%Y")
 
I want to be able to create a series that looks like this:
 
03/11/2008   15 
05/11/2008   15 
04/01/2009   12 
02/02/2009   13 
17/02/2009   13 
13/03/2009   11 
14/03/2009   11 
18/03/2009   11 
26/03/2009   11 
 
where because no daily dates in dd are in December, the final series has
no entries for December; there are two entries for November because
there are two dates in dd in November, etc.
 
Thanks,
Murali

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

2009-04-27 Thread Andris Jankevics
Hi, try this

A <- c(1:1000)
A <- paste ("000",A,sep="")
substr (A,nchar(A)-3,nchar(A))


Best regards,
Andris Jankevics


On Mon, Apr 27, 2009 at 12:35 PM, Mario dos Reis  wrote:
> I've been trough the R documentation for about half an hour and it's not
> clear to me how to do this:
>
> I need to format to character a series of integers from 1 to 1000, and I
> like them to look like
>
> "0001" "0002", "0059", "0123" and so on. Padded with zeroes to have four
> digits.
>
> Cheers!
> Mario.

__
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 re-import a table that was just exported to a file

2009-04-27 Thread jim holtman
Take a look at the output file.  You may need 'header=TRUE' on the read.table.

It would be good to at least supply the first couple of lines of the
file that you are trying to read.  The error message is self
explanitory: you have more columns than there are names on the first
line.

On Sun, Apr 26, 2009 at 7:38 PM, Nigel Birney  wrote:
>
> Hi all,
>
> I am saving a program's output to a file to be read by another algorithm.
> But somehow such a simple operation (the reading) fails. I get:
>
> Error in read.table("a_corr_data.txt", sep = ",", col.names = T, row.names =
> F) :
>  more columns than column names
>
>
> Here is the write statement:
>
>
> write.table(a_corr_data,"a_corr_data.txt",sep=",",col.names=T,row.names=F)
>
> Here is the read statement:
>
> a_corr_data <-
> read.table("a_corr_data.txt",sep=",",col.names=T,row.names=F)
>
> Nothing happens in-between (these actions are just 10-30 secs apart). I
> tried to export/import without col.names, also tried different deliminators
> ("/t") but the same error pops up again and again. I am already quite
> unhappy with this.
>
> thanks,
>
> N.
>
> --
> View this message in context: 
> http://www.nabble.com/Unable-to-re-import-a-table-that-was-just-exported-to-a-file-tp23248010p23248010.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.
>



-- 
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] Formatting numbers

2009-04-27 Thread Wacek Kusnierczyk
baptiste auguie wrote:
> sprintf("%04.f", 2)
>

makes no sense to use the float specifier for ints here;  besides, it's
slower:

x = 1:10^5

library(rbenchmark)
benchmark(columns=c('test', 'elapsed'), replications=100,
   sprintf('%05d', x),
   sprintf('%05.f', x))
#  test elapsed
# 1  sprintf("%05d", x)   4.952
# 2 sprintf("%05.f", x)  10.019


> sapply(sample(1:1000,4), function(ii) sprintf("%04.f",ii))

sprintf is vectorized!!!

>
> ?sprintf

indeed.

vQ

__
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] VIF's in R using BIGLM

2009-04-27 Thread dobomode
Dear R-help

This is a follow-up to my previous post here:
http://groups.google.com/group/r-help-archive/browse_thread/thread/d9b6f87ce06a9fb7/e9be30a4688f239c?lnk=gst&q=dobomode#e9be30a4688f239c

I am working on developing an open-source automated system for running
batch-regressions on very large datasets. In my previous post, I posed
the question of obtaining VIF's from the output of BIGLM. With a lot
of help from Assoc. Professor, Biostatistics Thomas Lumley at
University of Washington, I was able to make significant progress, but
ultimately got stuck. The following post describes the steps and
reasoning I undertook in trying to accomplish this task. Please note
that I am not a statistician so ignore any commentary that seems naive
to you.

A quick intro. The goal is to obtain VIF's (variance inflation
factors) from the regression output of BIGLM. Traditionally, this has
been possible with the regular lm() function. Follows a quick
illustration (the model below is pretty silly, only for illustration
purposes).

Example dataset:

> mtcars
 mpg cyl  disp  hp dratwt  qsec vs am gear
carb
Mazda RX4   21.0   6 160.0 110 3.90 2.620 16.46  0  14
4
Mazda RX4 Wag   21.0   6 160.0 110 3.90 2.875 17.02  0  14
4
Datsun 710  22.8   4 108.0  93 3.85 2.320 18.61  1  14
1
Hornet 4 Drive  21.4   6 258.0 110 3.08 3.215 19.44  1  03
1
Hornet Sportabout   18.7   8 360.0 175 3.15 3.440 17.02  0  03
2
Valiant 18.1   6 225.0 105 2.76 3.460 20.22  1  03
1
Duster 360  14.3   8 360.0 245 3.21 3.570 15.84  0  03
4
Merc 240D   24.4   4 146.7  62 3.69 3.190 20.00  1  04
2
Merc 23022.8   4 140.8  95 3.92 3.150 22.90  1  04
2
Merc 28019.2   6 167.6 123 3.92 3.440 18.30  1  04
4
Merc 280C   17.8   6 167.6 123 3.92 3.440 18.90  1  04
4
Merc 450SE  16.4   8 275.8 180 3.07 4.070 17.40  0  03
3
Merc 450SL  17.3   8 275.8 180 3.07 3.730 17.60  0  03
3
Merc 450SLC 15.2   8 275.8 180 3.07 3.780 18.00  0  03
3
Cadillac Fleetwood  10.4   8 472.0 205 2.93 5.250 17.98  0  03
4
Lincoln Continental 10.4   8 460.0 215 3.00 5.424 17.82  0  03
4
Chrysler Imperial   14.7   8 440.0 230 3.23 5.345 17.42  0  03
4
Fiat 12832.4   4  78.7  66 4.08 2.200 19.47  1  14
1
Honda Civic 30.4   4  75.7  52 4.93 1.615 18.52  1  14
2
Toyota Corolla  33.9   4  71.1  65 4.22 1.835 19.90  1  14
1
Toyota Corona   21.5   4 120.1  97 3.70 2.465 20.01  1  03
1
Dodge Challenger15.5   8 318.0 150 2.76 3.520 16.87  0  03
2
AMC Javelin 15.2   8 304.0 150 3.15 3.435 17.30  0  03
2
Camaro Z28  13.3   8 350.0 245 3.73 3.840 15.41  0  03
4
Pontiac Firebird19.2   8 400.0 175 3.08 3.845 17.05  0  03
2
Fiat X1-9   27.3   4  79.0  66 4.08 1.935 18.90  1  14
1
Porsche 914-2   26.0   4 120.3  91 4.43 2.140 16.70  0  15
2
Lotus Europa30.4   4  95.1 113 3.77 1.513 16.90  1  15
2
Ford Pantera L  15.8   8 351.0 264 4.22 3.170 14.50  0  15
4
Ferrari Dino19.7   6 145.0 175 3.62 2.770 15.50  0  15
6
Maserati Bora   15.0   8 301.0 335 3.54 3.570 14.60  0  15
8
Volvo 142E  21.4   4 121.0 109 4.11 2.780 18.60  1  14
2

Example model:

model <- mpg ~ cyl + disp + hp + drat + wt + qsec + vs + am + gear +
carb

Regression:

reg_lm <- lm(model, mtcars)

Results:

> summary(reg_lm)

Call:
lm(formula = model, data = mtcars)

Residuals:
Min  1Q  Median  3Q Max
-3.4506 -1.6044 -0.1196  1.2193  4.6271

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 12.30337   18.71788   0.657   0.5181
cyl -0.111441.04502  -0.107   0.9161
disp 0.013340.01786   0.747   0.4635
hp  -0.021480.02177  -0.987   0.3350
drat 0.787111.63537   0.481   0.6353
wt  -3.715301.89441  -1.961   0.0633 .
qsec 0.821040.73084   1.123   0.2739
vs   0.317762.10451   0.151   0.8814
am   2.520232.05665   1.225   0.2340
gear 0.655411.49326   0.439   0.6652
carb-0.199420.82875  -0.241   0.8122
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 2.65 on 21 degrees of freedom
Multiple R-squared: 0.869,  Adjusted R-squared: 0.8066
F-statistic: 13.93 on 10 and 21 DF,  p-value: 3.793e-07

VIF's:

> vif(reg_lm)
  cyl  disphp  dratwt  qsec
vsam  gear  carb
15.373833 21.620241  9.832037  3.374620 15.164887  7.527958  4.965873
4.648487  5.357452  7.908747

Here is the definition of vif() (courtesy of
http://www.stat.sc.edu/~hitchcock/bodyfatRexample.txt):

> vif.lm
function(object, ...) {
  V <- summary(object)$cov.unscaled
  Vi <- crossprod(model.matrix(object))
nam <- names(coef(object))
  if(k <- match("(Intercept)", nam, nomatch = F)) {

Re: [R] how to send email with R

2009-04-27 Thread Cuvelier Etienne
See http://finzi.psych.upenn.edu/R/Rhelp02/archive/113531.html

Etienne

At 12:43 27/04/2009, Thomas Loridan wrote:
>Hi all
>
>I can t seem to find a way to send an email using R
>
>would anyone have a suggestion?
>
>much appreciated
>
>Thomas
>
>-- 
>Thomas Loridan
>King's College email: thomas.lori...@kcl.ac.uk
>webpage:http://geography.kcl.ac.uk/micromet/tloridan/index.htm
>
>__
>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.


+ 
+ Cuvelier Etienne
+ Assistant 
+ FUNDP - Faculté d'Informatique  
+ rue Grandgagnage, 21   B-5000 Namur (Belgique)
+ tel: 32.81.72.49.75fax: 32.81.72.49.67
+ skype: cuvelier.etienne

THE TOP TEN REASONS TO BECOME A STATISTICIAN
 1. Deviation is considered normal.
 2. We feel complete and sufficient.
 3. We are "mean" lovers.
 4. Statisticians do it discretely and continuously.
 5. We are right 95% of the time.
 6. We can legally comment on someone's posterior distribution.
 7. We may not be normal but we are transformable.
 8. We never have to say we are certain.
 9. We are honestly significantly different.
10 No one wants our jobs.

__
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 re-import a table that was just exported to a file

2009-04-27 Thread Berwin A Turlach
On Sun, Apr 26, 2009 at 7:38 PM, Nigel Birney  wrote:
>
> Hi all,
>
> I am saving a program's output to a file to be read by another
> algorithm. But somehow such a simple operation (the reading) fails.
> I get:
>
> Error in read.table("a_corr_data.txt", sep = ",", col.names = T,
> row.names = F) :
> __more columns than column names
>
>
> Here is the write statement:
>
> write.table(a_corr_data,"a_corr_data.txt",sep=",",col.names=T,row.names=F)
>
> Here is the read statement:
>
> a_corr_data <-
> read.table("a_corr_data.txt",sep=",",col.names=T,row.names=F)
>
> Nothing happens in-between (these actions are just 10-30 secs
> apart). I tried to export/import without col.names, also tried
> different deliminators ("/t") but the same error pops up again and
> again. I am already quite unhappy with this.

?read.table

You might find that you are using col.names and row.names wrongly in the
read.table command.

Best wishes,

Berwin

=== Full address =
Berwin A TurlachTel.: +65 6516 4416 (secr)
Dept of Statistics and Applied Probability+65 6516 6650 (self)
Faculty of Science  FAX : +65 6872 3919   
National University of Singapore 
6 Science Drive 2, Blk S16, Level 7  e-mail: sta...@nus.edu.sg
Singapore 117546http://www.stat.nus.edu.sg/~statba

__
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] series at low freq expanded into high freq

2009-04-27 Thread Murali.MENON
Hmm, silly of me. I have the solution, after some mucking about with
coercion and so on:

> xx <- zoo(mm[as.character(as.yearmon(dd))], order.by = dd)
> xx

2008-11-03 2008-11-05 2009-01-04 2009-02-02 2009-02-17 2009-03-13
2009-03-14 2009-03-18 2009-03-26 
15 15 12 13 13 11
11 11 11

Right. Sorry to waste your time.

Murali

-Original Message-
From: MENON Murali 
Sent: 27 April 2009 11:51
To: 'r-help@r-project.org'
Subject: series at low freq expanded into high freq

Folks,
 
If I have a series mm of, say, monthly observations, and a series dd of
daily dates, what's a good way of expanding mm such that corresponding
to each day in dd within the corresponding month in mm, the values of mm
are repeated?
 
So e.g., if I have mm:
 
mm <- c(15, 10, 12, 13, 11)
names(mm)<-c("Nov 2008",   "Dec 2008",  "Jan 2009",   "Feb 2009",   "Mar
2009")
library(zoo)
mm <- zoo(mm, order.by = as.yearmon(names(mm), format="%b %Y"))
 
And days:
 
dd <- as.Date(c("03/11/2008", "05/11/2008",
"04/01/2009","02/02/2009","17/02/2009","13/03/2009","14/03/2009","18/03/
2009", "26/03/2009"), format="%d/%m/%Y")
 
I want to be able to create a series that looks like this:
 
03/11/2008   15 
05/11/2008   15 
04/01/2009   12 
02/02/2009   13 
17/02/2009   13 
13/03/2009   11 
14/03/2009   11 
18/03/2009   11 
26/03/2009   11 
 
where because no daily dates in dd are in December, the final series has
no entries for December; there are two entries for November because
there are two dates in dd in November, etc.
 
Thanks,
Murali

__
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] Vector of matrix

2009-04-27 Thread Romildo Martins
Hello,

To specify a vector of matrices in R (which may have different sizes)?

Thanks a lot!

Romildo

[[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] Vector of matrix

2009-04-27 Thread Duncan Murdoch

On 4/27/2009 8:01 AM, Romildo Martins wrote:

Hello,

To specify a vector of matrices in R (which may have different sizes)?


M1 <- matrix(1,1,1)
M2 <- matrix(2,2,2)
vec <- list(M1, M2)



Thanks a lot!

Romildo

[[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] how to install R really *locally*?

2009-04-27 Thread Oliver Kullmann
Thanks, but this wasn't my problem (I already use --vanilla
when *calling* R):

The problem is how to get a "vanilla" *installation*
(as I said, it was the installation which failed, not
later running R, and this failure was caused by the file
HOME/.RProfil).

Hope that's clearer now.

Thanks anyway!

Oliver



On Mon, Apr 27, 2009 at 10:45:53AM +0200, Uwe Ligges wrote:
> Set you system up in a way that its R is started with some of the 
> options reported by `R --help':
> 
>   --no-environ  Don't read the site and user environment files
>   --no-site-fileDon't read the site-wide Rprofile
>   --no-init-fileDon't read the .Rprofile or ~/.Rprofile files
>   --no-restore-data Don't restore previously saved objects
>   --no-restore-history  Don't restore the R history file
>   --no-restore  Don't restore anything
>   --vanilla Combine --no-save, --no-restore, --no-site-file,
>   --no-init-file and --no-environ
> 
> 
> Uwe Ligges
> 
> 
> Oliver Kullmann wrote:
> >Hello,
> >
> >my first attempt at installing version 2.9.0 failed
> >because I got an error
> >"Error in library(pspline) : there is no package called 'pspline'"
> >
> >Later I realised that this comes from HOME/.RProfil, and removing
> >that files "solves" that problem.
> >
> >However, I'm actually glad that this error happened, since it shows
> >a deeper problem (which is actually not solved yet):
> >My context is that I re-distribute R as a part of an open-source
> >library I develop, and this library (actually I call it a "research
> >environment") installs many things (like R and Maxima, gcc, git, ...),
> >and this all purely locally --- it shouldn't interfere with anything
> >the user has installed.
> >
> >So my question is how can I tell R as installation time that it should
> >not look at any configuration files or other files whatsoever (so it should
> >for example ignore HOME/.RProfil)?
> >
> >The installation instructions mention the variable "rhome", but I don't
> >understand what type of "home" is meant here. What I could need here
> >would be a redefinition of the user home-directory (to a local directory
> >in my installation), but I guess that is not meant with rhome.
> >
> >Hope somebody can help here.
> >
> >Oliver
> >
> >__
> >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] series at low freq expanded into high freq

2009-04-27 Thread Gabor Grothendieck
Try this:

> library(zoo)
> mm <- c(15, 10, 12, 13, 11)
> names(mm)<-c("Nov 2008",   "Dec 2008",  "Jan 2009",   "Feb 2009", "Mar 2009")
> library(zoo)
> mm <- zoo(mm, order.by = as.yearmon(names(mm), format="%b %Y"))
>
> dd <- as.Date(c("03/11/2008", "05/11/2008",
+ "04/01/2009","02/02/2009","17/02/2009","13/03/2009","14/03/2009","18/03/2009",
"26/03/2009"), format="%d/%m/%Y")
>
> zoo(coredata(mm)[match(as.yearmon(dd), time(mm))], dd)
2008-11-03 2008-11-05 2009-01-04 2009-02-02 2009-02-17 2009-03-13
2009-03-14 2009-03-18 2009-03-26
15 15 12 13 13 11
   11 11 11


On Mon, Apr 27, 2009 at 6:51 AM,   wrote:
> Folks,
>
> If I have a series mm of, say, monthly observations, and a series dd of
> daily dates, what's a good way of expanding mm such that corresponding
> to each day in dd within the corresponding month in mm, the values of mm
> are repeated?
>
> So e.g., if I have mm:
>
> mm <- c(15, 10, 12, 13, 11)
> names(mm)<-c("Nov 2008",   "Dec 2008",  "Jan 2009",   "Feb 2009",   "Mar
> 2009")
> library(zoo)
> mm <- zoo(mm, order.by = as.yearmon(names(mm), format="%b %Y"))
>
> And days:
>
> dd <- as.Date(c("03/11/2008", "05/11/2008",
> "04/01/2009","02/02/2009","17/02/2009","13/03/2009","14/03/2009","18/03/
> 2009", "26/03/2009"), format="%d/%m/%Y")
>
> I want to be able to create a series that looks like this:
>
> 03/11/2008       15
> 05/11/2008       15
> 04/01/2009       12
> 02/02/2009       13
> 17/02/2009       13
> 13/03/2009       11
> 14/03/2009       11
> 18/03/2009       11
> 26/03/2009       11
>
> where because no daily dates in dd are in December, the final series has
> no entries for December; there are two entries for November because
> there are two dates in dd in November, etc.
>
> Thanks,
> Murali
>
> __
> 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] refit with binomial model (lme4)

2009-04-27 Thread Eric Elguero
Dear R users,

I'm trying to use function 'refit' from lme4
and I get this error that I can't understand:

> refit(dolo4.model4,cbind(uu,50-uu))
Error in function (classes, fdef, mtable)  : 
  unable to find an inherited method for function "refit", for signature
"mer", "matrix"

if I try:

> refit(dolo4.model4,uu)
Error in asMethod(object) : matrix is not symmetric [1,2]

I get this error message that I can no more
understand but which suggests that refit expects
two columns.


the initial model was:

> dolo4.mod...@call
glmer(formula = cbind(sortis, restes) ~ mean.co2 + (1 | sujet), 
data = dollo4.df, family = binomial)



R version 2.9.0 (2009-04-17)

and

Package: lme4
Version: 0.999375-28
Date: 2008-12-13

thank you in advance

e.e.

__
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] series at low freq expanded into high freq

2009-04-27 Thread Gabor Grothendieck
I think you are assuming the version of mm prior to turning it into
a zoo object. If mm is a zoo object, as in the question, then see
my last post.

On Mon, Apr 27, 2009 at 7:55 AM,   wrote:
> Hmm, silly of me. I have the solution, after some mucking about with
> coercion and so on:
>
>> xx <- zoo(mm[as.character(as.yearmon(dd))], order.by = dd)
>> xx
>
> 2008-11-03 2008-11-05 2009-01-04 2009-02-02 2009-02-17 2009-03-13
> 2009-03-14 2009-03-18 2009-03-26
>        15         15         12         13         13         11
> 11         11         11
>
> Right. Sorry to waste your time.
>
> Murali
>
> -Original Message-
> From: MENON Murali
> Sent: 27 April 2009 11:51
> To: 'r-help@r-project.org'
> Subject: series at low freq expanded into high freq
>
> Folks,
>
> If I have a series mm of, say, monthly observations, and a series dd of
> daily dates, what's a good way of expanding mm such that corresponding
> to each day in dd within the corresponding month in mm, the values of mm
> are repeated?
>
> So e.g., if I have mm:
>
> mm <- c(15, 10, 12, 13, 11)
> names(mm)<-c("Nov 2008",   "Dec 2008",  "Jan 2009",   "Feb 2009",   "Mar
> 2009")
> library(zoo)
> mm <- zoo(mm, order.by = as.yearmon(names(mm), format="%b %Y"))
>
> And days:
>
> dd <- as.Date(c("03/11/2008", "05/11/2008",
> "04/01/2009","02/02/2009","17/02/2009","13/03/2009","14/03/2009","18/03/
> 2009", "26/03/2009"), format="%d/%m/%Y")
>
> I want to be able to create a series that looks like this:
>
> 03/11/2008       15
> 05/11/2008       15
> 04/01/2009       12
> 02/02/2009       13
> 17/02/2009       13
> 13/03/2009       11
> 14/03/2009       11
> 18/03/2009       11
> 26/03/2009       11
>
> where because no daily dates in dd are in December, the final series has
> no entries for December; there are two entries for November because
> there are two dates in dd in November, etc.
>
> Thanks,
> Murali
>
> __
> 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] Bumps chart in R

2009-04-27 Thread Jim Lemon

Andreas Christoffersen wrote:

Hi there,

I would like to make a 'bumps chart' like the ones described e.g.
here: http://junkcharts.typepad.com/junk_charts/bumps_chart/

Purpose: I'd like to plot the proportion of people in select countries
living for less then one USD pr day in 1994 and 2004 respectively. I
have already constructed a barplot - but I think a bumps chart would
be better

# The barplot and data
countries <- c("U-lande", "Afrika syd for sahara", "Europa og
Centralasien", "Lantinamerika og Caribien","Mellemøstenog Nordafrika",
"Sydasien","ØStasien og stillehaveet", "Kina", "Brasilien")
poor_1990 <- c(28.7,46.7,0.5,10.2,2.3,43,29.8,33,14)
poor_2004 <- c(18.1,41.1,0.9,8.6,1.5,30.8,9.1,9.9,7.5)
poor <- cbind(poor_1990,poor_2004)
rownames(poor) <- countries
oldpar <- par(no.readonly=T)
par <- par(mar=c(15,5,5,1))
png("poor.png")
par <- par(mar=c(15,5,5,1))
barplot(t(poor[order(poor[,2]),]),beside=T,col=c(1,2),las=3,ylab="%
poor",main="Percent living for < 1 USD per day (1993
prices)",ylim=c(0,50))
legend("topleft",c("1990","2004"),fill=c(1,2),bty="n")
par(oldpar)
dev.off()

I Guess I need to start with an normal plot? Something like the below
- but there is a loong way to go...

# A meager start - how to finish my bumps chart
plot(c(rep(1,9),rep(2,9)),c(fattig_1990,fattig_2004),type="b",ann=F)

  

Hi Andreas,
Not too hard. Try this:

bump.plot<-function (y1,y2=NULL,top.labels=NULL,left.labels=NULL,
right.labels=NULL,rank=TRUE,descending=TRUE,linecol=par("fg"),
mar=c(2,2,4,2),...) {

if(missing(y1))
 stop("Usage: spread.labels(y1,y2,labels,...)")
ydim<-dim(y1)
if(is.null(ydim) && is.null(y2))
 stop("y1 must be a matrix or data frame if y2 is NULL")
oldmar<-par("mar")
par(mar=mar)
if(is.null(y2) && ydim[2] > 1) {
 y2<-y1[,2]
 y1<-y1[,1]
}
if(rank) {
 left.labels<-left.labels[order(y1)]
 right.labels<-right.labels[order(y1)]
 y1<-rank(y1)
 y2<-rank(y2)
 if(descending) {
  left.labels<-rev(left.labels)
  right.labels<-rev(right.labels)
  y1<-rev(y1)
  y2<-rev(y2)
 }
}
ny<-length(y1)
plot(c(rep(1,ny),rep(2,ny)),c(rev(y1),rev(y2)),xlim=c(0,3),xlab="",ylab="",
 axes=FALSE,...)
segments(rep(1,ny),y1,rep(2,ny),y2,col=linecol)
text(0.8,rev(y1),left.labels,adj=1)
text(2.2,rev(y2),right.labels,adj=0)
par(mar=oldmar)
}
# use the above data
bump.plot(poor_1990,poor_2004,c("1990","2004"),countries,countries,
linecol=1:20,pch=16,main="Bumps plot")

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] refit with binomial model (lme4)

2009-04-27 Thread Douglas Bates
This is related to using the matrix form of the response for a
binomial glmm.  The refit method for a model fit by lmer is based on a
numeric vector response.

Is it possible to use the expanded form (i.e. a vector of 0/1 values)
of the responses instead of the matrix form?

On Mon, Apr 27, 2009 at 7:20 AM, Eric Elguero  wrote:
> Dear R users,
>
> I'm trying to use function 'refit' from lme4
> and I get this error that I can't understand:
>
>> refit(dolo4.model4,cbind(uu,50-uu))
> Error in function (classes, fdef, mtable)  :
>  unable to find an inherited method for function "refit", for signature
> "mer", "matrix"
>
> if I try:
>
>> refit(dolo4.model4,uu)
> Error in asMethod(object) : matrix is not symmetric [1,2]
>
> I get this error message that I can no more
> understand but which suggests that refit expects
> two columns.
>
>
> the initial model was:
>
>> dolo4.mod...@call
> glmer(formula = cbind(sortis, restes) ~ mean.co2 + (1 | sujet),
>    data = dollo4.df, family = binomial)
>
>
>
> R version 2.9.0 (2009-04-17)
>
> and
>
> Package: lme4
> Version: 0.999375-28
> Date: 2008-12-13
>
> thank you in advance
>
> e.e.
>
> __
> 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] integrate lgamma from 0 to Inf

2009-04-27 Thread JLucke
I am late to this discussion so forgive me if I am being redundant.  It 
appears to me that the integral from 0 to infinity of log-gamma may 
diverge to infinity.  Equation 6.1.50 of Abramowitz & Stegun shows that a 
re-expression of lnGamma(x) and the Stirling approximation involves 
(x-1/2)*log(x) -x along with other terms.  This term appears to dominate 
the integral and itself diverge.  It is worth checking out.


> integrate(lgamma, lower = 0, upper = 10)
43.24636 with absolute error < 1.6e-11
> integrate(lgamma, lower = 0, upper = 100)
15438.12 with absolute error < 1.4
> integrate(lgamma, lower = 0, upper = 1000)
2701843 with absolute error < 254
> integrate(lgamma, lower = 0, upper = 1)
385485116 with absolute error < 18464

> gterm <- function(x){(x-.5)*log(x)-x}
> integrate(gterm,lower=0,upper=10)
33.61633 with absolute error < 1.1e-05
> integrate(gterm,lower=0,upper=100)
15345.59 with absolute error < 1.2
> integrate(gterm,lower=0,upper=1000)
2700923 with absolute error < 252
> integrate(gterm,lower=0,upper=1)
385475926 with absolute error < 18462
> 

Joseph F. Lucke
Senior Statistician
Research Institute on Addictions
University at Buffalo
State University of New York
1021 Main Street
Buffalo, NY  14203-1016
Office: 716-887-6807
Fax: 716-887-2510
http://www.ria.buffalo.edu/profiles/lucke.html




"Andreas  Wittmann"  
Sent by: r-help-boun...@r-project.org
04/22/2009 03:28 AM

To
r-help@r-project.org
cc

Subject
[R] integrate lgamma from 0 to Inf






Dear R users,

i try to integrate lgamma from 0 to Inf. But here i get the message 
"roundoff error is detected in the extrapolation table", if i use 1.0e120 
instead of Inf the computation works, but this is against the suggestion 
of integrates help information to use Inf explicitly. Using stirlings 
approximation doesnt bring the solution too.

## Stirlings approximation
lgammaApprox <- function(x)
{
  0.5*log(2*pi)+(x-(1/2))*log(x)-x
}

integrate(lgamma, lower = 0, upper = 1.0e120)
integrate(lgammaApprox, lower = 0, upper = 1.0e120)
> integrate(lgamma, lower = 0, upper = 1.0e120)
1.374051e+242 with absolute error < 3.2e+235
> integrate(lgammaApprox, lower = 0, upper = 1.0e120)
1.374051e+242 with absolute error < 3.2e+235

integrate(lgamma, lower = 0, upper = Inf)
integrate(lgammaApprox, lower = 0, upper = Inf)
> integrate(lgamma, lower = 0, upper = Inf)
Fehler in integrate(lgamma, lower = 0, upper = Inf) : 
  roundoff error is detected in the extrapolation table
> integrate(lgammaApprox, lower = 0, upper = Inf)
Fehler in integrate(lgammaApprox, lower = 0, upper = Inf) : 
  roundoff error is detected in the extrapolation table


Many thanks if you have any advice for me!

best regards

Andreas
--

__
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] A way to get the R data stored temporarily in working memory?

2009-04-27 Thread Friedericksen

Hey guys,

I have a problem: I created a silly for loop without saving the results 
on each step. After a while I realised that it will take days to finish 
the loop until I get the results.


Is there a way to get the data R saves in working memory or in a 
temporary file while runing the loop? So that stoping the loop will not 
result in complete data loss?


Thank you very much!

Greetings,
Friederiksen

__
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] A way to get the R data stored temporarily in working memory?

2009-04-27 Thread ONKELINX, Thierry
Have a look at ?save and ?load. Those function will allow you to save an
R object to a file and reload it when needed.

HTH,

Thierry 




ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium 
tel. + 32 54/436 185
thierry.onkel...@inbo.be 
www.inbo.be 

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey

-Oorspronkelijk bericht-
Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
Namens Friedericksen
Verzonden: maandag 27 april 2009 14:53
Aan: r-h...@stat.math.ethz.ch
Onderwerp: [R] A way to get the R data stored temporarily in working
memory?

Hey guys,

I have a problem: I created a silly for loop without saving the results 
on each step. After a while I realised that it will take days to finish 
the loop until I get the results.

Is there a way to get the data R saves in working memory or in a 
temporary file while runing the loop? So that stoping the loop will not 
result in complete data loss?

Thank you very much!

Greetings,
Friederiksen

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

Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer 
en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is
door een geldig ondertekend document. The views expressed in  this message 
and any annex are purely those of the writer and may not be regarded as stating 
an official position of INBO, as long as the message is not confirmed by a duly 
signed document.

__
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] A way to get the R data stored temporarily in working memory?

2009-04-27 Thread Duncan Murdoch

On 4/27/2009 8:52 AM, Friedericksen wrote:

Hey guys,

I have a problem: I created a silly for loop without saving the results 
on each step. After a while I realised that it will take days to finish 
the loop until I get the results.


Is there a way to get the data R saves in working memory or in a 
temporary file while runing the loop? So that stoping the loop will not 
result in complete data loss?


Thank you very much!


You can use an explicit save() to write out a list of variables (or 
save.image() to write out all of them) but then you need to work out how 
to restart from one of these images.


Duncan Murdoch

__
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] Bumps chart in R

2009-04-27 Thread Andreas Christoffersen
> Hi Andreas,
> Not too hard. Try this:

Amazing! - a bump.plot function - so cool. I love it when I
simultaneously realize the power of R and my own limitations with R. I
must learn how to write my own functions (suggestions for good
introduction are very welcome)

But: When I run the following
bump.plot(poor_1990,poor_2004,c("1990","2004"),countries,
linecol=1:20, pch=16, main="Bumps plot" ,rank=F)

1: It seams the data is somehow sorted/ordered perversely: Now Kina
(Danish for "China") e.g. has traded places with "Afrika syd for
sahara" (Danish for "Africa south of Sahara"), etc.

2: When I set e.g. right.labels=NULL - I get a lot of empty space. How
could I remove it?

p.s. For aesthetics I've change a tiny part of your function to
plot(c(rep(1,ny),rep(2,ny)),c(rev(y1),rev(y2)),xlim=c(0,3),xlab="",ylab="",
axes=T,xaxt="n",yaxt="s",bty="n",...)
Thereby adding an Y axis. - I don't really know whats going on - but I
could guess this was were the axis magic happened.

Cheers - a very gratefull andreas (especially if someone can help with
the misplaces labels mentioned in 1 above)

__
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] large factorials

2009-04-27 Thread JLucke
I am late to this discussion so I apologize if what I say has already been 
noted.  The function below does NOT require large factorials, but very 
small reciprocal of factorials.  Thus if v2  would be replaced with 
something like exp(-lgamma(i-n+m+1)-lgamma(m+1)) and checked for underflow 
(ie .Machine$double.xmin), then the problem MAY be solved.



E.g., 
sum1 <- function(l,u,t,i,n,w,tol=.Machine$double.xmin) {
v <- 0
v2 <- 1
for (m in 0 :w & v2 > tol) {
 v1 <- ((u^(1/2))*(l^(1/2))*t)^(i-n+2*m)
 v2 <- exp(-lgamma(i-n+m+1)-lgamma(m+1))
 v3 <- v1/v2
 v <- v+v3
 }
return(v)
}

> sum1(1,2,10,80,3,80)
[1] 7.043456e+207
> sum1(1,2,10,80,3,100)
[1] 8.804319e+207
> sum1(1,2,10,80,3,200)
[1] 1.760863e+208
> sum1(1,2,10,80,3,1000)
[1] 8.804314e+208
> 

Joseph F. Lucke
Senior Statistician
Research Institute on Addictions
University at Buffalo
State University of New York
1021 Main Street
Buffalo, NY  14203-1016
Office: 716-887-6807
Fax: 716-887-2510
http://www.ria.buffalo.edu/profiles/lucke.html




molinar  
Sent by: r-help-boun...@r-project.org
04/23/2009 10:00 AM

To
r-help@r-project.org
cc

Subject
Re: [R] large factorials







Here is what I did:
library(rSymPy)
factorial.sympy <- function(n) sympy(paste("factorial(", n, ")"))
factorial.sympy(171) 
[1]
"124101807021766782342484052410310399261660557750169318538895180361199607522169175299275197812048758557646495950167038705280988985869071076733124203221848436431047357788996854827829075454156196485215346831804429323959817369689965723590394761615227855818006117636510842880"
>
Which work perfectly. 

Here is one of my summation functions:

sum1 <- function(l,u,t,i,n,w) {
+ v <- 0
+ for (m in 0 :w) {
+ v1 <- ((u^(1/2))*(l^(1/2))*t)^(i-n+2*m)
+ v2 <- (factorial.sympy(i-n+m))*(factorial.sympy(m))
+ v3 <- v1/v2
+ v <- v+v3
+ }
+ return(v)
+ }

sum1(1,2,10,80,3,80)
Error in (factorial.sympy(i - n + m)) * (factorial.sympy(m)) : 
  non-numeric argument to binary operator

I'm not sure why it works when I do the factorial normally but when I call
my function it doesn't work? 







molinar wrote:
> 
> Thank you everyone all of your posts were very helpful.  I tried each 
one
> and I think I have about 10 new packages installed.  The formula I need 
to
> calculate did not involve any logarithms but infinite summations of
> factorials, I'm sorry for not specifying.  I read some things about 
using
> logarithms but I thought in my case I would have to do an e to the log 
and
> by doing that R still gave me the same problems with numbers over 170. 
> 
> But I was able to get it to work by using the last post about the rsympy
> packages. 
> 
> I tried downloading bc but I didn't know how to connect it to R, so R 
said
> "could not find function bc". 
> 
> Thanks again for all of your help.
> Samantha
> 
> 
> 
> 
> 
> Gabor Grothendieck wrote:
>> 
>> Also the R sympy package can handle this:
>> 
>>> library(rSymPy)
>> Loading required package: rJava
>> 
>>> factorial.sympy <- function(n) sympy(paste("factorial(", n, ")"))
>> 
>>> # note that first time sympy is called it loads java, jython and sympy
>>> # but on subsequent calls its faster.  So make a dummy call first.
>>> factorial.sympy(10)
>> [1] "3628800"
>> 
>>> # code from earlier post defining factorial.bc to be inserted here
>> 
>>>benchmark(replications=10, columns=c('test', 'elapsed'),
>> +   bc=factorial.bc(500),
>> +   sympy = factorial.sympy(500))
>>test elapsed
>> 1bc2.17
>> 2 sympy0.09
>> 
>> See the rSymPy, r-bc and rbenchmark home pages:
>> http://rsympy.googlecode.com
>> http://r-bc.googlecode.com
>> http://rbenchmark.googlecode.com
>> 
>> On Wed, Apr 22, 2009 at 3:21 PM, molinar  wrote:
>>>
>>> I am working on a project that requires me to do very large factorial
>>> evaluations.  On R the built in factorial function and the one I 
created
>>> both are not able to do factorials over 170.  The first gives an error
>>> and
>>> mine return Inf.
>>>
>>> Is there a way to have R do these larger calculations (the calculator 
in
>>> accessories can do 1 factorial and Maple can do even larger)
>>> --
>>> View this message in context:
>>> http://www.nabble.com/large-factorials-tp23175816p23175816.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.
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/large-factorials-tp231758

[R] ANN: RHIPE 0.1

2009-04-27 Thread Saptarshi Guha
Hello,
I'd like to announce the release of the 0.1 version of RHIPE -R and
Hadoop Integrated Processing Environment. Using RHIPE, it is possible
to write map-reduce algorithms using the R language and start them
from within R.
RHIPE is built on Hadoop and so benefits from Hadoop's fault
tolerance, distributed file system and job scheduling features.
For the R user, there is rhlapply which runs an lapply across the cluster.
For the Hadoop user, there is rhmr which runs a general map-reduce program.

The tired example of counting words:

m <- function(key,val){
  words <- substr(val," +")[[1]]
  wc <- table(words)
  cln <- names(wc)
  return(sapply(1:length(wc),function(r)
list(key=cln[r],value=wc[[r]]),simplify=F))
}
r <- function(key,value){
  value <- do.call("rbind",value)
  return(list(list(key=key,value=sum(value
}
rhmr(mapper=m,reduce=r,input.folder="X",output.folder="Y")

URL: http://ml.stat.purdue.edu/rhipe

There are some downsides to RHIPE which are described at
http://ml.stat.purdue.edu/rhipe/install.html#sec-5

Regards
Saptarshi Guha

__
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] A way to get the R data stored temporarily in working memory?

2009-04-27 Thread Andrew Dolman
Using write() with append=T should work. Just be careful not to open the
text file with a program that will lock it while the loop is still running.
Text editors will not usually lock the file so in windows you could use
notepad to take a look at the output and copy/paste to somewhere else.


e.g.

a <- vector(length=10)
for (i in 1:10){
a[i]<-rnorm(1)
write(a[i], "temp.txt", append=T) ## append your new bit of data to the text
file at each iteration of the loop
}









andydol...@gmail.com


2009/4/27 Friedericksen 

> Hey guys,
>
> I have a problem: I created a silly for loop without saving the results on
> each step. After a while I realised that it will take days to finish the
> loop until I get the results.
>
> Is there a way to get the data R saves in working memory or in a temporary
> file while runing the loop? So that stoping the loop will not result in
> complete data loss?
>
> Thank you very much!
>
> Greetings,
> Friederiksen
>
> __
> 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] A way to get the R data stored temporarily in working memory?

2009-04-27 Thread Friedericksen

Hey,
thank you guys for your responses.The problem is, R is already running 
on the loop. So I don't see a way to use save() oder save.image() (or 
any other function?!)


Greetings

Duncan Murdoch wrote:

On 4/27/2009 8:52 AM, Friedericksen wrote:

Hey guys,

I have a problem: I created a silly for loop without saving the 
results on each step. After a while I realised that it will take days 
to finish the loop until I get the results.


Is there a way to get the data R saves in working memory or in a 
temporary file while runing the loop? So that stoping the loop will 
not result in complete data loss?


Thank you very much!


You can use an explicit save() to write out a list of variables (or 
save.image() to write out all of them) but then you need to work out how 
to restart from one of these images.


Duncan Murdoch

__
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] For Loop Syntax

2009-04-27 Thread Bronagh Grimes
Hi there,

 

Just wondering if someone can help me with the correct syntax to use
with for loops?

 

I have split my original file by count, & wish to first of all assign
new tables based on the splits.  Then I just want to create a new
variable.  Please see code below.

 

This code works outside of a loop so I am just trying to code so I don't
have to repeat numerous times.

 

Many thanks in advance,

Bronagh

 

A2 = split(A1,A1$count) 

 

for(i in 1:10){

trial[i]   <- data.frame(A2$`i`)

trial[i]$BLD[i]   <- triali$BLD

trial[i]$count <- triali$BLD <- NULL

}


[[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] large factorials

2009-04-27 Thread JLucke
The modified function I presented contains a stupid error, which is 
corrected below.

sum1 <- function(l,u,t,i,n,w,tol=.Machine$double.xmin) {
v <- 0
v2 <- 1
for (m in 0 :w & v2 > tol) {
 v1 <- ((u^(1/2))*(l^(1/2))*t)^(i-n+2*m)
 v2 <- exp(-lgamma(i-n+m+1)-lgamma(m+1))
 v3 <- v1*v2
 v <- v+v3
 }
return(v)
}

sum1(1,2,10,80,3,80)
[1] 5.519201e-23
> sum1(1,2,10,80,3,100)
[1] 6.892307e-23
> sum1(1,2,10,80,3,200)
[1] 1.375784e-22
> sum1(1,2,10,80,3,1000)
[1] 6.86821e-22


Need more coffee...

Joseph F. Lucke
Senior Statistician
Research Institute on Addictions
University at Buffalo
State University of New York
1021 Main Street
Buffalo, NY  14203-1016
Office: 716-887-6807
Fax: 716-887-2510
http://www.ria.buffalo.edu/profiles/lucke.html

[[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] integrate lgamma from 0 to Inf

2009-04-27 Thread Stavros Macrakis
On Wed, Apr 22, 2009 at 3:28 AM, Andreas  Wittmann
 wrote:
> i try to integrate lgamma from 0 to Inf.

Both gamma and log are positive and monotonically increasing for large
arguments.

What can you conclude about the integrability of log(gamma(x))?

  -s

__
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] A way to get the R data stored temporarily in working memory?

2009-04-27 Thread Duncan Murdoch

On 4/27/2009 10:18 AM, Friedericksen wrote:

Hey,
thank you guys for your responses.The problem is, R is already running 
on the loop. So I don't see a way to use save() oder save.image() (or 
any other function?!)


You would have had to have put these in your loop.  If it's running now, 
there's nothing you can do from within R.


Duncan Murdoch



Greetings

Duncan Murdoch wrote:

On 4/27/2009 8:52 AM, Friedericksen wrote:

Hey guys,

I have a problem: I created a silly for loop without saving the 
results on each step. After a while I realised that it will take days 
to finish the loop until I get the results.


Is there a way to get the data R saves in working memory or in a 
temporary file while runing the loop? So that stoping the loop will 
not result in complete data loss?


Thank you very much!


You can use an explicit save() to write out a list of variables (or 
save.image() to write out all of them) but then you need to work out how 
to restart from one of these images.


Duncan Murdoch

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


Re: [R] integrate lgamma from 0 to Inf

2009-04-27 Thread JLucke
IMHO, you should consult an advanced text on calculus with integration 
over infinite intervals, so that you understand what you are trying to do.

Joseph F. Lucke
Senior Statistician
Research Institute on Addictions
University at Buffalo
State University of New York
1021 Main Street
Buffalo, NY  14203-1016
Office: 716-887-6807
Fax: 716-887-2510
http://www.ria.buffalo.edu/profiles/lucke.html




Stavros Macrakis  
Sent by: r-help-boun...@r-project.org
04/27/2009 10:30 AM

To
Andreas Wittmann 
cc
r-help@r-project.org
Subject
Re: [R] integrate lgamma from 0 to Inf






On Wed, Apr 22, 2009 at 3:28 AM, Andreas  Wittmann
 wrote:
> i try to integrate lgamma from 0 to Inf.

Both gamma and log are positive and monotonically increasing for large
arguments.

What can you conclude about the integrability of log(gamma(x))?

  -s

__
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] Bumps chart in R

2009-04-27 Thread hadley wickham
]
> library(ggplot2)
> qplot(year,value, data=data,label=countries, geom=c("line","text"),
> group=countries, col=countries)
>
> But I would like to have the text labels show only once - e.g. at 1990
> - and also control the size of the text. In my crude qplot, setting
> size=2 e.g. changes not only the text, but also the lines etc. I guess
> I have to move from qplot to gplot.

Or just add the text layer separately:

qplot(year, value, data = data, geom = "line", group = countries) +
  geom_text(aes(label = countries), subset = .(year == 1990),
hjust = 1, size = 3, lineheight = 1)

Hadley

-- 
http://had.co.nz/

__
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] PLS Y scores (orthogonal scores algorithm)

2009-04-27 Thread L. Shyamal

Can someone make the following change to
http://cran.r-project.org/web/packages/pls/index.html

Line 68: oscorespls.fit.R (2.1-0)
from
   if (nresp == 1)
   break   # pls1: no iteration

to
  if (nresp == 1)
  {
   u.a <- Y %*% q.a / c(crossprod(q.a))
   break   # pls1: no iteration
  }

so that the Y scores are consistent across algorithms. 


best wishes
Shyamal

Shyamal Lakshminarayanan
Bangalore, India

__
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] equation on graph

2009-04-27 Thread Agus Susanto
Dear all,
I want to write regression equation on R graph by taking the actual
values of the regression coefficients. I have problem when writing X^2
(printed as X superscripts 2). I know there's a function "expression"
but still no luck to use it in this case. 

Below is the R code as an example:
plot(x,y,col=2)
reg.quad<-lm(y~x+I(x^2))
quad.fit<-coef(reg.quad)[1]+coef(reg.quad)[2]*x+coef(reg.quad)[3]*x^2
lines(x,quad.fit,lty=1)
text(4,1,paste("y=",round(coef(reg.quad)[1],4),round(coef(reg.quad)[2],4),"X",round(coef(reg.quad)[3],4),"X^2"),col=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] Merging data frames, or one column/vector with a data frame filling out empty rows with NA's

2009-04-27 Thread stephenb

You are exceeding your max memory here, so R will not be able to do that. 
dump both tables into a db such as mysql and then run the query either from
RMySQL or from mysql directly. then output the result and import back in R.

that will take care of the merge, but not sure what will happen when you
actually try to run some stats on the object. it is very likely the
operation will exceed memory again.

in the end you may have to write your own code which does not attempt to
load everything in memory, it could be either R or a lower level language.

if you have SAS it will probably work as it deals with large sets in long
format well. depending on what you do R may be able to deal with it after a
reshape() to a wide format.


joe1985 wrote:
> 
> Hello
> 
> I have two data frames, SNP4 and SNP1:
> 
>> head(SNP4)
>   Animal MarkerY
> 3213 194073197  P1001 0.021088
> 1295 194073197  P1002 0.021088
> 915   194073197  P1004 0.021088
> 2833 194073197  P1005 0.021088
> 1487 194073197  P1006 0.021088
> 1885 194073197  P1007 0.021088
> 
>> head(SNP1)
>AnimalMarker x
> 3213 194073197  P1001 2
> 1295 194073197  P1002 1
> 915   194073197  P1004 2
> 2833 194073197  P1005 0
> 1487 194073197  P1006 2
> 1885 194073197  P1007 0
> 
> I want these two data frames merged by 'Marker', but when i try 
> 
>> SNP5 <- merge(SNP4, SNP1, by = 'Marker', all = TRUE)
> Error: cannot allocate vector of size 2.4 Gb
> In addition: Warning messages:
> 1: In merge.data.frame(SNP4, SNP1, by = "Marker", all = TRUE) :
>   Reached total allocation of 1535Mb: see help(memory.size)
> 2: In merge.data.frame(SNP4, SNP1, by = "Marker", all = TRUE) :
>   Reached total allocation of 1535Mb: see help(memory.size)
> 3: In merge.data.frame(SNP4, SNP1, by = "Marker", all = TRUE) :
>   Reached total allocation of 1535Mb: see help(memory.size)
> 4: In merge.data.frame(SNP4, SNP1, by = "Marker", all = TRUE) :
>   Reached total allocation of 1535Mb: see help(memory.size)
> 
> And error occurs.
> 
> What i want is the column SNP1$x merged together with SNP4 by Marker, so
> some markers will have NA's in the 'x'-column in the SNP5 dataset.
> 
> I also tried this
> 
>> SNP5 <- merge(SNP4, SNP1$x, by.x = 'Marker', by.y = 'Marker', all = TRUE) 
> Error in fix.by(by.y, y) : 'by' must specify valid column(s)
> 
> I won't work either. 
> 
> Does anyone have any idea how to solve this.
> 
> Regards,
> 
> Johannes.
> 
> 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Merging-data-frames%2C-or-one-column-vector-with-a-data-frame-filling-out-empty-rows-with-NA%27s-tp23171110p23259062.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] A way to get the R data stored temporarily in working memory?

2009-04-27 Thread Friedericksen

But maybe from the outside?

Duncan Murdoch wrote:

On 4/27/2009 10:18 AM, Friedericksen wrote:

Hey,
thank you guys for your responses.The problem is, R is already running 
on the loop. So I don't see a way to use save() oder save.image() (or 
any other function?!)


You would have had to have put these in your loop.  If it's running now, 
there's nothing you can do from within R.


Duncan Murdoch



Greetings

Duncan Murdoch wrote:

On 4/27/2009 8:52 AM, Friedericksen wrote:

Hey guys,

I have a problem: I created a silly for loop without saving the 
results on each step. After a while I realised that it will take 
days to finish the loop until I get the results.


Is there a way to get the data R saves in working memory or in a 
temporary file while runing the loop? So that stoping the loop will 
not result in complete data loss?


Thank you very much!


You can use an explicit save() to write out a list of variables (or 
save.image() to write out all of them) but then you need to work out 
how to restart from one of these images.


Duncan Murdoch

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



__
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] prediction intervals (alpha and beta) for model average estimates from binomial glm and model.avg (library=dRedging)

2009-04-27 Thread David Winsemius


On Apr 27, 2009, at 3:19 AM, Michelle Ensbey wrote:


Thanks for your swift reply

I'm sorry to say that I tried that, and it doesn't appear to work  
for predicting from the "model.avg" object (ouput). Model.avg is a  
model averaging function in dRedging. I am NOT trying to predict  
from the coefficients estimated directly from the glm.


For :

fit1 <- glm(y~ dbh, family = binomial, data = data)



fit2 <- glm(y~ dbh+vegperc, family = binomial, data = data)



fit3 <- glm(y~ dbh, family = binomial, data = data)


##and the model averaging

model.averaging <-model.avg(fit1,fit2,fit3, method="0")


##Then when trying to predict you get the error below I understand  
it is because it is not a glm (or other compatable object) but I  
thought maybe someone had come across and solved this problem  
already so I thought I'd check:



predict(model.averaging)

OR

predict(model.averaging,"Patch_Num")

Error in UseMethod("predict") : no applicable method for "predict"
##Comes up.
Does anyone have a function or code or has done this (for  
coefficients obtained from the model.avg function) in the past and  
can give advice.


It will need to be someone other than me. I thought to look at an  
object created by that function to see if there were a path to  
success, but there is no dRedging package in either the CMU CRAN  
mirror or the BioC repository.


It makes me wonder whether the authors of that package may have  
decided for valid reasons not to provide such a facility. The question  
of how to concoct standard errors for the lme4 package comes up here  
on a regular basis and the answer is that the process is not at all  
straightforward.


Best of luck;
David



Thanks again for your help, let me know if I've just missed something.
Cheers
M


-Original Message-
From: David Winsemius [mailto:dwinsem...@comcast.net]
Sent: Friday, 24 April 2009 10:24 PM
To: Michelle Ensbey
Cc: r-help@r-project.org
Subject: Re: [R] prediction intervals (alpha and beta) for model  
average estimates from binomial glm and model.avg (library=dRedging)


In R, the predict family of functions provides that facility. If you
want the code it will be in the particular function associated with
the model type.

?predict
?predict.glm
# the example illustrates creation of prediction curves on the
response scale for  a specific range of data.
# create the desired CI's by appropriate use of the se.fit value
returned from the predict call.
# This is the code inside predict.glm that does the work when se.fit
is set as TRUE in the predict call:

se.fit <- pred$se.fit
switch(type, response = {
se.fit <- se.fit * abs(family(object)$mu.eta(fit))
fit <- family(object)$linkinv(fit)
}, link = , terms = )

--
David Winsemius

On Apr 24, 2009, at 3:03 AM, Michelle Ensbey wrote:


Hi all,

I was wondering if there is a function out there, or someone has
written code for making confidence intervals around model averaged
predictions (y~á+âx). The model average estimates are from the
dRedging library?

It seems a common thing but I can't seem to find one via the search
engines

Examples of the models are:

fit1 <- glm(y~ dbh, family = binomial, data = data)

fit2 <- glm(y~ dbh+vegperc, family = binomial, data = data)

fit3 <- glm(y~ dbh, family = binomial, data = data)

and the model averaging

model.averaging <-model.avg(fit1,fit2,fit3, method="0")

and the output (from model.avg) has the following items:
Coefficient, Variance, Standard error, adjusted standard error and
lower and upper confidence interval for each parameter (and
intercept).

What I would like to do is make "prediction intervals". I know I
need to include covariance and variance. Please let me know if
anyone has a function or code to get these prediction intervals out
of this output.

Thanks in advance for your help, and please advise me if you need
more information

M
michelle.ens...@nt.gov.au

R version 2.8.1


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] A way to get the R data stored temporarily in working memory?

2009-04-27 Thread Kenn Konstabel
You can interrupt the loop (e.g.. by pressing ESC), look at the results, and
then start it again.

e.g.

mumbo <- list()
for(jumbo in 1:1e+5000) {
  mumbo[[jumbo]] <- do.many.time.consuming.things.with(jumbo)
 }

# wait for a few days
# then press 

save(mumbo, file="head of mumbo")


# now restart it
for(jumbo in jumbo:1e+5000)  {
 mumbo[[jumbo]] <- do.many.time.consuming.things.with(jumbo)
}


KK



On Mon, Apr 27, 2009 at 5:18 PM, Friedericksen  wrote:

> Hey,
> thank you guys for your responses.The problem is, R is already running on
> the loop. So I don't see a way to use save() oder save.image() (or any other
> function?!)
>
> Greetings
>
>
> Duncan Murdoch wrote:
>
>> On 4/27/2009 8:52 AM, Friedericksen wrote:
>>
>>> Hey guys,
>>>
>>> I have a problem: I created a silly for loop without saving the results
>>> on each step. After a while I realised that it will take days to finish the
>>> loop until I get the results.
>>>
>>> Is there a way to get the data R saves in working memory or in a
>>> temporary file while runing the loop? So that stoping the loop will not
>>> result in complete data loss?
>>>
>>> Thank you very much!
>>>
>>
>> You can use an explicit save() to write out a list of variables (or
>> save.image() to write out all of them) but then you need to work out how to
>> restart from one of these images.
>>
>> Duncan Murdoch
>>
>> __
>> 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.
>

[[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] Problem with R 2.9.0 vs. R2.8.1 with either "survival" package or "predict" function

2009-04-27 Thread Dimitri Liakhovitski
Just wanted to alert everyone regarding a problem that I only
experience with R2.9.0 and not with R2.8.1 when I run both using
exactly the same script and the same data.
Here is what I do with my data "MyData", 2 predictors (V1 and V2) and
my survival DV "Depvar":

library(survival)
model<-coxph(Depvar~V1:V2+strata(ID),data=MyData,na.action=na.omit,method="breslow")

When I look at summary(model), the very end of it looks like this in R2.8.1:
Rsquare= 0.067   (max possible= 0.792 )
Likelihood ratio test= 169  on 24 df,   p=0
Wald test= 144  on 24 df,   p=0
Score (logrank) test = 164  on 24 df,   p=0

When I look at summary(model), the very end of it looks like this in
R2.9.0 (looks the same to me):
Rsquare= 0.067   (max possible= 0.792 )
Likelihood ratio test= 168.8  on 24 df,   p=0
Wald test= 144.1  on 24 df,   p=0
Score (logrank) test = 164.0  on 24 df,   p=0

Then, I run this line:
utilities<-predict(model,newdata=expand.grid(V1=factor(1:5),V2=factor(1:5)))

This line runs fine in R2.8.1 and gives me a vector of utilities.

But when I run it in R2.9.0, I get:
Error in model.frame.default(Terms2, newdata, xlev = object$xlevels) :
  variable lengths differ (found for 'V1')
In addition: Warning message:
'newdata' had 25 rows but variable(s) found have 2415 rows

I prefer not to get into the debugging of that whole thing. But
thought that someone knowledgeable might get an idea about what might
be wrong in the latest R version.

-- 
Dimitri Liakhovitski
MarketTools, Inc.
dimitri.liakhovit...@markettools.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] For Loop Syntax

2009-04-27 Thread jim holtman
What do you expect this statement to do:

trial[i]   <- data.frame(A2$`i`)

what is `i` supposed to mean?  What is it that you want to do?

On Mon, Apr 27, 2009 at 10:25 AM, Bronagh Grimes
 wrote:
> Hi there,
>
>
>
> Just wondering if someone can help me with the correct syntax to use
> with for loops?
>
>
>
> I have split my original file by count, & wish to first of all assign
> new tables based on the splits.  Then I just want to create a new
> variable.  Please see code below.
>
>
>
> This code works outside of a loop so I am just trying to code so I don't
> have to repeat numerous times.
>
>
>
> Many thanks in advance,
>
> Bronagh
>
>
>
> A2 = split(A1,A1$count)
>
>
>
> for(i in 1:10){
>
> trial[i]       <- data.frame(A2$`i`)
>
> trial[i]$BLD[i]   <- triali$BLD
>
> trial[i]$count <- triali$BLD <- NULL
>
> }
>
>
>        [[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] Multiple Imputation in mice/norm

2009-04-27 Thread Bert Gunter
Folks:

A comment ... subject to vigorous refutation, since it's jmui (just my
uninformed opinon).

It strikes me that this is a case where one may need own up to the
limitations of the data and be transparent about the tentativeness of the
statistical approaches. I say this because the statistical literature and
popular perception often seem to be that statistical methodology can
overcome these limitations and produce definitive answers in spite of them.
And, of course, statistical researchers tend to be enamored with their
clever methodology and gloss over the inevitable fact that their proofs
begin with "assume that ... " (reminding me of the old saw that "assume" can
make an ass out of u and me). 

Perhaps a useful approach is sensitivity analysis: try several quite
different approaches, each consistent with one reasonable set of
assumptions, and see how they compare. Not a new idea, of course, but
perhaps one worth being reminded of in such situations.

As always, thanks for **your** knowledgeable summary of exactly these
matters, Frank.

-- Bert Gunter
Genetech

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Frank E Harrell Jr
Sent: Saturday, April 25, 2009 3:38 PM
To: David Winsemius
Cc: Emmanuel Charpentier; r-h...@stat.math.ethz.ch
Subject: Re: [R] Multiple Imputation in mice/norm

David Winsemius wrote:
> 
> On Apr 25, 2009, at 9:25 AM, Frank E Harrell Jr wrote:
> 
>> Emmanuel Charpentier wrote:
>>> Le vendredi 24 avril 2009 à 14:11 -0700, ToddPW a écrit :
 I'm trying to use either mice or norm to perform multiple imputation 
 to fill
 in some missing values in my data.  The data has some missing values 
 because
 of a chemical detection limit (so they are left censored).  I'd like 
 to use
 MI because I have several variables that are highly correlated.  In 
 SAS's
 proc MI, there is an option with which you can limit the imputed 
 values that
 are returned to some range of specified values.  Is there a way to 
 limit the
 values in mice?
>>> You may do that by writing your own imputation function and assign them
>>> for the imputation of particular variable (see argument
>>> "imputationMethod" and details in the man page for "mice").
 If not, is there another MI tool in R that will 
 allow me to
 specify a range of acceptable values for my imputed data?
>>> In the function amelia (package "Amelia"), you might specify a "bounds"
>>> argument, which allows for such a limitation. However, be aware that
>>> this might destroy the basic assumption of Amelia, which is that your
>>> data are multivariate normal. Maybe a change of variable is in order (e.
>>> g. log(concentration) has usually much better statistical properties
>>> than concentration).
>>> Frank Harrell's aregImpute (package Hmisc) has the "curtail" argument
>>> (TRUE by default) which limits imputations to the range of observed
>>> values.
>>> But if your left-censored variables are your dependent variables (not
>>> covariates), may I suggest to analyze these data as censored data, as
>>> allowed by Terry Therneau's "coxph" function (package "survival") ? code
>>> your "missing" data as such a variable (use :
>>> coxph(Surv(min(x,,na.rm=TRUE),
>>>   !is.na(x),type="left")~) to do this on-the-fly).
>>> Another possible idea is to split your (supposedly x) variable in two :
>>> observed (logical), and value (observed value if observed, >> limit> if not) and include these two data in your model. You probably
>>> will run into numerical difficulties due to the (built-in total
>>> separation...).
>>> HTH,
>>> Emmanuel Charpentier
 Thanks for the help,
 Todd

>>
>> All see
>>
>> @Article{zha09non,
>>  author =   {Zhang, Donghui and Fan, Chunpeng and Zhang, 
>> Juan and Zhang, {Cun-Hui}},
>>  title ={Nonparametric methods for measurements below 
>> detection limit},
>>  journal =  Stat in Med,
>>  year = 2009,
>>  volume =   28,
>>  pages ={700-715},
>>  annote =   {lower limit of detection;left censoring;Tobit 
>> model;Gehan test;Peto-Peto test;log-rank test;Wilcoxon test;location 
>> shift model;superiority of nonparametric methods}
>> }
>>
>>
>> -- 
>> Frank E Harrell Jr   Professor and Chair   School of Medicine
>> Department of Biostatistics   Vanderbilt University
>>
> 
> It appears they were dealing with outcomes possibly censored at a limit 
> of detection. At least that was the example they used to illustrate.
> 
> Is there a message that can be inferred about what to do with covariates 
> with values below the limit of detection? And can someone translate to a 
> non-statistician what the operational process was on the values below 
> the limit of detection in the Wilcoxon approach that they endorsed? They 
> transformed the right censored situation into a le

Re: [R] Problem with R 2.9.0 vs. R2.8.1 with eith er "survival" package or "predict" function

2009-04-27 Thread Dieter Menne
Dimitri Liakhovitski  gmail.com> writes:

> 
> Just wanted to alert everyone regarding a problem that I only
> experience with R2.9.0 and not with R2.8.1 when I run both using
> exactly the same script and the same data.
> Here is what I do with my data "MyData", 2 predictors (V1 and V2) and
> my survival DV "Depvar":
> 
> library(survival)
> 

Make sure that this is really a problem with different versions of R,
not a problem of different versions of survival which was changed recently,
without backward compatibility, so that for example many function of
Design (Harrell) do not work currently.

It would be good if you could post the sessionInfo() for both cases.

Dieter

__
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] equation on graph

2009-04-27 Thread Matthieu Dubois
see ?plotmath and ?bquote

HTH, 

Matthieu

__
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] A way to get the R data stored temporarily in working memory?

2009-04-27 Thread Friedericksen

Hey,

that is very cool! But there is a problem: I use Emacs with ESS. When I 
press ESC, I get some emacs keybinding. What is R doing when I press 
ESC? Which function is then executed? I think it should also work with 
ESS, but I have to press the specific keybinding.


Thank you very much for the answer!

Greetings

__
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] Julia set in R

2009-04-27 Thread Erin Hodgess
Dear R People:

Has anyone produced code for a Julia set, please?

It's not all that tough to do, just thought I'd check before
re-inventing the wheel.

Thanks,
Erin


-- 
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodg...@gmail.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] problem with Power function on a power my result is "inf"

2009-04-27 Thread Alessandro
Dear user,

 

I have a problem with a power because after a value the result is "inf"

 

 

Mydata  <-  data.frame(plot=c(11,12,13,14,15, 16, 21, 22, 23, 24, 25, 26,
31, 32,33, 34),

SumH=c(17573.029,22572.162,19659.984,13952.781,6996.924,16049.598,13869.409,
8284.981,7752.961,18901.742,11078.659,33692.330,44456.277,18737.265,21623.89
8,15837.077))

 

# USE a power from 1 to 10 by 0.1

power <- seq(1.0, 10.0, by=0.1) 

 

for (method in 1:length(power)){

 

Mydata$power <- paste(Mydata$SumH^method)

write.matrix(Mydata, paste(file =
"C:/SNAMP_fns/GSmodel/mydata","_",method+9,".txt", sep=""), sep = "\t")



}

 

On 57 power some value strart to be "inf". All "inf" in power of 10. Is It a
limit of memory or another problem?

 

Eventually is there a possibility to correct? Or I need to use a seq from 1
to 5 or less?

 

Thanks Ale


[[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] FW: Install of R 2.9.0

2009-04-27 Thread Lyman, Mark
I am forwarding the below message from our sys-admin because I don't
know what the problem is. We are getting a "No space left on device"
error when there is plenty of space. See below.

 

Mark Lyman

 

From: Palmer, Michael 
Sent: Monday, April 27, 2009 12:09 PM
To: Lyman, Mark
Subject: Install of R 2.9.0

 

Mark -

 

I'm having trouble installing R-2.9.0.  During "make  install" it thinks
it's running out of space when there's actually lots of space available.
I'm installing this on the head node of a cluster running SLES 9 into a
common GPFS filesystem named /apps.  Any ideas?

 

 

These are the basic steps I'm using to install R -

 

Create a directory - /apps/R/R290

Copy the tar file to /apps/R/R290

cd  /apps/R/R290

tar  -xzvf  R-2.9.0.tar.gz

cd  R-2.9.0

./configure  prefix=/apps/R/R290

make

make  check

make  install

 

all appears to go well until well into "make install".  The first
indication of errors is -

 

head:/apps/R/R290/R-2.9.0 # make  install

mkdir -p -- /apps/R/R290/lib64/R

make[1]: Entering directory `/apps/R/R290/R-2.9.0/m4'

make[1]: Nothing to be done for `install'.

make[1]: Leaving directory `/apps/R/R290/R-2.9.0/m4'

make[1]: Entering directory `/apps/R/R290/R-2.9.0/tools'

make[1]: Nothing to be done for `install'.

make[1]: Leaving directory `/apps/R/R290/R-2.9.0/tools'

make[1]: Entering directory `/apps/R/R290/R-2.9.0/doc'

installing doc ...

mkdir -p -- /apps/R/R290/lib64/R/doc

mkdir -p -- /apps/R/R290/share/man/man1

/usr/bin/install -c -m 644 ../NEWS "/apps/R/R290/lib64/R/doc"

make[2]: Entering directory `/apps/R/R290/R-2.9.0/doc/html'

installing doc/html ...

mkdir -p -- /apps/R/R290/lib64/R/doc/html

make[3]: Entering directory `/apps/R/R290/R-2.9.0/doc/html/search'

installing doc/html/search ...

mkdir -p -- /apps/R/R290/lib64/R/doc/html/search

make[3]: Leaving directory `/apps/R/R290/R-2.9.0/doc/html/search'

make[2]: Leaving directory `/apps/R/R290/R-2.9.0/doc/html'

make[2]: Entering directory `/apps/R/R290/R-2.9.0/doc/manual'

installing doc/manual ...

mkdir -p -- /apps/R/R290/lib64/R/doc/manual

make[2]: Leaving directory `/apps/R/R290/R-2.9.0/doc/manual'

make[1]: Leaving directory `/apps/R/R290/R-2.9.0/doc'

make[1]: Entering directory `/apps/R/R290/R-2.9.0/etc'

mkdir -p -- /apps/R/R290/lib64/R/etc

installing etc ...

make[1]: Leaving directory `/apps/R/R290/R-2.9.0/etc'

make[1]: Entering directory `/apps/R/R290/R-2.9.0/share'

installing share ...

mkdir -p -- /apps/R/R290/lib64/R/share

mkdir -p -- /apps/R/R290/lib64/R/share/R

mkdir -p -- /apps/R/R290/lib64/R/share/encodings

mkdir -p -- /apps/R/R290/lib64/R/share/java

mkdir -p -- /apps/R/R290/lib64/R/share/licenses

mkdir -p -- /apps/R/R290/lib64/R/share/make

mkdir -p -- /apps/R/R290/lib64/R/share/perl

mkdir -p -- /apps/R/R290/lib64/R/share/perl/R

mkdir -p -- /apps/R/R290/lib64/R/share/perl/File/Copy

mkdir -p -- /apps/R/R290/lib64/R/share/perl/Text

mkdir -p -- /apps/R/R290/lib64/R/share/sh

mkdir -p -- /apps/R/R290/lib64/R/share/texmf

make[1]: Leaving directory `/apps/R/R290/R-2.9.0/share'

make[1]: Entering directory `/apps/R/R290/R-2.9.0/src'

make[2]: Entering directory `/apps/R/R290/R-2.9.0/src/scripts'

mkdir -p -- /apps/R/R290/bin

mkdir -p -- /apps/R/R290/lib64/R/bin

make[2]: Leaving directory `/apps/R/R290/R-2.9.0/src/scripts'

make[2]: Entering directory `/apps/R/R290/R-2.9.0/src/include'

mkdir -p -- /apps/R/R290/lib64/R/include

make[3]: Entering directory `/apps/R/R290/R-2.9.0/src/include/R_ext'

mkdir -p -- /apps/R/R290/lib64/R/include/R_ext

make[3]: Leaving directory `/apps/R/R290/R-2.9.0/src/include/R_ext'

make[2]: Leaving directory `/apps/R/R290/R-2.9.0/src/include'

make[2]: Entering directory `/apps/R/R290/R-2.9.0/src/extra'

make[3]: Entering directory `/apps/R/R290/R-2.9.0/src/extra/blas'

mkdir -p -- /apps/R/R290/lib64/R/lib

make[3]: Leaving directory `/apps/R/R290/R-2.9.0/src/extra/blas'

make[3]: Entering directory `/apps/R/R290/R-2.9.0/src/extra/bzip2'

make[3]: Nothing to be done for `install'.

make[3]: Leaving directory `/apps/R/R290/R-2.9.0/src/extra/bzip2'

make[3]: Entering directory `/apps/R/R290/R-2.9.0/src/extra/pcre'

make[3]: Nothing to be done for `install'.

make[3]: Leaving directory `/apps/R/R290/R-2.9.0/src/extra/pcre'

make[3]: Entering directory `/apps/R/R290/R-2.9.0/src/extra/xdr'

make[3]: Nothing to be done for `install'.

make[3]: Leaving directory `/apps/R/R290/R-2.9.0/src/extra/xdr'

make[3]: Entering directory `/apps/R/R290/R-2.9.0/src/extra/zlib'

make[3]: Nothing to be done for `install'.

make[3]: Leaving directory `/apps/R/R290/R-2.9.0/src/extra/zlib'

make[3]: Entering directory `/apps/R/R290/R-2.9.0/src/extra/intl'

make[3]: Nothing to be done for `install'.

make[3]: Leaving directory `/apps/R/R290/R-2.9.0/src/extra/intl'

make[2]: Leaving directory `/apps/R/R290/R-2.9.0/src/extra'

make[2]: Entering directory `/apps/R/R290/R-2.9.0/src/appl'

make[2]: Nothing to be done for `install'.

make[2]: Leaving directory `/ap

Re: [R] How to get rid of loop?

2009-04-27 Thread Martin Morgan
Uwe Ligges  writes:

> Ken-JP wrote:
>> The code below shows what I'm trying to get rid of.
>> If there is no way to get rid of the loop, I will try to use
>> package( inline
>> ).
>> I'm just curious as to whether there is a "vector way" of doing this
>> algorithm.
>
>
> I don't see a vector way. If speed is an issue, I'd suggest to port

Parsing the code, it seems like a run of 1's starts with a value
greater than .75, and continues until a value less than .5. So this...

x1 <- x > .75
c(x1[[1]], x1[-1] & !x1[-n])

flags the start of each run, and this
   
y1 <- lapply(split(x > .5, cumsum(c(x1[[1]], x1[-1] & !x1[-n]))),
 cumprod)
 
splits candidate runs x > .5 into subsets beginning at each start
point, and then processes the subset to extend the run as long as the
values are greater than .5. My 'vectorized' version, with an imperfect
solution to the first run and glossing over the point x==.5 in the
original code, is

encode.2 <- function(x) {
n <- length(x)
x0 <- x < .25
y0 <- lapply(split(x <= .5, cumsum(c(x0[[1]], x0[-1] & !x0[-n]))),
 cumprod)
x1 <- x > .75
y1 <- lapply(split(x > .5, cumsum(c(x1[[1]], x1[-1] & !x1[-n]))),
 cumprod)
as.vector((cumsum(abs(x-.5) > .25) != 0) *
  (-unlist(y0, use.names=FALSE) + unlist(y1, use.names=FALSE)))
}

this seems to be 7-20x faster than encode.1

encode.1 <- function(x) {
n <- length( x )
y <- rep(NA, n)
yprev <- 0;
for ( i in (1:n)) {
if ( x[i]>0.75 ) {
y[i] <- 1;
} else if ( x[i]<0.25 ) {
y[i] <- -1;
} else
if ( yprev==1 & x[i]<0.5) {
y[i] <- 0;
} else if ( yprev==-1 & x[i]>0.5) {
y[i] <- 0;
} else {
y[i] <- yprev
}
yprev
<-
y[i];
}
y
}
   

> set.seed(1)
> mean(replicate(10, system.time(encode.1(runif(10)), TRUE)[[3]]))
[1] 0.7256
> set.seed(1)
> mean(replicate(10, system.time(encode.2(runif(10)), TRUE)[[3]]))
[1] 0.0983

> mean(replicate(10, system.time(encode.1(integer(10)), TRUE)[[3]]))
[1] 0.6288
> mean(replicate(10, system.time(encode.2(integer(10)), TRUE)[[3]]))
[1] 0.0338
 
and, modulo x==.5, even seems to produce the same result ;)

> set.seed(1); res.1 <- replicate(10, encode.1(runif(1000)))
> set.seed(1); res.2 <- replicate(10, encode.2(runif(1000)))
> identical(res.1, res.2)
[1] TRUE

Algorithm f7 of

   https://stat.ethz.ch/pipermail/r-devel/2008-April/049111.html

might point to fast (comparable to C) R implementations.

Martin

> this small part to C, it's very simple and may yield a considerable
> performance boost (untested). It can probably be used as a textbook
> example for code where porting to C make sense.
>
> Best,
> Uwe Ligges
>
>
>
>> #
>> -
>> set.seed(1)
>> x <- runif(100)
>> n <- length( x )
>> y <- rep(NA, n)
>> yprev <- 0;
>> for ( i in (1:n)) {
>>  if ( x[i]>0.75 ) {
>>  y[i] <- 1;
>>  } else if ( x[i]<0.25 ) {
>>  y[i] <- -1;
>>  } else if ( yprev==1 & x[i]<0.5) {
>>  y[i] <- 0;
>>  } else if ( yprev==-1 & x[i]>0.5) {
>>  y[i] <- 0;
>>  } else {
>>  y[i] <- yprev
>>  }
>>  yprev <- y[i];
>> }
>> 
>>> y
>>   [1]  0  0  0  1 -1  1  1  1  1 -1 -1 -1  0  0  1  0  0  1  0  1  1 -1  0
>> -1 -1
>>  [26] -1 -1 -1  1  0  0  0  0 -1  1  1  1 -1  0  0  1  1  1  1  1  1
>> -1 -1 
>> 0  0
>>  [51]  0  1  0 -1 -1 -1 -1  0  0  0  1  0  0  0  0  0  0  1 -1  1  0
>> 1  0 0  0
>>  [76]  1  1  0  1  1  0  0  0  0  1 -1  0 -1 -1 -1 -1 -1  0  1  1  1
>> 0  0 1  1
>> 
>>
>
> __
> 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.

-- 
Martin Morgan
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793

__
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] Bumps chart in R

2009-04-27 Thread Andreas Christoffersen
> Or just add the text layer separately:
>
> qplot(year, value, data = data, geom = "line", group = countries) +
>  geom_text(aes(label = countries), subset = .(year == 1990),
>    hjust = 1, size = 3, lineheight = 1)

THX a lot!
The subset did not work for me, but this does:
subset(data,year == 1990)

Andreas

__
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] FW: Install of R 2.9.0

2009-04-27 Thread Lyman, Mark
I have just received some additional information. After the "No space
left on device", there are many file not found error messages. Also, the
first time or two our admin ran the install process R would not start.
Now R can start up despite all of the error messages. Can these error
messages be ignored?

 

Mark Lyman

 

From: Lyman, Mark 
Sent: Monday, April 27, 2009 12:49 PM
To: r-help@r-project.org
Subject: FW: Install of R 2.9.0

 

I am forwarding the below message from our sys-admin because I don't
know what the problem is. We are getting a "No space left on device"
error when there is plenty of space. See below.

 

Mark Lyman

 

From: Palmer, Michael 
Sent: Monday, April 27, 2009 12:09 PM
To: Lyman, Mark
Subject: Install of R 2.9.0

 

Mark -

 

I'm having trouble installing R-2.9.0.  During "make  install" it thinks
it's running out of space when there's actually lots of space available.
I'm installing this on the head node of a cluster running SLES 9 into a
common GPFS filesystem named /apps.  Any ideas?

 

 

These are the basic steps I'm using to install R -

 

Create a directory - /apps/R/R290

Copy the tar file to /apps/R/R290

cd  /apps/R/R290

tar  -xzvf  R-2.9.0.tar.gz

cd  R-2.9.0

./configure  prefix=/apps/R/R290

make

make  check

make  install

 

all appears to go well until well into "make install".  The first
indication of errors is -

 

head:/apps/R/R290/R-2.9.0 # make  install

mkdir -p -- /apps/R/R290/lib64/R

make[1]: Entering directory `/apps/R/R290/R-2.9.0/m4'

make[1]: Nothing to be done for `install'.

make[1]: Leaving directory `/apps/R/R290/R-2.9.0/m4'

make[1]: Entering directory `/apps/R/R290/R-2.9.0/tools'

make[1]: Nothing to be done for `install'.

make[1]: Leaving directory `/apps/R/R290/R-2.9.0/tools'

make[1]: Entering directory `/apps/R/R290/R-2.9.0/doc'

installing doc ...

mkdir -p -- /apps/R/R290/lib64/R/doc

mkdir -p -- /apps/R/R290/share/man/man1

/usr/bin/install -c -m 644 ../NEWS "/apps/R/R290/lib64/R/doc"

make[2]: Entering directory `/apps/R/R290/R-2.9.0/doc/html'

installing doc/html ...

mkdir -p -- /apps/R/R290/lib64/R/doc/html

make[3]: Entering directory `/apps/R/R290/R-2.9.0/doc/html/search'

installing doc/html/search ...

mkdir -p -- /apps/R/R290/lib64/R/doc/html/search

make[3]: Leaving directory `/apps/R/R290/R-2.9.0/doc/html/search'

make[2]: Leaving directory `/apps/R/R290/R-2.9.0/doc/html'

make[2]: Entering directory `/apps/R/R290/R-2.9.0/doc/manual'

installing doc/manual ...

mkdir -p -- /apps/R/R290/lib64/R/doc/manual

make[2]: Leaving directory `/apps/R/R290/R-2.9.0/doc/manual'

make[1]: Leaving directory `/apps/R/R290/R-2.9.0/doc'

make[1]: Entering directory `/apps/R/R290/R-2.9.0/etc'

mkdir -p -- /apps/R/R290/lib64/R/etc

installing etc ...

make[1]: Leaving directory `/apps/R/R290/R-2.9.0/etc'

make[1]: Entering directory `/apps/R/R290/R-2.9.0/share'

installing share ...

mkdir -p -- /apps/R/R290/lib64/R/share

mkdir -p -- /apps/R/R290/lib64/R/share/R

mkdir -p -- /apps/R/R290/lib64/R/share/encodings

mkdir -p -- /apps/R/R290/lib64/R/share/java

mkdir -p -- /apps/R/R290/lib64/R/share/licenses

mkdir -p -- /apps/R/R290/lib64/R/share/make

mkdir -p -- /apps/R/R290/lib64/R/share/perl

mkdir -p -- /apps/R/R290/lib64/R/share/perl/R

mkdir -p -- /apps/R/R290/lib64/R/share/perl/File/Copy

mkdir -p -- /apps/R/R290/lib64/R/share/perl/Text

mkdir -p -- /apps/R/R290/lib64/R/share/sh

mkdir -p -- /apps/R/R290/lib64/R/share/texmf

make[1]: Leaving directory `/apps/R/R290/R-2.9.0/share'

make[1]: Entering directory `/apps/R/R290/R-2.9.0/src'

make[2]: Entering directory `/apps/R/R290/R-2.9.0/src/scripts'

mkdir -p -- /apps/R/R290/bin

mkdir -p -- /apps/R/R290/lib64/R/bin

make[2]: Leaving directory `/apps/R/R290/R-2.9.0/src/scripts'

make[2]: Entering directory `/apps/R/R290/R-2.9.0/src/include'

mkdir -p -- /apps/R/R290/lib64/R/include

make[3]: Entering directory `/apps/R/R290/R-2.9.0/src/include/R_ext'

mkdir -p -- /apps/R/R290/lib64/R/include/R_ext

make[3]: Leaving directory `/apps/R/R290/R-2.9.0/src/include/R_ext'

make[2]: Leaving directory `/apps/R/R290/R-2.9.0/src/include'

make[2]: Entering directory `/apps/R/R290/R-2.9.0/src/extra'

make[3]: Entering directory `/apps/R/R290/R-2.9.0/src/extra/blas'

mkdir -p -- /apps/R/R290/lib64/R/lib

make[3]: Leaving directory `/apps/R/R290/R-2.9.0/src/extra/blas'

make[3]: Entering directory `/apps/R/R290/R-2.9.0/src/extra/bzip2'

make[3]: Nothing to be done for `install'.

make[3]: Leaving directory `/apps/R/R290/R-2.9.0/src/extra/bzip2'

make[3]: Entering directory `/apps/R/R290/R-2.9.0/src/extra/pcre'

make[3]: Nothing to be done for `install'.

make[3]: Leaving directory `/apps/R/R290/R-2.9.0/src/extra/pcre'

make[3]: Entering directory `/apps/R/R290/R-2.9.0/src/extra/xdr'

make[3]: Nothing to be done for `install'.

make[3]: Leaving directory `/apps/R/R290/R-2.9.0/src/extra/xdr'

make[3]: Entering directory `/apps/R/R290/R-2.9.0/src/extra/zlib'

make[3]: Nothing to be done for `install'.

[R] Changing color of points in violin plot

2009-04-27 Thread John Poulsen

Hello,

I am trying to graph a violin plot like the example in 
panel.violin(lattice) with the singer data - see below


Does anyone know how to change the color of the boxplot on the graph 
from blue to green?  I tried a number of changes, but to no avail.


Thanks for your help,
John



bwplot(voice.part ~ height, singer,
   panel = function(..., box.ratio) {
   panel.violin(..., col = "transparent",
 varwidth = FALSE, box.ratio = 
box.ratio)

   panel.bwplot(..., fill = NULL, box.ratio = .1)
} )

__
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] Grouping multiple runs of multiple datasets in lattice's xyplot

2009-04-27 Thread Daniel Kornhauser
Hi:

I don't know if my explanation below is clear, so afterwards, I wrote a
small a self contained annotated example that generates two plots.
I execute simulations with different parameters settings that create several
datasets, and for each parameter setting (or dataset) I can obtain different
results by choosing a different random seed.

I am stuck grouping data from the datasets and runs in an xyplot of lattice.
First, I would like to group my data *by datasets* but only using color.
Then, I would like to "subgroup" the data points into to draw  individual
line *by runs*.
Does anybody have any suggestions on how to do this ?

   Thanks
Daniel.

### START EXAMPLE
library("lattice")
model.run = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11,
11, 11, 11, 11, 12, 12, 12, 12, 12, 12)

model.dataset = c(2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2,
2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 2, 2, 2, 2,
2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 1,
1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2)

model.conditional.var = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
33, 33, 33, 33, 33, 33, 33, 33, 66, 66, 66, 66, 33, 33, 33, 33, 33, 33, 66,
66, 66, 66, 66, 66, 66, 66, 66, 66, 99, 99,99, 99, 66, 66, 66, 66, 66, 66,
99, 99, 99, 99, 66, 66, 66, 66, 66, 66, 99, 99, 99, 99, 99, 99, 99, 99, 99,
99, 99, 99, 99, 99, 99, 99, 99, 99)

model.x = c(0, 0, 1, 1, 2, 2, 3, 3, 4, 5, 0, 0, 1, 1, 2, 2, 3, 3, 4, 5, 0,
1, 2, 3, 4, 5, 0, 1, 2, 3, 0, 0, 1, 1, 2, 2, 3, 3, 4, 5, 0, 1, 2, 3, 4, 5,
0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 0, 1,2, 3, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 0, 1,
2, 3, 4, 5, 0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4,
5, 0, 1, 2, 3, 4, 5)

model.y = c(50, 50, 50, 51, 50, 55, 50, 59, 49, 46, 50, 50, 49, 53, 51, 55,
53, 54, 53, 52, 50, 50, 52, 52, 52, 46, 83, 82, 83, 87, 83, 83, 85, 89, 85,
93, 89, 97, 92, 92, 83, 85, 85, 88, 90, 90, 116, 117, 115, 117, 83, 86, 88,
91, 91, 96, 116, 116, 118, 123, 116, 118, 121,122, 120, 121, 149, 151, 154,
158, 116, 118, 120, 123, 128, 131, 149, 148, 150, 153, 116, 116, 118, 118,
122, 126, 149, 147, 145, 149, 157, 163, 149, 156, 165, 175, 180, 180, 149,
150, 152, 157, 165, 169)

dat = data.frame (run =  model.run,  dataset = model.dataset, conditional.x
= model.conditional.x, x = model.x, y = model.y)

a = xyplot(y ~ x | conditional.var,
main = "Correctly grouped colors",
sub =  "I would like to group multipe data sets with the colors
shown here, but I don't want the data points to be grouped in a single
lines",
groups = dataset, # Grouping by Data Set
ylab =  NULL,
data = dat,
type = "l",
auto.key = list(space = "right"))
print(a)

dev.new()
b = xyplot(y ~ x | conditional.var,
main = "Correctly grouped lines",
sub = "I would like group two data sets with the lines shown here,
but not with an individual color for each line",
data = dat,
groups = run,# Grouping by Run
ylab =  NULL,
type = "l",
auto.key = list(space = "right"))
print(b)
### END EXAMPLE

[[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] Multiple imputations : wicked dataset. Need advice for follow-up to a possible solution.

2009-04-27 Thread Emmanuel Charpentier
Answering to myself (for future archive users' sake), more to come
(soon) :

Le jeudi 23 avril 2009 à 00:31 +0200, Emmanuel Charpentier a écrit :
> Dear list,
> 
> I'd like to use multiple imputations to try and save a somewhat badly
> mangled dataset (lousy data collection, worse than lousy monitoring, you
> know that drill... especially when I am consulted for the first time
> about one year *after* data collection).
> 
> My dataset has 231 observations of 53 variables, of which only a very
> few has no missing data. Most variables have 5-10% of missing data, but
> the whole dataset has only 15% complete cases (40% when dropping the 3
> worst cases, which might be regained by other means).

[ Big snip ... ]

It turns out that my problems were caused by ... the dataset. Two very
important variables (i. e. of strong influence on the outcomes and
proxies) are ill-distributed :
- one is a modus operandi (two classes)
- the second is center (23 classes, alas...)

My data are quite ill-distributed : some centers have contributed a
large number of observations, some other very few. Furthermore, while
few variables are quite badly known, the "missingness pattern" is such
as :
- some centers have no directly usable information (= complete cases)
under one of the modi operandi
- some other have no complete case at all...

Therefore, any model-based prediction method using the whole dataset
(recommended for multiple imputations, since one should not use for
inference a richer set of data than what was imputed (seen this
statement in a lot of references)) fails miserably.

Remembering some fascinating readings (incl. V&R) and an early (20 years
ago) excursion in AI (yes, did that, didn't even got the T-shirt...), I
have attempted (with some success) to use recursive partitioning for
prediction. This (non-)model has some very interestind advantages in my
case :
- model-free
- distribution-free (quite important here : you should see my density
curves... and I won't speak about the outliers !)
- handles missing data gracefully (almost automagically)
- automatic selection and ranking of the pertinent variables
- current implementation in R has some very nice features, such as
surrogate splits if a value is missing, auto-pruning by
cross-validation, etc ...

It has also some drawbacks :
- no (easy) method for inference
- not easy to abstract (you can't just publish an ANOVA table and a
couple of p-values...)
- no "well-established" (i. e. acknowledged by journal reviewers) =>
difficult to publish

These latter point do not bother me in my case. So I attempted to use
this for imputation.

Since mice is based on a "chained equations" approach and allows the
end-user to write its own imputation functions, I wrote a set of such
imputers to be called within the framework of the Gibbs sampler. They
proceed as follow :
- build a regression or classification tree of the relevant variable
using the rest of the dataset
- predict the relevant variable for *all* the dataset,
- compute "residuals" from known values of the relevant variable and
their prediction
- impute values to missing data as prediction + a random residual.

It works. It's a tad slower than prediction using
normal/logistic/multinomial modelling (about a factor of 3, but for y
first trial, I attempted to err on the side of excessive precision ==>
deeper trees). It does not exhibit any "obvious" statistical
misfeatures.

But I have questions :

1) What is known of such imputation by regression/classification trees
(aka recursive partitionning) ? A quick research didn't turn up very
much : the idea has been evoked here and there, but I am not aware of
any published solution. In particular, I have no knowledge of any
theoretical (i. e. probability) wotrk on their properties ?

2) Where could I find published datasets having been used to validate
other imputation methods ?

3) Do you think that these functions should be published ?

Sincerely yours,

Emmanuel Charpentier

PS :

> Could someone offer an explanation ? Or must I recourse to sacrifying a
> black goat at midnight next new moon ?
> 
> Any hint will be appreciated (and by the way, next new moon is in about
> 3 days...).

The goat has endured the fear of her life, but is still alive... will
probably start worshipping the Moon, however.

__
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] rounding problem

2009-04-27 Thread Emmanuel Charpentier
Seconded !

Emmanuel Charpentier

Le lundi 02 mars 2009 à 21:06 -0700, Greg Snow a écrit :
> > -Original Message-
> > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> > project.org] On Behalf Of Prof Brian Ripley
> > Sent: Monday, March 02, 2009 12:38 AM
> > To: tedzzx
> > Cc: r-help@r-project.org
> > Subject: Re: [R] rounding problem
> > 
> 
> I nominate the following for the fortunes package:
> 
> > R is Open Source and so you can modify it to emulate the bugs in
> > other software: that is not one of the aims of its developers so
> > please don't expect us to do so for you.
> 
> 

__
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] downloading r 2.9.0

2009-04-27 Thread christophe dutang
Hi all,

I try to download R 2.9.0 from French mirrors... but the download stops
mysteriously at 13.2 MB of the 65MB file. I get this both on my mac and my
PC...

does anyone face this problem?

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] problem with symbol function

2009-04-27 Thread Christophe Dutang
Hi all,

I use the symbol functions to draw circles. But the argument lty does  
not work on windows but works correctly on my macbook:

x <- -4:4
y <- -4:4

plot(x,y,type="n")

symbols(0, 0, add = TRUE, circles = 1, inches = 1, fg="black",  
lty="solid")

symbols(0, 0, add = TRUE, circles = 1, inches = 2, fg="black",  
lty="dashed")


The second circle should be drawn with dash... it works on my macbook  
but on my PC.

I use R 2.9.0 on windows xp home and mac os 10.5.

Does anyone have this problem? is it a limitation of windows?

thanks in advance


Christophe

--
Christophe Dutang
Ph. D. student at ISFA, Lyon, France
website: http://dutangc.free.fr





[[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] Bumps chart in R

2009-04-27 Thread Andreas Christoffersen
I am sorry - but maybe someone will help me with the final puzzle. How
to remove the legend from the qplot?

I can google my way to something like
sc <- scale_fill_continuous()
s...@legend <- FALSE

but
qplot(year, value, data = data, xlab="År",ylab="% i ekstrem fattigdom",
 geom = "line", group = Lande,col=Lande) + sc +
 geom_text(aes(label = Lande), subset(data,year == 1990),
   hjust = 0.5,vjust=0, size = 3, lineheight = 1)

doesnot work. Is there no simple way to just: legend=F ?

On Mon, Apr 27, 2009 at 8:53 PM, Andreas Christoffersen
 wrote:
>> Or just add the text layer separately:
>>
>> qplot(year, value, data = data, geom = "line", group = countries) +
>>  geom_text(aes(label = countries), subset = .(year == 1990),
>>    hjust = 1, size = 3, lineheight = 1)
>
> THX a lot!
> The subset did not work for me, but this does:
> subset(data,year == 1990)
>
> Andreas
>

__
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 with symbol function

2009-04-27 Thread Joshua Wiley
Hi Christophe,

I am able to plot dashed circles on Windows. I'm afraid I do not have any 
suggestions for you. What happens when you try to plot it on Windows?


Joshua Wiley


 Original message 
>Date: Mon, 27 Apr 2009 22:15:53 +0200
>From: r-help-boun...@r-project.org (on behalf of Christophe Dutang 
>)
>Subject: [R] problem with symbol function  
>To: r-help@r-project.org
>
>Hi all,
>
>I use the symbol functions to draw circles. But the argument lty does  
>not work on windows but works correctly on my macbook:
>
>x <- -4:4
>y <- -4:4
>
>plot(x,y,type="n")
>
>symbols(0, 0, add = TRUE, circles = 1, inches = 1, fg="black",  
>lty="solid")
>
>symbols(0, 0, add = TRUE, circles = 1, inches = 2, fg="black",  
>lty="dashed")
>
>
>The second circle should be drawn with dash... it works on my macbook  
>but on my PC.
>
>I use R 2.9.0 on windows xp home and mac os 10.5.
>
>Does anyone have this problem? is it a limitation of windows?
>
>thanks in advance
>
>
>Christophe
>
>--
>Christophe Dutang
>Ph. D. student at ISFA, Lyon, France
>website: http://dutangc.free.fr
>
>
>
>
>
>   [[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] problem with symbol function

2009-04-27 Thread Christophe Dutang
it just plot solid lines? I also have a similar problem on my PC at  
the office, which run XP pro...



Le 27 avr. 09 à 22:29, Joshua Wiley a écrit :


Hi Christophe,

I am able to plot dashed circles on Windows. I'm afraid I do not  
have any suggestions for you. What happens when you try to plot it  
on Windows?



Joshua Wiley


 Original message 

Date: Mon, 27 Apr 2009 22:15:53 +0200
From: r-help-boun...@r-project.org (on behalf of Christophe Dutang >)

Subject: [R] problem with symbol function
To: r-help@r-project.org

Hi all,

I use the symbol functions to draw circles. But the argument lty does
not work on windows but works correctly on my macbook:

x <- -4:4
y <- -4:4

plot(x,y,type="n")

symbols(0, 0, add = TRUE, circles = 1, inches = 1, fg="black",
lty="solid")

symbols(0, 0, add = TRUE, circles = 1, inches = 2, fg="black",
lty="dashed")


The second circle should be drawn with dash... it works on my macbook
but on my PC.

I use R 2.9.0 on windows xp home and mac os 10.5.

Does anyone have this problem? is it a limitation of windows?

thanks in advance


Christophe

--
Christophe Dutang
Ph. D. student at ISFA, Lyon, France
website: http://dutangc.free.fr





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


--
Christophe Dutang
Ph. D. student at ISFA, Lyon, France
website: http://dutangc.free.fr

__
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] Generate ramified structures

2009-04-27 Thread Talita Perciano
Hello,

I would like to generate ramified structures like plant root systems, river
networks or trees and save the generated structure as an image. Does anyone
knows if there is a way to do that with R?

Thank you in advance,

Talita


--
Talita Perciano
Instituto de Matemática e Estatísitca
Universidade de São Paulo - USP
PhD Student in Computer Science
São Paulo, SP, Brazil
Tel: +55 11 8826 7092

"Success is not final, failure is not fatal: it is the courage to
continue that counts."
(Winston Churchill)

__
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] Julia set in R

2009-04-27 Thread Talita Perciano
Hi,

I'm really interested in Julia sets too... If there is a R code for
that I would like to know!

Talita

2009/4/27 Erin Hodgess 
>
> Dear R People:
>
> Has anyone produced code for a Julia set, please?
>
> It's not all that tough to do, just thought I'd check before
> re-inventing the wheel.
>
> Thanks,
> Erin
>
>
> --
> Erin Hodgess
> Associate Professor
> Department of Computer and Mathematical Sciences
> University of Houston - Downtown
> mailto: erinm.hodg...@gmail.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.



--
Talita Perciano
Instituto de Matemática e Estatísitca
Universidade de São Paulo - USP
PhD Student in Computer Science
São Paulo, SP, Brazil
Tel: +55 11 8826 7092

"Success is not final, failure is not fatal: it is the courage to
continue that counts."
(Winston Churchill)

__
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] Julia set in R

2009-04-27 Thread Henrique Dallazuanna
See this:

http://fractalswithr.blogspot.com/



On Mon, Apr 27, 2009 at 5:34 PM, Talita Perciano
wrote:

> Hi,
>
> I'm really interested in Julia sets too... If there is a R code for
> that I would like to know!
>
> Talita
>
> 2009/4/27 Erin Hodgess 
> >
> > Dear R People:
> >
> > Has anyone produced code for a Julia set, please?
> >
> > It's not all that tough to do, just thought I'd check before
> > re-inventing the wheel.
> >
> > Thanks,
> > Erin
> >
> >
> > --
> > Erin Hodgess
> > Associate Professor
> > Department of Computer and Mathematical Sciences
> > University of Houston - Downtown
> > mailto: erinm.hodg...@gmail.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.
>
>
>
> --
> Talita Perciano
> Instituto de Matemática e Estatísitca
> Universidade de São Paulo - USP
> PhD Student in Computer Science
> São Paulo, SP, Brazil
> Tel: +55 11 8826 7092
>
> "Success is not final, failure is not fatal: it is the courage to
> continue that counts."
> (Winston Churchill)
>
> __
> 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

[[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] problem with symbol function

2009-04-27 Thread Christophe Dutang

what is your service pack version?

at home I use the SP2 version.

Le 27 avr. 09 à 22:29, Joshua Wiley a écrit :


Hi Christophe,

I am able to plot dashed circles on Windows. I'm afraid I do not  
have any suggestions for you. What happens when you try to plot it  
on Windows?



Joshua Wiley


 Original message 

Date: Mon, 27 Apr 2009 22:15:53 +0200
From: r-help-boun...@r-project.org (on behalf of Christophe Dutang >)

Subject: [R] problem with symbol function
To: r-help@r-project.org

Hi all,

I use the symbol functions to draw circles. But the argument lty does
not work on windows but works correctly on my macbook:

x <- -4:4
y <- -4:4

plot(x,y,type="n")

symbols(0, 0, add = TRUE, circles = 1, inches = 1, fg="black",
lty="solid")

symbols(0, 0, add = TRUE, circles = 1, inches = 2, fg="black",
lty="dashed")


The second circle should be drawn with dash... it works on my macbook
but on my PC.

I use R 2.9.0 on windows xp home and mac os 10.5.

Does anyone have this problem? is it a limitation of windows?

thanks in advance


Christophe

--
Christophe Dutang
Ph. D. student at ISFA, Lyon, France
website: http://dutangc.free.fr





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


--
Christophe Dutang
Ph. D. student at ISFA, Lyon, France
website: http://dutangc.free.fr

__
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] The .tex version of the manual in foo.Rcheck

2009-04-27 Thread BXC (Bendix Carstensen)
In version 2.8.1, running Rcmd check on the package foo would leave the file 
foo-manual.tex in the folder foo.Rcheck.

But as of 2.9.0 only foo-manual.pdf and foo-manual.log are there.

Is this intentional?
Anyway it is inconvenient, because I would occasionally like to include the 
manual at the end of a set of exercises, and this was a convenient file to 
\input with a few select %'s added.

br.
Bendix
___

Bendix Carstensen 
Senior Statistician
Steno Diabetes Center
Niels Steensens Vej 2-4
DK-2820 Gentofte
Denmark
+45 44 43 87 38 (direct)
+45 30 75 87 38 (mobile)
b...@steno.dk   http://www.biostat.ku.dk/~bxc
www.steno.dk

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

__
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] Generate ramified structures

2009-04-27 Thread Bert Gunter
Don't know, but try checking the "Graphical Models" Task View on CRAN.

-- Bert Gunter

> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> On Behalf Of Talita Perciano
> Sent: Monday, April 27, 2009 1:38 PM
> To: r-help@r-project.org; R help
> Subject: [R] Generate ramified structures
> 
> Hello,
> 
> I would like to generate ramified structures like plant root systems,
> river
> networks or trees and save the generated structure as an image. Does
> anyone
> knows if there is a way to do that with R?
> 
> Thank you in advance,
> 
> Talita
> 
> 
> --
> Talita Perciano
> Instituto de Matemática e Estatísitca
> Universidade de São Paulo - USP
> PhD Student in Computer Science
> São Paulo, SP, Brazil
> Tel: +55 11 8826 7092
> 
> "Success is not final, failure is not fatal: it is the courage to
> continue that counts."
> (Winston Churchill)
> 
> __
> 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 with symbol function

2009-04-27 Thread Christophe Dutang
This point is ok if I download R from the Austrian mirror. R is  
properly install on both computers. I also get this strange behavior  
with R 2.7.2. There is something I'm missing...



Le 27 avr. 09 à 22:54, Joshua Wiley a écrit :

I am running SP3. You said earlier that you were having trouble  
downloading 2.9.0, are you sure everything downloaded and installed  
properly? There have been some questions about transitioning to the  
new build going around.


Joshua Wiley



 Original message 

Date: Mon, 27 Apr 2009 22:45:26 +0200
From: Christophe Dutang 
Subject: Re: [R] problem with symbol function
To: Joshua Wiley 
Cc: r-help@r-project.org

what is your service pack version?

at home I use the SP2 version.

Le 27 avr. 09 à 22:29, Joshua Wiley a écrit :


Hi Christophe,

I am able to plot dashed circles on Windows. I'm afraid I do not
have any suggestions for you. What happens when you try to plot it
on Windows?


Joshua Wiley


 Original message 

Date: Mon, 27 Apr 2009 22:15:53 +0200
From: r-help-boun...@r-project.org (on behalf of Christophe  
Dutang 
)

Subject: [R] problem with symbol function
To: r-help@r-project.org

Hi all,

I use the symbol functions to draw circles. But the argument lty  
does

not work on windows but works correctly on my macbook:

x <- -4:4
y <- -4:4

plot(x,y,type="n")

symbols(0, 0, add = TRUE, circles = 1, inches = 1, fg="black",
lty="solid")

symbols(0, 0, add = TRUE, circles = 1, inches = 2, fg="black",
lty="dashed")


The second circle should be drawn with dash... it works on my  
macbook

but on my PC.

I use R 2.9.0 on windows xp home and mac os 10.5.

Does anyone have this problem? is it a limitation of windows?

thanks in advance


Christophe

--
Christophe Dutang
Ph. D. student at ISFA, Lyon, France
website: http://dutangc.free.fr





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


--
Christophe Dutang
Ph. D. student at ISFA, Lyon, France
website: http://dutangc.free.fr






--
Christophe Dutang
Ph. D. student at ISFA, Lyon, France
website: http://dutangc.free.fr

__
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 with symbol function

2009-04-27 Thread Joshua Wiley
I am running SP3. You said earlier that you were having trouble downloading 
2.9.0, are you sure everything downloaded and installed properly? There have 
been some questions about transitioning to the new build going around.

Joshua Wiley



 Original message 
>Date: Mon, 27 Apr 2009 22:45:26 +0200
>From: Christophe Dutang   
>Subject: Re: [R] problem with symbol function  
>To: Joshua Wiley 
>Cc: r-help@r-project.org
>
>what is your service pack version?
>
>at home I use the SP2 version.
>
>Le 27 avr. 09 à 22:29, Joshua Wiley a écrit :
>
>> Hi Christophe,
>>
>> I am able to plot dashed circles on Windows. I'm afraid I do not  
>> have any suggestions for you. What happens when you try to plot it  
>> on Windows?
>>
>>
>> Joshua Wiley
>>
>>
>>  Original message 
>>> Date: Mon, 27 Apr 2009 22:15:53 +0200
>>> From: r-help-boun...@r-project.org (on behalf of Christophe Dutang 
>>> >> >)
>>> Subject: [R] problem with symbol function
>>> To: r-help@r-project.org
>>>
>>> Hi all,
>>>
>>> I use the symbol functions to draw circles. But the argument lty does
>>> not work on windows but works correctly on my macbook:
>>>
>>> x <- -4:4
>>> y <- -4:4
>>>
>>> plot(x,y,type="n")
>>>
>>> symbols(0, 0, add = TRUE, circles = 1, inches = 1, fg="black",
>>> lty="solid")
>>>
>>> symbols(0, 0, add = TRUE, circles = 1, inches = 2, fg="black",
>>> lty="dashed")
>>>
>>>
>>> The second circle should be drawn with dash... it works on my macbook
>>> but on my PC.
>>>
>>> I use R 2.9.0 on windows xp home and mac os 10.5.
>>>
>>> Does anyone have this problem? is it a limitation of windows?
>>>
>>> thanks in advance
>>>
>>>
>>> Christophe
>>>
>>> --
>>> Christophe Dutang
>>> Ph. D. student at ISFA, Lyon, France
>>> website: http://dutangc.free.fr
>>>
>>>
>>>
>>>
>>>
>>> [[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.
>
>--
>Christophe Dutang
>Ph. D. student at ISFA, Lyon, France
>website: http://dutangc.free.fr
>
>
>
>

__
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 with symbol function

2009-04-27 Thread Andrew Dolman
I just tested this on my windows setup and you're right - it appears to draw
2 solid circles and if you save as .png or .jpeg that's what you get in the
resultant file - but if you save as .ps or .pdf you get a dashed outer
circle.


I don't know why.

Andy. R 2.8.1



andydol...@gmail.com


2009/4/27 Christophe Dutang 

> what is your service pack version?
>
> at home I use the SP2 version.
>
> Le 27 avr. 09 à 22:29, Joshua Wiley a écrit :
>
>  Hi Christophe,
>>
>> I am able to plot dashed circles on Windows. I'm afraid I do not have any
>> suggestions for you. What happens when you try to plot it on Windows?
>>
>>
>> Joshua Wiley
>>
>>
>>  Original message 
>>
>>> Date: Mon, 27 Apr 2009 22:15:53 +0200
>>> From: r-help-boun...@r-project.org (on behalf of Christophe Dutang <
>>> duta...@gmail.com>)
>>> Subject: [R] problem with symbol function
>>> To: r-help@r-project.org
>>>
>>> Hi all,
>>>
>>> I use the symbol functions to draw circles. But the argument lty does
>>> not work on windows but works correctly on my macbook:
>>>
>>> x <- -4:4
>>> y <- -4:4
>>>
>>> plot(x,y,type="n")
>>>
>>> symbols(0, 0, add = TRUE, circles = 1, inches = 1, fg="black",
>>> lty="solid")
>>>
>>> symbols(0, 0, add = TRUE, circles = 1, inches = 2, fg="black",
>>> lty="dashed")
>>>
>>>
>>> The second circle should be drawn with dash... it works on my macbook
>>> but on my PC.
>>>
>>> I use R 2.9.0 on windows xp home and mac os 10.5.
>>>
>>> Does anyone have this problem? is it a limitation of windows?
>>>
>>> thanks in advance
>>>
>>>
>>> Christophe
>>>
>>> --
>>> Christophe Dutang
>>> Ph. D. student at ISFA, Lyon, France
>>> website: http://dutangc.free.fr
>>>
>>>
>>>
>>>
>>>
>>>[[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.
>>>
>>
> --
> Christophe Dutang
> Ph. D. student at ISFA, Lyon, France
> website: http://dutangc.free.fr
>
> __
> 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] problem with symbol function

2009-04-27 Thread Joshua Wiley
I read that the lty=2 argument does not work on all graphics devices. You might 
double check that since it works on mac.


Joshua Wiley



 Original message 
>Date: Mon, 27 Apr 2009 22:58:11 +0200
>From: Christophe Dutang   
>Subject: Re: [R] problem with symbol function  
>To: Joshua Wiley 
>Cc: r-help@r-project.org
>
>This point is ok if I download R from the Austrian mirror. R is  
>properly install on both computers. I also get this strange behavior  
>with R 2.7.2. There is something I'm missing...
>
>
>Le 27 avr. 09 à 22:54, Joshua Wiley a écrit :
>
>> I am running SP3. You said earlier that you were having trouble  
>> downloading 2.9.0, are you sure everything downloaded and installed  
>> properly? There have been some questions about transitioning to the  
>> new build going around.
>>
>> Joshua Wiley
>>
>>
>>
>>  Original message 
>>> Date: Mon, 27 Apr 2009 22:45:26 +0200
>>> From: Christophe Dutang 
>>> Subject: Re: [R] problem with symbol function
>>> To: Joshua Wiley 
>>> Cc: r-help@r-project.org
>>>
>>> what is your service pack version?
>>>
>>> at home I use the SP2 version.
>>>
>>> Le 27 avr. 09 à 22:29, Joshua Wiley a écrit :
>>>
 Hi Christophe,

 I am able to plot dashed circles on Windows. I'm afraid I do not
 have any suggestions for you. What happens when you try to plot it
 on Windows?


 Joshua Wiley


  Original message 
> Date: Mon, 27 Apr 2009 22:15:53 +0200
> From: r-help-boun...@r-project.org (on behalf of Christophe  
> Dutang > )
> Subject: [R] problem with symbol function
> To: r-help@r-project.org
>
> Hi all,
>
> I use the symbol functions to draw circles. But the argument lty  
> does
> not work on windows but works correctly on my macbook:
>
> x <- -4:4
> y <- -4:4
>
> plot(x,y,type="n")
>
> symbols(0, 0, add = TRUE, circles = 1, inches = 1, fg="black",
> lty="solid")
>
> symbols(0, 0, add = TRUE, circles = 1, inches = 2, fg="black",
> lty="dashed")
>
>
> The second circle should be drawn with dash... it works on my  
> macbook
> but on my PC.
>
> I use R 2.9.0 on windows xp home and mac os 10.5.
>
> Does anyone have this problem? is it a limitation of windows?
>
> thanks in advance
>
>
> Christophe
>
> --
> Christophe Dutang
> Ph. D. student at ISFA, Lyon, France
> website: http://dutangc.free.fr
>
>
>
>
>
>   [[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.
>>>
>>> --
>>> Christophe Dutang
>>> Ph. D. student at ISFA, Lyon, France
>>> website: http://dutangc.free.fr
>>>
>>>
>>>
>>>
>
>--
>Christophe Dutang
>Ph. D. student at ISFA, Lyon, France
>website: http://dutangc.free.fr
>
>
>
>

__
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 with symbol function

2009-04-27 Thread Christophe Dutang
Yes png or jpeg files do not work whereas pdfs are ok on windows...

Le 27 avr. 09 à 22:59, Andrew Dolman a écrit :

> I just tested this on my windows setup and you're right - it appears  
> to draw 2 solid circles and if you save as .png or .jpeg that's what  
> you get in the resultant file - but if you save as .ps or .pdf you  
> get a dashed outer circle.
>
>
> I don't know why.
>
> Andy. R 2.8.1
>
>
>
> andydol...@gmail.com
>
>
> 2009/4/27 Christophe Dutang 
> what is your service pack version?
>
> at home I use the SP2 version.
>
>
> Le 27 avr. 09 à 22:29, Joshua Wiley a écrit :
>
> Hi Christophe,
>
> I am able to plot dashed circles on Windows. I'm afraid I do not  
> have any suggestions for you. What happens when you try to plot it  
> on Windows?
>
>
> Joshua Wiley
>
>
>  Original message 
> Date: Mon, 27 Apr 2009 22:15:53 +0200
> From: r-help-boun...@r-project.org (on behalf of Christophe Dutang 
>  >)
> Subject: [R] problem with symbol function
> To: r-help@r-project.org
>
> Hi all,
>
> I use the symbol functions to draw circles. But the argument lty does
> not work on windows but works correctly on my macbook:
>
> x <- -4:4
> y <- -4:4
>
> plot(x,y,type="n")
>
> symbols(0, 0, add = TRUE, circles = 1, inches = 1, fg="black",
> lty="solid")
>
> symbols(0, 0, add = TRUE, circles = 1, inches = 2, fg="black",
> lty="dashed")
>
>
> The second circle should be drawn with dash... it works on my macbook
> but on my PC.
>
> I use R 2.9.0 on windows xp home and mac os 10.5.
>
> Does anyone have this problem? is it a limitation of windows?
>
> thanks in advance
>
>
> Christophe
>
> --
> Christophe Dutang
> Ph. D. student at ISFA, Lyon, France
> website: http://dutangc.free.fr
>
>
>
>
>
>[[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.
>
> --
> Christophe Dutang
> Ph. D. student at ISFA, Lyon, France
> website: http://dutangc.free.fr
>
> __
> 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.
>

--
Christophe Dutang
Ph. D. student at ISFA, Lyon, France
website: http://dutangc.free.fr





[[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] problem with symbol function

2009-04-27 Thread Duncan Murdoch

On 27/04/2009 4:29 PM, Joshua Wiley wrote:

Hi Christophe,

I am able to plot dashed circles on Windows. I'm afraid I do not have any 
suggestions for you. What happens when you try to plot it on Windows?


Were you using the same code as Christophe?  I see what he saw: the 
circle comes out with a solid line.


Duncan Murdoch




Joshua Wiley


 Original message 

Date: Mon, 27 Apr 2009 22:15:53 +0200
From: r-help-boun...@r-project.org (on behalf of Christophe Dutang 
)
Subject: [R] problem with symbol function  
To: r-help@r-project.org


Hi all,

I use the symbol functions to draw circles. But the argument lty does  
not work on windows but works correctly on my macbook:


x <- -4:4
y <- -4:4

plot(x,y,type="n")

symbols(0, 0, add = TRUE, circles = 1, inches = 1, fg="black",  
lty="solid")


symbols(0, 0, add = TRUE, circles = 1, inches = 2, fg="black",  
lty="dashed")



The second circle should be drawn with dash... it works on my macbook  
but on my PC.


I use R 2.9.0 on windows xp home and mac os 10.5.

Does anyone have this problem? is it a limitation of windows?

thanks in advance


Christophe

--
Christophe Dutang
Ph. D. student at ISFA, Lyon, France
website: http://dutangc.free.fr





[[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-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 with symbol function

2009-04-27 Thread Christophe Dutang
so it could be a limitation of graphics on windows?

It also appears with "long dash" lines.

x <- -4:4
y <- -4:4

plot(x,y,type="n")

symbols(0, 0, add = TRUE, circles = 1, inches = 1, fg="black",  
lty="solid")

symbols(0, 0, add = TRUE, circles = 1, inches = 2,  
fg="black",lty="dashed")

symbols(0, 0, add = TRUE, circles = 1, inches = 3,  
fg="black",lty="longdash", lwd=2)


Le 27 avr. 09 à 23:07, Joshua Wiley a écrit :

> I read that the lty=2 argument does not work on all graphics  
> devices. You might double check that since it works on mac.
>
>
> Joshua Wiley
>
>
>
>  Original message 
>> Date: Mon, 27 Apr 2009 22:58:11 +0200
>> From: Christophe Dutang 
>> Subject: Re: [R] problem with symbol function
>> To: Joshua Wiley 
>> Cc: r-help@r-project.org
>>
>> This point is ok if I download R from the Austrian mirror. R is
>> properly install on both computers. I also get this strange behavior
>> with R 2.7.2. There is something I'm missing...
>>
>>
>> Le 27 avr. 09 à 22:54, Joshua Wiley a écrit :
>>
>>> I am running SP3. You said earlier that you were having trouble
>>> downloading 2.9.0, are you sure everything downloaded and installed
>>> properly? There have been some questions about transitioning to the
>>> new build going around.
>>>
>>> Joshua Wiley
>>>
>>>
>>>
>>>  Original message 
 Date: Mon, 27 Apr 2009 22:45:26 +0200
 From: Christophe Dutang 
 Subject: Re: [R] problem with symbol function
 To: Joshua Wiley 
 Cc: r-help@r-project.org

 what is your service pack version?

 at home I use the SP2 version.

 Le 27 avr. 09 à 22:29, Joshua Wiley a écrit :

> Hi Christophe,
>
> I am able to plot dashed circles on Windows. I'm afraid I do not
> have any suggestions for you. What happens when you try to plot it
> on Windows?
>
>
> Joshua Wiley
>
>
>  Original message 
>> Date: Mon, 27 Apr 2009 22:15:53 +0200
>> From: r-help-boun...@r-project.org (on behalf of Christophe
>> Dutang >> )
>> Subject: [R] problem with symbol function
>> To: r-help@r-project.org
>>
>> Hi all,
>>
>> I use the symbol functions to draw circles. But the argument lty
>> does
>> not work on windows but works correctly on my macbook:
>>
>> x <- -4:4
>> y <- -4:4
>>
>> plot(x,y,type="n")
>>
>> symbols(0, 0, add = TRUE, circles = 1, inches = 1, fg="black",
>> lty="solid")
>>
>> symbols(0, 0, add = TRUE, circles = 1, inches = 2, fg="black",
>> lty="dashed")
>>
>>
>> The second circle should be drawn with dash... it works on my
>> macbook
>> but on my PC.
>>
>> I use R 2.9.0 on windows xp home and mac os 10.5.
>>
>> Does anyone have this problem? is it a limitation of windows?
>>
>> thanks in advance
>>
>>
>> Christophe
>>
>> --
>> Christophe Dutang
>> Ph. D. student at ISFA, Lyon, France
>> website: http://dutangc.free.fr
>>
>>
>>
>>
>>
>>  [[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.

 --
 Christophe Dutang
 Ph. D. student at ISFA, Lyon, France
 website: http://dutangc.free.fr




>>
>> --
>> Christophe Dutang
>> Ph. D. student at ISFA, Lyon, France
>> website: http://dutangc.free.fr
>>
>>
>>
>>

--
Christophe Dutang
Ph. D. student at ISFA, Lyon, France
website: http://dutangc.free.fr





[[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] is there a way generate correlated binomial data in R?

2009-04-27 Thread Jonathan Williams
Dear R Helpers,

Is there a way to generate multivariate correlated binomial data in R, similar 
to how the rmvbin procedure in package bindata can generate multivariate 
correlated binary data?

Thanks for your help,

Jonathan Williams

__
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 with symbol function

2009-04-27 Thread Duncan Murdoch

On 27/04/2009 5:23 PM, Christophe Dutang wrote:

so it could be a limitation of graphics on windows?


It's not graphics on Windows, but it appears to be a limitation of the 
windows() graphics device in R.  It is used for bitmap plots as well as 
on-screen plots, which is why you saw the same effect in jpeg, but 
different devices are used for Postscript and PDF.


When drawing lines, R handles the dash style itself, rather than using 
the built-in dashes.  But it doesn't do so for circles, and doesn't make 
use of the Windows line styles.


If you really need the dashes onscreen, you can draw the circle 
yourself.  Assuming the scales are equal on both axes that's easy, just use


> theta <- seq(0,2*pi, len=256)
> lines(x+r*cos(theta), y+r*sin(theta), lty="dashed")

(where (x,y) is the center and r is the radius).  It's more work if you 
want things to appear as circles when the scales are unequal, but I 
think this works:


circle <- function(x, y, inches=1, ...) {
  theta <- seq(0, 2*pi, len=256)
  lines(x + grconvertX(inches*cos(theta), "inches", "user") - 
grconvertX(0, "inches", "user"),

y + grconvertY(inches*sin(theta), "inches", "user") -
grconvertY(0, "inches", "user"),
...)
}

so you'd get the plot you wanted using

circle(0, 0, inches = 1.5, fg="black",lty="dashed")

The circle function is not vectorized, so it's not as useful as symbols, 
but it could be improved.


Duncan Murdoch




It also appears with "long dash" lines.

x <- -4:4
y <- -4:4

plot(x,y,type="n")

symbols(0, 0, add = TRUE, circles = 1, inches = 1, fg="black",  
lty="solid")


symbols(0, 0, add = TRUE, circles = 1, inches = 2,  
fg="black",lty="dashed")


symbols(0, 0, add = TRUE, circles = 1, inches = 3,  
fg="black",lty="longdash", lwd=2)



Le 27 avr. 09 à 23:07, Joshua Wiley a écrit :

I read that the lty=2 argument does not work on all graphics  
devices. You might double check that since it works on mac.



Joshua Wiley



 Original message 

Date: Mon, 27 Apr 2009 22:58:11 +0200
From: Christophe Dutang 
Subject: Re: [R] problem with symbol function
To: Joshua Wiley 
Cc: r-help@r-project.org

This point is ok if I download R from the Austrian mirror. R is
properly install on both computers. I also get this strange behavior
with R 2.7.2. There is something I'm missing...


Le 27 avr. 09 à 22:54, Joshua Wiley a écrit :


I am running SP3. You said earlier that you were having trouble
downloading 2.9.0, are you sure everything downloaded and installed
properly? There have been some questions about transitioning to the
new build going around.

Joshua Wiley



 Original message 

Date: Mon, 27 Apr 2009 22:45:26 +0200
From: Christophe Dutang 
Subject: Re: [R] problem with symbol function
To: Joshua Wiley 
Cc: r-help@r-project.org

what is your service pack version?

at home I use the SP2 version.

Le 27 avr. 09 à 22:29, Joshua Wiley a écrit :


Hi Christophe,

I am able to plot dashed circles on Windows. I'm afraid I do not
have any suggestions for you. What happens when you try to plot it
on Windows?


Joshua Wiley


 Original message 

Date: Mon, 27 Apr 2009 22:15:53 +0200
From: r-help-boun...@r-project.org (on behalf of Christophe
Dutang 
)

Subject: [R] problem with symbol function
To: r-help@r-project.org

Hi all,

I use the symbol functions to draw circles. But the argument lty
does
not work on windows but works correctly on my macbook:

x <- -4:4
y <- -4:4

plot(x,y,type="n")

symbols(0, 0, add = TRUE, circles = 1, inches = 1, fg="black",
lty="solid")

symbols(0, 0, add = TRUE, circles = 1, inches = 2, fg="black",
lty="dashed")


The second circle should be drawn with dash... it works on my
macbook
but on my PC.

I use R 2.9.0 on windows xp home and mac os 10.5.

Does anyone have this problem? is it a limitation of windows?

thanks in advance


Christophe

--
Christophe Dutang
Ph. D. student at ISFA, Lyon, France
website: http://dutangc.free.fr





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

--
Christophe Dutang
Ph. D. student at ISFA, Lyon, France
website: http://dutangc.free.fr





--
Christophe Dutang
Ph. D. student at ISFA, Lyon, France
website: http://dutangc.free.fr






--
Christophe Dutang
Ph. D. student at ISFA, Lyon, France
website: http://dutangc.free.fr





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

Re: [R] problem dowloading

2009-04-27 Thread R Heberto Ghezzo, Dr

Hello,
I am trying to upgrade the system:
niu <- new.packages()
install.packages(niu)
commands that have worked in previous instances, now it downloads the packages 
missing but complains with:
malformed bundle DESCRPTION file, no Contains field
and does this for 
diseasemapping_0.3
EMJumpDiffusion_1.3.4
InfluenceME_0.6
since it stops installing I gave up. Now I tried to Update my packages and 
after one or two updates the same complain
for FactoMineR_1.12
I used the mirror of Toronto and then I checked the one in Austria given the 
same error
Using the last R-2.9.0 in Win XP SP3
.
Heberto Ghezzo
Montreal Canada
__
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] save history only option under Linux

2009-04-27 Thread alex lee

Hi,

I have a question regarding the R command options under Linux
Is there any options that I can save history only?
The only save option is --save, which saves both data and history.
I don't want to save temporary data, because sometimes the it takes much
time if the temp data is too big.
However I want to restore the history for my next R session..

If there is no such option that meets my needs. Is there any other way to
work out, such as configuration in the profile file, etc. ?

Thanks a lot.

alex
-- 
View this message in context: 
http://www.nabble.com/save-history-only-option-under-Linux-tp23257673p23257673.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] memory.limit

2009-04-27 Thread Derek Stephen Elmerick
Hello --

So, independently of any other code, the memory limit error I referenced is
not a problem. The issue I am running into now is that our analytics
group must go back to all existing code and comment out the memory limit
reference [See my example below]. I'm sure there is a quick fix. If anyone
has ideas, I would appreciate it.

Thanks

>
> for (k in 1:3)
+ {
+cat("hello world","\n")
+ }
hello world
hello world
hello world
>
>
> for (k in 1:10)
+ {
+memory.limit(size=4095)
+cat("hello world","\n")
+ }
Error in trunc(.Internal(memory.size(size))) :
  Non-numeric argument to mathematical function
>



On Wed, Apr 22, 2009 at 4:33 PM, Francisco J. Zagmutt <
gerifalt...@hotmail.com> wrote:

> Hello Stephen,
>
> I can confirm that I get the same behavior in my Windows machine.  Here is
> a summary:
>
> > memory.limit()
> [1] 2046
> > memory.limit(2092)
> Error in trunc(.Internal(memory.size(size))) :
>  Non-numeric argument to mathematical function
> > memory.limit()
> [1] 2092
>
> As you described, the function reports an error but it indeed modified the
> memory allocation limit.  This must be somehow related to the modification
> to memory.limit() described in the release notes for Windows R version 2.9.0
> (http://cran.r-project.org/bin/windows/base/CHANGES.R-2.9.0)
>
> > version
>   _
> platform   i386-pc-mingw32
> arch   i386
> os mingw32
> system i386, mingw32
> status
> major  2
> minor  9.0
> year   2009
> month  04
> day17
> svn rev48333
> language   R
> version.string R version 2.9.0 (2009-04-17)
>
> All: is this a bug or are we missing something?
>
> Regards,
>
> Francisco
>
> __
> Francisco J. Zagmutt
> Vose Consulting
> 2891 20th Street
> Boulder, CO, 80304
> USA
> franci...@voseconsulting.com
> www.voseconsulting.com
>
> Derek Stephen Elmerick wrote:
>
>>  I ran the memory limit function in R 2.9.0 and received the 'error'
>> below. The memory appears to update correctly, so there's probably no
>> implication beyond cosmetic; however, thought I would make sure since the
>> function as written did not generate the same error in my 2.8.0 version of
>> R.
>>
>> Thanks
>>
>>
>> memory.limit(size=4095)
>>>
>> Error in trunc(.Internal(memory.size(size))) :
>>  Non-numeric argument to mathematical function
>>
>>> memory.limit()
>>>
>> [1] 4095
>>
>>  
>>
>>[[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] Memoria y Procesamiento

2009-04-27 Thread Mario Martinez
(English)
I seek information on the processing capacity of R. I understand it is
possible to define 4Gb of memory capacity, but I would like to know more
unless you can have a maximum size database to work with it in R (rows and
columns).

Who can help me be extremely grateful.

Greetings

M. Martinez
SIP Network Colleges
Santiago de Chile


(Español)
Busco información sobre la capacidad de procesamiento de R. Entiendo es
posible definir 4Gb de capacidad de memoria pero me gustaría saber más menos
que dimensión máxima puede tener una base de datos para trabajar con ella en
R (filas y columnas). Quien pueda ayudarme estaré muy agradecido. Saludos M.
Martínez SIP Red de Colegios Santiago de Chile

[[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] plot implicit function

2009-04-27 Thread José E. Chacón
Dear Ying,

A simple way to obtain what you want is the following:

1) Select an x-y mesh where you want to plot the function, using

xs<-seq(xmin,xmax,length.xs)
ys<-seq(xmin,xmax,length.ys)

2) Define f as a function of (x,y) and compute the values of f over the x-y 
mesh, by using

zs<-outer(xs,ys,FUN=f)

3) Draw a contour plot at level 0:

contours(xs,ys,zs,levels=0,drawpoints=FALSE)

Hope it helped.
[[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] gettext and utf-8

2009-04-27 Thread JKPeck
We are building message catalogs in utf-8, and we want all characters
to be preserved in the strings returned by gettext.  I.e., we do not
want conversion to the locale code page (unless it, too, is utf-8).

We are unable to set the locale to a utf-8 encoding on Windows.  Using
iconv to convert to utf-8 won't help, because characters will have
been lost before that point.

Is there a way to force gettext to return the utf-8 text in the
message catalog without any encoding conversion?

Using R2.8.  We'll actually want this to work on all platforms.

TIA.

-Jon Peck

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

2009-04-27 Thread Sarjinder Singh
 Good Day!

 Could you please help us with R language?

 Our question is to learn editing in the R editor.  While typing in the 
R-editor, how can we make changes if we typed something wrong in the previous 
lines of the program.  How to save and reload a program in R?

 Your help will be appreciated.


 With best regards,

 Sarjinder






  
[[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] Generalized linear models

2009-04-27 Thread mathallan

I have to fit a generalized linear model in R, and I have never done this
before, so I'm in very much doubt.

I have a dataset (of 4036 observations)

  claims  sum grp
1   3852  345702931
2   1194  7776468   1
3   3916  26343305  1
4   1258  5502915  1
5   11594   711453346   1
...

there are 4 groups (grp).

The task is to determine the effect of sum and grp (and interactions between
them) on the claims.

I have to test using different link functions and distributions


What I think I should do is (in R)

> glm(claims~sum*grp, family=gaussian(link="log"))

Call:  glm(formula = claims ~ sum * grp, family = gaussian(link = "log")) 

Coefficients:
(Intercept)  sum  grp  sum:grp  
  1.215e+01   -4.466e-096.814e-025.294e-09  

Degrees of Freedom: 4035 Total (i.e. Null);  4032 Residual
Null Deviance:  3.371e+16 
Residual Deviance: 3.355e+16AIC: 131500 


Is this right? And how can the output be interpreted?

Did I even answer the question, and how can I plot a curve to the
oberservations?


/Thank you so much for helping


-- 
View this message in context: 
http://www.nabble.com/Generalized-linear-models-tp23265349p23265349.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.


  1   2   >