[R] Question of nlme package

2009-04-28 Thread Helen Chen

Dear R user
I would like to run some panel  regressions with R. Therefore I want to use 
fixed effect
model.
I consulted nlme package pdf. Unfortunately I couldn't find 
anything clear example about fixed effect model.

Is there any defined function to calculate panel data under fixed effect
model.
I need some suggestions or examples.

Thanks
Best 
Helen Chen 
-- 
View this message in context: 
http://www.nabble.com/Question-of-nlme-package-tp23270918p23270918.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] need some help finding power in test about variances

2009-04-28 Thread ati sundar

Hello All

I am new to this list. I have a problem where for a single sample drawn from 
normal population, null hypothesis is that variance = k (say). Alternative 
hypothesis is variance > k. Now if we know the true variance, then I would like 
to calculate the sample size required to produce certain power (for some
significance). How do I do this ? I thought of using pwr.chisq.test, and I 
contacted the author stephane champely, but he said his package can't do this. 
Does anybody have an idea ?

Thanks
Ati

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


Re: [R] Generalized linear models

2009-04-28 Thread mathallan

Thanks for the answer David

Sum er the "sum insured" the maximal loss of the company. Claims, is the
actually claim size. Group is wich type of business is insured.

Can you help me to solve the problem?



It is very difficult to determine "rightness" since you have omitted  
essential background information. The most glaring omission is what  
sort of data is in "sum". If this is either the number of policies or  
the dollar amount at risk then a categorical "NO" is the answer to the  
question.
>

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.



-- 
View this message in context: 
http://www.nabble.com/Generalized-linear-models-tp23265349p23271211.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] Processing POST data with brew?

2009-04-28 Thread Martijn Ras
Heya Folks,

I've got to process a form that contains variable series of values,
which i want to collect into a vectors.

Say the first series has ten values, with id's ranging from X1 to X10,
currently i process them in the following hardcoded manner:

x1 <- c(as.numeric(POST$X1), as.numeric(POST$X2), as.numeric(POST$X3),
as.numeric(POST$X4), as.numeric(POST$X5), as.numeric(POST$X6),
as.numeric(POST$X7), as.numeric(POST$X8), as.numeric(POST$X9),
as.numeric(POST$X10))

Is there a way to process these in a loop?

Mazzel,

Martijn.

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

2009-04-28 Thread Vivek Dikshit
hi,
 I am using R's  "kernlab" package, exactly i am doing classification using
ksvm(.) and predict.ksvm(.).I want use of custom kernel. I am getting some
error.

# Following R code works (with promotergene dataset):

library("kernlab")
s <- function(x, y) {
 sum((x*y)^1.25)
 }
class(s) <- "kernel"
data("promotergene")
gene <- ksvm(Class ~ ., data = promotergene,
kernel = s, C = 10, cross = 5)
gene
pred<-predict(gene, promotergene[c(6), -1])

# but the same code fails to work with iris dataset

library("kernlab")
s <- function(x, y) {
 sum((x*y)^1.25)
 }
class(s) <- "kernel"
gene <- ksvm(Species ~ ., data = iris,kernel = s, C = 10, cross = 5)


# above code gives the following error:

Error in votematrix[i, ret < 0] <- votematrix[i, ret < 0] + 1 :
  NAs are not allowed in subscripted assignments

Thank you very much for your time and attention.

Sincerely,
Vivek
Banaras Hindu University,
India.

[[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] R: constrained optimization

2009-04-28 Thread Patrick Burns

A genetic algorithm would probably be
a pretty good choice for this problem.
It is not in a package, but you can get
the code for the 'genopt' function from
S Poetry on the public domain page of
www.burns-stat.com.

However, I think I understand enough of
the problem to predict that a bespoke
algorithm will be needed.  In which case
the introduction to genetic algorithms on
the Tutorials page may be of use.

Patrick Burns
patr...@burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of "The R Inferno" and "A Guide for the Unwilling S User")

mau...@alice.it wrote:
Thank you. 
Unluckily what makes the problem only apparenttly simple (for me) is that we have not differentiable functions and the parameter space is not continuous ... which reduces dramatically the number of choices.

I would be grateful to chat with anyone who has tackled a similar problem.

Maura

-Messaggio originale-
Da: David Winsemius [mailto:dwinsem...@comcast.net]
Inviato: dom 26/04/2009 6.55
A: mau...@alice.it
Cc: r-h...@stat.math.ethz.ch
Oggetto: Re: [R] constrained optimization
 
http://search.r-project.org/cgi-bin/namazu.cgi?query=%22constrained+optimization%22&max=100&result=normal&sort=score&idxname=functions&idxname=Rhelp08


And that is only the help messages from the last two years.'



On Apr 26, 2009, at 12:00 AM,  wrote:

Is there any R package addressing problems of constrained  
optimization ?

I have the following "apparently" simple problem:

Given a set V with fixed cardinality:nv
Given a set S whose cardinality is a parameter:nHat
Let the cardinality of the intersection S.and.V be:   nHatv

The problem consists of maximizing   nHatv/nv  subject to a penalty  
if  nHat > nHatv


It is allowed and even desirable to make set S contain set V

Thank you so much


tutti i telefonini TIM!


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


David Winsemius, MD
Heritage Laboratories
West Hartford, CT





tutti i telefonini TIM!


[[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] Finding rows common to two datasets

2009-04-28 Thread Steve Murray

Dear all,
 
I have 2 data frames, both with 14 columns of data and differing numbers of 
rows. The first two columns are 'Latitude' and 'Longitude'. I want to find the 
pairs of Latitude and Longitude coordinates which are common to both datasets, 
and output a new data frame which is composed of these coincident rows. I tried 
using the 'unique' command, but had difficulties interpreting the help file.
 
Many thanks for any help offered,
 
Steve

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Finding rows common to two datasets

2009-04-28 Thread Umesh Srinivasan
Dear Steve,

Try

? intersect

and see if that might help.

Cheers,
Umesh

On Tue, Apr 28, 2009 at 1:29 PM, Steve Murray wrote:

>
> Dear all,
>
> I have 2 data frames, both with 14 columns of data and differing numbers of
> rows. The first two columns are 'Latitude' and 'Longitude'. I want to find
> the pairs of Latitude and Longitude coordinates which are common to both
> datasets, and output a new data frame which is composed of these coincident
> rows. I tried using the 'unique' command, but had difficulties interpreting
> the help file.
>
> Many thanks for any help offered,
>
> Steve
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] refit with binomial model (lme4)

2009-04-28 Thread Eric Elguero
On Mon, 2009-04-27 at 08:30 -0500, Douglas Bates wrote:
> 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.
> 

thank you for this explanation.

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

yes I could but I found that I could use the
probability/weights form, at least in my case 
where I am simulating new binomial data with
the observed number of trials.

Eric Elguero

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


[R] I can't install dprep

2009-04-28 Thread Grześ

When I want to install "dprep" and I always get information:

> install.packages("dprep")
Warning in install.packages("dprep") :
  argument 'lib' is missing: using 'C:\Users\Documents/R/win-library/2.8'
--- Please select a CRAN mirror for use in this session ---
Warning message:
package ‘dprep’ is not available 

I have tried a lot of mirror... 
What I shoud do. I use Windows Vista. 

-- 
View this message in context: 
http://www.nabble.com/I-can%27t-install-dprep-tp23272265p23272265.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] Matrix manipulation

2009-04-28 Thread Tammy Ma



From: metal_lical...@live.com
To: r-help@r-project.org
Subject: About Matrix
Date: Tue, 28 Apr 2009 11:28:43 +0300








Hi, Dear R users,

I have a question:

I have A matrix which is  11519X14
and B matrix which is  1764X14,

How do I get C matrix which is The remaining matrix after removing B from A?

Thanks a lot.

Kind regards,
Tammy

check out the rest of the Windows Live™.
More than mail–Windows Live™ goes way beyond your inbox.
 More than messages
_
Invite your mail contacts to join your friends list with Windows Live Spaces. 
It's easy!
http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us
[[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] Change font type PNG device with Lattice xyplot

2009-04-28 Thread RBlonk

Dear All,
I have some problems with changing the default font (Arial) in a xyplot
which is printed using the PNG-device. Although some things have been
mentioned about this in the forum, I still couldn't figure it out. Can
someone help me out?n Thanks in advance!

I want to print the plot for pasting in Microsoft Word
OS: Windows XP

see example:

a<-data.frame(x=c(1:5),y=c(2,2,3,3,4))
png(filename="let's change the font.png", width=480, height=300,
pointsize=12)
  xyplot(y~x,data=a,
ylab="y-axis",
xlab="x-axis",
ylim=c(0,5),
par.settings=list(axis.line=list(lwd=1.5),
strip.border=list(lwd=2)),
scales=list(y=list(tick.number=5,tck=0.5)),
type="l",lwd=3,lty=1,col=2)
dev.off()

Robbert
-- 
View this message in context: 
http://www.nabble.com/Change-font-type-PNG-device-with-Lattice-xyplot-tp23272171p23272171.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] About Matrix

2009-04-28 Thread Tammy Ma

Hi, Dear R users,

I have a question:

I have A matrix which is  11519X14
and B matrix which is  1764X14,

How do I get C matrix which is The remaining matrix after removing B from A?

Thanks a lot.

Kind regards,
Tammy

_
More than messages–check out the rest of the Windows Live™.
http://www.microsoft.com/windows/windowslive/
[[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] About Matrix

2009-04-28 Thread Martin Maechler
> "TM" == Tammy Ma 
> on Tue, 28 Apr 2009 11:28:43 +0300 writes:

TM> Hi, Dear R users,

TM> I have a question:

TM> I have A matrix which is  11519X14
TM> and B matrix which is  1764X14,

TM> How do I get C matrix which is The remaining matrix after removing B 
from A?

Your question can be read as asking for

  C <- B - A  

but probably that's not what you mean.

Please be more exact, and ___following the posting guide (see URL below!!)__
probably use an *explicit* example where e.g.
A is   13 x 2 and B is 4 x 2

Only then can we help you.

Regards,
Martin Maechler, ETH Zurich

PS: Sending your question to R-help *twice* can be seen as impolite..

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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-28 Thread Petr PIKAL
Hi
r-help-boun...@r-project.org napsal dne 27.04.2009 19:29:35:

>  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 

UP arrow?


> lines of the program.  How to save and reload a program in R?

?save, load, source,

maybe save history in some other file, edit this file in suitable editor 
and copy it to command window?

Much of it you can find in any intro document.

Regards
Petr


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


Re: [R] Question of nlme package

2009-04-28 Thread Dieter Menne
Helen Chen <96258011  nccu.edu.tw> writes:

> I would like to run some panel  regressions with R. Therefore I want to use 
> fixed effect  model.

The focus of lme is on mixed models, but gls in nlme can handle fixed-only
problems. I doubt, however that it is exactly what you want for your case.

> I consulted nlme package pdf. Unfortunately I couldn't find 
> anything clear example about fixed effect model.

The standard reference is Pinheiro/Bates and a must-have to more
clearly define the problem.

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] Setting R not to try to contact a CRAN repository

2009-04-28 Thread Dieter Menne
Richard Croy  fonterra.com> writes:

> I have a computer running R that cannot see the Internet. When I start
> RGui it asks me to select a CRAN mirror. This always fails, of course.

RGui does not ask for a connection to the Internet by default, so some 
installation must have mucked up your Rprofile file in the etc directory.
Open the file, and check for offending lines, and uncomment those.

For example, someone might have smuggled in 

update.packages(...)

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

2009-04-28 Thread Gerard M. Keogh
Emmanuel,

Friedman's (Annals of Stats 1991) MARS program implements recursive
partitioning in a regression context - a version of it written by Trevor
Hastie was available in R but I don't know what package it's now in - I
only have base stuff available (long story).

MARS, like recursive partitioning is a data exploration tool that builds up
an approximation to a nonlinear regression function using piecewise
regression splines. Each splines is split and replaced by a pair and the
GCV score computed - if the split reduces the GCV then the split is
accepted - in this way the method is adaptive.

MARS is very powerful and was used for  time  series research by LEwis &
Bonnie Ray (JASA 1991) - Bonnie has later papers as well. The main flaw
with MARS and I suppose a key reason why it doesn't feature more is that
there is no physical/biological underlying model that the researcher in
trying to make sense of - MARS just finds the best curve. Interpretation of
the result can therefore be a problem. However, MARS does provide an
"anova" type decomposition of the curve and this can certainly help in
making sense of the underlying relationships.

To use it (or related methods such as Generalised Additive Models GAMs) for
imputation then is a question of taste. If you're happy that the regression
curve is sufficient explanation then MARS is worth looking at - if you want
to know more about the physical model, well ...
Finally, MARS will treat all missing data as missing at random so if there
are specific conditional effects there have to be included as categorical
predictors a priori. As MARS is based on least squares it's only optimal
for Gaussian errors - it can be used on categorical data as well - another
variation called PolyMARS also implements MARS for categorical/multinomial
data.

Hope this is of interest!

Gerard







   
 Emmanuel  
 Charpentier   
r-h...@stat.math.ethz.ch
 Sent by:   cc 
 r-help-boun...@r- 
 project.org   Subject 
   Re: [R] Multiple imputations :  
   wicked dataset. Need advice for 
 27/04/2009 20:49  follow-up to a possible solution.   
   
   
   
   
   
   




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 : 

Re: [R] Finding rows common to two datasets

2009-04-28 Thread Steve Murray

Thanks for the reply, however, when I do the following command, I receive the 
message: 'data frame with 0 columns and 0 rows'. I've checked again though, and 
there should be several thousand rows where the Latitude and Longitude pairs 
are the same.

> common <- intersect(data_frame_x[c("Latitude", "Longitude")], 
> data_frame_y[c("Latitude","Longitude")])
> common
data frame with 0 columns and 0 rows


Is there an obvious solution to this? Should I be using 'unique' instead, and 
if so, how would I get the above to correspond to this command?

Thanks,

Steve





> Date: Tue, 28 Apr 2009 13:36:51 +0530
> Subject: Re: [R] Finding rows common to two datasets
> From: umesh.sriniva...@gmail.com
> To: smurray...@hotmail.com
> CC: r-help@r-project.org
>
> Dear Steve,
>
> Try
>
> ? intersect
>
> and see if that might help.
>
> Cheers,
> Umesh
>
> On Tue, Apr 28, 2009 at 1:29 PM, Steve Murray> wrote:
>
>
>
> Dear all,
>
>
>
> I have 2 data frames, both with 14 columns of data and differing numbers of 
> rows. The first two columns are 'Latitude' and 'Longitude'. I want to find 
> the pairs of Latitude and Longitude coordinates which are common to both 
> datasets, and output a new data frame which is composed of these coincident 
> rows. I tried using the 'unique' command, but had difficulties interpreting 
> the help file.
>
>
>
>
> Many thanks for any help offered,
>
>
>
> Steve
>
>
>
> __
>
> R-help@r-project.org mailing list
>
> https://stat.ethz.ch/mailman/listinfo/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] Out of memory issue

2009-04-28 Thread Neotropical bat risk assessments

   Hi again all,
   I can read all of the data is in CSV format with a header row and with
   1,200,240 rows.
   I can do all the plots and ggplot2 has no problems.
   Seems to be a problem with the MASS package???
   It seems that the contour plots are the problem with the memory error.
   Error: cannot allocate vector of size 228.9 Mb
   I can run smaller data sets and do the contour plots w/o problems.
   The data can not really be summarized as I need to plot the actual values to
   get the insight into the large data sets.
   I am using latest R version 2.9.0 (2009-04-17)
   My alternative is to bump up the memory of my one Dell workstation to 16 GB
   as it runs with Ubuntu and can access that amount if I figure out how to
   install R on a Linux box.
   It may not truly be a memory issue but a limit to how MASS does the contour
   plots?
   This works 100% with the large data sets.
   Bodega <- read.csv ("C:/R-Stats/Bat calls/Bodega.csv")
   attach(Bodega)
   library(ggplot2)
   f=jpeg(file="Bodega Sc_Fc plot.jpg")
   print(qplot(Sc, Fc))
   dev.off()
   f=jpeg(file="Bodega Fc Dens plot.jpg")
   print(qplot(Fc,geom="density"))
   dev.off()
   This does not.and I get the vector size error.
   library(MASS)
   library(batcalls)
   BRC<-kde2d(Sc,Fc)
   f=jpeg(file="Rainey contour plot.jpg")
   filled.contour(BRC)
dev.off()
   Thanks again for in sight as I trundle up the learn curve for R.
   Bruce
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] creating a vector of sums

2009-04-28 Thread Andrew Dolman
Look at ?cumsum



andydol...@gmail.com


2009/4/28 Rachel Taylor 

>
> Hi,
>
> I am trying to create a function for a goodness-of-fit test for the Pareto
> Distribution for some loss data that I have.
> So far I have the following:
>
> function(X=OTOL)
> {
> n <- length(X)-1 #calculated the number of values (extra as 0 included)
> i <- 2:640 #values of i
> j <- 1:639 #values of i-1
> Y <- (n-j+1)*((X[i])-(X[j])) #First part of GoF model
> Y
> }
>
> Where OTOL is the ordered loss data (decreasing), and Y is a vector of
> length 639
>
> What I need to do next is create another vector TY (of the same length)
> that is the the sum of part of the Y vector.
> So TY[1]=Y[1]
> TY[2]=Y[1]+Y[2]
> TY[3]=Y[1]+Y[2]+Y[3]
> and so on.
>
> I have tried to do a sum(Y[j]) but it just comes out with a single value.
>
> Any help is greatly appreciated, thank you.
>
> Rachel
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] Bounded memory ANOVA

2009-04-28 Thread Hardi

Hi,

I'm using aov() to analyze the data and get the rank of factors. However, this 
does not work for larger set of data due to memory limitation.
Are there any similar function to use aov() on data sets larger than memory 
similar to biglm ?

Thanks,

~ Hardi

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

2009-04-28 Thread Paul Hiemstra

christophe dutang wrote:

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

  

Try a different mirror and see what that does
Paul

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

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


Re: [R] creating a vector of sums

2009-04-28 Thread jim holtman
?cumsum

On Tue, Apr 28, 2009 at 5:30 AM, Rachel Taylor  wrote:
>
> Hi,
>
> I am trying to create a function for a goodness-of-fit test for the Pareto 
> Distribution for some loss data that I have.
> So far I have the following:
>
> function(X=OTOL)
> {
> n <- length(X)-1 #calculated the number of values (extra as 0 included)
> i <- 2:640 #values of i
> j <- 1:639 #values of i-1
> Y <- (n-j+1)*((X[i])-(X[j])) #First part of GoF model
> Y
> }
>
> Where OTOL is the ordered loss data (decreasing), and Y is a vector of length 
> 639
>
> What I need to do next is create another vector TY (of the same length) that 
> is the the sum of part of the Y vector.
> So TY[1]=Y[1]
> TY[2]=Y[1]+Y[2]
> TY[3]=Y[1]+Y[2]+Y[3]
> and so on.
>
> I have tried to do a sum(Y[j]) but it just comes out with a single value.
>
> Any help is greatly appreciated, thank you.
>
> Rachel
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] Finding rows common to two datasets

2009-04-28 Thread jim holtman
You are missing a comma:

common <- intersect(data_frame_x[,c("Latitude", "Longitude")],
data_frame_y[,c("Latitude","Longitude")])

On Tue, Apr 28, 2009 at 5:49 AM, Steve Murray  wrote:
>
> Thanks for the reply, however, when I do the following command, I receive the 
> message: 'data frame with 0 columns and 0 rows'. I've checked again though, 
> and there should be several thousand rows where the Latitude and Longitude 
> pairs are the same.
>
>> common <- intersect(data_frame_x[c("Latitude", "Longitude")], 
>> data_frame_y[c("Latitude","Longitude")])
>> common
> data frame with 0 columns and 0 rows
>
>
> Is there an obvious solution to this? Should I be using 'unique' instead, and 
> if so, how would I get the above to correspond to this command?
>
> Thanks,
>
> Steve
>
>
>
>
> 
>> Date: Tue, 28 Apr 2009 13:36:51 +0530
>> Subject: Re: [R] Finding rows common to two datasets
>> From: umesh.sriniva...@gmail.com
>> To: smurray...@hotmail.com
>> CC: r-help@r-project.org
>>
>> Dear Steve,
>>
>> Try
>>
>> ? intersect
>>
>> and see if that might help.
>>
>> Cheers,
>> Umesh
>>
>> On Tue, Apr 28, 2009 at 1:29 PM, Steve Murray> wrote:
>>
>>
>>
>> Dear all,
>>
>>
>>
>> I have 2 data frames, both with 14 columns of data and differing numbers of 
>> rows. The first two columns are 'Latitude' and 'Longitude'. I want to find 
>> the pairs of Latitude and Longitude coordinates which are common to both 
>> datasets, and output a new data frame which is composed of these coincident 
>> rows. I tried using the 'unique' command, but had difficulties interpreting 
>> the help file.
>>
>>
>>
>>
>> Many thanks for any help offered,
>>
>>
>>
>> Steve
>>
>>
>>
>> __
>>
>> R-help@r-project.org mailing list
>>
>> https://stat.ethz.ch/mailman/listinfo/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.
>



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

What is the problem that you are trying to solve?

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


[R] Fwd: kernlab - custom kernel

2009-04-28 Thread Vivek Dikshit
-- Forwarded message --
From: Vivek Dikshit 
Date: Tue, Apr 28, 2009 at 1:20 PM
Subject: kernlab - custom kernel
To: r-help@r-project.org


hi,
 I am using R's  "kernlab" package, exactly i am doing classification using
ksvm(.) and predict.ksvm(.).I want use of custom kernel. I am getting some
error.

# Following R code works (with promotergene dataset):

library("kernlab")
s <- function(x, y) {
 sum((x*y)^1.25)
 }
class(s) <- "kernel"
data("promotergene")
gene <- ksvm(Class ~ ., data = promotergene,
kernel = s, C = 10, cross = 5)
gene
pred<-predict(gene, promotergene[c(6), -1])

# but the same code fails to work with iris dataset

library("kernlab")
s <- function(x, y) {
 sum((x*y)^1.25)
 }
class(s) <- "kernel"
gene <- ksvm(Species ~ ., data = iris,kernel = s, C = 10, cross = 5)


# above code gives the following error:

Error in votematrix[i, ret < 0] <- votematrix[i, ret < 0] + 1 :
  NAs are not allowed in subscripted assignments

Thank you very much for your time and attention.

Sincerely,
Vivek
Banaras Hindu University,
India.

[[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] Build Windows binary

2009-04-28 Thread Duncan Murdoch

On 27/04/2009 8:35 PM, Matthew Fero wrote:

Hi everyone,
I'm trying to use the online resource, http://win-builder.r- 
project.org/ in order to build an R package for colleagues on Windows  
machines (I'm on Mac OS X).  I'm not getting an email response from  
the server (even in my junk mail box).   The site explains that the  
email address is need on the maintainer line in the DESCRIPTION  
file.  Mine is listed as follows:


Maintainer: Matthew Fero 

Any suggestions?


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Mathematical label in a plot with a percent sign

2009-04-28 Thread Daniel Brewer
Hi,

I am trying to produce a plot with an xlabel that reads (x >= 5%) with
the >= turned into the correct epression.  I can do this up to the
percentage sign by specifiing xlab=expression(x>=5).  Whatever I do to
include the % sign as well doesn't seem to work.

xlab=bquote(x>=5.("%")) almost works but includes brackets.

Anyonw know how to solve this one

Dan

PS I am running R 2.9.0

-- 
**
Daniel Brewer, Ph.D.

Institute of Cancer Research
Molecular Carcinogenesis
Email: daniel.bre...@icr.ac.uk
**

The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company 
Limited by Guarantee, Registered in England under Company No. 534147 with its 
Registered Office at 123 Old Brompton Road, London SW7 3RP.

This e-mail message is confidential and for use by the a...{{dropped:2}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Mathematical label in a plot with a percent sign

2009-04-28 Thread Gabor Grothendieck
Try:

plot(0, main = ~ x >= 5 * "%")


On Tue, Apr 28, 2009 at 6:37 AM, Daniel Brewer  wrote:
> Hi,
>
> I am trying to produce a plot with an xlabel that reads (x >= 5%) with
> the >= turned into the correct epression.  I can do this up to the
> percentage sign by specifiing xlab=expression(x>=5).  Whatever I do to
> include the % sign as well doesn't seem to work.
>
> xlab=bquote(x>=5.("%")) almost works but includes brackets.
>
> Anyonw know how to solve this one
>
> Dan
>
> PS I am running R 2.9.0
>
> --
> **
> Daniel Brewer, Ph.D.
>
> Institute of Cancer Research
> Molecular Carcinogenesis
> Email: daniel.bre...@icr.ac.uk
> **
>
> The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company 
> Limited by Guarantee, Registered in England under Company No. 534147 with its 
> Registered Office at 123 Old Brompton Road, London SW7 3RP.
>
> This e-mail message is confidential and for use by the a...{{dropped:2}}
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] Build Windows binary

2009-04-28 Thread Duncan Murdoch

On 27/04/2009 8:35 PM, Matthew Fero wrote:

Hi everyone,
I'm trying to use the online resource, http://win-builder.r- 
project.org/ in order to build an R package for colleagues on Windows  
machines (I'm on Mac OS X).  I'm not getting an email response from  
the server (even in my junk mail box).   The site explains that the  
email address is need on the maintainer line in the DESCRIPTION  
file.  Mine is listed as follows:


Maintainer: Matthew Fero 

Any suggestions?


(Oops, hit the wrong button.)

I'd suggest asking Uwe Ligges, who maintains win-builder.  I've cc'd him.

If it turns out there's something incompatible between your package and 
his system, an alternative is to put your package on R-forge; it also 
does binary builds for Windows.


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] Build Windows binary

2009-04-28 Thread Uwe Ligges



Duncan Murdoch wrote:

On 27/04/2009 8:35 PM, Matthew Fero wrote:

Hi everyone,
I'm trying to use the online resource, http://win-builder.r- 
project.org/ in order to build an R package for colleagues on Windows  
machines (I'm on Mac OS X).  I'm not getting an email response from  
the server (even in my junk mail box).   The site explains that the  
email address is need on the maintainer line in the DESCRIPTION  
file.  Mine is listed as follows:


Maintainer: Matthew Fero 

Any suggestions?


(Oops, hit the wrong button.)

I'd suggest asking Uwe Ligges, who maintains win-builder.  I've cc'd him.



Thanks,

the problem is that I forgot to make a required change when swicthing to 
2.9 and nobody else of the 20 authors who submitted packages sent a notice.


The stuff will work again now and you will get a message within 60 
minutes for your submitted package.


Uwe Ligges



If it turns out there's something incompatible between your package and 
his system, an alternative is to put your package on R-forge; it also 
does binary builds for Windows.


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] creating a vector of sums

2009-04-28 Thread Alain Guillet

Look at cumsum()

Alain

Rachel Taylor wrote:

Hi,
 
I am trying to create a function for a goodness-of-fit test for the Pareto Distribution for some loss data that I have.

So far I have the following:
 
function(X=OTOL)

{
n <- length(X)-1 #calculated the number of values (extra as 0 included)
i <- 2:640 #values of i
j <- 1:639 #values of i-1
Y <- (n-j+1)*((X[i])-(X[j])) #First part of GoF model
Y
}
 
Where OTOL is the ordered loss data (decreasing), and Y is a vector of length 639
 
What I need to do next is create another vector TY (of the same length) that is the the sum of part of the Y vector.

So TY[1]=Y[1]
TY[2]=Y[1]+Y[2]
TY[3]=Y[1]+Y[2]+Y[3]
and so on.
 
I have tried to do a sum(Y[j]) but it just comes out with a single value.
 
Any help is greatly appreciated, thank you.
 
Rachel


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

  


--
Alain Guillet
Statistician and Computer Scientist

SMCS - Institut de statistique - Université catholique de Louvain
Bureau d.126
Voie du Roman Pays, 20
B-1348 Louvain-la-Neuve
Belgium

tel: +32 10 47 30 50

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

2009-04-28 Thread Benoit Boulinguiez
Hi all,
 
I'm using 'expression' in the axes labels in graphs to get the greek letters
(ylab), as follows:
 
plot(
 layer_1$U0
 ,layer_1$dP/(H1.Theo)
 #,ylim=c(0,100)
 ,xlim=c(0,1.1)
 #,main="Pressure Drop",
 ,xlab=expression(U[0]~(Nm/s))
 ,ylab=expression(Delta~P~(Pa/m))
 ,col=2
 ,pch=16
 ,cex=1.5)
 
I just need to know how to avoid the use of a space (~) between the greek
letter (Delta) and the rest of the text.
 

Regards/Cordialement

-
Benoit Boulinguiez
Ph.D student
Ecole de Chimie de Rennes (ENSCR) Bureau 1.20 
Equipe CIP UMR CNRS 6226 "Sciences Chimiques de Rennes"
Avenue du Général Leclerc 
CS 50837 
35708 Rennes CEDEX 7 
Tel 33 (0)2 23 23 80 83
Fax 33 (0)2 23 23 81 20
  http://www.ensc-rennes.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] Mathematical label in a plot with a percent sign

2009-04-28 Thread Daniel Brewer
That worked great.  Many thanks.

Dan

Gabor Grothendieck wrote:
> Try:
> 
> plot(0, main = ~ x >= 5 * "%")
> 
> 
> On Tue, Apr 28, 2009 at 6:37 AM, Daniel Brewer  
> wrote:
>> Hi,
>>
>> I am trying to produce a plot with an xlabel that reads (x >= 5%) with
>> the >= turned into the correct epression.  I can do this up to the
>> percentage sign by specifiing xlab=expression(x>=5).  Whatever I do to
>> include the % sign as well doesn't seem to work.
>>
>> xlab=bquote(x>=5.("%")) almost works but includes brackets.
>>
>> Anyonw know how to solve this one
>>
>> Dan
>>
>> PS I am running R 2.9.0
>>
>> --
>> **
>> Daniel Brewer, Ph.D.
>>
>> Institute of Cancer Research
>> Molecular Carcinogenesis
>> Email: daniel.bre...@icr.ac.uk
>> **
>>
>> The Institute of Cancer Research: Royal Cancer Hospital, a charitable 
>> Company Limited by Guarantee, Registered in England under Company No. 534147 
>> with its Registered Office at 123 Old Brompton Road, London SW7 3RP.
>>
>> This e-mail message is confidential and for use by the a...{{dropped:2}}
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>

-- 
**

Daniel Brewer, Ph.D.

Institute of Cancer Research
Molecular Carcinogenesis
MUCRC
15 Cotswold Road
Sutton, Surrey SM2 5NG
United Kingdom

Tel: +44 (0) 20 8722 4109

**

The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company 
Limited by Guarantee, Registered in England under Company No. 534147 with its 
Registered Office at 123 Old Brompton Road, London SW7 3RP.

This e-mail message is confidential and for use by the a...{{dropped:2}}

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

2009-04-28 Thread Rachel Taylor

Hi,
 
I am trying to create a function for a goodness-of-fit test for the Pareto 
Distribution for some loss data that I have.
So far I have the following:
 
function(X=OTOL)
{
n <- length(X)-1 #calculated the number of values (extra as 0 included)
i <- 2:640 #values of i
j <- 1:639 #values of i-1
Y <- (n-j+1)*((X[i])-(X[j])) #First part of GoF model
Y
}
 
Where OTOL is the ordered loss data (decreasing), and Y is a vector of length 
639
 
What I need to do next is create another vector TY (of the same length) that is 
the the sum of part of the Y vector.
So TY[1]=Y[1]
TY[2]=Y[1]+Y[2]
TY[3]=Y[1]+Y[2]+Y[3]
and so on.
 
I have tried to do a sum(Y[j]) but it just comes out with a single value.
 
Any help is greatly appreciated, thank you.
 
Rachel

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Finding rows common to two datasets

2009-04-28 Thread Umesh Srinivasan
Dear Steve,

Can you show us a small sample of your two data frames (maybe the top twenty
or so rows)? Maybe things will become clearer then. I don't think 'unique'
will help you very much with this. What you can do alternatively (though
less elegantly!) do is use a 'for' loop. This would probably look something
like:

common.rows <- matrix(NA, nrow = nrow(dataframe1), ncol = ncol(dataframe1))
for (s in 1:nrow(common.rows)){
for (i in 1:nrow(dataframe1)){
for (j in 1:nrow(dataframe2)){
if(dataframe1[i,1] == dataframe[j,1]){
if(dataframe1[i,2] == dataframe[j,2]){
common.rows[s,] <- dataframe1[i,]
}}
}}}
You will then have to make a new dataframe from common.rows which removes
all the extra NAs.
As you can see, very inelegant and quite horrible!

I haven't tried this on anything yet, so not 100 per cent sure it will work,
but I am sure 'intersect' will help. Maybe I can try with some of your data,
if you're willing.

Cheers,
Umesh

On Tue, Apr 28, 2009 at 3:19 PM, Steve Murray wrote:

>
> Thanks for the reply, however, when I do the following command, I receive
> the message: 'data frame with 0 columns and 0 rows'. I've checked again
> though, and there should be several thousand rows where the Latitude and
> Longitude pairs are the same.
>
> > common <- intersect(data_frame_x[c("Latitude", "Longitude")],
> data_frame_y[c("Latitude","Longitude")])
> > common
> data frame with 0 columns and 0 rows
>
>
> Is there an obvious solution to this? Should I be using 'unique' instead,
> and if so, how would I get the above to correspond to this command?
>
> Thanks,
>
> Steve
>
>
>
>
> 
> > Date: Tue, 28 Apr 2009 13:36:51 +0530
> > Subject: Re: [R] Finding rows common to two datasets
> > From: umesh.sriniva...@gmail.com
> > To: smurray...@hotmail.com
> > CC: r-help@r-project.org
> >
> > Dear Steve,
> >
> > Try
> >
> > ? intersect
> >
> > and see if that might help.
> >
> > Cheers,
> > Umesh
> >
> > On Tue, Apr 28, 2009 at 1:29 PM, Steve Murray> wrote:
> >
> >
> >
> > Dear all,
> >
> >
> >
> > I have 2 data frames, both with 14 columns of data and differing numbers
> of rows. The first two columns are 'Latitude' and 'Longitude'. I want to
> find the pairs of Latitude and Longitude coordinates which are common to
> both datasets, and output a new data frame which is composed of these
> coincident rows. I tried using the 'unique' command, but had difficulties
> interpreting the help file.
> >
> >
> >
> >
> > Many thanks for any help offered,
> >
> >
> >
> > Steve
> >
> >
> >
> > __
> >
> > R-help@r-project.org mailing list
> >
> > https://stat.ethz.ch/mailman/listinfo/r-help
> >
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> >
> > and provide commented, minimal, self-contained, reproducible code.
> >
> >
>
> _
> Beyond Hotmail — see what else you can do with Windows Live.
> http://clk.atdmt.com/UKM/go/134665375/direct/01/
>

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

2009-04-28 Thread christophe dutang
with the Austrian, it works fine... I should have think before sending an
email to r help..

Thanks

2009/4/28 Paul Hiemstra 

> christophe dutang wrote:
>
>> 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
>>
>>
>>
> Try a different mirror and see what that does
> Paul
>
> --
> Drs. Paul Hiemstra
> Department of Physical Geography
> Faculty of Geosciences
> University of Utrecht
> Heidelberglaan 2
> P.O. Box 80.115
> 3508 TC Utrecht
> Phone:  +3130 274 3113 Mon-Tue
> Phone:  +3130 253 5773 Wed-Fri
> http://intamap.geo.uu.nl/~paul 
>
>


-- 
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] Why there is no p-value from likelihood ratio test using anova in GAM model fitting?

2009-04-28 Thread willow1980

Hello, everybody,
There is the first time for me to post a question, because I really cannot
find answer from books, websites or my colleagues. Thank you in advance for
your help!
I am running likelihood ratio test to find if the simpler model is not
significant from more complicated model. However, when I run LRT to compare
them, the test did not return F value and p-value for me. What's the reason?
How can I get such important information?


Analysis of Deviance Table

Model 1: sum_surv15 ~ s(FLBS) + s(byear) + s(FLBS, byear)
Model 2: sum_surv15 ~ s(FLBS) + SES + s(byear) + s(FLBS, byear)
   Resid. Df Resid. Dev Df Deviance F Pr(>F)
1 1202.21094 601.27 
2 1201.43848 601.290.77246-0.02

Thank you very much!

Jianghua Liu, University of Sheffield
-- 
View this message in context: 
http://www.nabble.com/Why-there-is-no-p-value-from-likelihood-ratio-test-using-anova-in-GAM-model-fitting--tp23275224p23275224.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] Random Sample with Unique function

2009-04-28 Thread Krystyna Golabek

Dear R-users

I have a dataset of 243 lines with replicate information for 20 different 
individuals (ID). 
I would like to randomly sample this dataset 100 times with a selection of 
unique IDs in each sample.

First to create a random sample I have;

cc<-read.table(blah.blah.blah)
names(cc)
 [1] "CALL""CONTEXT" "ORDER"   "ID"  "STATUS" 

s1<-cc[sample(1:243,20,replace=TRUE),]

This code samples 20 rows from the dataset but can anyone help me write the 
code to request unique(ID) in this sample?

Thank you so much for your time and help.

Krystyna Golabek



_


[[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] text in graph with expression

2009-04-28 Thread Uwe Ligges



Benoit Boulinguiez wrote:

Hi all,
 
I'm using 'expression' in the axes labels in graphs to get the greek letters

(ylab), as follows:
 
plot(

 layer_1$U0
 ,layer_1$dP/(H1.Theo)
 #,ylim=c(0,100)
 ,xlim=c(0,1.1)
 #,main="Pressure Drop",
 ,xlab=expression(U[0]~(Nm/s))
 ,ylab=expression(Delta~P~(Pa/m))
 ,col=2
 ,pch=16
 ,cex=1.5)
 
I just need to know how to avoid the use of a space (~) between the greek

letter (Delta) and the rest of the text.


Use "*", see ?plotmath

Uwe Ligges




 


Regards/Cordialement

-
Benoit Boulinguiez
Ph.D student
Ecole de Chimie de Rennes (ENSCR) Bureau 1.20 
Equipe CIP UMR CNRS 6226 "Sciences Chimiques de Rennes"
Avenue du Général Leclerc 
CS 50837 
35708 Rennes CEDEX 7 
Tel 33 (0)2 23 23 80 83

Fax 33 (0)2 23 23 81 20
  http://www.ensc-rennes.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] I can't install dprep

2009-04-28 Thread Uwe Ligges



Grześ wrote:

When I want to install "dprep" and I always get information:


install.packages("dprep")

Warning in install.packages("dprep") :
  argument 'lib' is missing: using 'C:\Users\Documents/R/win-library/2.8'
--- Please select a CRAN mirror for use in this session ---
Warning message:
package ‘dprep’ is not available 

I have tried a lot of mirror... 
What I shoud do. I use Windows Vista. 



Well, see the CRAN check results:
http://cran.r-project.org/web/checks/check_results_dprep.html
that tells you dprep gives ERRORs on all platforms, hence it is no 
longer provided as a binary package under Windows. If you want to use 
it, please compile from sources yourself and live with the errors or fix 
them (in which case you'd have to recompile yourserlf anyway).


Uwe Ligges

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Cannot update.packages (error message)

2009-04-28 Thread Richardson, Patrick
When trying to update (various) packages using update.packages() I get the 
following error message for various packages

package 'fBasics' successfully unpacked and MD5 sums checked
Error in unpackPkg(foundpkgs[okp, 2L], foundpkgs[okp, 1L], lib) :
  malformed bundle DESCRIPTION file, no Contains field
>

This happens with other packages besides fBasics (Matrix, as well as others) 
and I have switched mirrors and the same thing occurs.

Any suggestions?

Best regards,

Patrick
Win XP SP3

R version 2.9.0 (2009-04-17)
i386-pc-mingw32

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United 
States.1252;LC_MONETARY=English_United 
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

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

other attached packages:
[1] svSocket_0.9-5 TinnR_1.0.3R2HTML_1.59-1  Hmisc_3.5-2

loaded via a namespace (and not attached):
[1] cluster_1.11.13 grid_2.9.0  lattice_0.17-22 svMisc_0.9-5tools_2.9.0

This email message, including any attachments, is for th...{{dropped:9}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] duplicate 'row.names' are not allowed

2009-04-28 Thread Gabor Grothendieck
You are trying to create an illegal object, i.e. a
data.frame with duplicate row names so its
correctly signally the error.

Read the definition of data.frame in ?data.frame


On Tue, Apr 28, 2009 at 8:04 AM, amor Gandhi  wrote:
> Hi everyone,
>
> I have got the following problem:
>
> x1 <- rnorm(10,5,1)
> x2 <- runif(10,0,1)
> nam1 <- paste("A",1:4,sep=".")
> nam2 <- paste("A",6:9,sep=".")
> nam <- c(nam1,"A.4",nam2,"A.9")
> mydata <- data.frame(x1,x2)
> rownames(mydata) <- nam
> Error in `row.names<-.data.frame`(`*tmp*`, value = c("A.1", "A.2", "A.3", :
> duplicate 'row.names' are not allowed
> In addition: Warning message:
> non-unique values when setting 'row.names': ‘A.4’, ‘A.9’
>
> I am very thankful for your help!
>
> Amor
>
>
>
>        [[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] duplicate 'row.names' are not allowed

2009-04-28 Thread Uwe Ligges



amor Gandhi wrote:

Hi everyone,
 
I have got the following problem:
 
x1 <- rnorm(10,5,1)

x2 <- runif(10,0,1)
nam1 <- paste("A",1:4,sep=".")
nam2 <- paste("A",6:9,sep=".")
nam <- c(nam1,"A.4",nam2,"A.9")
mydata <- data.frame(x1,x2)
rownames(mydata) <- nam
Error in `row.names<-.data.frame`(`*tmp*`, value = c("A.1", "A.2", "A.3", : 
duplicate 'row.names' are not allowed


This message suggests that you have to choose unique row.names ... or 
assign those values as an additional column in your data.frame, if you 
need non unique values.


Uwe Ligges






In addition: Warning message:
non-unique values when setting 'row.names': ‘A.4’, ‘A.9’
 
I am very thankful for your help!
 
Amor



  
	[[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] duplicate 'row.names' are not allowed

2009-04-28 Thread S Ellison
You have used A.4 and A.9 twice.

Look at 
> nam
# or 
> duplicated(nam)


>>> amor Gandhi  28/04/2009 13:04:03 >>>
Hi everyone,
*á
I have got the following problem:
*á
x1 <- rnorm(10,5,1)
x2 <- runif(10,0,1)
nam1 <- paste("A",1:4,sep=".")
nam2 <- paste("A",6:9,sep=".")
nam <- c(nam1,"A.4",nam2,"A.9")
mydata <- data.frame(x1,x2)
rownames(mydata) <- nam
Error in `row.names<-.data.frame`(`*tmp*`, value = c("A.1", "A.2", "A.3", : 
duplicate 'row.names' are not allowed
In addition: Warning message:
non-unique values when setting 'row.names': *ÇÿA.4*ÇÖ, *ÇÿA.9*ÇÖ
*á
I am very thankful for your help!
*á
Amor


  
[[alternative HTML version deleted]]


***
This email and any attachments are confidential. Any use...{{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] memory.limit

2009-04-28 Thread Uwe Ligges



Derek Stephen Elmerick wrote:

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.



Use R-2.9.0 *patched*, the bug has already been fixed in the patched 
version.


Uwe Ligges



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-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] duplicate 'row.names' are not allowed

2009-04-28 Thread amor Gandhi
Hi everyone,
 
I have got the following problem:
 
x1 <- rnorm(10,5,1)
x2 <- runif(10,0,1)
nam1 <- paste("A",1:4,sep=".")
nam2 <- paste("A",6:9,sep=".")
nam <- c(nam1,"A.4",nam2,"A.9")
mydata <- data.frame(x1,x2)
rownames(mydata) <- nam
Error in `row.names<-.data.frame`(`*tmp*`, value = c("A.1", "A.2", "A.3", : 
duplicate 'row.names' are not allowed
In addition: Warning message:
non-unique values when setting 'row.names': ‘A.4’, ‘A.9’
 
I am very thankful for your help!
 
Amor


  
[[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] help on bwplot function

2009-04-28 Thread Dieter Menne
He, Yulei  hcp.med.harvard.edu> writes:

> 
> I am using R function bwplot to plot box plots. I would like to change some
parameters of the typical box
> plots. For example, I would like to try different types of whisker lines. I
can use whiskerline=x in
> boxplot function but not in bwplot function. Could you tell me how I can do it
in the latter?

For a detailed documentation of bwplot, check panel.bwplot. By typing

panel.bwplot 

without the (), you get the code, and you will notice some lines at the
top that could give you a hint where to tweak some more details.

   box.dot <- trellis.par.get("box.dot")
box.rectangle <- trellis.par.get("box.rectangle")
box.umbrella <- trellis.par.get("box.umbrella")
plot.symbol <- trellis.par.get("plot.symbol")


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.


[R] R 2.9 and XML

2009-04-28 Thread Luis Orlindo Tedeschi
After I installed R 2.9.0 my XML package cannot load; I get an error "This
application has failed to start because iconv.dll was not found.
Re-installing the application may fix this problem". I already re-installed
both but the problem persists. Does anyone know what is going on? I would
appreciate any help. Thanks a lot

-- 

___
Luís Orlindo Tedeschi
mailto:luis.tedes...@gmail.com
___

[[alternative HTML version deleted]]

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


Re: [R] A way to get the R data stored temporarily in working memory?

2009-04-28 Thread Kenn Konstabel
What ESC does is "stopping current computation" -- no idea how to do it in
ESS, but there's been a similar question in another list:

http://www.archivum.info/gnu.emacs.help/2005-10/msg00509.html

KK

On Mon, Apr 27, 2009 at 9:11 PM, Friedericksen  wrote:

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

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

2009-04-28 Thread bartjoosen

Hi,

how about this:
x <- runif(100) 
n <- length( x ) 

y2 <- rep(0,n)
y2[x > 0.75] <- 1
y2[x < 0.25] <- -1
cx <- cumsum(abs(y2) )
m <- match(cx, cx)
y2[y2==0] <- 2
y2[x<0.5 & y2[m]==1] <- 0
y2[x>0.5 & y2[m]==-1] <- 0
y3 <- y2
y3[y3==0] <- 1
y3[y3==2] <- 0
cx <- cumsum(abs(y3))
m <- match(cx, cx)
y2 <- y2[m]


Best regards

Bart
-- 
View this message in context: 
http://www.nabble.com/How-to-get-rid-of-loop--tp23226779p23273405.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] FW: Install of R 2.9.0

2009-04-28 Thread Uwe Ligges



Lyman, Mark wrote:

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?



Well, I do not want to blame your admin ... but I fear I need to ...
if cp answer about a full file space, the admin should look if there is 
really no space left or quotas may apply or network problems or whatever 
may cause that problem. At least R won't.


Uwe Ligges


 


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/

Re: [R] problem dowloading

2009-04-28 Thread Uwe Ligges

Thanks for the report.

There have been some problems with the WIndows binary package building 
process that have been fixed since yesterday. Everything except 
FactoMineR works again (I hope), a corrected version of the FactoMineR 
binary will appear on CRAN master within a few hours. That one slipped 
through when I looked what needed to be recompiled in a hurry yesterday.


Best,
Uwe Ligges




R Heberto Ghezzo, Dr wrote:

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


Re: [R] Change font type PNG device with Lattice xyplot

2009-04-28 Thread Dieter Menne
RBlonk  gmail.com> writes:

> I have some problems with changing the default font (Arial) in a xyplot
> which is printed using the PNG-device. Although some things have been
> mentioned about this in the forum, I still couldn't figure it out. Can
> someone help me out?n Thanks in advance!

Thanks a lot for the nice example!

There may be other ways, but I would do it as follows:

-- Open R_HOME\etc\Rdevga
-- Add the font you want as text at the end of the list
-- Use font=18 (I may have miscounted)

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.


[R] truehist and density plots

2009-04-28 Thread carol white
Hi,
I wanted to plot the histogram of a vector and then, plot the density function 
of subsets of the vector on the histogram. So I use truehist in MASS package 
and lines(density) as follows:

length(b) = 1000
truehist(b)
lines(density(b[1:100]))

however the density plot of the first 100 points exceeds the max of y axis (see 
attached). how is it possible to make a graphics so that the density plot of 
the subsets doesn't go beyond the maximum of all points in the complete set?

Cheers,

Carol






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

2009-04-28 Thread Uwe Ligges
In order to use stratified sampling, either try to implement it yourself 
or use the "sampling" package and its function strata() as in:


s1 <- strata(cc, stratanames="ID", size=rep(1, 20), method="srswr")

then you will get 1 observation for each ID. Note that it is not 
important to use "with replacement" in your case, since you only sample 
1 obervation for each stratum.


Uwe Ligges




Krystyna Golabek wrote:

Dear R-users

I have a dataset of 243 lines with replicate information for 20 different individuals (ID). 
I would like to randomly sample this dataset 100 times with a selection of unique IDs in each sample.


First to create a random sample I have;

cc<-read.table(blah.blah.blah)
names(cc)
 [1] "CALL""CONTEXT" "ORDER"   "ID"  "STATUS" 


s1<-cc[sample(1:243,20,replace=TRUE),]

This code samples 20 rows from the dataset but can anyone help me write the 
code to request unique(ID) in this sample?

Thank you so much for your time and help.

Krystyna Golabek



_


[[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] duplicate 'row.names' are not allowed

2009-04-28 Thread amor Gandhi
Thank you for your reply :)! Is it possible to solve the problem by using A.4, 
A.4a, A.9 and A.91? How one cand do this in R?
 
Many thanks


--- S Ellison  schrieb am Di, 28.4.2009:


Von: S Ellison 
Betreff: Re: [R] duplicate 'row.names' are not allowed
An: r-h...@stat.math.ethz.ch, "amor Gandhi" 
Datum: Dienstag, 28. April 2009, 14:17


You have used A.4 and A.9 twice.

Look at 
> nam
# or 
> duplicated(nam)


>>> amor Gandhi  28/04/2009 13:04:03 >>>
Hi everyone,
*á
I have got the following problem:
*á
x1 <- rnorm(10,5,1)
x2 <- runif(10,0,1)
nam1 <- paste("A",1:4,sep=".")
nam2 <- paste("A",6:9,sep=".")
nam <- c(nam1,"A.4",nam2,"A.9")
mydata <- data.frame(x1,x2)
rownames(mydata) <- nam
Error in `row.names<-.data.frame`(`*tmp*`, value = c("A.1", "A.2", "A.3", : 
duplicate 'row.names' are not allowed
In addition: Warning message:
non-unique values when setting 'row.names': *ÇÿA.4*ÇÖ, *ÇÿA.9*ÇÖ
*á
I am very thankful for your help!
*á
Amor


      
    [[alternative HTML version deleted]]


***
This email and any attachments are confidential. Any use...{{dropped:13}}

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

2009-04-28 Thread Uwe Ligges



Luis Orlindo Tedeschi wrote:

After I installed R 2.9.0 my XML package cannot load; I get an error "This
application has failed to start because iconv.dll was not found.
Re-installing the application may fix this problem". I already re-installed
both but the problem persists. Does anyone know what is going on? I would
appreciate any help. Thanks a lot



Is this the XML version from the 2.9 repository on CRANextras? How did 
you install it? install.packages() should pick the right one.


I guess you did it in another way, but you really should use the one 
mentioned above.


Uwe Ligges









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

2009-04-28 Thread Uwe Ligges



carol white wrote:

Hi,
I wanted to plot the histogram of a vector and then, plot the density function 
of subsets of the vector on the histogram. So I use truehist in MASS package 
and lines(density) as follows:

length(b) = 1000
truehist(b)
lines(density(b[1:100]))



I do not undertsand what you mean. Can you please provide a 
*reproducible* example?


Uwe Ligges



however the density plot of the first 100 points exceeds the max of y axis (see 
attached). how is it possible to make a graphics so that the density plot of 
the subsets doesn't go beyond the maximum of all points in the complete set?

Cheers,

Carol






  





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

2009-04-28 Thread Uwe Ligges



Martijn Ras wrote:

Heya Folks,

I've got to process a form that contains variable series of values,
which i want to collect into a vectors.

Say the first series has ten values, with id's ranging from X1 to X10,
currently i process them in the following hardcoded manner:

x1 <- c(as.numeric(POST$X1), as.numeric(POST$X2), as.numeric(POST$X3),
as.numeric(POST$X4), as.numeric(POST$X5), as.numeric(POST$X6),
as.numeric(POST$X7), as.numeric(POST$X8), as.numeric(POST$X9),
as.numeric(POST$X10))


I guess unlist helps:

x1 <- as.numeric(unlist(POST))

but hard to be sure without seeing the original object for which
str(POST)
would have been helpful.

Uwe Ligges






Is there a way to process these in a loop?

Mazzel,

Martijn.

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

2009-04-28 Thread Uwe Ligges



Cecilia Lezama wrote:

Hello,
I would like to know how to obtain the misclassification error when performing 
a boosting analisis with ADABAG package?
With:

prop.table(Tesis.boostcv$confusion)


I obtain the confusion matrix, but not the overall missclassification error.


Well, the misclassification error is

  1 - diag(table) / sum(table)

Uwe Ligges




Thanks in advance,


BSc. Cecilia Lezama
Facultad de Ciencias - UDELAR
Montevideo - Uruguay.
[[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] Out of memory issue

2009-04-28 Thread Uwe Ligges



Neotropical bat risk assessments wrote:

   Hi again all,
   I can read all of the data is in CSV format with a header row and with
   1,200,240 rows.
   I can do all the plots and ggplot2 has no problems.
   Seems to be a problem with the MASS package???
   It seems that the contour plots are the problem with the memory error.
   Error: cannot allocate vector of size 228.9 Mb
   I can run smaller data sets and do the contour plots w/o problems.
   The data can not really be summarized as I need to plot the actual values to
   get the insight into the large data sets.
   I am using latest R version 2.9.0 (2009-04-17)
   My alternative is to bump up the memory of my one Dell workstation to 16 GB
   as it runs with Ubuntu and can access that amount if I figure out how to
   install R on a Linux box.
   It may not truly be a memory issue but a limit to how MASS does the contour
   plots?
   This works 100% with the large data sets.
   Bodega <- read.csv ("C:/R-Stats/Bat calls/Bodega.csv")
   attach(Bodega)
   library(ggplot2)
   f=jpeg(file="Bodega Sc_Fc plot.jpg")
   print(qplot(Sc, Fc))
   dev.off()
   f=jpeg(file="Bodega Fc Dens plot.jpg")
   print(qplot(Fc,geom="density"))
   dev.off()
   This does not.and I get the vector size error.
   library(MASS)
   library(batcalls)
   BRC<-kde2d(Sc,Fc)
   f=jpeg(file="Rainey contour plot.jpg")
   filled.contour(BRC)
dev.off()
   Thanks again for in sight as I trundle up the learn curve for R.


You need to think about how many points you are plotting into a filled 
contour plot (i.e. estimate what the memory is comsumed for just holding 
the image in memory) and how much memory has been wasted already. You 
may want to reduce the size of the stuff you are going to plot.


Uwev Ligges






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

2009-04-28 Thread Chrysanthi A.
Many thanks for your help. Sorry for my delayed reply, but I was away.
Regarding the OOB error, sorry it was a typo.

As far as the voting, I was just wondering if there is a function that will
give me the prediction of each case through each tree. Is there any function
that produce the rules for each tree? If I have a new case that I want to
predict the class that it belongs to, how can I predict that? I should look
to each tree and then get the voting? Or are there some predictive rules
that I can use? I cannot do that prediction from the results that function
votes give to me...

Also, I was wondering why randomizations along with combining the
predictions from the trees significantly improve the overall predictive
accuracy?

Thanks a lot,

Chrysanthi




2009/4/13 Liaw, Andy 

>  I really don't understand what you don't understand.  Do you know how a
> tree forms a prediction?  If not, it may be a good idea to learn about that
> first.  The code runs prediction of each case through all trees in the
> forest and that's how the votes are formed.
>
> [For OOB predictions, only predictions from trees for which the case is
> out-of-bag are counted.  That's why you may get odd-ball vote fractions even
> when you grow 100 trees and expect the votes to be in seq(0, 1, by=0.01).]
>
> 100% - 2.34% = 97.66%, not 76.6% (I can only assume you had a typo).
>
> Cheers,
> Andy
>
>  --
> *From:* Chrysanthi A. [mailto:chrys...@gmail.com]
> *Sent:* Monday, April 13, 2009 9:44 AM
>
> *To:* Liaw, Andy
> *Cc:* r-help@r-project.org
> *Subject:* Re: [R] help with random forest package
>
>
> But how does it estimate that voting output? How does it get the 85.7% for
> all the trees?
>
> Regarding the prediction accuracy. If I have OOB error = 2.34, then the
> prediction accuracy will be equal to 76.6%, right?
>
> Many thanks,
>
> Chrysanthi.
>
>
> 2009/4/13 Liaw, Andy 
>
>>  RF forms prediction by voting.  Note that each row in the output sums to
>> 1.  It says 85.7% of the trees classified the first case as "healthy" and
>> the other 14.3% of the trees "unhealthy".  The majority (in two-class cases
>> like this one) wins, so the prediction is "healthy".
>>
>> You can take 1 - OOB error rate as the estimate of prediction accuracy (if
>> you have not selected variables, e.g., using variable importance, in
>> building the final RF model).
>>
>> Andy
>>
>>  --
>>  *From:* Chrysanthi A. [mailto:chrys...@gmail.com]
>> *Sent:* Friday, April 10, 2009 10:44 AM
>>
>> *To:* Liaw, Andy
>> *Cc:* r-help@r-project.org
>> *Subject:* Re: [R] help with random forest package
>>
>>
>>
>> Hi,
>>
>> To be honest, I cannot really understand what is the meaning of the
>> votes.. For example having five samples and two classes what the numbers
>> below means?
>>   healthy  unhealthy
>> 1  0.85714286 0.14285714
>> 2  0.92857143 0.07142857
>> 3  0.9000 0.1000
>> 4  0.92857143 0.07142857
>> 5  0.84615385 0.15384615
>>
>> Suppose now, having the classification, I have an unknown sample and
>> according to the results that Ive got, how can I predict in which class it
>> belongs to? Do the votes give that prediction to us?
>>
>> Also,  the error is reported on the "OOB estimate of  error rate", right?
>> For example, if we have OOB estimate of  error rate:2.34%, we can say that
>> the prediction accuracy is approx. 97.7%? How can we estimate the prediction
>> accuracy?
>>
>>
>> Thanks a lot,
>>
>> Chrysanthi.
>>
>>
>> 2009/4/8 Liaw, Andy 
>>
>>>  I'm not quite sure what you're asking.  RF predicts by classifying the
>>> new observation using all trees in the forest, and take plural vote.  The
>>> predict() method for randomForest objects does that for you.  The getTree()
>>> function shows you what each individual tree is like (not visually, just the
>>> underlying representation of the tree).
>>>
>>> Andy
>>>
>>>  --
>>> *From:* Chrysanthi A. [mailto:chrys...@gmail.com]
>>> *Sent:* Wednesday, April 08, 2009 2:56 PM
>>> *To:* Liaw, Andy
>>> *Cc:* r-help@r-project.org
>>> *Subject:* Re: [R] help with random forest package
>>>
>>>   Many thanks for the reply.
>>>
>>> So, extracting the votes, how can we clarify the classification result?
>>> If I want to predict in which class will be included an unknown sample, what
>>> is the rule that will give me that?
>>>
>>> Thanks a lot,
>>>
>>> Chrysanthi.
>>>
>>>
>>>
>>> 2009/4/8 Liaw, Andy 
>>>
 The source code of the whole package is available on CRAN.  All packages
 are submitted to CRAN is source form.

 There's no "rule" per se that gives the final prediction, as the final
 prediction is the result of plural vote by all trees in the forest.

 You may want to look at the varUsed() and getTree() functions.

 Andy

 From:  Chrysanthi A.
  > Hello,
 >
 > I am a phd student in Bioinformatics and I am using the Random Forest
 > package in order to classify my data,

Re: [R] duplicate 'row.names' are not allowed

2009-04-28 Thread Uwe Ligges



amor Gandhi wrote:

Thank you for your reply :)! Is it possible to solve the problem by using A.4, 
A.4a, A.9 and A.91? How one cand do this in R?



Err, change "A.4" to "A.4a" in your code?

Uwe



Many thanks


--- S Ellison  schrieb am Di, 28.4.2009:


Von: S Ellison 
Betreff: Re: [R] duplicate 'row.names' are not allowed
An: r-h...@stat.math.ethz.ch, "amor Gandhi" 
Datum: Dienstag, 28. April 2009, 14:17


You have used A.4 and A.9 twice.

Look at 

nam
# or 

duplicated(nam)




amor Gandhi  28/04/2009 13:04:03 >>>

Hi everyone,
*á
I have got the following problem:
*á
x1 <- rnorm(10,5,1)
x2 <- runif(10,0,1)
nam1 <- paste("A",1:4,sep=".")
nam2 <- paste("A",6:9,sep=".")
nam <- c(nam1,"A.4",nam2,"A.9")
mydata <- data.frame(x1,x2)
rownames(mydata) <- nam
Error in `row.names<-.data.frame`(`*tmp*`, value = c("A.1", "A.2", "A.3", : 
duplicate 'row.names' are not allowed

In addition: Warning message:
non-unique values when setting 'row.names': *ÇÿA.4*ÇÖ, *ÇÿA.9*ÇÖ
*á
I am very thankful for your help!
*á
Amor


  
[[alternative HTML version deleted]]



***
This email and any attachments are confidential. Any use...{{dropped:13}}





__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] duplicate 'row.names' are not allowed

2009-04-28 Thread Petr PIKAL
Hi

r-help-boun...@r-project.org napsal dne 28.04.2009 14:33:44:

> Thank you for your reply :)! Is it possible to solve the problem by 
using A.4,
> A.4a, A.9 and A.91? How one cand do this in R?

Yes but why? If you want to have some names A.whatever which can repeat 
itself then does not use it as row names and put it in separate column 
called e.g. mynames. In this column you can have any number of 
replications - if I am not mistaken somebody suggested it already.

You can imagine row.names more like row numbers and in that case you 
probably do not want to have several row numbers let say 42, do you?

Regards
Petr


>  
> Many thanks
> 
> 
> --- S Ellison  schrieb am Di, 28.4.2009:
> 
> 
> Von: S Ellison 
> Betreff: Re: [R] duplicate 'row.names' are not allowed
> An: r-h...@stat.math.ethz.ch, "amor Gandhi" 
> Datum: Dienstag, 28. April 2009, 14:17
> 
> 
> You have used A.4 and A.9 twice.
> 
> Look at 
> > nam
> # or 
> > duplicated(nam)
> 
> 
> >>> amor Gandhi  28/04/2009 13:04:03 >>>
> Hi everyone,
> *á
> I have got the following problem:
> *á
> x1 <- rnorm(10,5,1)
> x2 <- runif(10,0,1)
> nam1 <- paste("A",1:4,sep=".")
> nam2 <- paste("A",6:9,sep=".")
> nam <- c(nam1,"A.4",nam2,"A.9")
> mydata <- data.frame(x1,x2)
> rownames(mydata) <- nam
> Error in `row.names<-.data.frame`(`*tmp*`, value = c("A.1", "A.2", 
"A.3", : 
> duplicate 'row.names' are not allowed
> In addition: Warning message:
> non-unique values when setting 'row.names': *Ç˙A.4*ÇÖ, *Ç˙A.9*ÇÖ
> *á
> I am very thankful for your help!
> *á
> Amor
> 
> 
>   
> [[alternative HTML version deleted]]
> 
> 
> ***
> This email and any attachments are confidential. Any 
use...{{dropped:13}}
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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 Power function on a power my result is "inf"

2009-04-28 Thread Uwe Ligges



Alessandro wrote:

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?




Do you mean
  Mydata$SumH^method
or
  Mydata$SumH^(power[method])
?

If the latter, you won't see Inf as early as before.

The limit is the representation of floating point numbers. See ?.Machine 
 on how to learn about the limits of your version of R / platform.


Uwe Ligges




 


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-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Random Sample with Unique function

2009-04-28 Thread Uwe Ligges

You need to wrap it accordingly:

s1 <- cc[strata(cc, stratanames="ID", size=rep(1, 20), 
method="srswr")$ID_unit, ]


Uwe



Krystyna Golabek wrote:
Thanks Uwe, 


Your strata suggestion works, thank you, but it has created a dataset of random 
rows but without the data, other columns involved. You see I would further like 
to use this random sample for a DFA (lda) analysis. Can you suggest how I would 
use the strata function to sample a subset of the data.frame?

Thanks
Krystyna 


Date: Tue, 28 Apr 2009 14:33:22 +0200
From: lig...@statistik.tu-dortmund.de
To: kagola...@hotmail.com
CC: r-help@r-project.org
Subject: Re: [R] Random Sample with Unique function

In order to use stratified sampling, either try to implement it yourself 
or use the "sampling" package and its function strata() as in:


s1 <- strata(cc, stratanames="ID", size=rep(1, 20), method="srswr")

>>
then you will get 1 observation for each ID. Note that it is not 
important to use "with replacement" in your case, since you only sample 
1 obervation for each stratum.


Uwe Ligges




Krystyna Golabek wrote:

Dear R-users

I have a dataset of 243 lines with replicate information for 20 different individuals (ID). 
I would like to randomly sample this dataset 100 times with a selection of unique IDs in each sample.


First to create a random sample I have;

cc<-read.table(blah.blah.blah)
names(cc)
 [1] "CALL""CONTEXT" "ORDER"   "ID"  "STATUS" 


s1<-cc[sample(1:243,20,replace=TRUE),]

This code samples 20 rows from the dataset but can anyone help me write the 
code to request unique(ID) in this sample?

Thank you so much for your time and help.

Krystyna Golabek



_


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


_
Share your photos with Windows Live Photos – Free.
http://clk.atdmt.com/UKM/go/134665338/direct/01/


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] duplicate 'row.names' are not allowed

2009-04-28 Thread amor Gandhi
Yes, I would like, but what I sent you was just an example! I am reading a huge 
data, so I cant do it by hand, could you please tell how to do this in R, some 
of the names are also coming one after another.
 
Many thanks

--- Uwe Ligges  schrieb am Di, 28.4.2009:


Von: Uwe Ligges 
Betreff: Re: [R] duplicate 'row.names' are not allowed
An: "amor Gandhi" 
CC: r-h...@stat.math.ethz.ch, "S Ellison" 
Datum: Dienstag, 28. April 2009, 14:52




amor Gandhi wrote:
> Thank you for your reply :)! Is it possible to solve the problem by using 
> A.4, A.4a, A.9 and A.91? How one cand do this in R?


Err, change "A.4" to "A.4a" in your code?

Uwe


> Many thanks
> 
> 
> --- S Ellison  schrieb am Di, 28.4.2009:
> 
> 
> Von: S Ellison 
> Betreff: Re: [R] duplicate 'row.names' are not allowed
> An: r-h...@stat.math.ethz.ch, "amor Gandhi" 
> Datum: Dienstag, 28. April 2009, 14:17
> 
> 
> You have used A.4 and A.9 twice.
> 
> Look at 
>> nam
> # or 
>> duplicated(nam)
> 
> 
 amor Gandhi  28/04/2009 13:04:03 >>>
> Hi everyone,
> *á
> I have got the following problem:
> *á
> x1 <- rnorm(10,5,1)
> x2 <- runif(10,0,1)
> nam1 <- paste("A",1:4,sep=".")
> nam2 <- paste("A",6:9,sep=".")
> nam <- c(nam1,"A.4",nam2,"A.9")
> mydata <- data.frame(x1,x2)
> rownames(mydata) <- nam
> Error in `row.names<-.data.frame`(`*tmp*`, value = c("A.1", "A.2", "A.3", : 
> duplicate 'row.names' are not allowed
> In addition: Warning message:
> non-unique values when setting 'row.names': *ÇÿA.4*ÇÖ, *ÇÿA.9*ÇÖ
> *á
> I am very thankful for your help!
> *á
> Amor
> 
> 
>           [[alternative HTML version deleted]]
> 
> 
> ***
> This email and any attachments are confidential. Any u...{{dropped:19}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] re fit with binomial model (lme4)

2009-04-28 Thread Ben Bolker



I think the following works, but use with caution -- I just
wrote it last night.

setMethod("refit", signature(object = "mer", newresp = "matrix"),
  function(object, newresp, ...)
  {
## newresp <- as.double(newresp[!is.na(newresp)])
wts <- rowSums(newresp)
newresp <- newresp[,1]/wts
stopifnot(length(newresp) == obj...@dims["n"])
obj...@y <- newresp
obj...@pwt <- wts
lme4:::mer_finalize(object)
  })

  Ben Bolker

-- 
View this message in context: 
http://www.nabble.com/refit-with-binomial-model-%28lme4%29-tp23255224p23276751.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] Generalized linear models

2009-04-28 Thread David Winsemius

I do not answer questions offlist.

On Apr 28, 2009, at 2:56 AM, mathallan wrote:



Thanks for the answer David

Sum er the "sum insured" the maximal loss of the company. Claims, is  
the

actually claim size. Group is wich type of business is insured.

Can you help me to solve the problem?



It is very difficult to determine "rightness" since you have omitted
essential background information. The most glaring omission is what
sort of data is in "sum". If this is either the number of policies or
the dollar amount at risk then a categorical "NO" is the answer to the
question.




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.



--
View this message in context: 
http://www.nabble.com/Generalized-linear-models-tp23265349p23271211.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.


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] duplicate 'row.names' are not allowed

2009-04-28 Thread Uwe Ligges



amor Gandhi wrote:

Yes, I would like, but what I sent you was just an example! I am reading a huge 
data, so I cant do it by hand, could you please tell how to do this in R, some 
of the names are also coming one after another.


But I do not understand why you would habe it as row.names and not as a 
separate variavle.


And I do not undertsand which principle is behind your renaming. You 
need to give a real example.


Uwe Ligges






Many thanks

--- Uwe Ligges  schrieb am Di, 28.4.2009:


Von: Uwe Ligges 
Betreff: Re: [R] duplicate 'row.names' are not allowed
An: "amor Gandhi" 
CC: r-h...@stat.math.ethz.ch, "S Ellison" 
Datum: Dienstag, 28. April 2009, 14:52




amor Gandhi wrote:

Thank you for your reply :)! Is it possible to solve the problem by using A.4, 
A.4a, A.9 and A.91? How one cand do this in R?



Err, change "A.4" to "A.4a" in your code?

Uwe



Many thanks


--- S Ellison  schrieb am Di, 28.4.2009:


Von: S Ellison 
Betreff: Re: [R] duplicate 'row.names' are not allowed
An: r-h...@stat.math.ethz.ch, "amor Gandhi" 
Datum: Dienstag, 28. April 2009, 14:17


You have used A.4 and A.9 twice.

Look at 

nam
# or 

duplicated(nam)



amor Gandhi  28/04/2009 13:04:03 >>>

Hi everyone,
*á
I have got the following problem:
*á
x1 <- rnorm(10,5,1)
x2 <- runif(10,0,1)
nam1 <- paste("A",1:4,sep=".")
nam2 <- paste("A",6:9,sep=".")
nam <- c(nam1,"A.4",nam2,"A.9")
mydata <- data.frame(x1,x2)
rownames(mydata) <- nam
Error in `row.names<-.data.frame`(`*tmp*`, value = c("A.1", "A.2", "A.3", : 
duplicate 'row.names' are not allowed
In addition: Warning message:
non-unique values when setting 'row.names': *ÇÿA.4*ÇÖ, *ÇÿA.9*ÇÖ
*á
I am very thankful for your help!
*á
Amor


   [[alternative HTML version deleted]]


***
This email and any attachments are confidential. Any use...{{dropped:13}}





__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] update.packages(checkBuilt=TRUE) returns Error: invalid version specification NA in 2.9.0

2009-04-28 Thread Uwe Ligges



peter_kel...@fws.gov wrote:

Just tried a minute ago with the Austria mirror as you said, and I still
get the error.



Can you please tell us the result of
traceback() after you did that.

Are you sure you have no *old* base packages in the library you want to 
run update.packages() on?

Are you sure that all packages within your library are valid?
Do you have others than just the standard library?

Uwe Ligges



Peter Keller
Wildlife Biologist
Tetlin National Wildlife Refuge



   
 Uwe Ligges
  .tu-dortmund.de>   To 
   peter_kel...@fws.gov
 04/24/2009 12:24   cc 
 PMr-help@r-project.org
   Subject 
   Re: [R] 
   update.packages(checkBuilt=TRUE)
   returns Error: invalid version  
   specification NA in 2.9.0   
   
   
   
   
   
   





Just a guess: We had an issues with malformed PACKAGES files in the
Windows repositories.

Maybe you are affected here.
Can you please try in 24 hours from now to do that again using the
mirror in Austria.

If the problem persists, please let me know.

Thank you,
Uwe Ligges


peter_kel...@fws.gov wrote:

I installed R-2.9.0 yesterday, and followed the instructions in the R for
Windows FAQ, 2.8 What's the best way to upgrade?  It reads "run
update.packages(checkBuilt=TRUE, ask=FALSE) in the new R and then delete
anything left of the old installation."  I did this but it returned an
error.  It's the checkBuilt=TRUE which causes it, though I don't know

why:

leaving it out or changing it to checkBuilt=FALSE do not return errors.


update.packages(checkBuilt=TRUE, ask=FALSE)

--- Please select a CRAN mirror for use in this session ---
Error: invalid version specification NA


update.packages(checkBuilt=TRUE)

Error: invalid version specification NA

Peter Keller
Wildlife Biologist
Tetlin National Wildlife Refuge
   [[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] duplicate 'row.names' are not allowed

2009-04-28 Thread amor Gandhi
Thanks, I can't use the name as a variable because I need to create a matrix 
which does include only numerical values!

--- Uwe Ligges  schrieb am Di, 28.4.2009:


Von: Uwe Ligges 
Betreff: Re: [R] duplicate 'row.names' are not allowed
An: "amor Gandhi" 
CC: r-h...@stat.math.ethz.ch, "S Ellison" 
Datum: Dienstag, 28. April 2009, 15:04




amor Gandhi wrote:
> Yes, I would like, but what I sent you was just an example! I am reading a 
> huge data, so I cant do it by hand, could you please tell how to do this in 
> R, some of the names are also coming one after another.

But I do not understand why you would habe it as row.names and not as a 
separate variavle.

And I do not undertsand which principle is behind your renaming. You 
need to give a real example.

Uwe Ligges





> Many thanks
> 
> --- Uwe Ligges  schrieb am Di, 28.4.2009:
> 
> 
> Von: Uwe Ligges 
> Betreff: Re: [R] duplicate 'row.names' are not allowed
> An: "amor Gandhi" 
> CC: r-h...@stat.math.ethz.ch, "S Ellison" 
> Datum: Dienstag, 28. April 2009, 14:52
> 
> 
> 
> 
> amor Gandhi wrote:
>> Thank you for your reply :)! Is it possible to solve the problem by using 
>> A.4, A.4a, A.9 and A.91? How one cand do this in R?
> 
> 
> Err, change "A.4" to "A.4a" in your code?
> 
> Uwe
> 
> 
>> Many thanks
>>
>>
>> --- S Ellison  schrieb am Di, 28.4.2009:
>>
>>
>> Von: S Ellison 
>> Betreff: Re: [R] duplicate 'row.names' are not allowed
>> An: r-h...@stat.math.ethz.ch, "amor Gandhi" 
>> Datum: Dienstag, 28. April 2009, 14:17
>>
>>
>> You have used A.4 and A.9 twice.
>>
>> Look at 
>>> nam
>> # or 
>>> duplicated(nam)
>>
> amor Gandhi  28/04/2009 13:04:03 >>>
>> Hi everyone,
>> *á
>> I have got the following problem:
>> *á
>> x1 <- rnorm(10,5,1)
>> x2 <- runif(10,0,1)
>> nam1 <- paste("A",1:4,sep=".")
>> nam2 <- paste("A",6:9,sep=".")
>> nam <- c(nam1,"A.4",nam2,"A.9")
>> mydata <- data.frame(x1,x2)
>> rownames(mydata) <- nam
>> Error in `row.names<-.data.frame`(`*tmp*`, value = c("A.1", "A.2", "A.3", : 
>> duplicate 'row.names' are not allowed
>> In addition: Warning message:
>> non-unique values when setting 'row.names': *ÇÿA.4*ÇÖ, *ÇÿA.9*ÇÖ
>> *á
>> I am very thankful for your help!
>> *á
>> Amor
>>
>>
>>            [[alternative HTML version deleted]]
>>
>>
>> ***
>> This email and any attachments are confidential. Any use...{{dropped:13}}
>>
>>
>>
>> 
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/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] truehist and density plots

2009-04-28 Thread carol white
Consider a vector of 100 elements (attached files). then, 

truehist(b)
lines(density(b[20:50]))

How is it possible to have density plots of all subsets like b[20:50] within 
histogram (without exceeding the max of historgram on y axis)?

Is it more clear?

Best,

--- On Tue, 4/28/09, Uwe Ligges  wrote:
From: Uwe Ligges 
Subject: Re: [R] truehist and density plots
To: "carol white" 
Cc: r-h...@stat.math.ethz.ch
Date: Tuesday, April 28, 2009, 5:42 AM


carol white wrote:
> Hi,
> I wanted to plot the histogram of a vector and then, plot the density
function of subsets of the vector on the histogram. So I use truehist in MASS
package and lines(density) as follows:
> 
> length(b) = 1000
> truehist(b)
> lines(density(b[1:100]))


I do not undertsand what you mean. Can you please provide a *reproducible*
example?

Uwe Ligges


> however the density plot of the first 100 points exceeds the max of y axis
(see attached). how is it possible to make a graphics so that the density plot
of the subsets doesn't go beyond the maximum of all points in the complete
set?
> 
> Cheers,
> 
> Carol
> 
> 
> 
> 
> 
> 
>   
> 
> 
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] Dropping 'empty' panels from lattice

2009-04-28 Thread amvds
I have 8 cofactors possibly affecting one and only one variable.

I make conditional histograms:

<-pdf(file="tst3.pdf",paper="special",width=36,height=36)
<-histogram(~Oversized|dat$c1*dat$c2*dat$c5*dat$c6*dat$c7*dat$c8*dat$c9*dat$c10,nint=21,layout=c(32,8),data=dat,type="count")
<-dev.off()

This works (compliments to R developers!) but it does generate a large
plot with many panels being 'empty', e.g. that combination of factors
c1..c10 never occurs in this data set.

Is there a way to autmatically drop those empty panels?

I looked at the docs: there is a drop.unused.levels parameter for trellis
graphs but the docs says it is default true. I checked but could not make
much sense out of the list of possibilties.

Thanks!
Alex van der Spek

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


Re: [R] help with random forest package

2009-04-28 Thread Liaw, Andy
Let's try an example:
 
R> iris.1tree <- randomForest(Species ~ ., data=iris, ntree=1)
R> getTree(iris.1tree, 1)
  left daughter right daughter split var split point status prediction
1 2  3 40.80  1  0
2 0  0 00.00 -1  1
3 4  5 41.75  1  0
4 0  0 00.00 -1  2
5 6  7 34.85  1  0
6 8  9 16.05  1  0
7 0  0 00.00 -1  3
8 0  0 00.00 -1  2
9 0  0 00.00 -1  3
R> iris[1,]
  Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1  5.1 3.5  1.4 0.2  setosa
R> predict(iris.1tree, iris[1,], type="prob")
  setosa versicolor virginica
1  1  0 0
R> levels(iris$Species)
[1] "setosa" "versicolor" "virginica" 

The getTree() function showed the first (and only) tree.  To predict the
first row of iris, we read the tree in the following way.  In the first
row (the root node), the variable to split is the 4th, or "Petal.Width".
The splitting point is 0.8, so data points with Petal.Width < 0.8 go to
left and others go to right.  Since the "left daughter" is "2", we look
at the second row of the tree, and it is a leaf (i.e., a terminal node)
since the status is -1.  The prediction is "1", or the first level of
the factor--- "setosa".  I don't expect anyone to predict data
"manually" like this.  predict.randomForest() does all this for you.
 
As to individual tree predictions, predict.randomForest() has an option
"predict.all" that you can use.  To get the OOB votes, though, you will
also need to look at the output of randomForest(..., inbag=TRUE) to see
which data point is OOB for which tree.
 
I hope that's clear now.
 
Cheers,
Andy
 




From: Chrysanthi A. [mailto:chrys...@gmail.com] 
Sent: Tuesday, April 28, 2009 8:52 AM
To: Liaw, Andy
Cc: r-help@r-project.org
Subject: Re: [R] help with random forest package



Many thanks for your help. Sorry for my delayed reply, but I was
away. 
Regarding the OOB error, sorry it was a typo. 

As far as the voting, I was just wondering if there is a
function that will give me the prediction of each case through each
tree. Is there any function that produce the rules for each tree? If I
have a new case that I want to predict the class that it belongs to, how
can I predict that? I should look to each tree and then get the voting?
Or are there some predictive rules that I can use? I cannot do that
prediction from the results that function votes give to me...

Also, I was wondering why randomizations along with combining
the predictions from the trees significantly improve the overall
predictive accuracy? 

Thanks a lot,

Chrysanthi





2009/4/13 Liaw, Andy 


I really don't understand what you don't understand.  Do
you know how a tree forms a prediction?  If not, it may be a good idea
to learn about that first.  The code runs prediction of each case
through all trees in the forest and that's how the votes are formed.  
 
[For OOB predictions, only predictions from trees for
which the case is out-of-bag are counted.  That's why you may get
odd-ball vote fractions even when you grow 100 trees and expect the
votes to be in seq(0, 1, by=0.01).]
 
100% - 2.34% = 97.66%, not 76.6% (I can only assume you
had a typo).
 
Cheers,
Andy





From: Chrysanthi A. [mailto:chrys...@gmail.com] 

Sent: Monday, April 13, 2009 9:44 AM 

To: Liaw, Andy
Cc: r-help@r-project.org
Subject: Re: [R] help with random forest package



But how does it estimate that voting output? How
does it get the 85.7% for all the trees? 

Regarding the prediction accuracy. If I have OOB
error = 2.34, then the prediction accuracy will be equal to 76.6%,
right? 

Many thanks,

Chrysanthi.


2009/4/13 Liaw, Andy 


RF forms prediction by voting.  Note
that each row in the output sums to 1.  It says 85.7% of the trees
classified the first case as "healthy" and the other 14.3% of th

Re: [R] effects package --- add abline to plot

2009-04-28 Thread John Fox
Dear Paul,

I can't think of a way to do what you want using the plot() methods provided
by the package. (You don't say what kind of model you're fitting, but this
is true for all of the plot() methods.) On the other hand, as described in
?effect, the object returned by effect() contains all of the information
needed to construct a custom graph, and you should be able to easily get
what you want.

I hope this helps,
 John

--
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On
> Behalf Of Prew, Paul
> Sent: April-28-09 12:00 AM
> To: r-help@r-project.org
> Subject: [R] effects package --- add abline to plot
> 
> Hello,  I am not having success in a simple task.  Using the effects
package,
> I would like to add reference lines at probability values of 0.1 b

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


Re: [R] help working with date values

2009-04-28 Thread Uwe Ligges



steve_fried...@nps.gov wrote:

My data contains a variable "observation_date"  and it contains values as:

1985-09-02
1985-09-15
1985-07-31
1985-09-02


I need to process data annually rather than daily, therefore I'm trying to
1) either extract the first 4 digits from this field and use them as a new
variable "year" 



year <- as.numeric(format((strptime(observation_date, "%Y-%m-%d")), "%Y"))

or

year <- as.numeric(substr(observation_date, 1, 4))


Uwe Ligges



or 2) keep the variable as it is and process the analysis
using the first 4 digits of the observation_date field.

I'm not sure how to do either one of these approaches. I've looked in the
R-archive help pages, date, strsplit and a few others


attach(gator)
observation_date[1:10]

 [1] 1985-09-02 1985-09-16 1985-07-31 1985-07-31 1985-09-02 1985-08-26
1985-07-31 1985-08-26 1985-09-02 1985-09-16


as.date(observation_date)

Error in as.date(observation_date)  : Cannot coerce to date format


mode(observation_date)

  "numeric"


y <- as.character(observation_date)

[1]  "1985-09-02" "1985-09-16" "1985-07-31" "1985-07-31" "1985-09-02"
"1985-08-26" "1985-07-31" "1985-08-26" "1985-09-02" "1985-09-16"

< y.date <- as.date(y)
 [1]  on and on
and on ...



x <- strsplit(observation_date, "-")

Error in strsplit(observation_date, "-")  : non-character argument


All help is greatly appreciated.

Thanks
Steve



Steve Friedman Ph. D.
Spatial Statistical Analyst
Everglades and Dry Tortugas National Park
950 N Krome Ave (3rd Floor)
Homestead, Florida 33034

steve_fried...@nps.gov
Office (305) 224 - 4282
Fax (305) 224 - 4147

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

2009-04-28 Thread Uwe Ligges



carol white wrote:
Consider a vector of 100 elements (attached files). then, 


truehist(b)
lines(density(b[20:50]))

How is it possible to have density plots of all subsets like b[20:50] within 
histogram (without exceeding the max of historgram on y axis)?

Is it more clear?



Yes, example:

 # ignore the first plot:
 truehist(b)
 yl <- par("usr")[4]
 d <- density(b[20:50])

 truehist(b, ylim=c(0, max(yl, d$y)))
 lines(d)


Uwe Ligges





Best,

--- On Tue, 4/28/09, Uwe Ligges  wrote:
From: Uwe Ligges 
Subject: Re: [R] truehist and density plots
To: "carol white" 
Cc: r-h...@stat.math.ethz.ch
Date: Tuesday, April 28, 2009, 5:42 AM


carol white wrote:

Hi,
I wanted to plot the histogram of a vector and then, plot the density

function of subsets of the vector on the histogram. So I use truehist in MASS
package and lines(density) as follows:

length(b) = 1000
truehist(b)
lines(density(b[1:100]))



I do not undertsand what you mean. Can you please provide a *reproducible*
example?

Uwe Ligges



however the density plot of the first 100 points exceeds the max of y axis

(see attached). how is it possible to make a graphics so that the density plot
of the subsets doesn't go beyond the maximum of all points in the complete
set?

Cheers,

Carol






  




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

2009-04-28 Thread Uwe Ligges



carol white wrote:

OK but how to generalize so that the max of y would cover for all subsets of b? 
because 50:70 was just an example, so consider other subsets (known or unknow 
in advance) whose density will be plotted on the histogram.


Take all subsets at first and calculate the max of all those density 
estimates of all substes, then plot all the estimates, as I have done 
for just 1 sample.






But since b is the full set, why it doesn't contain the max of y for all 
subsets?


Consult a textbook about statistics:
Consider a density estimate of just very few numbers with very small 
variance (which might happen), you'd get a very high estimate at the center.




Uwe Ligges




thanks

--- On Tue, 4/28/09, Uwe Ligges  wrote:
From: Uwe Ligges 
Subject: Re: [R] truehist and density plots
To: "carol white" 
Cc: r-h...@stat.math.ethz.ch
Date: Tuesday, April 28, 2009, 6:16 AM


carol white wrote:
Consider a vector of 100 elements (attached files). then, 
truehist(b)

lines(density(b[20:50]))

How is it possible to have density plots of all subsets like b[20:50]

within histogram (without exceeding the max of historgram on y axis)?

Is it more clear?



Yes, example:

 # ignore the first plot:
 truehist(b)
 yl <- par("usr")[4]
 d <- density(b[20:50])

 truehist(b, ylim=c(0, max(yl, d$y)))
 lines(d)


Uwe Ligges




Best,

--- On Tue, 4/28/09, Uwe Ligges 

wrote:

From: Uwe Ligges 
Subject: Re: [R] truehist and density plots
To: "carol white" 
Cc: r-h...@stat.math.ethz.ch
Date: Tuesday, April 28, 2009, 5:42 AM


carol white wrote:

Hi,
I wanted to plot the histogram of a vector and then, plot the density

function of subsets of the vector on the histogram. So I use truehist in

MASS

package and lines(density) as follows:

length(b) = 1000
truehist(b)
lines(density(b[1:100]))


I do not undertsand what you mean. Can you please provide a *reproducible*
example?

Uwe Ligges



however the density plot of the first 100 points exceeds the max of y

axis

(see attached). how is it possible to make a graphics so that the density

plot

of the subsets doesn't go beyond the maximum of all points in the

complete

set?

Cheers,

Carol






  




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

2009-04-28 Thread Benedikt Niesterok
Hello,
I would like to get a correlation coefficient (R-squared) for my model.
I don't know how to calculate it in R.
What I've done so far:

x<-8.5:32.5   #Vektor x
y<-c(NA ,5.88 , 6.95  , 7.2 , 7.66 , 8.02 , 8.44 , 9.06,  9.65, 10.22 ,
10.63 ,11.06, 11.37, 11.91 ,12.28, 12.69 ,13.07 , 13.5 , 13.3 ,14.14  ,  NA  ,  
NA ,   NA  ,  NA  ,  NA) #Vektor y
plot(y~x,col="green",pch=16,ylim=c(0,20),xlim=c(0,50))

(mod1<-nls(y~a+b*log(x,base=exp(1)),start=list(a=1,b=1),trace=TRUE))
xx<-seq(min(x),max(x),length=100)
yy<-6.2456*log(xx)-7.7822
lines(xx,yy,col="blue1")
summary(mod1)

This way I don't get R-squared like I do using the command "lm" for linear
models.
Would appreciate your help,

Benedikt N.
--

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Why there is no p-value from likelihood ratio test using anova in GAM model fitting?

2009-04-28 Thread Dieter Menne
willow1980  shef.ac.uk> writes:

> However, when I run LRT to compare
> them, the test did not return F value and p-value for me. What's the reason?
> 
> 
> Analysis of Deviance Table
> 
> Model 1: sum_surv15 ~ s(FLBS) + s(byear) + s(FLBS, byear)
> Model 2: sum_surv15 ~ s(FLBS) + SES + s(byear) + s(FLBS, byear)
>Resid. Df Resid. Dev Df Deviance F Pr(>F)
> 1 1202.21094 601.27 
> 2 1201.43848 601.290.77246-0.02
> 

-- Provide at least the command line you used
-- Wild guess: Try to add test="F" (which is indicated in the docs)

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.


[R] help working with date values

2009-04-28 Thread Steve_Friedman

My data contains a variable "observation_date"  and it contains values as:

1985-09-02
1985-09-15
1985-07-31
1985-09-02


I need to process data annually rather than daily, therefore I'm trying to
1) either extract the first 4 digits from this field and use them as a new
variable "year"  or 2) keep the variable as it is and process the analysis
using the first 4 digits of the observation_date field.

I'm not sure how to do either one of these approaches. I've looked in the
R-archive help pages, date, strsplit and a few others

> attach(gator)
> observation_date[1:10]
 [1] 1985-09-02 1985-09-16 1985-07-31 1985-07-31 1985-09-02 1985-08-26
1985-07-31 1985-08-26 1985-09-02 1985-09-16

> as.date(observation_date)
Error in as.date(observation_date)  : Cannot coerce to date format

> mode(observation_date)
  "numeric"

> y <- as.character(observation_date)
[1]  "1985-09-02" "1985-09-16" "1985-07-31" "1985-07-31" "1985-09-02"
"1985-08-26" "1985-07-31" "1985-08-26" "1985-09-02" "1985-09-16"

< y.date <- as.date(y)
 [1]  on and on
and on ...


> x <- strsplit(observation_date, "-")
Error in strsplit(observation_date, "-")  : non-character argument


All help is greatly appreciated.

Thanks
Steve



Steve Friedman Ph. D.
Spatial Statistical Analyst
Everglades and Dry Tortugas National Park
950 N Krome Ave (3rd Floor)
Homestead, Florida 33034

steve_fried...@nps.gov
Office (305) 224 - 4282
Fax (305) 224 - 4147

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Why there is no p-value from likelihood ratio test using anova in GAM model fitting?

2009-04-28 Thread Simon Wood
The simpler model has the lower deviance (marginally), so there is nothing to 
test here. This can happen with maximum penalized likelihood estimators, even 
though the models are nested (especially if the smoothing parameters are 
selected automatically). Are you using gam:gam or mgcv:gam (and which version 
numbers)? 

best,
Simon

On Tuesday 28 April 2009 12:38, willow1980 wrote:
> Hello, everybody,
> There is the first time for me to post a question, because I really cannot
> find answer from books, websites or my colleagues. Thank you in advance for
> your help!
> I am running likelihood ratio test to find if the simpler model is not
> significant from more complicated model. However, when I run LRT to compare
> them, the test did not return F value and p-value for me. What's the
> reason? How can I get such important information?
>
> 
> Analysis of Deviance Table
>
> Model 1: sum_surv15 ~ s(FLBS) + s(byear) + s(FLBS, byear)
> Model 2: sum_surv15 ~ s(FLBS) + SES + s(byear) + s(FLBS, byear)
>Resid. Df Resid. Dev Df Deviance F Pr(>F)
> 1 1202.21094 601.27
> 2 1201.43848 601.290.77246-0.02
> 
> Thank you very much!
>
> Jianghua Liu, University of Sheffield

-- 
> Simon Wood, Mathematical Sciences, University of Bath, Bath, BA2 7AY UK
> +44 1225 386603  www.maths.bath.ac.uk/~sw283

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


Re: [R] help working with date values

2009-04-28 Thread Gabor Grothendieck
Here are a few ways:

> xx <- c("1985-09-02", "1985-09-16", "1985-07-31", "1985-07-31", "1985-09-02",
"1985-08-26", "1985-07-31", "1985-08-26", "1985-09-02", "1985-09-16")

> # 1
> library(zoo)
> as.numeric(floor(as.yearmon(xx)))
 [1] 1985 1985 1985 1985 1985 1985 1985 1985 1985 1985

> #2
> as.numeric(substr(xx, 1, 4))
 [1] 1985 1985 1985 1985 1985 1985 1985 1985 1985 1985

> #3
> as.numeric(format(as.Date(xx), "%Y"))
 [1] 1985 1985 1985 1985 1985 1985 1985 1985 1985 1985


On Tue, Apr 28, 2009 at 9:04 AM,   wrote:
>
> My data contains a variable "observation_date"  and it contains values as:
>
> 1985-09-02
> 1985-09-15
> 1985-07-31
> 1985-09-02
>
>
> I need to process data annually rather than daily, therefore I'm trying to
> 1) either extract the first 4 digits from this field and use them as a new
> variable "year"  or 2) keep the variable as it is and process the analysis
> using the first 4 digits of the observation_date field.
>
> I'm not sure how to do either one of these approaches. I've looked in the
> R-archive help pages, date, strsplit and a few others
>
>> attach(gator)
>> observation_date[1:10]
>  [1] 1985-09-02 1985-09-16 1985-07-31 1985-07-31 1985-09-02 1985-08-26
> 1985-07-31 1985-08-26 1985-09-02 1985-09-16
>
>> as.date(observation_date)
> Error in as.date(observation_date)  : Cannot coerce to date format
>
>> mode(observation_date)
>  "numeric"
>
>> y <- as.character(observation_date)
> [1]  "1985-09-02" "1985-09-16" "1985-07-31" "1985-07-31" "1985-09-02"
> "1985-08-26" "1985-07-31" "1985-08-26" "1985-09-02" "1985-09-16"
>
> < y.date <- as.date(y)
>  [1]  on and on
> and on ...
>
>
>> x <- strsplit(observation_date, "-")
> Error in strsplit(observation_date, "-")  : non-character argument
>
>
> All help is greatly appreciated.
>
> Thanks
> Steve
>
>
>
> Steve Friedman Ph. D.
> Spatial Statistical Analyst
> Everglades and Dry Tortugas National Park
> 950 N Krome Ave (3rd Floor)
> Homestead, Florida 33034
>
> steve_fried...@nps.gov
> Office (305) 224 - 4282
> Fax     (305) 224 - 4147
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] R-2.9.0 malformed bundle DESCRIPTION file, no Contains field

2009-04-28 Thread Richardson, Patrick
When trying to update (various) packages using update.packages() I get the 
following error message for various packages



package 'fBasics' successfully unpacked and MD5 sums checked Error in 
unpackPkg(foundpkgs[okp, 2L], foundpkgs[okp, 1L], lib) :

  malformed bundle DESCRIPTION file, no Contains field

>



This happens with other packages besides fBasics (Matrix, as well as others) 
and I have switched mirrors and the same thing occurs.



Any suggestions?



Best,



Patrick

Win XP SP3



R version 2.9.0 (2009-04-17)

i386-pc-mingw32



locale:

LC_COLLATE=English_United States.1252;LC_CTYPE=English_United 
States.1252;LC_MONETARY=English_United 
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252



attached base packages:

[1] stats graphics  grDevices datasets  tcltk utils methods   base



other attached packages:

[1] svSocket_0.9-5 TinnR_1.0.3R2HTML_1.59-1  Hmisc_3.5-2



loaded via a namespace (and not attached):

[1] cluster_1.11.13 grid_2.9.0  lattice_0.17-22 svMisc_0.9-5tools_2.9.0


This email message, including any attachments, is for th...{{dropped:9}}

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

2009-04-28 Thread carol white
OK but how to generalize so that the max of y would cover for all subsets of b? 
because 50:70 was just an example, so consider other subsets (known or unknow 
in advance) whose density will be plotted on the histogram.

But since b is the full set, why it doesn't contain the max of y for all 
subsets?

thanks

--- On Tue, 4/28/09, Uwe Ligges  wrote:
From: Uwe Ligges 
Subject: Re: [R] truehist and density plots
To: "carol white" 
Cc: r-h...@stat.math.ethz.ch
Date: Tuesday, April 28, 2009, 6:16 AM


carol white wrote:
> Consider a vector of 100 elements (attached files). then, 
> truehist(b)
> lines(density(b[20:50]))
> 
> How is it possible to have density plots of all subsets like b[20:50]
within histogram (without exceeding the max of historgram on y axis)?
> 
> Is it more clear?


Yes, example:

 # ignore the first plot:
 truehist(b)
 yl <- par("usr")[4]
 d <- density(b[20:50])

 truehist(b, ylim=c(0, max(yl, d$y)))
 lines(d)


Uwe Ligges



> 
> Best,
> 
> --- On Tue, 4/28/09, Uwe Ligges 
wrote:
> From: Uwe Ligges 
> Subject: Re: [R] truehist and density plots
> To: "carol white" 
> Cc: r-h...@stat.math.ethz.ch
> Date: Tuesday, April 28, 2009, 5:42 AM
> 
> 
> carol white wrote:
>> Hi,
>> I wanted to plot the histogram of a vector and then, plot the density
> function of subsets of the vector on the histogram. So I use truehist in
MASS
> package and lines(density) as follows:
>> length(b) = 1000
>> truehist(b)
>> lines(density(b[1:100]))
> 
> 
> I do not undertsand what you mean. Can you please provide a *reproducible*
> example?
> 
> Uwe Ligges
> 
> 
>> however the density plot of the first 100 points exceeds the max of y
axis
> (see attached). how is it possible to make a graphics so that the density
plot
> of the subsets doesn't go beyond the maximum of all points in the
complete
> set?
>> Cheers,
>> 
>> Carol
>> 
>> 
>> 
>> 
>> 
>> 
>>   
>>

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

2009-04-28 Thread Cuvelier Etienne

Perhaps like this :

temp =density(b[20:50])
truehist(b, ymax=max(temp$y))
lines(temp)

Etienne

carol white a écrit :
Consider a vector of 100 elements (attached files). then, 


truehist(b)
lines(density(b[20:50]))

How is it possible to have density plots of all subsets like b[20:50] within 
histogram (without exceeding the max of historgram on y axis)?

Is it more clear?

Best,

--- On Tue, 4/28/09, Uwe Ligges  wrote:
From: Uwe Ligges 
Subject: Re: [R] truehist and density plots
To: "carol white" 
Cc: r-h...@stat.math.ethz.ch
Date: Tuesday, April 28, 2009, 5:42 AM


carol white wrote:

Hi,
I wanted to plot the histogram of a vector and then, plot the density

function of subsets of the vector on the histogram. So I use truehist in MASS
package and lines(density) as follows:

length(b) = 1000
truehist(b)
lines(density(b[1:100]))



I do not undertsand what you mean. Can you please provide a *reproducible*
example?

Uwe Ligges



however the density plot of the first 100 points exceeds the max of y axis

(see attached). how is it possible to make a graphics so that the density plot
of the subsets doesn't go beyond the maximum of all points in the complete
set?

Cheers,

Carol






  




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

2009-04-28 Thread Peter Flom
carol white  wrote
>Consider a vector of 100 elements (attached files). then, 
>
>truehist(b)
>lines(density(b[20:50]))
>
>How is it possible to have density plots of all subsets like b[20:50] within 
>histogram (without exceeding the max of historgram on y axis)?
>


I didn't open your attached file  but 

b <- rnorm(100)
library(MASS)
truehist(b)
lines(density(b[20:50]))


works fine

if some of your density plots line go too high, then you can first find the 
maximum and then use that in the truehist function, which has ymax.

There's probably some elegant way to find the max, but I *THINK* this is right:
den1 <- density(b[20:50])
max1 <- max(den1[[2]])

then, if you have a lot of densities, you could get
maxim <- max(max1, max2) or some such

HTH

Peter


Peter L. Flom, PhD
Statistical Consultant
www DOT peterflomconsulting DOT 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] rounding problem

2009-04-28 Thread Uwe Ligges



Emmanuel Charpentier wrote:

Seconded !


Errr, this is in the sources for ages now ...

Uwe Ligges



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-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Dropping 'empty' panels from lattice

2009-04-28 Thread Dieter Menne
  xs4all.nl> writes:

> 
> I have 8 cofactors possibly affecting one and only one variable.
> 
> I make conditional histograms:
> 
> <-pdf(file="tst3.pdf",paper="special",width=36,height=36)
>
<-histogram(~Oversized|dat$c1*dat$c2*dat$c5*dat$c6*dat$c7*dat$c8*
  dat$c9*dat$c10,nint=21,layout=c(32,8),data=dat,type="count")
> <-dev.off()
> 
> This works (compliments to R developers!) but it does generate a large
> plot with many panels being 'empty', e.g. that combination of factors
> c1..c10 never occurs in this data set.
> 
> Is there a way to autmatically drop those empty panels?
> 

Since there is little hope that you get a useful arrangement in the
2D-paper world, and neither in 4D relativistic space, I would
suggest to make a new factor by pasting all cX factors, use that
as the only grouping factor. 

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] truehist and density plots

2009-04-28 Thread carol white
Is there any other way to illustrate the overlap of subsets' distribution (not 
necessarily by an estimation plot but by a plot of true values)?

--- On Tue, 4/28/09, Uwe Ligges  wrote:
From: Uwe Ligges 
Subject: Re: [R] truehist and density plots
To: wht_...@yahoo.com
Cc: r-h...@stat.math.ethz.ch
Date: Tuesday, April 28, 2009, 6:29 AM


carol white wrote:
> OK but how to generalize so that the max of y would cover for all subsets
of b? because 50:70 was just an example, so consider other subsets (known or
unknow in advance) whose density will be plotted on the histogram.

Take all subsets at first and calculate the max of all those density 
estimates of all substes, then plot all the estimates, as I have done 
for just 1 sample.




> But since b is the full set, why it doesn't contain the max of y for
all subsets?

Consult a textbook about statistics:
Consider a density estimate of just very few numbers with very small 
variance (which might happen), you'd get a very high estimate at the
center.



Uwe Ligges


> 
> thanks
> 
> --- On Tue, 4/28/09, Uwe Ligges 
wrote:
> From: Uwe Ligges 
> Subject: Re: [R] truehist and density plots
> To: "carol white" 
> Cc: r-h...@stat.math.ethz.ch
> Date: Tuesday, April 28, 2009, 6:16 AM
> 
> 
> carol white wrote:
>> Consider a vector of 100 elements (attached files). then, 
>> truehist(b)
>> lines(density(b[20:50]))
>>
>> How is it possible to have density plots of all subsets like b[20:50]
> within histogram (without exceeding the max of historgram on y axis)?
>> Is it more clear?
> 
> 
> Yes, example:
> 
>  # ignore the first plot:
>  truehist(b)
>  yl <- par("usr")[4]
>  d <- density(b[20:50])
> 
>  truehist(b, ylim=c(0, max(yl, d$y)))
>  lines(d)
> 
> 
> Uwe Ligges
> 
> 
> 
>> Best,
>>
>> --- On Tue, 4/28/09, Uwe Ligges

> wrote:
>> From: Uwe Ligges 
>> Subject: Re: [R] truehist and density plots
>> To: "carol white" 
>> Cc: r-h...@stat.math.ethz.ch
>> Date: Tuesday, April 28, 2009, 5:42 AM
>>
>>
>> carol white wrote:
>>> Hi,
>>> I wanted to plot the histogram of a vector and then, plot the
density
>> function of subsets of the vector on the histogram. So I use truehist
in
> MASS
>> package and lines(density) as follows:
>>> length(b) = 1000
>>> truehist(b)
>>> lines(density(b[1:100]))
>>
>> I do not undertsand what you mean. Can you please provide a
*reproducible*
>> example?
>>
>> Uwe Ligges
>>
>>
>>> however the density plot of the first 100 points exceeds the max
of y
> axis
>> (see attached). how is it possible to make a graphics so that the
density
> plot
>> of the subsets doesn't go beyond the maximum of all points in the
> complete
>> set?
>>> Cheers,
>>>
>>> Carol
>>>
>>>
>>>
>>>
>>>
>>>
>>>   
>>>
> 
>>> __
>>> R-help@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/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] Cannot update.packages (error message)

2009-04-28 Thread Uwe Ligges



Richardson, Patrick wrote:

When trying to update (various) packages using update.packages() I get the 
following error message for various packages

package 'fBasics' successfully unpacked and MD5 sums checked
Error in unpackPkg(foundpkgs[okp, 2L], foundpkgs[okp, 1L], lib) :
  malformed bundle DESCRIPTION file, no Contains field



Can you try to reinstall (with install.packages()) all your installed 
package *bundles* (the 8 on CRAN are VR, CoCo, dse, hoa, gregmisc, 
BACCO, empiricalBayes, forecasting). I hope update packages will work 
again afterwards.


Best wishes,
Uwe Ligges





This happens with other packages besides fBasics (Matrix, as well as others) 
and I have switched mirrors and the same thing occurs.

Any suggestions?

Best regards,

Patrick
Win XP SP3

R version 2.9.0 (2009-04-17)
i386-pc-mingw32

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United 
States.1252;LC_MONETARY=English_United 
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

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

other attached packages:
[1] svSocket_0.9-5 TinnR_1.0.3R2HTML_1.59-1  Hmisc_3.5-2

loaded via a namespace (and not attached):
[1] cluster_1.11.13 grid_2.9.0  lattice_0.17-22 svMisc_0.9-5tools_2.9.0

This email message, including any attachments, is for th...{{dropped:9}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Why there is no p-value from likelihood ratio test using anova in GAM model fitting?

2009-04-28 Thread Ben Bolker



willow1980 wrote:
> 
> Hi, Dieter,
> I did add (test="F") in my script, but it does not matter. The following
> is my whole script.
> 
> #
> modelsurs_fer13<-gam(sum_surv15~s(FLBS)+SES+s(byear)+s(FLBS,byear),family=quasipoisson)
> modelsurs_fer14<-gam(sum_surv15~s(FLBS)+s(byear)+s(FLBS,byear),family=quasipoisson)
> anova.gam(modelsurs_fer14,modelsurs_fer13,test="F")
> #
> 
> Would you please make further suggestions? Thank you in advance!
> Jianghua
> 
> 

We can't make further suggestions until you (1) provide the output of
sessionInfo() ;
(2) provide a reproducible example.

The following example works for me:

library(mgcv)
example(anova.gam)
b1 <- gam(y~x0+s(x1)+s(x2),family=quasipoisson,data=dat)
b2 <- gam(y~x0+s(x1),family=quasipoisson,data=dat)
anova.gam(b1,b2,test="F")


Analysis of Deviance Table

Model 1: y ~ x0 + s(x1) + s(x2)
Model 2: y ~ x0 + s(x1)
  Resid. Df Resid. Dev   Df Deviance  FPr(>F)
1  187.9672 83.684   
2  194.2014226.042  -6.2342 -142.358 51.291 < 2.2e-16 ***

  Unless you can provide us with an example that _will not work_
when we run it, it will be hard for us to help you.

  Ben Bolker

-- 
View this message in context: 
http://www.nabble.com/Why-there-is-no-p-value-from-likelihood-ratio-test-using-anova-in-GAM-model-fitting--tp23275224p2328.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] combining distributions

2009-04-28 Thread Rachel Taylor

Hi all,
 
I am trying to generate a series of random numbers.  What I want to do is 
create n random Poisson numbers (easily done with the rpois function) and then 
use those generated numbers as the number of genenerated from another 
distribution (in this case, a function for the bounded Pareto distribution I 
have created).
 
Or, to put it in a less convoluted way, say rpois generates the values 
40,35,32,28,46.  I then want to use my Pareto random number generator to 
generate 40, 35, 32, etc... numbers.  My prefered final output will be a vector 
with 1000 values, each value being the sum of (random poisson) pareto random 
numbers.  
 
It is basically simulating loss values, where the losses per year are Poisson 
distributed, and the values are Pareto distributed.  I wanted a vector with 
total loss in each year.
 
My function for bounded pareto values is 
 
function(n,gamma=0.7,alpha=500,beta=100)
{
U <- runif(n)
A <- U*beta^gamma
B <- U*alpha^gamma
C <- beta^gamma
Num <- -(A-B-C)
D <- alpha^gamma
E <- beta^gamma
Denom <- D*E
Frac <- Num/Denom
Power <- -(1/gamma)
Val <- Frac^Power
Val
}

And so far for this function I have 
 
function(n)
{
Y <- rpois(n,33.63)
i <- 1:n
m <- 2*sum(Y)
S <- rboundpareto(m)
G <- sample(S, Y[i], replace=FALSE)
G
}

As you can see, my theory was to sample from a set S of Pareto values.  It does 
output values, I think it is just outputting one sample.
 
Any help would be greatly appreciated
 
Rachel
_
[[elided Hotmail spam]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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-2.9.0 malformed bundle DESCRIPTION file, no Contains field

2009-04-28 Thread Uwe Ligges

Why do you post more than once?

I have answered your former (almost) identical message minutes ago.

Best,
Uwe Ligges


Richardson, Patrick wrote:

When trying to update (various) packages using update.packages() I get the 
following error message for various packages



package 'fBasics' successfully unpacked and MD5 sums checked Error in 
unpackPkg(foundpkgs[okp, 2L], foundpkgs[okp, 1L], lib) :

  malformed bundle DESCRIPTION file, no Contains field




This happens with other packages besides fBasics (Matrix, as well as others) 
and I have switched mirrors and the same thing occurs.



Any suggestions?



Best,



Patrick

Win XP SP3



R version 2.9.0 (2009-04-17)

i386-pc-mingw32



locale:

LC_COLLATE=English_United States.1252;LC_CTYPE=English_United 
States.1252;LC_MONETARY=English_United 
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252



attached base packages:

[1] stats graphics  grDevices datasets  tcltk utils methods   base



other attached packages:

[1] svSocket_0.9-5 TinnR_1.0.3R2HTML_1.59-1  Hmisc_3.5-2



loaded via a namespace (and not attached):

[1] cluster_1.11.13 grid_2.9.0  lattice_0.17-22 svMisc_0.9-5tools_2.9.0


This email message, including any attachments, is for th...{{dropped:9}}

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

2009-04-28 Thread Steve_Friedman
Gabor,

These options will work just fine. Thank you

Steve

Steve Friedman Ph. D.
Spatial Statistical Analyst
Everglades and Dry Tortugas National Park
950 N Krome Ave (3rd Floor)
Homestead, Florida 33034

steve_fried...@nps.gov
Office (305) 224 - 4282
Fax (305) 224 - 4147


   
 Gabor 
 Grothendieck  
   steve_fried...@nps.gov  
cc 
 04/28/2009 09:39  r-help@r-project.org
 AM ASTSubject 
   Re: [R] help working with date  
   values  
   
   
   
   
   
   




Here are a few ways:

> xx <- c("1985-09-02", "1985-09-16", "1985-07-31", "1985-07-31",
"1985-09-02",
"1985-08-26", "1985-07-31", "1985-08-26", "1985-09-02", "1985-09-16")

> # 1
> library(zoo)
> as.numeric(floor(as.yearmon(xx)))
 [1] 1985 1985 1985 1985 1985 1985 1985 1985 1985 1985

> #2
> as.numeric(substr(xx, 1, 4))
 [1] 1985 1985 1985 1985 1985 1985 1985 1985 1985 1985

> #3
> as.numeric(format(as.Date(xx), "%Y"))
 [1] 1985 1985 1985 1985 1985 1985 1985 1985 1985 1985


On Tue, Apr 28, 2009 at 9:04 AM,   wrote:
>
> My data contains a variable "observation_date"  and it contains values
as:
>
> 1985-09-02
> 1985-09-15
> 1985-07-31
> 1985-09-02
>
>
> I need to process data annually rather than daily, therefore I'm trying
to
> 1) either extract the first 4 digits from this field and use them as a
new
> variable "year"  or 2) keep the variable as it is and process the
analysis
> using the first 4 digits of the observation_date field.
>
> I'm not sure how to do either one of these approaches. I've looked in the
> R-archive help pages, date, strsplit and a few others
>
>> attach(gator)
>> observation_date[1:10]
>  [1] 1985-09-02 1985-09-16 1985-07-31 1985-07-31 1985-09-02 1985-08-26
> 1985-07-31 1985-08-26 1985-09-02 1985-09-16
>
>> as.date(observation_date)
> Error in as.date(observation_date)  : Cannot coerce to date format
>
>> mode(observation_date)
>  "numeric"
>
>> y <- as.character(observation_date)
> [1]  "1985-09-02" "1985-09-16" "1985-07-31" "1985-07-31" "1985-09-02"
> "1985-08-26" "1985-07-31" "1985-08-26" "1985-09-02" "1985-09-16"
>
> < y.date <- as.date(y)
>  [1]  on and
on
> and on ...
>
>
>> x <- strsplit(observation_date, "-")
> Error in strsplit(observation_date, "-")  : non-character argument
>
>
> All help is greatly appreciated.
>
> Thanks
> Steve
>
>
>
> Steve Friedman Ph. D.
> Spatial Statistical Analyst
> Everglades and Dry Tortugas National Park
> 950 N Krome Ave (3rd Floor)
> Homestead, Florida 33034
>
> steve_fried...@nps.gov
> Office (305) 224 - 4282
> Fax     (305) 224 - 4147
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] Odp: help working with date values

2009-04-28 Thread Petr PIKAL
Hi

r-help-boun...@r-project.org napsal dne 28.04.2009 15:04:01:

> 
> My data contains a variable "observation_date"  and it contains values 
as:
> 
> 1985-09-02
> 1985-09-15
> 1985-07-31
> 1985-09-02
> 
> 
> I need to process data annually rather than daily, therefore I'm trying 
to
> 1) either extract the first 4 digits from this field and use them as a 
new
> variable "year"  or 2) keep the variable as it is and process the 
analysis
> using the first 4 digits of the observation_date field.
> 
> I'm not sure how to do either one of these approaches. I've looked in 
the
> R-archive help pages, date, strsplit and a few others
> 
> > attach(gator)
> > observation_date[1:10]
>  [1] 1985-09-02 1985-09-16 1985-07-31 1985-07-31 1985-09-02 1985-08-26
> 1985-07-31 1985-08-26 1985-09-02 1985-09-16
> 
> > as.date(observation_date)
> Error in as.date(observation_date)  : Cannot coerce to date format

new.date <- as.Date(observation_date, format="%Y-%m-%d")

and then you can use format for coercing to years

format(new.date, "%Y")

or 

cut(new.date, "year")

Regards
Petr

> 
> > mode(observation_date)
>   "numeric"
> 
> > y <- as.character(observation_date)
> [1]  "1985-09-02" "1985-09-16" "1985-07-31" "1985-07-31" "1985-09-02"
> "1985-08-26" "1985-07-31" "1985-08-26" "1985-09-02" "1985-09-16"
> 
> < y.date <- as.date(y)
>  [1]  on and 
on
> and on ...
> 
> 
> > x <- strsplit(observation_date, "-")
> Error in strsplit(observation_date, "-")  : non-character argument
> 
> 
> All help is greatly appreciated.
> 
> Thanks
> Steve
> 
> 
> 
> Steve Friedman Ph. D.
> Spatial Statistical Analyst
> Everglades and Dry Tortugas National Park
> 950 N Krome Ave (3rd Floor)
> Homestead, Florida 33034
> 
> steve_fried...@nps.gov
> Office (305) 224 - 4282
> Fax (305) 224 - 4147
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] effects package --- add abline to plot

2009-04-28 Thread David Winsemius


On Apr 28, 2009, at 12:00 AM, Prew, Paul wrote:

Hello,  I am not having success in a simple task.  Using the effects  
package, I would like to add reference lines at probability values  
of 0.1 – 0.6 on a plot of the effects.


I have concerns that you are considering these probabilities. They are  
not going to be probabilities. They are effects.


 The plot command works, but following up with an abline command  
produces the message “plot .new has not been called yet”, and of  
course the reference lines were not added.


Looking through past R help lists, there was a similar request for  
help --- trying to add an abline but “got the error "plot.new  has  
not been called yet".


The help list reply was

“ ?abline: "This function adds one or more straight lines through  
the

current plot.", i.e. the already existing *current plot*.

So plot your data (e.g. with plot(x, y)) before adding a regression  
line.”


I interpreted the above to suggest the following ---

plot(allEffects(Clean.label),ask=FALSE, alternating = TRUE,
	ylab="Probability of Rating", xlab="City",main="Cleanliness Ratings  
by City",

factor.names=FALSE, ticks=c(0.1,0.2,0.3,0.4,0.5,0.6))
abline(h=c(0.1,0.2,0.3,0.4,0.5,0.6))


I do not know why that is happening and you have not provided a  
minimal executable example. The vectorized use of abline does succeed  
in a simper example:


> plot(.5,.5)
> abline(h=c(0.1,0.2,0.3,0.4,0.5,0.6))

  so the problem may lie in how the effects package completes its  
plot function for this particular object. You ought to provide at a  
minimum the results of str on that object. Perhaps it executes a  
device call and then turns off the device? However I loaded the  
effects package and ran that abline call after the example:


> mod.cowles <- glm(volunteer ~ sex + neuroticism*extraversion,
+ data=Cowles, family=binomial)
> eff.cowles <- allEffects(mod.cowles, xlevels=list(neuroticism=0:24,
+ extraversion=seq(0, 24, 6)))
> eff.cowles


I did not get what I expected, which would have been a single  
horizontal line at 0.4 but rather got four lines roughly at 0.351,  
0.378, 0.408, 0.439. Even then, I would have expected one more line  
before the upper limits of that plot, which makes me think these four  
lines were the results of arguments 0.3 ,0.4, 0.5, 0.6.   Most R  
plotting is done in the coordinate system rather than with absolute  
coordinates, but perhaps the mixture of base graphics with lattice  
graphis is ht eproblem



Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...) :
 plot.new has not been called yet

Less bothersome is the fact that the tick marks weren’t modified to  
0.1, 0.2, 0.3, etc.


Further searching brought the panel.abline command to light, but  
that didn’t produce any results, not even an error message.



plot(allEffects(Clean.label),ask=FALSE, alternating = TRUE,
+ ylab="Probability of Rating", xlab="City",main="Cleanliness  
Ratings by City",

+  factor.names=FALSE, ticks=c(0.1,0.2,0.3,0.4,0.5,0.6))


panel.abline(h=c(0.1,0.2,0.3,0.4,0.5,0.6))






;;;

sessionInfo()

R version 2.9.0 RC (2009-04-10 r48318)
i386-pc-mingw32

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States. 
1252;LC_MONETARY=English_United States. 
1252;LC_NUMERIC=C;LC_TIME=English_United States.1252


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

[9] base

other attached packages:
[1] relimp_1.0-1 Rcmdr_1.4-9  car_1.2-13   effects_2.0-4
[5] colorspace_1.0-0 nnet_7.2-46  MASS_7.2-46  lattice_0.17-22

loaded via a namespace (and not attached):
[1] tools_2.9.0
Thank you for any advice.
Paul

Paul Prew   ▪  Statistician
651-795-5942   ▪   fax 651-204-7504
Ecolab Research Center   ▪  Mail Stop ESC-F4412-A
655 Lone Oak Drive   ▪   Eagan, MN 55121-1560




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] image3d in misc3d

2009-04-28 Thread Colin Beale
Hi,

I'm trying to make sense of the image3d plots in misc3d. Unfortunately I can't 
find any authors on the help pages of the function to e-mail directly. In the 
following toy example, I'm puzzled as to why (1) the positions of the image 
plot on the axes include negative values when I think I've specified all to be 
1:3 and (2) the logic that needs to be adhered to in order to reliably match up 
the sphere plot with the image plot. 

library(misc3d)
##Set up array:
arr <- array(1:27, dim = rep(3,3))
## Plot image, with x, y, z positions all  set (I thought) to 1:3
image3d(arr, x = 1:3, y = 1:3, z = 1:3, vlim = quantile(arr, c(0.01, 0.99)))
## Add spheres of the same data at the same positions
spheres3d(x=expand.grid(x = 1:3, y = 1:3, z = 1:3), radius = 0.1 *sqrt(arr))

## Ooops! So why don't they match up? Add axes:

axes3d()
## For some reason the image3d is generating negative values of z...

spheres3d(x=expand.grid(x = 1:3, y = 1:3, z = -(1:3)), radius = 0.1 * arr^(1/3))
## But is this reliable? I've tried with a variety of plots and sometimes it 
seems as though another axis is the negative one...

I'm using:
R version 2.8.1 (2008-12-22) 
i386-pc-mingw32 

locale:
LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United 
Kingdom.1252;LC_MONETARY=English_United 
Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252

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

other attached packages:
[1] rgl_0.83-3 misc3d_0.6-1   debug_1.1.0mvbutils_1.1.1 svSocket_0.9-5 
svIO_0.9-5 R2HTML_1.58svMisc_0.9-5   svIDE_0.9-5   

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


Thanks!

Colin


-- 
Please note that the views expressed in this e-mail are those of the
sender and do not necessarily represent the views of the Macaulay
Institute. This email and any attachments are confidential and are
intended solely for the use of the recipient(s) to whom they are
addressed. If you are not the intended recipient, you should not read,
copy, disclose or rely on any information contained in this e-mail, and
we would ask you to contact the sender immediately and delete the email
from your system. Thank you.
Macaulay Institute and Associated Companies, Macaulay Drive,
Craigiebuckler, Aberdeen, AB15 8QH.

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