Re: [R] Subsample points for mclust

2009-07-22 Thread Mario Valle

Nothing is better than asking help to find the answer by myself...

Page 47 of the technical report (tr504.pdf) deals exactly with the 
problem of big datasets.


Also I found that mclust is too much for my problem, the optimum number 
of Gaussian suggested is way too high. For example for one dataset 
(downsampled to 1/10) it suggests 9 Gaussian, but the central 7 sum with 
good approximation to a single Gaussian, so the dataset is better 
decomposed into only 3 Gaussian.

I admit I'm not rigorous at all...

Bye!
  mario

Mario Valle wrote:

Hi all!

I have an ordered vector of values. The distribution of these values 
can be modeled by a sum of Gaussians.
So I'm using the package 'mclust' to get the Gaussians's parameters 
for this 1D distribution. It works very well, but, for input sizes 
above 100.000 values it starts taking really forever. Unfortunately my 
dataset has around 4.6M values...


My question: is it correct to subsample my dataset taking a value 
every N to make mclust happy? Or have I no alternative except using 
the complete dataset?


Excuse my profound ignorance and thank for your help!

mario





--
Ing. Mario Valle
Data Analysis and Visualization Group| http://www.cscs.ch/~mvalle
Swiss National Supercomputing Centre (CSCS)  | Tel:  +41 (91) 610.82.60
v. Cantonale Galleria 2, 6928 Manno, Switzerland | Fax:  +41 (91) 610.82.82

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


Re: [R] Collinearity in Linear Multiple Regression

2009-07-22 Thread Tim Paysen
Actually, the CI index and VIF are just a start.  It is best to look at what 
they call a matrix of variance proportions (found in SAS and a few other 
places...)--which hardly anyone understands (including the SAS folks).  It is a 
matrix of estimates of what the variences of the regression coefficients would 
be if you could figure them out in the first place.  It shows which factors 
dominate over others IN THE PARTICULAR SETUP you are analyzing.  The matrix is 
often calculated using eigenvalues, but is best done with Singular Value 
Decomposition techniques (you don't have to have a square matrix, and you 
maintain better precision).  Analysts will say that it can display an unstable 
system -- which is correct, but they generally say that, if its true, you have 
bad data and should throw it out--or collect more.  I suggest care, because it 
may be illustrating the nature of the system you are studying.

The only decent reference that I know of is a little book (hard to read) that I 
can't remember off the top of my head.  Have to look it up.

Timothy E. Paysen, Phd
Research Forester (ret.)





From: John Sorkin jsor...@grecc.umaryland.edu
To: Alex Roy alexroy2...@gmail.com; r-help@r-project.org
Sent: Tuesday, July 21, 2009 4:19:11 AM
Subject: Re: [R] Collinearity in Linear Multiple Regression

I suggest you start by doing some reading about Condition index (CI) and 
variation inflation factor (VIF). Once you have reviewed the theory, a search 
of search.r-project.org (under the help menu in a windows-based R installation) 
for VIF will help you obtain values for VIF, c.f. 
http://finzi.psych.upenn.edu/R/library/HH/html/vif.html 
John

John David Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)

 Alex Roy alexroy2...@gmail.com 7/21/2009 7:01 AM 
Dear all,
                  How can I test for collinearity in the predictor data set
for multiple linear regression.

Thanks

Alex

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

Confidentiality Statement:
This email message, including any attachments, is for th...{{dropped:11}}

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


[R] how to calculate growth rate of CO2 (ppm) time series

2009-07-22 Thread Yogesh Tiwari
Dear R Users,
I have CO2 mixing ratio(ppm) time series data during 1991-2000.
I would like to calculate CO2 growth rate /ppm.a-1
(is it derivative dt/dco2 ??)

Kindly can any one advise how to calculate above.

My data file looks like;

time, year, month, day, hour, min, sec, lat, long, height, CO2

1991.476722 1991 6 24 0 5 0 -38.93 145.15 4270 353.680

1991.476741 1991 6 24 0 15 0 -39.20 145.22 4270 353.950

1991.476747 1991 6 24 0 18 0 -39.43 145.28 4270 353.510

---

2000.740788 2000 9 28 3 5 0 -38.00 145.00 2280 366.750

2000.740794 2000 9 28 3 8 0 -38.00 145.00 1830 366.550

2000.740803 2000 9 28 3 13 0 -38.00 145.00 1220 370.550
Many great thanks,

Best Regards,
Yogesh

-- 
Yogesh K. Tiwari (Dr.rer.nat),
Scientist,
Indian Institute of Tropical Meteorology,
Homi Bhabha Road,
Pashan,
Pune-411008
INDIA

Phone: 0091-99 2273 9513 (Cell)
: 0091-20-25904350 (O)
Fax: 0091-20-258 93 825

[[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] margins defined in randomForest and supclust

2009-07-22 Thread Weiwei Shi
Hi there,

How to solve the conflicts as to the same object between two packages, for
example, like margins in both randomForest and supclust?

When both libraries are installed, supclust will complain margins defined
in randomForest.

I can only solve it by re-starting R, which is very inconvenient, any clever
way?

Thanks,

Weiwei

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

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

[[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] animated grid graphics

2009-07-22 Thread Paul Hiemstra

Allan Engelhardt wrote:

On 21/07/09 14:00, Paul Hiemstra wrote:

Hi,

Drawing grid graphics always takes long, I would write the images to 
png's and make the animation. If you use Linux I can suggest some 
nice tools to do this. 


Please do suggest!  I was thinking about a similar problem.

Allan.

Hi Allan and Jeremy,

I use the jpeg2yuv and mpg2enc commands to create an mpg movie from a 
series of jpeg's, in this case created using R. The command to produce 
the mpg movie looks something like:


ls *.jpg | jpeg2yuv -f 25 -I p | mpg2enc -q3 -M2 2048 -o animation.mpg

These tools are part of the ffmpeg project (http://ffmpeg.org/) an I 
think they are part of the debian (and maybe ubuntu) repositories. 
Another cool tool is yuvmotionfps, it allows you to interpolation 
between frame, see http://jcornet.free.fr/linux/yuvmotionfps.html.


cheers and good luck,
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] How do I delete a row from a data frame when varA == TRUE

2009-07-22 Thread Uwe Ligges



Daniel Malter wrote:

XYZ=XYZ[XYZ$A==TRUE , ]



install.packages(fortunes)
library(fortunes)
fortune(==TRUE)


Uwe Ligges


 should do. Note that this specific command

overwrites your XYZ dataframe. If you want to keep XYZ, you will want to
name the newly created frame differently.

HTH,
Daniel

-
cuncta stricte discussurus
-

-Ursprüngliche Nachricht-
Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im
Auftrag von kxk
Gesendet: Wednesday, July 22, 2009 12:24 AM
An: r-help@r-project.org
Betreff: [R] How do I delete a row from a data frame when varA == TRUE


I want to delete a row from a data frame XYZ where A == TRUE.  Let's
assume there are five variables in this data frame XYZ.  My deletion is
based on the TRUE vs. FALSE value under variable A.  How do I do this?
Thanks!

My current code: 
for (i in 1:length(XYZ$A)) if (XYZ$A == FALSE) XYZ-XYZ else XYZ-

XYZ[-i,]

Error message is:
Error in if (XYZ$A == FALSE) XYZ-XYZ else XYZ- XYZ[-i,  : 
  missing value where TRUE/FALSE needed



Please help!!
--
View this message in context:
http://www.nabble.com/How-do-I-delete-a-row-from-a-data-frame-when-varA-%3D%
3D-%22TRUE%22-tp24599876p24599876.html
Sent from the R help mailing list archive at Nabble.com.

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

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


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


Re: [R] Application logging in R

2009-07-22 Thread SIES 73
Hi Brian,

In general, R lacks many utilities for applications. I'd say 
it's more focused on one-shot analysis, what is logic given its
origin in statistics/academics. Few packages deal with these types 
of application automation.

Logging is already addressed in some packages: you should have
a look at Verbose on R.utils. logger on Rcmdr has a different
purpose (logging commands, not messages), but you should consider
the name clash with your functions, as well as potential problems
with S3 dispatching.

Logging is one of these types of utilities where one good 
package could be useful to many of us. Here are some personal 
ideas about what would make a general R logging tool useful:

1) It should be on a package of its own. Embedding it into a
general tools  utilities package like futile only dilutes
it. It becomes much harder to find, and forces the interested user 
to load a lot of unrelated stuff which is likely not useful to him.

2) It should, if possible, be built on top of the condition 
handling system of R. 

3) It should build on the message translation system of R
(the set of gettext, gettextf, etc, functions)

4) It should be R-like, not Java-like. I don't think mimicking
a Java system like log4j is specially useful, and having that as
the main design statement can only be --in my very personal 
opinion-- harmful, unless you're really interfacing to Java code. 
You may get some inspiration from it but R and Java are 
different enough that forcing too much in that direction is 
unlikely to lead to a great R package.

Hope this is useful. Regards,

Enrique

--
Date: Mon, 20 Jul 2009 07:55:53 -0400
From: B Rowe public_br...@muxspace.com
Subject: [R] Application logging in R
To: r-help@r-project.org
Message-ID: 1248090953.4586.52.ca...@localhost
Content-Type: text/plain

Hello,

I'm curious to know how people log their applications in R. It seems
like it's a combination of cat statements or writing out the session to
a file, given the discussions I've had with people. This is fine for
interactive work but is a little lacking for automated systems. To
address this, I've written a logging facility modeled on the log4j Java
library. The basic concept is that you can route logging statements to
customizable loggers, each with their own 'threshold' (e.g. debug, info,
warn) and output. The output can be anything from stdout, a file, a URL,
to a message bus, depending on the implementation.

Here are some quick examples:

  library(futile)
  # Use the ROOT logger
  logger.info(Hello, world)
  logger.debug(Won't print since level is currently INFO)
  setLogger('ROOT', level='DEBUG')
  logger.debug(This will %s print, 'now')

  # Create new loggers
  addLogger('a.logger', 'WARN', logger.stdout)
  addLogger('b.logger', 'INFO', logger.file, file='temp.log')
  object - 1
  logger.debug(This is a %s, class(object), logger='a.logger')
  logger.warn(This is a %s, class(object), logger='b.logger')

This type of control also provides an alternative to stdout redirection
in distributed environments, which can facilitate debugging.

Version 1.1.1 of the package is available on CRAN. Any thoughts on how
to improve this or requests for other loggers are appreciated.

Regards,
Brian

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


[R] A Flash Mob for R Content on Stack Overflow: Tonite @ 7-9pm PST

2009-07-22 Thread Michael E. Driscoll
R Users -

Tomorrow night, we are leading a group of R programmers to a site
called Stack Overflow, Stackoverflow is a collaborative question and
answer site for programmers, currently lacks much R content.
to populate some of the most oft-asked and reluctantly-answered
questions about R.

The R-help mailing list is an indispensable resource to members of the
R community.  Perhaps owing to its interdisciplinary appeal, R is not
always an easy language for its suitors.  There are a common set of
questions that tend be asked repeatedly, to the detriment of many of
the R experts here (you tire of repeating yourself) and the beginners
(who receive technically correct, but terse responses).  As the ranks
of the R user community grow, this may test the limits of patience for
its subscribers.  Our aim is to shift this corpus of common technical
questions off the mailing list.

If you would like to join us in this effort, we'll be starting it 7pm
PST Wednesday, July 22nd 2009.  You can see the questions as they
appear on Stack Overflow or follow @rstatsmob on Twitter.

  http://stackoverflow.com/questions/tagged/r
  http://twitter.com/rstatsmob

If you'd like to join us in person, we'll be in San Jose at O'Reilly's
Open Source Conference.  The event is free and open to the public.

  http://en.oreilly.com/oscon2009/public/schedule/detail/10432
  Location: Ballroom A2
  San Jose McEnery Convention Center
  150 West San Carlos St.
  San Jose, CA 95113

We're hopeful that our efforts may result in the creation of a
valuable resource for the growing R community.

Sincerely,


Michael Driscoll, San Francisco, CA
(in collaboration with)
James D. Long, Chicago, IL
David Chu, Oakland, CA

--
Michael E. Driscoll, Ph.D.
Co-Chair, Bay Area R Users Group | www.meetup.com/R-Users/
Principal, Dataspora LLC | www.dataspora.com/blog

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


Re: [R] margins defined in randomForest and supclust

2009-07-22 Thread Uwe Ligges



Weiwei Shi wrote:

Hi there,

How to solve the conflicts as to the same object between two packages, for
example, like margins in both randomForest and supclust?

When both libraries are installed, supclust will complain margins defined
in randomForest.

I can only solve it by re-starting R, which is very inconvenient, any clever
way?



Well, the *package* (not library!) randomForest has a NAMESPACE and 
should not be affected by loading supclust afterwards - and you can 
access its margin function explicitly with randomForest::margin()


Unfortunately, supclust does not have a NAMESPACE and may be affected by 
later loading randomForest. Hence workaround is to load randomForest at 
first.
Aynway, you could try to convince the authors / maintainer of supclust 
to add a Namespace. I'll start bugging them by CCing this message. ;-)


Best wishes,
Uwe Ligges






Thanks,

Weiwei



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
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 Flash Mob for R Content on Stack Overflow: Tonite @ 7-9pm PST

2009-07-22 Thread cls59



Michael E. Driscoll wrote:
 
 R Users -
 
 Tomorrow night, we are leading a group of R programmers to a site
 called Stack Overflow, Stackoverflow is a collaborative question and
 answer site for programmers, currently lacks much R content.
 to populate some of the most oft-asked and reluctantly-answered
 questions about R.
 
 snip
 
 If you would like to join us in this effort, we'll be starting it 7pm
 PST Wednesday, July 22nd 2009.  You can see the questions as they
 appear on Stack Overflow or follow @rstatsmob on Twitter.
 
 

Excellent idea? I recently joint StackOverflow and have been very impressed
with the level of activity questions on that site receive. You are right
though- R is an extremely low profile language on the site. I'm glad you are
organizing this effort.

Let's go vote up some answers!

-
Charlie Sharpsteen
Undergraduate
Environmental Resources Engineering
Humboldt State University
-- 
View this message in context: 
http://www.nabble.com/A-Flash-Mob-for-R-Content-on-Stack-Overflow%3A-Tonite-%40-7-9pm-PST-tp24602076p24602564.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] Automatic differentiation in R

2009-07-22 Thread Finlay Scott (Cefas)
Hi 
I recently gave a presentation about Automatic Differentiation (AD) and R at 
the Eighth Euro AD Workshop in Oxford (17/07/09).  The presentation was 
intended as a general introduction to R and the desire for a generic AD 
interface for R.  During the presentation I emphasised the need and the high 
level of interest that the R community has in developing such an interface and 
that input from the AD community is essential to achieve it.

The presentation seemed to generate a good level of interest and several 
suggestions for potential directions were made.  However, it is not clear at 
the moment what the best way is of implementing an AD interface in R in terms 
of success, difficulty and amount of work.

One suggestion was that it may be possible to develop it entirely in R, using 
the S4 classes and overloading the intrinsic functions.  This may not result in 
the fastest solution, in terms of time taken to calculate the derivatives, but 
could result in a 'clean' interface that was relatively straightforward to 
extend.

Alternatively, it may be possible to make use of a pre-exisiting AD library in 
another language (e.g. ADOL-C or the AutoDiff libraries from AD Model Builder). 
 As these libraries are C++ based this would require functions that were 
written in R to be parsed into C++ and then compiled before their derviatives 
could be found.  Although this has the advantage of using work that is already 
well developed, the parsing and compilation from R to C++ may make the 
interface 'clunky'.

It is likely that we won't know how successful either of these approaches could 
be until someone actually sits down and has a go at doing it.  Is there anyone 
out there who is interested in getting involved with this project or who has 
advice / time to offer?

Also, would it be possible to also post this message in the R-devel list?  I 
realise that this would mean 'double posting' but the potential for a generic 
AD interface affects many packages and may also be of interest to developers 
(e.g. John Nash's 'optimx' package)

Finlay Scott


***
This email and any attachments are intended for the name...{{dropped:10}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] je veux me sésinscrir!!!!!!!!!!!help

2009-07-22 Thread mariam farjallah



  
[[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] Split plot analysis problems

2009-07-22 Thread Jean-Paul Maalouf

Thanks a lot for your answer.

My blocks are geographically well-separated, and within each block my  
four treatments are randomized. Therefore I am choosing the first model.


Do you have any idea on how can I verify preliminary assumptions in  
this model (normality of the residuals and variance homogeneity),  
since R is not able to extract residuals?



residuals(aov(PH~Community*Mowing*Water + Error(Block)))


NULL


Regards,

JPM


Quoting Kevin W kw.st...@gmail.com:


I don't think you are clear enough about the layout within each block.  If
the four treatments are randomized, I would choose the first model.

KW


On Tue, Jul 21, 2009 at 9:38 AM, Jean-Paul Maalouf 
jean-paul.maal...@u-bordeaux1.fr wrote:


Hello,

I would be very grateful if someone could give me a hand with my split plot
design problems.

So here is my design :
I am studying the crossed-effects of water (wet/dry) and mowing
(mowed/not-mowed = nm) on plant height (PH) within 2 types of plant
communities (Xerobromion and Mesobromion) :
- Within each type of communities, I have localised 4 blocks
- In each block, I have defined 4 plots in order to have the 4 possible
treatments of both the water and mowing factors : nm/dry ; mowed/dry ;
mowed/wet ; nm/wet.

Here is my data table :

  Community Block Mowing WaterPH
1   Mesob1  Mowed   Wet  7.40
2   Mesob1 nm   Wet 13.10
3   Mesob1  Mowed   Dry  5.55
4   Mesob1 nm   Dry 10.35
5   Mesob2 nm   Dry 10.70
6   Mesob2  Mowed   Dry  6.38
7   Mesob2 nm   Wet  9.75
8   Mesob2  Mowed   Wet  6.35
9   Mesob3 nm   Wet  9.60
10  Mesob3  Mowed   Dry  5.10
11  Mesob3 nm   Dry 10.05
12  Mesob3  Mowed   Wet  6.25
13  Mesob4 nm   Wet  9.00
14  Mesob4  Mowed   Wet  6.50
15  Mesob4 nm   Dry  7.75
16  Mesob4  Mowed   Dry  5.90
17  Xerob5 nm   Wet  7.69
18  Xerob5  Mowed   Wet  8.11
19  Xerob5 nm   Dry  3.98
20  Xerob5  Mowed   Dry  3.69
21  Xerob6 nm   Wet  5.24
22  Xerob6  Mowed   Wet  4.22
23  Xerob6 nm   Dry  6.55
24  Xerob6  Mowed   Dry  4.40
25  Xerob7  Mowed   Dry  3.79
26  Xerob7 nm   Dry  3.91
27  Xerob7 nm   Wet  9.00
28  Xerob7  Mowed   Wet  8.50
29  Xerob8  Mowed   Dry  3.33
30  Xerob8 nm   Wet  6.25
31  Xerob8  Mowed   Wet  8.00
32  Xerob8 nm   Dry  6.33

I actually have 2 questions :
I wrote my model in two different ways, and there were differences in
P-Values according to the model written :

First model : summary(aov(PH~Community*Mowing*Water + Error(Block)))
Error: Block
 Df Sum Sq Mean Sq F value   Pr(F)
Community  1 42.182  42.182  24.407 0.002603 **
Residuals  6 10.370   1.728
---
Signif. codes:  0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1

Error: Within
  Df Sum Sq Mean Sq F valuePr(F)
Mowing  1 40.007  40.007 21.1747 0.0002215 ***
Water   1 23.120  23.120 12.2370 0.0025673 **
Community:Mowing1 21.060  21.060 11.1467 0.0036554 **
Community:Water 1  6.901   6.901  3.6524 0.0720478 .
Mowing:Water1  1.611   1.611  0.8527 0.3680090
Community:Mowing:Water  1  0.858   0.858  0.4542 0.5089331
Residuals  18 34.008   1.889
---

- Second model (assuming that Mowing*Water are nested inside the Block
factor) :
summary(aov(PH~Community*Mowing*Water + Error(Block/(Mowing*Water

Error: Block
 Df Sum Sq Mean Sq F value   Pr(F)
Community  1 42.182  42.182  24.407 0.002603 **
Residuals  6 10.370   1.728
---
Signif. codes:  0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1

Error: Block:Mowing
Df Sum Sq Mean Sq F valuePr(F)
Mowing1 40.007  40.007  37.791 0.0008489 ***
Community:Mowing  1 21.060  21.060  19.893 0.0042820 **
Residuals 6  6.352   1.059
---
Signif. codes:  0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1

Error: Block:Water
   Df  Sum Sq Mean Sq F value  Pr(F)
Water1 23.1200 23.1200  6.0725 0.04884 *
Community:Water  1  6.9006  6.9006  1.8125 0.22685
Residuals6 22.8439  3.8073
---
Signif. codes:  0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1

Error: Block:Mowing:Water
  Df Sum Sq Mean Sq F value Pr(F)
Mowing:Water1 1.6110  1.6110  2.0085 0.2062
Community:Mowing:Water  1 0.8581  0.8581  1.0697 0.3409
Residuals   6 4.8126  0.8021

Both models give me interesting (but different!) results. Which one would
be the most appropriate?

Second question : How can I verify preliminary assumptions (normality of
residuals and variance homogeneity) in this kind of models?
When I ask R to extract residuals, the answer is NULL:

 residuals(aov(PH~Community*Mowing*Water + Error(Block/(Mowing*Water



NULL


residuals(aov(PH~Community*Mowing*Water + 

[R] How to list R object properties save workspace?

2009-07-22 Thread Matej Kovacic
Hi,

I am new to R and have a couple of questions.

I know how to list all objects (with ls()), but how to list all
properties of them?

For instance, I found function object.size(), but I would also like to
know whether one object is a dataset or just one vector (variable) or
even only one value, etc...

And another question - how to save workspace to a custom location while
running R? Is there any command for that?

Thanks,

Matej

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Memory errors when using QCA package

2009-07-22 Thread Matthew Gwynne
Hi,

I have been using the QCA package, in particular the eqmcc function
and I am having some issues when trying to use this to minimise a
particular boolean function.

The  boolean function in question has 16 variables, and I am providing
the full truth table for the function (65536 with 256 true entries),
in the following way :

library(QCA)

func_tt = read.table(func.tt,header=TRUE)
eqmcc(func_tt, outcome=O, expl.0=TRUE)

However, after calculating for a little while, the system throws up a
memory error :

Error in vector(double, length) :
  cannot allocate vector of length 2130706560


However, looking at the memory usage, I seem to have far more than 2GB free.

Is there some kind of built-in limit on the size of the heap in R? If
so, is there some way I can extend this?

Does anyone have any insight into this? Perhaps I am doing something stupid?

Thanks

Matthew

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


Re: [R] Automatic differentiation in R

2009-07-22 Thread Gabor Grothendieck
R does not currently have AD (except for the Ryacas package
which can do true AD for certain simple one line functions, i..e.
input the function and output a function representing its
derivative); however, for specific problems one can get close
using deriv and associated functions or the approach explained
below using rSymPy:

1. R has symbolic differentiation (not quite the same as AD but
it could be built upon) already:
?deriv

2. the rSymPy package on CRAN is an interface to the sympy
computer algebra system.  It is meant for symbolic manipulation
rather than AD but it can be used for semi-automatic differentiation
as in this example:

http://code.google.com/p/rsympy/#Semi-Automatic_Differentiation

You just replace the indented code with your function, suitably modified,
as in the example.

Home page is at:
http://rsympy.googlecode.com

3. the Ryacas R package on CRAN can do AD for certain simple one
line functions (and an approach similar to rSymPy is also possible):

library(Ryacas)
demo(Ryacas-Function)

Home page is at:
http://ryacas.googlecode.com

If its your intention to use it that way you would probably want
to write a short wrapper function to make it more convenient to
use; however, the basic capability is there.

4. if numeric differentiation is sufficient see:
?numericDeriv


On Wed, Jul 22, 2009 at 5:21 AM, Finlay Scott
(Cefas)finlay.sc...@cefas.co.uk wrote:
 Hi
 I recently gave a presentation about Automatic Differentiation (AD) and R at 
 the Eighth Euro AD Workshop in Oxford (17/07/09).  The presentation was 
 intended as a general introduction to R and the desire for a generic AD 
 interface for R.  During the presentation I emphasised the need and the high 
 level of interest that the R community has in developing such an interface 
 and that input from the AD community is essential to achieve it.

 The presentation seemed to generate a good level of interest and several 
 suggestions for potential directions were made.  However, it is not clear at 
 the moment what the best way is of implementing an AD interface in R in terms 
 of success, difficulty and amount of work.

 One suggestion was that it may be possible to develop it entirely in R, using 
 the S4 classes and overloading the intrinsic functions.  This may not result 
 in the fastest solution, in terms of time taken to calculate the derivatives, 
 but could result in a 'clean' interface that was relatively straightforward 
 to extend.

 Alternatively, it may be possible to make use of a pre-exisiting AD library 
 in another language (e.g. ADOL-C or the AutoDiff libraries from AD Model 
 Builder).  As these libraries are C++ based this would require functions that 
 were written in R to be parsed into C++ and then compiled before their 
 derviatives could be found.  Although this has the advantage of using work 
 that is already well developed, the parsing and compilation from R to C++ may 
 make the interface 'clunky'.

 It is likely that we won't know how successful either of these approaches 
 could be until someone actually sits down and has a go at doing it.  Is there 
 anyone out there who is interested in getting involved with this project or 
 who has advice / time to offer?

 Also, would it be possible to also post this message in the R-devel list?  I 
 realise that this would mean 'double posting' but the potential for a generic 
 AD interface affects many packages and may also be of interest to developers 
 (e.g. John Nash's 'optimx' package)

 Finlay Scott


 ***
 This email and any attachments are intended for the name...{{dropped:10}}

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


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


Re: [R] How do I delete a row from a data frame when varA == TRUE

2009-07-22 Thread David Winsemius


On Jul 22, 2009, at 4:02 AM, Uwe Ligges wrote:




Daniel Malter wrote:

XYZ=XYZ[XYZ$A==TRUE , ]



install.packages(fortunes)
library(fortunes)
fortune(==TRUE)


I've also made the repeated unnecessary invocation of which() in this  
situation. But ... the OP asked for removal rather than inclusion of  
such rows. So wouldn't he want something likef:



XYZ=XYZ[!XYZ$A , ]






Uwe Ligges


 should do. Note that this specific command
overwrites your XYZ dataframe. If you want to keep XYZ, you will  
want to

name the newly created frame differently.
HTH,
Daniel
-
cuncta stricte discussurus
-
-Ursprüngliche Nachricht-
Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org 
] Im

Auftrag von kxk
Gesendet: Wednesday, July 22, 2009 12:24 AM
An: r-help@r-project.org
Betreff: [R] How do I delete a row from a data frame when varA ==  
TRUE
I want to delete a row from a data frame XYZ where A == TRUE.   
Let's
assume there are five variables in this data frame XYZ.  My  
deletion is
based on the TRUE vs. FALSE value under variable A.  How do I do  
this?

Thanks!
My current code: for (i in 1:length(XYZ$A)) if (XYZ$A == FALSE)  
XYZ-XYZ else XYZ-

XYZ[-i,]
Error message is:
Error in if (XYZ$A == FALSE) XYZ-XYZ else XYZ- XYZ[-i,  :
missing value where TRUE/FALSE needed

Please help!!
--
View this message in context:
http://www.nabble.com/How-do-I-delete-a-row-from-a-data-frame-when-varA-%3D 
%

3D-%22TRUE%22-tp24599876p24599876.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


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


David Winsemius, MD
Heritage Laboratories
West Hartford, CT

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


[R] R help - howto suppress chm help and use text/latex help?

2009-07-22 Thread Tsunhin John Wong
Dear R Users,

I've installed R with the chm option, but eventually I found I am more
used to the normal way of latex help.
Is there any argument to suppress chm help by default when starting R?
So that I don't have to type something like help(rle,chmhelp=NULL)

I know the last resort would be to reinstall R.
Thanks in advance!

- J

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


Re: [R] animated grid graphics

2009-07-22 Thread Duncan Murdoch

On 22/07/2009 7:49 AM, Jim Lemon wrote:

Allan Engelhardt wrote:

On 21/07/09 14:00, Paul Hiemstra wrote:

Hi,

Drawing grid graphics always takes long, I would write the images to 
png's and make the animation. If you use Linux I can suggest some 
nice tools to do this. 

Hi Allan,
I often have to do this for presentations. As above, I write the images 
to PNG format, then convert to GIF format, then animate with whirlgif. 
There are other tools to do this, but it is very convenient for 
HTML-based presentations, which can be placed on the Web or a local network.


ImageMagick is another tool that can produce animated gifs.  I believe 
it can also act as a front-end to produce mpgs if you have the right 
support tools, but I don't.


For the ImageMagick syntax for animated gifs, take a look at ?movie3d in 
rgl.


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] How to list R object properties save workspace?

2009-07-22 Thread Liviu Andronic
Hello,

On Wed, Jul 22, 2009 at 1:22 PM, Matej Kovacicmatej.kova...@owca.info wrote:
 I know how to list all objects (with ls()), but how to list all
 properties of them?

 For instance, I found function object.size(), but I would also like to
 know whether one object is a dataset or just one vector (variable) or
 even only one value, etc...

 And another question - how to save workspace to a custom location while
 running R? Is there any command for that?

You could use JGR to display a list similar to what you described (via
Object browser), and to graphically save the workspace to a custom
location. JGR is a cross-platform R GUI that is more advanced than the
default GUI/terminal.

Alternatively, you can save the workspace wherever you want via save.image().
Liviu

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
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 - howto suppress chm help and use text/latex help?

2009-07-22 Thread Duncan Murdoch

On 22/07/2009 7:52 AM, Tsunhin John Wong wrote:

Dear R Users,

I've installed R with the chm option, but eventually I found I am more
used to the normal way of latex help.
Is there any argument to suppress chm help by default when starting R?
So that I don't have to type something like help(rle,chmhelp=NULL)

I know the last resort would be to reinstall R.


You will have options(chmhelp=TRUE) in one of your startup files (likely
RHOME\etc\Rprofile.site, but see ?Startup for other possibilities). 
Comment it out.


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] How to list R object properties save workspace?

2009-07-22 Thread Duncan Murdoch

On 22/07/2009 7:22 AM, Matej Kovacic wrote:

Hi,

I am new to R and have a couple of questions.

I know how to list all objects (with ls()), but how to list all
properties of them?


ls.str() gives more info than ls().  str() on a particular one gives 
more detail.




For instance, I found function object.size(), but I would also like to
know whether one object is a dataset or just one vector (variable) or
even only one value, etc...

And another question - how to save workspace to a custom location while
running R? Is there any command for that?


save.image(file=mycustomlocation)


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] R extract vertices for polygon

2009-07-22 Thread David Winsemius


On Jul 21, 2009, at 10:18 PM, Angel Marley wrote:



Dear R users,
I'm trying to extract from a given matrix (GROUP) the coordinates of  
the vertices of the different groups (i.e. 3, 7, 1 . . .) to plot  
the polygons to delineate the area in which each group wins and  
colour it diferentially. I can make a simple point plot, but I would  
like to add polygons with full colored area. The example is with a  
5x5 matrix, but I'm working with 500 x 500 matrix, so hand work is  
difficult,

Any suggestion will be welcomed.

Nrep=5
GROUP- 
matrix(c(3,3,3,3,7,3,3,3,3,7,1,3,3,3,7,1,3,3,3,7,1,1,4,4,0),Nrep,Nrep)

column- seq(1, 5, length=Nrep)
row- seq(0,10,length=Nrep)

colnames(GROUP)- round(column,3)
rownames(GROUP)- row

GROUP

grupovec-as.vector(GROUP)
flushvec-rep(column,rep(Nrep,Nrep))
MORvec-rep(row,Nrep)

plot(flushvec,MORvec, col=grupovec, pch=19)

polygon() # 

Thanks
Angel


I am having trouble figuring out what variables represents  
coordinates, but that's probably my problem and it's clear in your  
head. There are several convex hull functions that you can find with:


http://search.r-project.org/cgi-bin/namazu.cgi?query=convex+hullmax=100result=normalsort=scoreidxname=functionsidxname=Rhelp08idxname=views 



Or if the wrapping breaks that URL just:

http://search.r-project.org/

--

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] All possible linear models given multiple explaining variables

2009-07-22 Thread hadley wickham
Have a look at the meifly package, which also includes tools for
visualising the resulting models.
Hadley

On Wed, Jul 22, 2009 at 7:28 AM, Thomas A. Groentagr...@gmail.com wrote:
 Hi,

 I would like to have a script/function (or write one) that can calculate the
 linear models for all possible combinations of explaining variables.
 Eventually I would like to end up with a data base (or data frame) giving
 for each model the R2, R2adj, AIC etc.
 Currently I'm a bit stuck while writing my own script using the lm()
 function from the base package. Also, I haven't fund any function (yet) that
 can do this as well. Perhaps these functions/scripts already exist? I would
 be very grateful to any suggestions and thoughts.

 kind regards,
 Thomas

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




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

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


Re: [R] Memory errors when using QCA package

2009-07-22 Thread Allan Engelhardt
It is a little stupid, but the length of a vector is limited to 2^31-1 
entries on any platform.  A matrix is stored as a vector, so the product 
of all dimensions is also limited to 2^31-1.


Allan.

Matthew Gwynne wrote:

Hi,

I have been using the QCA package, in particular the eqmcc function
and I am having some issues when trying to use this to minimise a
particular boolean function.

The  boolean function in question has 16 variables, and I am providing
the full truth table for the function (65536 with 256 true entries),
in the following way :

library(QCA)

func_tt = read.table(func.tt,header=TRUE)
eqmcc(func_tt, outcome=O, expl.0=TRUE)

However, after calculating for a little while, the system throws up a
memory error :

Error in vector(double, length) :
  cannot allocate vector of length 2130706560


However, looking at the memory usage, I seem to have far more than 2GB free.

Is there some kind of built-in limit on the size of the heap in R? If
so, is there some way I can extend this?

Does anyone have any insight into this? Perhaps I am doing something stupid?

Thanks

Matthew

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] All possible linear models given multiple explaining variables

2009-07-22 Thread Ben Bolker



hadley wrote:
 
 Have a look at the meifly package, which also includes tools for
 visualising the resulting models.
 Hadley
 
 On Wed, Jul 22, 2009 at 7:28 AM, Thomas A. Groentagr...@gmail.com wrote:
 Hi,

 I would like to have a script/function (or write one) that can calculate
 the
 linear models for all possible combinations of explaining variables.
 Eventually I would like to end up with a data base (or data frame) giving
 for each model the R2, R2adj, AIC etc.
 Currently I'm a bit stuck while writing my own script using the lm()
 function from the base package. Also, I haven't fund any function (yet)
 that
 can do this as well. Perhaps these functions/scripts already exist? I
 would
 be very grateful to any suggestions and thoughts.

 kind regards,
 Thomas

 
 

Also try the MuMIn package from r-forge , and possibly the leaps package.

-- 
View this message in context: 
http://www.nabble.com/All-possible-linear-models-given-multiple-explaining-variables-tp24605474p24606776.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] Rcmdr GUI goes into loop via alt+backspace under Windows OS

2009-07-22 Thread Robert W. Baer, Ph.D.
It just produces the bell sound on my 32-bit windows XP machine runing R 
2.9.1


Is this really a standard combination?  I know a  lot of programs that use 
ctrl-Z, but I've never come across this shortcut key combination for undo.



- Original Message - 
From: tradenet nodeco...@yahoo.com

To: r-help@r-project.org
Sent: Tuesday, July 21, 2009 5:39 PM
Subject: [R] Rcmdr GUI goes into loop via alt+backspace under Windows OS




I'm using Rcmdr version 1.4-10 with R version 2.9.0 under Vista x64.

A standard editing convention under Windows is that alt+backspace is a
keyboard shortcut for undo.  I often find myself hitting the [alt] and
[backspace] keys while editing scripts in Rcmdr. However, this causes the
Rcmdr GUI to go into a crazy mode where the menu keeps flashing and the 
GUI

is unresponsive.  Sometimes after several minutes, the GUI menus stop
sporadically flashing and the GUI becomes responsive again, but usually I
have to kill R.

Has anyone else seen this problem and might there be a fix for it?

If it weren't for the fact that the particular key combination is a 
standard
in Windows I would ignore the problem, but I often get trapped by it 
because
the GUI handles this standard Windows key combination is such a bizzare 
way.


I'd appreciate any suggestions you might have.

Regards,

Andrew
--
View this message in context: 
http://www.nabble.com/Rcmdr-GUI-goes-into-loop-via-alt%2Bbackspace-under-Windows-OS-tp24597087p24597087.html

Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html

and provide commented, minimal, self-contained, reproducible code.



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


[R] How to dynamically generate lm() function arguments?

2009-07-22 Thread Moumita Das
Hi All,
How do you dynamically generate the arguments for the lm() function when
your items vary for each database.
Say in my case for a particular database i have items from i1 to i15 .

In the code below there a line like this :--
 item_cat_fit-lm(as.numeric(item_item_table$i1) ~
as.numeric(item_item_table$i2) + as.numeric(item_category_table$i3)  ) *#
this gives proper results,i am accessing each column of the dataset using
column names.
*
how do i dynamically generate this :---
item_cat_fit-lm(as.numeric(item_item_table[item_item_dependent_var_counter])
~  as.numeric(item_item_table[item_item_independent_var_counter ] ) )

*Because of this as.numeric(item_item_table[item_item_dependent_var_counter])
i get error that you cannot convert a list to double.I tried doing this
as.numeric(as.matrix(item_item_table[item_item_dependent_var_counter]))*

I also tried doing this
mode(item_item_table[item_item_dependent_var_counter])-numeric  but of no
use.

for(item_item_dependent_var_counter in 1:item_item_size[1])  # no of all
items
 {


  for(item_item_independent_var_counter in 1:(item_item_size[1] - 1))
  {


item_item_third_var_data-contrld_third_var(stringOfItemItemToDataFrameOfItemItem[item_item_dependent_var_counter,1],x-stringOfItemItemToDataFrameOfItemItem,item__table,regr_type-ii)


 item_cat_fit-lm(as.numeric(item_item_table$i1) ~
as.numeric(item_item_table$i2) )
 item_cat_fit-lm(as.numeric(item_item_table[item_item_dependent_var_counter])
~  as.numeric(item_item_table[item_item_independent_var_counter ] ) )

#print(summary(item_item_fit))
   }
}

How can the lm() arguments be generated dynamically.?Would be grateful if
anyone can come up with a solution for my problem.
-- 
Thanks
Moumita

[[alternative HTML version deleted]]

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


Re: [R] Collinearity in Linear Multiple Regression

2009-07-22 Thread Stephan Kolassa

Hi Alex,

I personally have had more success with the (more complicated) 
collinearity diagnostics proposed by Belsley, Kuh  Welsch in their book 
Regression Diagnostics than with Variance Inflation Factors. See also:


Belsley, D. A. A Guide to using the collinearity diagnostics. 
Computational Economics, 1991, 4, 33-50


However, I know of no R package that implements these diagnostics. 
Anyway, it's not hard to do so oneself.


Good luck!
Stephan


Alex Roy schrieb:

Dear all,
  How can I test for collinearity in the predictor data set
for multiple linear regression.

Thanks

Alex

[[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] contour plot

2009-07-22 Thread axionator
Hi,
I want to draw a contour plot of the following function:

z = y*x + epsilon,

where x ~ N(y, 1)
and epsilon ~ N(0, sigma) with sigma fixed (e.g. 1)

But didnt manage to feed contour with the right input.

Thanks for your help.
Armin

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

2009-07-22 Thread Mark Knecht
Hi,
   I looked in the language definition and was surprised. Is there
really no multi-line/block comment defined in R?

   I wanted to comment out 20 lines that I'm moving to a function but
didn't want to delete them. Is there no defined way to get around
using a # on each of the 20 lines?

Thanks,
Mark

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

2009-07-22 Thread Jun Shen
Thanks to Deepayan's suggestion, I was able to use boxplot.stats to specify
type=6 to calculate quantiles by creating my own stats function as follows,

my.boxplot.stats-function(y,subscripts,...)boxplot.stats(quantile(y,type=6),...)


And then call bwplot(Result~Group,data=d2,stats=my.boxplot.stats)


However the whisker lines are missing when there are outliers. Also not all
the outliers are drawn but only the maximum or the minimum.  I appreciate
any comment from the group. Thanks.

Jun

On Tue, Jul 21, 2009 at 10:20 AM, Deepayan Sarkar deepayan.sar...@gmail.com
 wrote:

 On Tue, Jul 21, 2009 at 7:47 AM, Jun Shenjun.shen...@gmail.com wrote:
  Uwe,
 
  Thank you for your reply.  I am still not very clear about the meanings
 of
  the arguments in the stats function.   To make it clearer, quantile()
 uses
  type=7 as default method. I believe this is the method bwplot() uses to
  calculate the quantiles. I want to use type=6 method for bwplot(). How do
 I
  achieve that? Thanks again.

 Maybe this will be clearer: bwplot() uses the boxplot.stats() function
 to compute the quantiles used, which in turn uses fivenum(), which
 has its own quantile calculation (and does not explicitly use
 quantile()). There is no easy way to allow for type=6 etc. here.

 bwplot() allows you to replace boxplot.stats() and provide your own
 alternative. So what you need to do is:

 (1) write a function, say, 'my.boxpot.stats', that takes the same
 arguments as boxplot.stats() and returns a similar result, but using
 your preferred calculation for the quantiles. There are many ways to
 do this.

 (2) plug in this function into the bwplot() call; e.g. bwplot(...,
 stats = my.boxplot.stats)

 -Deepayan


 
  Jun
 
  2009/7/21 Uwe Ligges lig...@statistik.tu-dortmund.de
 
 
 
  Jun Shen wrote:
 
  Hi, everyone,
 
  Since quantile calculation has nine different methods in R, I wonder
 how I
  specify a method when calling the bwplot() in lattice. I couldn't find
 any
  information in the documentation. Thanks.
 
 
 
  bwplot() uses the panel function panel.bwplot() which allows to specify
 a
  function that calculates the statistics in its argument stats that
 defaults
  to boxplot.stats(). Hence you can change that function.
 
  Example with some fixed values:
 
  bwplot( ~ 1:10,
 stats = function(x, ...)
 return(list(stats=1:5, n=10, conf=1, 10, out=integer(0)))
  )
 
 
  Uwe Ligges
 
 
 [[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.
 




-- 
Jun Shen PhD
PK/PD Scientist
BioPharma Services
Millipore Corporation
15 Research Park Dr.
St Charles, MO 63304
Direct: 636-720-1589

[[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] time difference

2009-07-22 Thread Erin Hodgess
Dear R People:

I am looking at the ctime attribute of two different files.  It
contains the year, month, day, time of creation and time zone.

Is there a way to determine the difference between the ctimes of two
files, please?

I looked in the chron package and nothing seemed to work.

Thanks in advance,
Sincerely,
Erin


-- 
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodg...@gmail.com

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


Re: [R] Split plot analysis problems

2009-07-22 Thread Mark Difford

Hi Jean-Paul,

 ... since R is not able to extract residuals?

R can extract the residuals, but they are a hidden in models with an error
structure

##
str(aov(PH~Community*Mowing*Water + Error(Block)))
residuals(aov(PH~Community*Mowing*Water + Error(Block))$Block)
residuals(aov(PH~Community*Mowing*Water + Error(Block))$Within)

Regards, Mark.


Jean-Paul Maalouf wrote:
 
 Hello,
 
 I would be very grateful if someone could give me a hand with my split  
 plot design problems.
 
 So here is my design :
 I am studying the crossed-effects of water (wet/dry) and mowing  
 (mowed/not-mowed = nm) on plant height (PH) within 2 types of plant  
 communities (Xerobromion and Mesobromion) :
 - Within each type of communities, I have localised 4 blocks
 - In each block, I have defined 4 plots in order to have the 4  
 possible treatments of both the water and mowing factors : nm/dry ;  
 mowed/dry ; mowed/wet ; nm/wet.
 
 Here is my data table :
 
 Community Block Mowing WaterPH
 1   Mesob1  Mowed   Wet  7.40
 2   Mesob1 nm   Wet 13.10
 3   Mesob1  Mowed   Dry  5.55
 4   Mesob1 nm   Dry 10.35
 5   Mesob2 nm   Dry 10.70
 6   Mesob2  Mowed   Dry  6.38
 7   Mesob2 nm   Wet  9.75
 8   Mesob2  Mowed   Wet  6.35
 9   Mesob3 nm   Wet  9.60
 10  Mesob3  Mowed   Dry  5.10
 11  Mesob3 nm   Dry 10.05
 12  Mesob3  Mowed   Wet  6.25
 13  Mesob4 nm   Wet  9.00
 14  Mesob4  Mowed   Wet  6.50
 15  Mesob4 nm   Dry  7.75
 16  Mesob4  Mowed   Dry  5.90
 17  Xerob5 nm   Wet  7.69
 18  Xerob5  Mowed   Wet  8.11
 19  Xerob5 nm   Dry  3.98
 20  Xerob5  Mowed   Dry  3.69
 21  Xerob6 nm   Wet  5.24
 22  Xerob6  Mowed   Wet  4.22
 23  Xerob6 nm   Dry  6.55
 24  Xerob6  Mowed   Dry  4.40
 25  Xerob7  Mowed   Dry  3.79
 26  Xerob7 nm   Dry  3.91
 27  Xerob7 nm   Wet  9.00
 28  Xerob7  Mowed   Wet  8.50
 29  Xerob8  Mowed   Dry  3.33
 30  Xerob8 nm   Wet  6.25
 31  Xerob8  Mowed   Wet  8.00
 32  Xerob8 nm   Dry  6.33
 
 I actually have 2 questions :
 I wrote my model in two different ways, and there were differences in  
 P-Values according to the model written :
 
 First model : summary(aov(PH~Community*Mowing*Water + Error(Block)))
 Error: Block
Df Sum Sq Mean Sq F value   Pr(F)
 Community  1 42.182  42.182  24.407 0.002603 **
 Residuals  6 10.370   1.728
 ---
 Signif. codes:  0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1
 
 Error: Within
 Df Sum Sq Mean Sq F valuePr(F)
 Mowing  1 40.007  40.007 21.1747 0.0002215 ***
 Water   1 23.120  23.120 12.2370 0.0025673 **
 Community:Mowing1 21.060  21.060 11.1467 0.0036554 **
 Community:Water 1  6.901   6.901  3.6524 0.0720478 .
 Mowing:Water1  1.611   1.611  0.8527 0.3680090
 Community:Mowing:Water  1  0.858   0.858  0.4542 0.5089331
 Residuals  18 34.008   1.889
 ---
 
 - Second model (assuming that Mowing*Water are nested inside the Block  
 factor) :
 summary(aov(PH~Community*Mowing*Water + Error(Block/(Mowing*Water
 
 Error: Block
Df Sum Sq Mean Sq F value   Pr(F)
 Community  1 42.182  42.182  24.407 0.002603 **
 Residuals  6 10.370   1.728
 ---
 Signif. codes:  0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1
 
 Error: Block:Mowing
   Df Sum Sq Mean Sq F valuePr(F)
 Mowing1 40.007  40.007  37.791 0.0008489 ***
 Community:Mowing  1 21.060  21.060  19.893 0.0042820 **
 Residuals 6  6.352   1.059
 ---
 Signif. codes:  0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1
 
 Error: Block:Water
  Df  Sum Sq Mean Sq F value  Pr(F)
 Water1 23.1200 23.1200  6.0725 0.04884 *
 Community:Water  1  6.9006  6.9006  1.8125 0.22685
 Residuals6 22.8439  3.8073
 ---
 Signif. codes:  0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1
 
 Error: Block:Mowing:Water
 Df Sum Sq Mean Sq F value Pr(F)
 Mowing:Water1 1.6110  1.6110  2.0085 0.2062
 Community:Mowing:Water  1 0.8581  0.8581  1.0697 0.3409
 Residuals   6 4.8126  0.8021
 
 Both models give me interesting (but different!) results. Which one  
 would be the most appropriate?
 
 Second question : How can I verify preliminary assumptions (normality  
 of residuals and variance homogeneity) in this kind of models?
 When I ask R to extract residuals, the answer is NULL:
 
 residuals(aov(PH~Community*Mowing*Water + Error(Block/(Mowing*Water
 NULL
 residuals(aov(PH~Community*Mowing*Water + Error(Block)))
 NULL
 
 A huge thanks to the one who will rescue (or at least try to rescue) my
 PhD!
 
 Sincerely,
 
 
 -- 
 Jean-Paul Maalouf
 UMR 1202 BIOGECO
 Inra - Université Bordeaux 1
 Bâtiment B8, Avenue des 

Re: [R] How to dynamically generate lm() function arguments?

2009-07-22 Thread Gabor Grothendieck
Using the built in anscombe data frame we can regress y1 on x2 and x4 like this
(place the response first):

lm(anscombe[c(y1, x2, x4)])


On Wed, Jul 22, 2009 at 9:50 AM, Moumita
Dasdas.moumita.onl...@gmail.com wrote:
 Hi All,
 How do you dynamically generate the arguments for the lm() function when
 your items vary for each database.
 Say in my case for a particular database i have items from i1 to i15 .

 In the code below there a line like this :--
  item_cat_fit-lm(as.numeric(item_item_table$i1) ~
 as.numeric(item_item_table$i2) + as.numeric(item_category_table$i3)  ) *#
 this gives proper results,i am accessing each column of the dataset using
 column names.
 *
 how do i dynamically generate this :---
 item_cat_fit-lm(as.numeric(item_item_table[item_item_dependent_var_counter])
 ~  as.numeric(item_item_table[item_item_independent_var_counter ] ) )

 *Because of this as.numeric(item_item_table[item_item_dependent_var_counter])
 i get error that you cannot convert a list to double.I tried doing this
 as.numeric(as.matrix(item_item_table[item_item_dependent_var_counter]))*

 I also tried doing this
 mode(item_item_table[item_item_dependent_var_counter])-numeric  but of no
 use.

 for(item_item_dependent_var_counter in 1:item_item_size[1])  # no of all
 items
  {


      for(item_item_independent_var_counter in 1:(item_item_size[1] - 1))
      {


 item_item_third_var_data-contrld_third_var(stringOfItemItemToDataFrameOfItemItem[item_item_dependent_var_counter,1],x-stringOfItemItemToDataFrameOfItemItem,item__table,regr_type-ii)


  item_cat_fit-lm(as.numeric(item_item_table$i1) ~
 as.numeric(item_item_table$i2) )
  item_cat_fit-lm(as.numeric(item_item_table[item_item_dependent_var_counter])
 ~  as.numeric(item_item_table[item_item_independent_var_counter ] ) )

                            #print(summary(item_item_fit))
       }
 }

 How can the lm() arguments be generated dynamically.?Would be grateful if
 anyone can come up with a solution for my problem.
 --
 Thanks
 Moumita

        [[alternative HTML version deleted]]

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


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


Re: [R] Multi-line comments?

2009-07-22 Thread Gabor Grothendieck
Try
if (FALSE) { ... }

On Wed, Jul 22, 2009 at 10:30 AM, Mark Knechtmarkkne...@gmail.com wrote:
 Hi,
   I looked in the language definition and was surprised. Is there
 really no multi-line/block comment defined in R?

   I wanted to comment out 20 lines that I'm moving to a function but
 didn't want to delete them. Is there no defined way to get around
 using a # on each of the 20 lines?

 Thanks,
 Mark

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

2009-07-22 Thread Paul Hiemstra

Mark Knecht wrote:

Hi,
   I looked in the language definition and was surprised. Is there
really no multi-line/block comment defined in R?

   I wanted to comment out 20 lines that I'm moving to a function but
didn't want to delete them. Is there no defined way to get around
using a # on each of the 20 lines?

Thanks,
Mark

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

Hi,

This issue has come up before, and as far as I know there is no 
multiline comment. However, there are a few ways of commenting out 
larges pieces of code.


- Use a good text editor, Kate (KDE) allows you to select the 20 lines 
and press Ctrl-D to comment them all at once.

- Use a setup like:
if(FALSE) {
line1
...
line20
}

And set FALSE to TRUE if you want to let the code be executed.

These are probably not the only ones, but this is what I could think of 
right now.


cheers and good luck,
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] All possible linear models given multiple explaining variables

2009-07-22 Thread Paul Hiemstra

Thomas A. Groen wrote:

Hi,
 
I would like to have a script/function (or write one) that can calculate the

linear models for all possible combinations of explaining variables.
Eventually I would like to end up with a data base (or data frame) giving
for each model the R2, R2adj, AIC etc.
Currently I'm a bit stuck while writing my own script using the lm()
function from the base package. Also, I haven't fund any function (yet) that
can do this as well. Perhaps these functions/scripts already exist? I would
be very grateful to any suggestions and thoughts.
 
kind regards,

Thomas

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

Hi,

Take a look at the step() command.

cheers,
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] Multi-line comments?

2009-07-22 Thread Michael Knudsen
On Wed, Jul 22, 2009 at 4:30 PM, Mark Knechtmarkkne...@gmail.com wrote:

   I wanted to comment out 20 lines that I'm moving to a function but
 didn't want to delete them. Is there no defined way to get around
 using a # on each of the 20 lines?

Just like you, I have been longing for that myself. It seems that the
answer is negative, so I have ended up using

if (1==0)
{
   # code goes here
}

although is not really nice to look at.

-- 
Michael Knudsen
micknud...@gmail.com
http://lifeofknudsen.blogspot.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] adding p-value to a correlogram

2009-07-22 Thread Alon Ben-Ari
Hello,

I am trying to plot a  correlogram and add the correlation coefficient
and p-value.
This is the code I am using :

pairs(d,
  gap = 0,
  lower.panel = panel.smooth,
  upper.panel = function (x,y) {
panel.smooth(x,y)
par(usr = c(0, 1, 0, 1))
a - cor(x,y,use=pairwise.complete.obs,method=spearman)
a.p.value=cor.test(x,y,use=pairwise.complete.obs,method=kendall)

text(.1,.9,
 adj=c(0,1),
 round(a, digits=2),
 col='blue',
 cex=2*a)
text (0.9,0.9,round(a.p.value,digits=2),col='blue',cex=2*a.p.value)
  })

I get the error
In cor.test.default(x, y, use = pairwise.complete.obs, method = kendall) :
  Cannot compute exact p-value with ties
And it will not print the p-values. Any ideas how to work around this issue?

R:2.8
Linux openSUSE 11.1

Thanks,

Alon

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


Re: [R] Multi-line comments?

2009-07-22 Thread Barry Rowlingson
On Wed, Jul 22, 2009 at 3:30 PM, Mark Knechtmarkkne...@gmail.com wrote:
 Hi,
   I looked in the language definition and was surprised. Is there
 really no multi-line/block comment defined in R?

   I wanted to comment out 20 lines that I'm moving to a function but
 didn't want to delete them. Is there no defined way to get around
 using a # on each of the 20 lines?

 Hmmm I think this might be a FAQ... Usual suggestions are:

 1. use an editor that can do un/commenting of regions.

 2. Stick it in an if(FALSE){ ... } block, but that's only good if
it's syntactically correct.

 I prefer:

 3. Manage your code under a decent SCM and don't fear the delete.

Barry

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


Re: [R] time difference

2009-07-22 Thread David Huffer
On Wednesday, July 22, 2009 10:44 AM, Erin Hodgess wrote:

  ...I am looking at the  ctime  attribute  of
  two  different  files. It contains the year,
  month, day, time of creation and time  zone.
  Is  there  a way to determine the difference
  between the ctimes of two files, please...

are you looking for something different from

file1 - file.info ( '~/Desktop/file1.txt' ) $ ctime
file1
   [1] 2009-07-20 16:35:17 EDT
file2 - file.info ( '~/Desktop/file2.txt' ) $ ctime
file2
   [1] 2009-02-12 18:58:47 EST
file1 - file2
   Time difference of 157.8587 days
   

David

--
 David
 
 -
 David Huffer, Ph.D.   Senior Statistician
 CSOSA/Washington, DC   david.huf...@csosa.gov

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


Re: [R] time difference

2009-07-22 Thread Gabor Grothendieck
Try this:

 file.info(abc.R)$ctime - file.info(aa.R)$ctime
Time difference of 228.9912 days


On Wed, Jul 22, 2009 at 10:44 AM, Erin Hodgesserinm.hodg...@gmail.com wrote:
 Dear R People:

 I am looking at the ctime attribute of two different files.  It
 contains the year, month, day, time of creation and time zone.

 Is there a way to determine the difference between the ctimes of two
 files, please?

 I looked in the chron package and nothing seemed to work.

 Thanks in advance,
 Sincerely,
 Erin


 --
 Erin Hodgess
 Associate Professor
 Department of Computer and Mathematical Sciences
 University of Houston - Downtown
 mailto: erinm.hodg...@gmail.com

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


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


Re: [R] Multi-line comments?

2009-07-22 Thread Jonathan Baron
On 07/22/09 07:30, Mark Knecht wrote:
 Hi,
I looked in the language definition and was surprised. Is there
 really no multi-line/block comment defined in R?
 
I wanted to comment out 20 lines that I'm moving to a function but
 didn't want to delete them. Is there no defined way to get around
 using a # on each of the 20 lines?

This topic has come up before and the answer seems to be no, although
you can do tricky things like defining a function containing the
comment as a quoted string (beginning and ending with quote marks), or
putting a quoted string after an if() for a condition that isn't met.
It helps that line breaks are allowed in quoted strings.

However

With (x)emacs and ESS, you can say
M-x comment-region
after defining a region with point and mark.

I got tired of typing this, so I defined the following in my
.xemacs/init.el and .emacs files:

(global-set-key \M-r 'comment-region)

So now I do it with alt-R.  That key may have had some other
purpose, but not one I ever used.

I think the alt key is something else on a Mac.  And I have no idea
whether this will work on Windows.

Jon
-- 
Jonathan Baron, Professor of Psychology, University of Pennsylvania
Home page: http://www.sas.upenn.edu/~baron

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


Re: [R] Multi-line comments?

2009-07-22 Thread Erik Iverson
What editor are you all using to write R code?  Many will have ways of doing 
what you want, e.g., comment-region (bound  by default to M-; through 
comment-dwim) in Emacs. 

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Michael Knudsen
Sent: Wednesday, July 22, 2009 9:55 AM
To: Mark Knecht
Cc: r-help
Subject: Re: [R] Multi-line comments?

On Wed, Jul 22, 2009 at 4:30 PM, Mark Knechtmarkkne...@gmail.com wrote:

   I wanted to comment out 20 lines that I'm moving to a function but
 didn't want to delete them. Is there no defined way to get around
 using a # on each of the 20 lines?

Just like you, I have been longing for that myself. It seems that the
answer is negative, so I have ended up using

if (1==0)
{
   # code goes here
}

although is not really nice to look at.

-- 
Michael Knudsen
micknud...@gmail.com
http://lifeofknudsen.blogspot.com/

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

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


Re: [R] Multi-line comments?

2009-07-22 Thread Michael Knudsen
On Wed, Jul 22, 2009 at 5:27 PM, Erik Iversoneiver...@nmdp.org wrote:

 What editor are you all using to write R code?  Many will have ways of doing 
 what you want, e.g., comment-region (bound  by default to M-; through 
 comment-dwim) in Emacs.

Cool! I'm using Xcode, and I have just realized that cmd+/ will make a
block comment. By default it adds '//' instead of '#', but I guess
that it can be fixed somehow.

-- 
Michael Knudsen
micknud...@gmail.com
http://lifeofknudsen.blogspot.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] How to replace NAs in a vector of factors?

2009-07-22 Thread Gene Leynes
Thank you so much, I'm humbled by the response from such great authors and
scholars.  I thought I would share the final version that worked perfectly
in my illustrative example, as well as the real one.

My main confusion was this part:
 db1$olditems[db1$olditems=='']
[1]
Levels:  nuts soup
I thought it was only one item, but really it's all three.  Only the first
one labeled with [1]

A side note, I don't understand the motivation to use within when simple
subsetting works using $ or [
Maybe it's important if the data frame has a really long name?
# To me, this is easier to read:
db1$olditems = factor(db1$olditems))
# Than this
db1 - within(db1, olditems - factor(olditems))

Here is my code example working, thanks to the generous feedback:

#A little function I always have loaded:
# (which, incidentally, was inspired by Modern Applied Statistics with S
page 33)
factors=function(x)levels(x)[x]

# The data.frame option stringsAsFactors=FALSE would have been perfect to
use here,
# but in my real example I can't re-import the data
db1 - data.frame(
   olditems = c('soup','','','','nuts'),
   prices = c(4.45, 3.25, 4.42, 2.25, 3.98))
db2 - data.frame(
   newitems = c('stew','crackers','tofu','goatsmilk','peanuts'))

db1$olditems[db1$olditems==''] #it looks like only one item is
returned
length(db1$olditems[db1$olditems=='']) #but all three are actually returned

db1$olditems=factors(db1$olditems) #converts the factors to strings
db1$olditems[db1$olditems=='']=NA  #replaces blanks with NA

#Note: this only works when db2 is in same order as db1
db1$olditems[is.na(db1$olditems)]=
factors(db2$newitems[is.na(db1$olditems)])
db1$olditems=factor(db1$olditems)  #I like to use factors b/c they
inherently
   # give a count of unique values
db1$olditems   #Success!

On Tue, Jul 21, 2009 at 8:22 PM, bill.venab...@csiro.au wrote:

 Couple of points:

 1. if you are going to be replacing entries in factors with updated levels,
 it's probably easier if you start with your strings remaining as strings as
 they go into the data frames.  So here is how I would start your example


 db1 - data.frame(
olditems = c('soup','','','','nuts'),
 prices = c(4.45, 3.25, 4.42, 2.25, 3.98),
stringsAsFactors = FALSE)
 db2 - data.frame(
newitems = c('stew','crackers','tofu','goatsmilk','peanuts'),
stringsAsFactors = FALSE)


 2. Strings with zero characters are still strings (like zero is still a
 number).  They are not missing.  If you want them to be made missing you can
 do so afterwards with:


  zero length strings become NA
 is.na(db1$olditems[db1$olditems == '']) - TRUE


 3. Now to replace the missing values with the corresponding ones from the
 second data frame:


 k - is.na(db1$olditems)
 db1[k, olditems] - db2[k, newitems]


 4. Check

  db1
   olditems prices
 1  soup   4.45
 2  crackers   3.25
 3  tofu   4.42
 4 goatsmilk   2.25
 5  nuts   3.98
 

 5. If you really do want factors rather than character strings, you can now
 change back:

 db1 - within(db1, olditems - factor(olditems)) ## use - here!

 6. check the difference

  str(db1)
 'data.frame':   5 obs. of  2 variables:
  $ olditems: Factor w/ 5 levels crackers,goatsmilk,..: 4 1 5 2 3
  $ prices  : num  4.45 3.25 4.42 2.25 3.98
 



 Bill Venables
 http://www.cmis.csiro.au/bill.venables/


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
 On Behalf Of Gene Leynes
 Sent: Wednesday, 22 July 2009 10:39 AM
 To: r-help@r-project.org
 Subject: [R] How to replace NAs in a vector of factors?

 # Just when I thought I had the basic stuff mastered
 # This has been quite perplexing, thanks for any help


 ## Here's the example:

 db1=data.frame(
olditems=c('soup','','','','nuts'),
prices=c(4.45, 3.25, 4.42, 2.25, 3.98))
 db2=data.frame(
newitems=c('stew','crackers','tofu','goatsmilk','peanuts'))

 str(db1)#factors and prices
 str(db2)#new names, but I want *only* the updates

 is.na(db1$olditems)  #a little surprising that '' is not equal to NA
 db1$olditems=='' #oh good, at least I can get to the blanks this way
 db1$olditems[db1$olditems=='']  #wait, only one item is returned?
 db1[db1$olditems=='',]  #somehow this works!

 #how would I get the new item names into the old items column of db1??
 # I was expecting that this would work:
 #db1$olditems[db1$olditems=='']=
 #db2$newitems[db1$olditems=='']

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

Re: [R] time difference

2009-07-22 Thread Dirk Eddelbuettel

On 22 July 2009 at 09:44, Erin Hodgess wrote:
| I am looking at the ctime attribute of two different files.  It
| contains the year, month, day, time of creation and time zone.

[ Well only if you convert it to POSIXlt... ]

| Is there a way to determine the difference between the ctimes of two
| files, please?

Just use '-' or the difftime() functions. As help(file.info) clearly states, the
class of the ctime component is a standard POSIXct and your problem reduces
to the common difference between two POSIXct times.  Which R happens to excel 
at:

 bashrc - file.info(~/.bashrc)$ctime
 Rprofile - file.info(~/.Rprofile)$ctime
 Rprofile - bashrc
Time difference of 52.57426 days
 difftime(Rprofile, bashrc, units=weeks)
Time difference of 7.510608 weeks

See ?difftime for other units, and use as.numeric() to cast to just a number.

Hth, Dirk 

-- 
Three out of two people have difficulties with fractions.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] IDE's/Editors for R-- Was: Multi-line comments?

2009-07-22 Thread Bert Gunter
You can find a list of IDE's/R code editors for R here:
http://www.sciviews.org/_rgui/projects/Editors.html

However, this is somewhat dated, and you may find others not here just by
googling on R Editor, R IDE, etc.

Bert Gunter
Genentech Nonclinical Biostatistics

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Michael Knudsen
Sent: Wednesday, July 22, 2009 8:35 AM
To: Erik Iverson
Cc: r-help
Subject: Re: [R] Multi-line comments?

On Wed, Jul 22, 2009 at 5:27 PM, Erik Iversoneiver...@nmdp.org wrote:

 What editor are you all using to write R code?  Many will have ways of
doing what you want, e.g., comment-region (bound  by default to M-; through
comment-dwim) in Emacs.

Cool! I'm using Xcode, and I have just realized that cmd+/ will make a
block comment. By default it adds '//' instead of '#', but I guess
that it can be fixed somehow.

-- 
Michael Knudsen
micknud...@gmail.com
http://lifeofknudsen.blogspot.com/

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

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


Re: [R] Rcmdr GUI goes into loop via alt+backspace under Windows OS

2009-07-22 Thread tradenet

Robert,

Alt+Backspace is a standard global shortcut key shortcut key for most
Windows programs (Word, Excel, Visual Studio, Notepad, Wordpad.  It is
equivalent to Ctrl+Z

It has been around since at least windows 98:
http://www.microsoft.com/enable/products/KeyboardSearch_98.aspx

I wished alt+backspace performed the same action under Vista x64, or rang a
bell like it does on your machine.

Thanks for the feedback.

Regards,


Andrew



Robert Baer wrote:
 
 It just produces the bell sound on my 32-bit windows XP machine runing R 
 2.9.1
 
 Is this really a standard combination?  I know a  lot of programs that
 use 
 ctrl-Z, but I've never come across this shortcut key combination for undo.
 
 
 - Original Message - 
 From: tradenet nodeco...@yahoo.com
 To: r-help@r-project.org
 Sent: Tuesday, July 21, 2009 5:39 PM
 Subject: [R] Rcmdr GUI goes into loop via alt+backspace under Windows OS
 
 

 I'm using Rcmdr version 1.4-10 with R version 2.9.0 under Vista x64.

 A standard editing convention under Windows is that alt+backspace is a
 keyboard shortcut for undo.  I often find myself hitting the [alt] and
 [backspace] keys while editing scripts in Rcmdr. However, this causes the
 Rcmdr GUI to go into a crazy mode where the menu keeps flashing and the 
 GUI
 is unresponsive.  Sometimes after several minutes, the GUI menus stop
 sporadically flashing and the GUI becomes responsive again, but usually I
 have to kill R.

 Has anyone else seen this problem and might there be a fix for it?

 If it weren't for the fact that the particular key combination is a 
 standard
 in Windows I would ignore the problem, but I often get trapped by it 
 because
 the GUI handles this standard Windows key combination is such a bizzare 
 way.

 I'd appreciate any suggestions you might have.

 Regards,

 Andrew
 -- 
 View this message in context: 
 http://www.nabble.com/Rcmdr-GUI-goes-into-loop-via-alt%2Bbackspace-under-Windows-OS-tp24597087p24597087.html
 Sent from the R help mailing list archive at Nabble.com.

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

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

-- 
View this message in context: 
http://www.nabble.com/Rcmdr-GUI-goes-into-loop-via-alt%2Bbackspace-under-Windows-OS-tp24597087p24609888.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] Multi-line comments?

2009-07-22 Thread Mark Knecht
Thanks Gabor and EVERYONE else who answered so quickly.

On Wed, Jul 22, 2009 at 7:50 AM, Gabor
Grothendieckggrothendi...@gmail.com wrote:
 Try
 if (FALSE) { ... }

 On Wed, Jul 22, 2009 at 10:30 AM, Mark Knechtmarkkne...@gmail.com wrote:
 Hi,
   I looked in the language definition and was surprised. Is there
 really no multi-line/block comment defined in R?

   I wanted to comment out 20 lines that I'm moving to a function but
 didn't want to delete them. Is there no defined way to get around
 using a # on each of the 20 lines?

 Thanks,
 Mark

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] Symmetrically Trimmed Least Squares (STLS) Regression Analysis Help

2009-07-22 Thread Vivek Ayer
Hi all,

Just started using R recently. Got OLS and Truncated Regression to
work via lm() and truncreg(). But we need to use STLS for our data. Is
there a function out there that does this, or can we use a clever
workaround using what we already have?

Thanks in advance,
Vivek Ayer

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


Re: [R] Collinearity in Linear Multiple Regression

2009-07-22 Thread Stephan Kolassa

Hi Tim,

Variance proportions (and condition indices) are exactly the tools
described in Belsley, Kuh  Welsch, Regression Diagnostics - see my 
previous post. Good to see I'm not the only one to use them! BKW also 
describe in detail how to calculate all this using SVD, so you don't 
need to use SAS...


And I certainly agree that a problematic system means that you need to 
do more work - probably either collect more data or refine your research 
agenda, as collinearity may just be inherent in the independent 
variables you have been collecting.


Best,
Stephan


Tim Paysen schrieb:

Actually, the CI index and VIF are just a start.  It is best to look
at what they call a matrix of variance proportions (found in SAS
and a few other places...)--which hardly anyone understands
(including the SAS folks).  It is a matrix of estimates of what the
variences of the regression coefficients would be if you could figure
them out in the first place.  It shows which factors dominate over
others IN THE PARTICULAR SETUP you are analyzing.  The matrix is
often calculated using eigenvalues, but is best done with Singular
Value Decomposition techniques (you don't have to have a square
matrix, and you maintain better precision).  Analysts will say that
it can display an unstable system -- which is correct, but they
generally say that, if its true, you have bad data and should throw
it out--or collect more.  I suggest care, because it may be
illustrating the nature of the system you are studying.

The only decent reference that I know of is a little book (hard to
read) that I can't remember off the top of my head.  Have to look it
up.

Timothy E. Paysen, Phd Research Forester (ret.)




 From: John Sorkin
jsor...@grecc.umaryland.edu To: Alex Roy alexroy2...@gmail.com;
r-help@r-project.org Sent: Tuesday, July 21, 2009 4:19:11 AM Subject:
Re: [R] Collinearity in Linear Multiple Regression

I suggest you start by doing some reading about Condition index (CI)
and variation inflation factor (VIF). Once you have reviewed the
theory, a search of search.r-project.org (under the help menu in a
windows-based R installation) for VIF will help you obtain values for
VIF, c.f. http://finzi.psych.upenn.edu/R/library/HH/html/vif.html 
John


John David Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics 
University of Maryland School of Medicine Division of Gerontology 
Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) 
Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913

(Please call phone number above prior to faxing)


Alex Roy alexroy2...@gmail.com 7/21/2009 7:01 AM 
Dear all, How can I test for collinearity in the predictor data set 
for multiple linear regression.


Thanks

Alex

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


Confidentiality Statement: This email message, including any
attachments, is for th...{{dropped:11}}






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

2009-07-22 Thread Erin Hodgess
Dear R People:

I'm running from R to a grid computer and getting some unusual results
with the system command:

 e7 - system(globus-job-run x /bin/sh -c 'cd $OSG_APP/engage;chmod 777 
 oops',intern=TRUE)
chmod: changing permissions of `oops': Operation not permitted
 e7
character(0)



I xx'ed out the site name.  Anyhow, I would expect that the e7 would
contain the warning.  Is there any way to have e7 contain the warning
please?

Thanks,
Erin

-- 
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodg...@gmail.com

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


[R] Long character not truncated by str() after adding comment

2009-07-22 Thread Chris Stubben

If I add a comment to a long character string, I can't get the truncated
string to display in the str() output.  Anyone know how to get str to
compactly display a truncated string and the comment? 

longch - paste(rep(letters,100), collapse=)
str(longch)  # truncated
comment(longch)-100 ABCs
str(longch) # not truncated


Thanks,

Chris Stubben
-- 
View this message in context: 
http://www.nabble.com/Long-character-not-truncated-by-str%28%29-after-adding-comment-tp24611767p24611767.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] strange behavior of system command

2009-07-22 Thread Steve Lianoglou

Hi Erin,

On Jul 22, 2009, at 2:16 PM, Erin Hodgess wrote:


Dear R People:

I'm running from R to a grid computer and getting some unusual results
with the system command:

e7 - system(globus-job-run x /bin/sh -c 'cd $OSG_APP/ 
engage;chmod 777 oops',intern=TRUE)

chmod: changing permissions of `oops': Operation not permitted

e7

character(0)





I xx'ed out the site name.  Anyhow, I would expect that the e7 would
contain the warning.  Is there any way to have e7 contain the warning
please?



You'll see this call in the Stdout and stderr section of ?system:

system(some command 21, intern=TRUE)

The 21 is a command that redirects stderr to stdout, and it seems  
that intern=TRUE only captures sdout, so in your case, are you running  
to commands at once? I don't know, the command looks weird to me, but  
I think the help is suggesting to:


e7 - system(globus-job-run x /bin/sh -c 'cd $OSG_APP/ 
engage;chmod 777 oops' 21,intern=TRUE)


??maybe?? or do you have to add the 21 to each of the separate  
commands you're invoking? Play around with that and see.


-steve

--
Steve Lianoglou
Graduate Student: Physiology, Biophysics and Systems Biology
Weill Medical College of Cornell University

Contact Info: http://cbio.mskcc.org/~lianos/contact

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


Re: [R] Multi-line comments?

2009-07-22 Thread Paul Hiemstra

Erik Iverson schreef:
What editor are you all using to write R code?  Many will have ways of doing what you want, e.g., comment-region (bound  by default to M-; through comment-dwim) in Emacs. 
  

I use Kate, the advanced text editor in KDE.
Paul

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Michael Knudsen
Sent: Wednesday, July 22, 2009 9:55 AM
To: Mark Knecht
Cc: r-help
Subject: Re: [R] Multi-line comments?

On Wed, Jul 22, 2009 at 4:30 PM, Mark Knechtmarkkne...@gmail.com wrote:

  

  I wanted to comment out 20 lines that I'm moving to a function but
didn't want to delete them. Is there no defined way to get around
using a # on each of the 20 lines?



Just like you, I have been longing for that myself. It seems that the
answer is negative, so I have ended up using

if (1==0)
{
   # code goes here
}

although is not really nice to look at.




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


[R] Extreme Value Bivariate Point Process Model

2009-07-22 Thread Ron Burns

Dear All-

I am looking at the bivariate point process model for extreme values as 
described in Section 8.3.2 of Coles book.  I am stuck at a very low 
level in being unable to reproduce the initial step of transforming the 
data to unit Frechet  margins.   In particular, I am unable  to 
reproduce the wave-surge pairs distribution after transformation to 
Frechet scale (Figure 8.6 of Coles book).  Here is what I am doing:


library(ismev)
data(wavesurge)
wave - wavesurge[,1]
surge - wavesurge[,2]
plot(wave,surge, pch=20)  ## reproduces Coles fig 1.11
## do the GEV fit
w - gev.fit(wave)
s - gev.fit(surge)
### Transform to frechet variable using
GEV2frechet - function (x, loc, scale, shape)
 pmax(1 + shape * (x - loc)/scale, 0)^(1/shape)
Zw - GEV2frechet(wave,w$mle[1],w$mle[2],w$mle[3])
Zs - GEV2frechet(surge,s$mle[1],s$mle[2],s$mle[3])
## Check point distribution with Figure 8.6
plot(log(Zw),log(Zs),pch=20)
### Very different

The above seems to be quite straightforward and I am at a loss for what 
is going wrong.  Perhaps someone can get me pointed in the right 
direction.  Thanks in advance for your consideration and help.


Regards
   Ron Burns

--
R. R. Burns
Physicist (Retired)
Oceanside, CA

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


Re: [R] Split plot analysis problems

2009-07-22 Thread Richard M. Heiberger

Jean-Paul Maalouf wrote:
Do you have any idea on how can I verify preliminary assumptions in 
this model (normality of the residuals and variance homogeneity), 
since R is not able to extract residuals?


Of course, R extracts residuals.  Use the proj() function.  See ?proj 
for the example

to get the projection of an aovlist object onto the terms of a linear model

proj(npk.aovE)


To get the projections into a simple data.frame, use
tmpE - proj(npk.aovE)
tmpE.df - do.call(data.frame, tmpE)
tmpE.df

Mark Difford's solution effectively retrieved columns 3 and 10 from tmpE.df

Rich

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


Re: [R] Memory errors when using QCA package

2009-07-22 Thread David Winsemius

But:

 2^31-1   # is more than the specified problem length
[1] 2147483647
   2130706560

You may be dealing with a system that is not facile at memory  
allocation. Windows?



On Jul 22, 2009, at 9:16 AM, Allan Engelhardt wrote:

It is a little stupid, but the length of a vector is limited to  
2^31-1 entries on any platform.  A matrix is stored as a vector, so  
the product of all dimensions is also limited to 2^31-1.


Allan.

Matthew Gwynne wrote:

Hi,

I have been using the QCA package, in particular the eqmcc function
and I am having some issues when trying to use this to minimise a
particular boolean function.

The  boolean function in question has 16 variables, and I am  
providing

the full truth table for the function (65536 with 256 true entries),
in the following way :

library(QCA)

func_tt = read.table(func.tt,header=TRUE)
eqmcc(func_tt, outcome=O, expl.0=TRUE)

However, after calculating for a little while, the system throws up a
memory error :

Error in vector(double, length) :
 cannot allocate vector of length 2130706560


However, looking at the memory usage, I seem to have far more than  
2GB free.


Is there some kind of built-in limit on the size of the heap in R? If
so, is there some way I can extend this?

Does anyone have any insight into this? Perhaps I am doing  
something stupid?


Thanks

Matthew

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


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] contour plot

2009-07-22 Thread David Winsemius


On Jul 22, 2009, at 10:17 AM, axionator wrote:


Hi,
I want to draw a contour plot of the following function:

z = y*x + epsilon,

where x ~ N(y, 1)
and epsilon ~ N(0, sigma) with sigma fixed (e.g. 1)

But didnt manage to feed contour with the right input.

Thanks for your help.
Armin


The help page has an example that appears be straightforward. If you  
have made any attempt, then you should include it in your request.


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] What works on windows

2009-07-22 Thread malcolm Crouch
Hi ,

How can you tell which packages work on windows ?

Regards

Malcolm

[[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] What works on windows

2009-07-22 Thread David Winsemius


On Jul 22, 2009, at 3:02 PM, malcolm Crouch wrote:


Hi ,

How can you tell which packages work on windows ?


This is the place to find listing for automated compiler check results:

http://cran.stat.ucla.edu/bin/windows/contrib/checkSummaryWin.html



Regards

Malcolm


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] A question on operation on list

2009-07-22 Thread megh

Hi,
I have created a list object like that :
x = vector(list)
for (i in 1:5) x[[i]] = rnorm(2) 
x

Now I want to do two things :
1. for each i, I want to do following matrix calculation : t(x[[i]]) %*%
x[[i]] i.e. for each i, I want to get a 2x2 matrix
2. Next I want to get  x[[1]] + x[[2]] +

I did following : res=vector(list); res = sapply(x, function(i) t(x[[i]])
%*% x[[i]])
However above syntax is not giving desired result. Any suggestion please?

-- 
View this message in context: 
http://www.nabble.com/A-question-on-operation-on-list-tp24612796p24612796.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] Find multiple elements in a vector

2009-07-22 Thread Michael Knudsen
Hi,

Given a vector, say

x=sample(0:9,10)
x
[1] 0 6 3 5 1 9 7 4 8 2

I can find the location of an element by

which(x==2)
[1] 10

but what if I want to find the location of more than one number? I could do

c(which(x==2),which(x==3))

but isn't there something more streamlined? My first guess was

y=c(2,3)
which(x==y)
integer(0)

which doesn't work. I haven't found any clue in the R manual.

Thanks!

-- 
Michael Knudsen
micknud...@gmail.com
http://lifeofknudsen.blogspot.com/

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


Re: [R] A question on operation on list

2009-07-22 Thread Jorge Ivan Velez
Hi megh,
Perhaps?

# Data
x = vector(list)
for (i in 1:5) x[[i]] = rnorm(2)

# 2x2 matrices
res - lapply(x, function(a) a %*% t(a) )
res

# Funcion from ?Reduce
add - function(x) Reduce(+, x)

# Summing up!
add(res)

See ?lapply and ?Reduce for more information.

HTH,

Jorge


On Wed, Jul 22, 2009 at 3:18 PM, megh megh700...@yahoo.com wrote:


 Hi,
 I have created a list object like that :
 x = vector(list)
 for (i in 1:5) x[[i]] = rnorm(2)
 x

 Now I want to do two things :
 1. for each i, I want to do following matrix calculation : t(x[[i]]) %*%
 x[[i]] i.e. for each i, I want to get a 2x2 matrix
 2. Next I want to get  x[[1]] + x[[2]] +

 I did following : res=vector(list); res = sapply(x, function(i) t(x[[i]])
 %*% x[[i]])
 However above syntax is not giving desired result. Any suggestion please?

 --
 View this message in context:
 http://www.nabble.com/A-question-on-operation-on-list-tp24612796p24612796.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.


[[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] Find multiple elements in a vector

2009-07-22 Thread Chuck Cleland
On 7/22/2009 3:32 PM, Michael Knudsen wrote:
 Hi,
 
 Given a vector, say
 
 x=sample(0:9,10)
 x
 [1] 0 6 3 5 1 9 7 4 8 2
 
 I can find the location of an element by
 
 which(x==2)
 [1] 10
 
 but what if I want to find the location of more than one number? I could do
 
 c(which(x==2),which(x==3))
 
 but isn't there something more streamlined? My first guess was
 
 y=c(2,3)
 which(x==y)
 integer(0)
 
 which doesn't work. I haven't found any clue in the R manual.

  How about this?

which(x %in% c(2,3))

 Thanks! 

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

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


Re: [R] Find multiple elements in a vector

2009-07-22 Thread Jorge Ivan Velez
Dear Michael,
Take a look at ?%in%   This is an example:

set.seed(123)
x - sample(0:9,10)
y - c(2,3)
which(x %in% y)
# [1] 1 3

HTH,

Jorge


On Wed, Jul 22, 2009 at 3:32 PM, Michael Knudsen  wrote:

 Hi,

 Given a vector, say

 x=sample(0:9,10)
 x
 [1] 0 6 3 5 1 9 7 4 8 2

 I can find the location of an element by

 which(x==2)
 [1] 10

 but what if I want to find the location of more than one number? I could do

 c(which(x==2),which(x==3))

 but isn't there something more streamlined? My first guess was

 y=c(2,3)
 which(x==y)
 integer(0)

 which doesn't work. I haven't found any clue in the R manual.

 Thanks!

 --
 Michael Knudsen
 micknud...@gmail.com
 http://lifeofknudsen.blogspot.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.


[[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 question on operation on list

2009-07-22 Thread Tony Plate

Here's one way:


set.seed(1)
x1 - lapply(1:5, function(i) rnorm(2))
x2 - lapply(x1, function(x) outer(x, x))
Reduce(+, x2, 0)

 [,1]  [,2]
[1,]  1.768406 -1.534413
[2,] -1.534413  3.890200




and another way using the abind package:


library(abind)
dim(abind(along=0, x2))

[1] 5 2 2

colSums(abind(along=0, x2))

 [,1]  [,2]
[1,]  1.768406 -1.534413
[2,] -1.534413  3.890200




-- Tony Plate

megh wrote:

Hi,
I have created a list object like that :
x = vector(list)
for (i in 1:5) x[[i]] = rnorm(2) 
x


Now I want to do two things :
1. for each i, I want to do following matrix calculation : t(x[[i]]) %*%
x[[i]] i.e. for each i, I want to get a 2x2 matrix
2. Next I want to get  x[[1]] + x[[2]] +

I did following : res=vector(list); res = sapply(x, function(i) t(x[[i]])
%*% x[[i]])
However above syntax is not giving desired result. Any suggestion please?



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


[R] Problem with merge command duplicating values

2009-07-22 Thread Archana Dayalu
Hello,
I am attempting to merge 8 different data sets into a grand merge data
set; all their variable names are common except for the the gas measured.
However, when I did a quick stat summary comparison of merged data with
unmerged data, it turned out that R mysteriously duplicated thousands of
values in the merged set and I have no idea why. I've not had this problem
with merge in the past any thoughts?

To illustrate:

given the following objects (as data frames) with 1 unique and 10 common
variables:
h2_flasks
co2c13_flasks
co2o18_flasks
ch4_flasks
co2_flasks
co_flasks
n2o_flasks
co2c14_flasks

#Merge objects into one data frame (grand merge):
obj.list - ls(pattern='flasks')
grand.merge-merge(get(obj.list[1]),get(obj.list[2]),all=TRUE)
for (ss in 3:length(obj.list)){
grand.merge-merge(grand.merge,get(obj.list[ss]),all=TRUE)
}

#CH4 data extracted from grand merge
length(na.omit(grand.merge$CH4))
[1] 29027

#Unmerged CH4 data only (from object ch4_flasks)
 length(na.omit(ch4_flasks$CH4))
[1] 23739

#So 5000+ CH4 values are mysteriously added to the grand merge file. This
duplicated value problem occurs for all gas variables in the grand merged
data, in varying degrees. (For example, H2 had only 2 extra values
mysteriously added).

Thanks very much for any input.
Archana

[[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 question on operation on list

2009-07-22 Thread David Winsemius


On Jul 22, 2009, at 3:18 PM, megh wrote:



Hi,
I have created a list object like that :
x = vector(list)



for (i in 1:5) x[[i]] = rnorm(2)



x



So now you have a list with 5 elements


Now I want to do two things :
1. for each i, I want to do following matrix calculation : t(x[[i]])  
%*%

x[[i]] i.e. for each i, I want to get a 2x2 matrix


Why not use an object of class matrix?

x - matrix(rnorm(10), nrow=5)
 t(x) %*% x
  [,1]  [,2]
[1,]  6.621608 -1.558713
[2,] -1.558713  1.555916



2. Next I want to get  x[[1]] + x[[2]] +

I did following : res=vector(list); res = sapply(x, function(i)  
t(x[[i]])

%*% x[[i]])
However above syntax is not giving desired result. Any suggestion  
please?


--
View this message in context: 
http://www.nabble.com/A-question-on-operation-on-list-tp24612796p24612796.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] Find multiple elements in a vector

2009-07-22 Thread Steve Lianoglou

Hi,

On Jul 22, 2009, at 3:39 PM, Jorge Ivan Velez wrote:


Dear Michael,
Take a look at ?%in%   This is an example:

set.seed(123)
x - sample(0:9,10)
y - c(2,3)
which(x %in% y)
# [1] 1 3


In addition to the above, you can also use the `match` function:

match(c(2,3), x)
[1] 1 3

The problem is that if you have repeat elements in x, it will only  
return you the index of the first match in x.


-steve

--
Steve Lianoglou
Graduate Student: Physiology, Biophysics and Systems Biology
Weill Medical College of Cornell University

Contact Info: http://cbio.mskcc.org/~lianos/contact

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


Re: [R] Find multiple elements in a vector

2009-07-22 Thread Michael Knudsen
On Wed, Jul 22, 2009 at 9:37 PM, Chuck Clelandcclel...@optonline.net wrote:

  How about this?

 which(x %in% c(2,3))

Thanks to you all! I had never thought about using %% in this context.

-- 
Michael Knudsen
micknud...@gmail.com
http://lifeofknudsen.blogspot.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] Problem with merge command duplicating values

2009-07-22 Thread John Kane

What package is 'grand.merge' in?

--- On Wed, 7/22/09, Archana Dayalu dayalu.arch...@gmail.com wrote:

 From: Archana Dayalu dayalu.arch...@gmail.com
 Subject: [R] Problem with merge command duplicating values
 To: r-help@r-project.org
 Received: Wednesday, July 22, 2009, 3:44 PM
 Hello,
 I am attempting to merge 8 different data sets into a
 grand merge data
 set; all their variable names are common except for the the
 gas measured.
 However, when I did a quick stat summary comparison of
 merged data with
 unmerged data, it turned out that R mysteriously duplicated
 thousands of
 values in the merged set and I have no idea why. I've not
 had this problem
 with merge in the past any thoughts?
 
 To illustrate:
 
 given the following objects (as data frames) with 1 unique
 and 10 common
 variables:
 h2_flasks
 co2c13_flasks
 co2o18_flasks
 ch4_flasks
 co2_flasks
 co_flasks
 n2o_flasks
 co2c14_flasks
 
 #Merge objects into one data frame (grand merge):
 obj.list - ls(pattern='flasks')
 grand.merge-merge(get(obj.list[1]),get(obj.list[2]),all=TRUE)
 for (ss in 3:length(obj.list)){
    
 grand.merge-merge(grand.merge,get(obj.list[ss]),all=TRUE)
     }
 
 #CH4 data extracted from grand merge
 length(na.omit(grand.merge$CH4))
 [1] 29027
 
 #Unmerged CH4 data only (from object ch4_flasks)
  length(na.omit(ch4_flasks$CH4))
 [1] 23739
 
 #So 5000+ CH4 values are mysteriously added to the grand
 merge file. This
 duplicated value problem occurs for all gas variables in
 the grand merged
 data, in varying degrees. (For example, H2 had only 2 extra
 values
 mysteriously added).
 
 Thanks very much for any input.
 Archana
 
     [[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.
 


  __
The new Internet Explorer® 8 - Faster, safer, easier.  Optimized for Yahoo!  
Get it Now for
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Multcomp, means and mixed models

2009-07-22 Thread Metconnection

Hi all, 
I wonder if anyone can help. I'm trying to calculate the means from a mixed
model analysis using Multcomp

My  code is 

glht(lme(response~treatment, random=~1|patient, data=statdata, na.action =
(na.omit)), linfct=mcp(treatment=Means))

It appears that the Means option is not valid for lme models, is this
correct? I couldn't find anything in the documentation about this.

Thanks in advance for any advice!
Simon
-- 
View this message in context: 
http://www.nabble.com/Multcomp%2C-means-and-mixed-models-tp24614247p24614247.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] download.file() help! setting the proxy for user /passw0rd

2009-07-22 Thread ByR1

I would like to download climate data files from PCMDI website using R. I
tried this line below and I was not able to get the file mainly due to user
name and password requirements. I am looking for help for setting up the
user and password within R (or somewhere). I have read the FAQ but
unfortunately I am a newbie on R and couldnt figure out how to do it. Many
thanks in advance 

download.file('ftp://ftp-esg.ucllnl.org/ipcc/20c3m/land/mo/pr//run1/pr_A1_1.nc',
destfile=clt_A1.nc, method=wget, quiet = FALSE, mode = w,cacheOK=TRUE)


--2009-07-22 19:20:12-- 
ftp://ftp-esg.ucllnl.org/ipcc/20c3m/land/mo/pr//run1/pr_A1_1.nc
   = `clt_A1.nc'
Resolving ftp-esg.ucllnl.org... 192.12.137.5
Connecting to ftp-esg.ucllnl.org|192.12.137.5|:21... connected.
Logging in as anonymous ... 
Login incorrect.
Warning message:
In
download.file(ftp://ftp-esg.ucllnl.org/ipcc/20c3m/land/mo/pr//run1/pr_A1_1.nc;,
 
:
  download had nonzero exit status
-- 
View this message in context: 
http://www.nabble.com/download.file%28%29-help%21-setting-the-proxy-for-user--passw0rd-tp24610964p24610964.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] Difficulty Increasing R memory on Windows 32-Bit

2009-07-22 Thread Dan Fleder
I'm having difficulty increasing the memory R can access above 2Gb and wasn't 
able to resolve this from the R Windows FAQ. For reference, I'm running Windows 
XP, 32bit, Service Pack 2 on a machine with 4GB RAM.

Following the FAQ, I set the --max-mem-size flag to 2800Mb. However, when I 
start R, I get the error: WARNING --max-mem-size=2800M: too large and taken as 
2047M. 

The R Windows FAQ says Rgui.exe supports 3Gb per process under suitably 
enabled versions of 32-bit windows. So, the above should be fine if Windows is 
suitably enabled. The FAQ also says how to enable Windows this way, and it 
links to a Microsoft page about setting Windows's /3GB switch. From what I 
read, however, this switch is already active on Windows XP Service Pack 2 (what 
I'm running) -- so Windows should already be enabled for running R at above 
2Gb. (In fact adding the /3GB switch throws an error for me).

Could anyone offer a suggestion for getting R to use more than 2GB of memory?

Thanks very much for any ideas,
Dan





  
[[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] Merge vectors

2009-07-22 Thread MarcioRibeiro

Hi listers,
I would like to merge two vectors as follows...
A-c(3,5,7,18,43,85,91,98,100,130,230,487) #data values
B-c(10,5,5,10,8,11,2,7,3,11,10)  #random numbers (sample)
I would like to set the vector of random numbers according to the order set
of the vector of data values...
The result would be: (130,43,43,130,98,230,5,91,7,230,130)
I could do this with merging, but I would need to set a primary key to merge
the vectors... Is there a way of doing directly...
Thanks in advance,
Marcio


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

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


[R] help in buliding a likelihood function...

2009-07-22 Thread resident76

I am hoping someone may be able to help me out here.  I need to build up a
likelihood function algorithmically based on the data.  The likelihood
function is almost impossible to generate analytically due to a large number
of summations.  I just can't figure out how to get the variables into the
function as I go down the data.  The general form of the function is:

Lik() = Sum_i Sum_j Sum_k  x_i * x_j * x_k * n()_ij * n()_jk

where the numbers i,j,k can go from 1 to 5 and n() are the normal densities. 
In going through the data, I can determined the vectors x, so the general
form is x = c(g1,g2,g3,g4,g4) which is the vector of the coefficients of the
g variables and describes a probability.  I'm trying to do a maximum
likelihood estimation to get the g variables given some input data.  

I'm at a dead end with trying to form the likelihood function.  Any insights
from the folks out there?

res
   
-- 
View this message in context: 
http://www.nabble.com/help-in-buliding-a-likelihood-function...-tp24613820p24613820.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] Merge vectors

2009-07-22 Thread Steve Lianoglou

Hi,

On Jul 22, 2009, at 3:31 PM, MarcioRibeiro wrote:



Hi listers,
I would like to merge two vectors as follows...
A-c(3,5,7,18,43,85,91,98,100,130,230,487) #data values
B-c(10,5,5,10,8,11,2,7,3,11,10)  #random numbers (sample)
I would like to set the vector of random numbers according to the  
order set

of the vector of data values...
The result would be: (130,43,43,130,98,230,5,91,7,230,130)


R A[B]
[1] 130  43  43 130  98 230   5  91   7 230 130

-steve

--
Steve Lianoglou
Graduate Student: Physiology, Biophysics and Systems Biology
Weill Medical College of Cornell University

Contact Info: http://cbio.mskcc.org/~lianos/contact

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

2009-07-22 Thread megh

Thanks for your suggestions. I need one more thing :

x = y = vector(list)
for (i in 1:5) x[[i]] = rnorm(2);  y[[i]] = rnorm(2)

Here I want to get t(x[[i]]) %*% y[[i]] for each i. Can anyone please help
me?

Regards,



Jorge Ivan Velez wrote:
 
 Hi megh,
 Perhaps?
 
 # Data
 x = vector(list)
 for (i in 1:5) x[[i]] = rnorm(2)
 
 # 2x2 matrices
 res - lapply(x, function(a) a %*% t(a) )
 res
 
 # Funcion from ?Reduce
 add - function(x) Reduce(+, x)
 
 # Summing up!
 add(res)
 
 See ?lapply and ?Reduce for more information.
 
 HTH,
 
 Jorge
 
 
 On Wed, Jul 22, 2009 at 3:18 PM, megh megh700...@yahoo.com wrote:
 

 Hi,
 I have created a list object like that :
 x = vector(list)
 for (i in 1:5) x[[i]] = rnorm(2)
 x

 Now I want to do two things :
 1. for each i, I want to do following matrix calculation : t(x[[i]]) %*%
 x[[i]] i.e. for each i, I want to get a 2x2 matrix
 2. Next I want to get  x[[1]] + x[[2]] +

 I did following : res=vector(list); res = sapply(x, function(i)
 t(x[[i]])
 %*% x[[i]])
 However above syntax is not giving desired result. Any suggestion please?

 --
 View this message in context:
 http://www.nabble.com/A-question-on-operation-on-list-tp24612796p24612796.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.

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

-- 
View this message in context: 
http://www.nabble.com/A-question-on-operation-on-list-tp24612796p24614641.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] Merge vectors

2009-07-22 Thread Erik Iverson
A[B]

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of MarcioRibeiro
Sent: Wednesday, July 22, 2009 2:31 PM
To: r-help@r-project.org
Subject: [R] Merge vectors


Hi listers,
I would like to merge two vectors as follows...
A-c(3,5,7,18,43,85,91,98,100,130,230,487) #data values
B-c(10,5,5,10,8,11,2,7,3,11,10)  #random numbers (sample)
I would like to set the vector of random numbers according to the order set
of the vector of data values...
The result would be: (130,43,43,130,98,230,5,91,7,230,130)
I could do this with merging, but I would need to set a primary key to merge
the vectors... Is there a way of doing directly...
Thanks in advance,
Marcio


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

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

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


Re: [R] A question on operation on list

2009-07-22 Thread David Winsemius


On Jul 22, 2009, at 5:07 PM, megh wrote:



Thanks for your suggestions. I need one more thing :

x = y = vector(list)
for (i in 1:5) x[[i]] = rnorm(2);  y[[i]] = rnorm(2)

Here I want to get t(x[[i]]) %*% y[[i]] for each i. Can anyone  
please help

me?



?lapply



Regards,



Jorge Ivan Velez wrote:


Hi megh,
Perhaps?

# Data
x = vector(list)
for (i in 1:5) x[[i]] = rnorm(2)

# 2x2 matrices
res - lapply(x, function(a) a %*% t(a) )
res

# Funcion from ?Reduce
add - function(x) Reduce(+, x)

# Summing up!
add(res)

See ?lapply and ?Reduce for more information.

HTH,

Jorge


On Wed, Jul 22, 2009 at 3:18 PM, megh megh700...@yahoo.com wrote:



Hi,
I have created a list object like that :
x = vector(list)
for (i in 1:5) x[[i]] = rnorm(2)
x

Now I want to do two things :
1. for each i, I want to do following matrix calculation :  
t(x[[i]]) %*%

x[[i]] i.e. for each i, I want to get a 2x2 matrix
2. Next I want to get  x[[1]] + x[[2]] +

I did following : res=vector(list); res = sapply(x, function(i)
t(x[[i]])
%*% x[[i]])
However above syntax is not giving desired result. Any suggestion  
please?


--
View this message in context:
http://www.nabble.com/A-question-on-operation-on-list-tp24612796p24612796.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.



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




--
View this message in context: 
http://www.nabble.com/A-question-on-operation-on-list-tp24612796p24614641.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] Problem with aov

2009-07-22 Thread Ben Bolker



theliver wrote:
 
 I'm currently doing simple, one way ANOVA using R. 
 
 I'm analyzing a count based upon an Hour value (0-23) in which it occurs.
 The count varies greatly over the entire day (usually with a range of 400
 or so), but certain hour groupings could be useful for later data
 processing.
 
 So I've loaded my data:
 data.nas - read.csv(file=simple.csv,head=TRUE,sep=,)
 [the file has headers of Center, MaxInst(which is the count im
 analyzing),Hour,X.ofCap]
 
 I've filtered it based on my needs
 data.ztl-subset(data.nas,Center==ZTL)
 data.ztlf-subset(data.ztl,X.ofCap97)
 
 which gives me everything I need to start breaking up the hours
 
 So I enter
 
 hours15t21.data.ztl-subset(data.ztlf,Hour14  Hour22)
 
 then
 
 aov.15t21.ztl-aov(MaxInst~Hour, data=hours15t21.data.ztl)
 
 then
 summary(aov.15t21.ztl)
 
 and the output is
 
 Df Sum Sq   Mean Sq F value  Pr(F)  
 Hour  1   2745  2745  4.4879 0.03467 *
 Residuals   461 281939 612  
 
 My problem is, since my data set has 7 different Hours, shouldn't the
 first DF be 6?
 
 I'm not ready to trust this output without knowing why DF is 1 and not 6.
 
 

Hour is being treated as a continuous variable, because R has no way of
knowing otherwise.

Try

hours15t21.data.ztl$Hour - factor(hours15t21.data.ztl)

before running your aov() command.

-- 
View this message in context: 
http://www.nabble.com/Problem-with-aov-tp24613042p24615055.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] Problem with aov

2009-07-22 Thread Ben Bolker


Oops, I mean 
hours15t21.data.ztl$Hour - factor(hours15t21.data.ztl$Hour)

  Sorry


-- 
View this message in context: 
http://www.nabble.com/Problem-with-aov-tp24613042p24615059.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] Question on qplot

2009-07-22 Thread RON70

I have following code on qplot :

library(ggplot2)
ggplot() + geom_histogram(aes(x=rnorm(100), fill=..count..), xlab=,
ylab=)

However above code doesnot seem to remove the xlab  ylab. What is the
correct code? I also want to remove the color-palate in the right side. Is
there any way to do that?

Thanks
-- 
View this message in context: 
http://www.nabble.com/Question-on-qplot-tp24615077p24615077.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] Question on qplot

2009-07-22 Thread baptiste auguie
try this,


library(ggplot2)
ggplot() + geom_histogram(aes(x=rnorm(100), fill=..count..))+
xlab(NULL)+
scale_y_continuous()+
opts(legend.position=none)

HTH,

baptiste

2009/7/22 RON70 ron_michae...@yahoo.com


 I have following code on qplot :

 library(ggplot2)
 ggplot() + geom_histogram(aes(x=rnorm(100), fill=..count..), xlab=,
 ylab=)

 However above code doesnot seem to remove the xlab  ylab. What is the
 correct code? I also want to remove the color-palate in the right side. Is
 there any way to do that?

 Thanks
 --
 View this message in context:
 http://www.nabble.com/Question-on-qplot-tp24615077p24615077.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.




-- 

_

Baptiste Auguié

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

Phone: +44 1392 264187

http://newton.ex.ac.uk/research/emag
__

[[alternative HTML version deleted]]

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


[R] How to use macro variable in a text string

2009-07-22 Thread kxk

I want to use read.table to input many files, each for a different year.  I
would like to use the macro variable 't' to refer to the exact file that I
would like to input the data using read.table.  How could I do this?  Thank
you!

for (t in 1970:2005)
{ edge - read.table(file=edge_t.csv, header=T,  sep=,)
## I will  have many rows of code following the read.table line 
}

-- 
View this message in context: 
http://www.nabble.com/How-to-use-macro-variable-in-a-text-string-tp24615030p24615030.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] Question about the lars package

2009-07-22 Thread lulu9797

Hello, 

I have a question about lars package, probably basic. 

The returned values of lars function include R squares along the variable
selection path. However, such values are always slightly different from the
R squares returned by the regression function lm using the same models.
Anyone know the reasons? 

Very important, and needs quick answers. Thanks a million!
-- 
View this message in context: 
http://www.nabble.com/Question-about-the-lars-package-tp24615778p24615778.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] How to use macro variable in a text string

2009-07-22 Thread Steve Lianoglou

Hi,

On Jul 22, 2009, at 5:46 PM, kxk wrote:

I want to use read.table to input many files, each for a different  
year.  I
would like to use the macro variable 't' to refer to the exact file  
that I
would like to input the data using read.table.  How could I do  
this?  Thank

you!

for (t in 1970:2005)
{ edge - read.table(file=edge_t.csv, header=T,  sep=,)
## I will  have many rows of code following the read.table line
}


Two things:

1. Not extremely important here at all, but for the future: just note  
that but by using t you're trampling over the transpose function  
t(), so perhaps you can use a more descriptive variable to both make  
code more readable and less ... urm, trample-itve :-)


2. Answer:

for (year in 1970:2005) {
  edge - read.table(file=sprintf(edge_%d.csv, year), header=T,  
sep=,)

  ...
}

You can also use the paste function in place of sprintf

-steve

--
Steve Lianoglou
Graduate Student: Physiology, Biophysics and Systems Biology
Weill Medical College of Cornell University

Contact Info: http://cbio.mskcc.org/~lianos/contact

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


Re: [R] Merge vectors

2009-07-22 Thread Mark Knecht
Sort of like this?

 A-c(3,5,7,18,43,85,91,98,100,130,230,487) #data values
 B-c(10,5,5,10,8,11,2,7,3,11,10)  #random numbers (sample)

 C = A[B]
 C
 [1] 130  43  43 130  98 230   5  91   7 230 130

On Wed, Jul 22, 2009 at 2:08 PM, Erik Iversoneiver...@nmdp.org wrote:
 A[B]

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
 Behalf Of MarcioRibeiro
 Sent: Wednesday, July 22, 2009 2:31 PM
 To: r-help@r-project.org
 Subject: [R] Merge vectors


 Hi listers,
 I would like to merge two vectors as follows...
 A-c(3,5,7,18,43,85,91,98,100,130,230,487) #data values
 B-c(10,5,5,10,8,11,2,7,3,11,10)  #random numbers (sample)
 I would like to set the vector of random numbers according to the order set
 of the vector of data values...
 The result would be: (130,43,43,130,98,230,5,91,7,230,130)
 I could do this with merging, but I would need to set a primary key to merge
 the vectors... Is there a way of doing directly...
 Thanks in advance,
 Marcio


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

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

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


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


Re: [R] How to use macro variable in a text string

2009-07-22 Thread David Winsemius


On Jul 22, 2009, at 5:46 PM, kxk wrote:



I want to use read.table to input many files, each for a different  
year.  I
would like to use the macro variable 't' to refer to the exact file  
that I
would like to input the data using read.table.  How could I do  
this?  Thank

you!

for (t in 1970:2005)
{ edge - read.table(file=edge_t.csv, header=T,  sep=,)


Pretty sure that will not work. Take a look at the paste function for  
putting together strings and values.


paste(test, 1:3, sep=)

#[1] test1 test2 test3

And you might consider whether you want edge to be wiped out the  
next time through the loop, too. That is what would happen with your  
current construction.




## I will  have many rows of code following the read.table line
}

--


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] How to use macro variable in a text string

2009-07-22 Thread Jorge Ivan Velez
Dear kxk,
Here are a couple of options:

# Option 1 -- sapply
mydata - sapply(1970:2005, function(i){
  mydata - read.table(file = paste(edge_, i, .csv,
sep=), header=TRUE)
 # more code goes here
}
  )

Please note that mydata would be a list, so to access the data for 1970,
type mydata[[1]] in the R Console.

# Option 2  -- create a function foo
Another possibility would be to create a function, e.g foo, that reads the
data in and does the procedures you need for each file. It would be
something like:

foo - function(nameFile){
  mydata - read.table(file = paste(edge_, nameFile, .csv,
sep=), header=T)
 # more code goes here
 }

To do what you want for one file, just type

onefile - foo(1970)

in the R Console. To do all your files at once, then

myresults - sapply(1970:2005, foo)

is what you need. Once again, myresults would be a list.

Now, If you insist using a for loop, then

1. Avoid to use t. It is an R function. See ?t
2. Rewrite your loop as

edge - NULL
for (i in 1970:2005){
  edge[[i]] - read.table(file = paste(edge_, i, .csv, sep=),
header=TRUE)
 # more code goes here
   }

3. Use the [[ operator to extract the information you need from edge.

Also, you might be interested in the foreach package 
http://cran.r-project.org/web/packages/foreach/. Take a look at the
Vignette that come with it.

See ?sapply and ?for for more details.

HTH,

Jorge



On Wed, Jul 22, 2009 at 5:46 PM, kxk kk...@u.washington.edu wrote:


 I want to use read.table to input many files, each for a different year.  I
 would like to use the macro variable 't' to refer to the exact file that I
 would like to input the data using read.table.  How could I do this?  Thank
 you!

 for (t in 1970:2005)
 { edge - read.table(file=edge_t.csv, header=T,  sep=,)
 ## I will  have many rows of code following the read.table line
 }

 --
 View this message in context:
 http://www.nabble.com/How-to-use-macro-variable-in-a-text-string-tp24615030p24615030.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.


[[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] mathematical notation in R

2009-07-22 Thread Mary A. Marion

Hello,

I have an R function which includes the statement LBAuo- -.  Rather 
than printing out - I want it to print out - infinity.
As of yet I have not been able to do that.  I am not in a graphics 
window just outputting a set of variables.  Can you help?

Thanks.

Sincerely,
Mary A. Marion

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

2009-07-22 Thread Steven McKinney
Does this approach what you're looking for?
See 
?is.finite

for more info

 LBAuo- -
 LBAuo
[1] -
 if (LBAuo = -) LBAuo - -Inf
 LBAuo
[1] -Inf


HTH
Steven McKinney

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
 project.org] On Behalf Of Mary A. Marion
 Sent: Wednesday, July 22, 2009 8:00 PM
 To: r-help@r-project.org
 Subject: [R] mathematical notation in R
 
 Hello,
 
 I have an R function which includes the statement LBAuo- -.
 Rather
 than printing out - I want it to print out - infinity.
 As of yet I have not been able to do that.  I am not in a graphics
 window just outputting a set of variables.  Can you help?
 Thanks.
 
 Sincerely,
 Mary A. Marion
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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] panel.lmline - are m, b, and r^2 accessible somehow?

2009-07-22 Thread Bryan Hanson
Hi R Folks...

Are the results of a fit carried out by panel.lmline readily available for
use in a lattice plot?  I¹d like to put r^2, m, and b on each panel.  I can
certainly write something that does this manually and then use it with
panel.text, but if it¹s already available, that would be preferable,
especially as lattice permits condition and subsetting so readily.

Looking at panel.abline, I see that it returns invisibly (which makes sense
as one doesn¹t assign panel.abline to a variable) so my guess is the answer
is no.

The only thing I could find in the archives had the calculations done
manually within panel.groups (
http://www.nabble.com/add-trend-line-to-each-group-of-data-in%3A-xyplot(y1%2
By2-~-x-|-grp...-td3344023.html#a3382909) but that was a few versions back.

Other suggestions?

Thanks, Bryan
*
Bryan Hanson
Professor of Chemistry  Biochemistry
DePauw University, Greencastle IN USA


[[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] kmeans.big.matrix

2009-07-22 Thread Jay Emerson
This sort of question is ideal to send directly to the maintainer.

We've removed kmeans.big.matrix for the time being and will place it in a
new package, bigmemoryAnalytics.  bigmemory itself is the core building
block and tool, and we don't want to pollute it with lots of extras.

Allan's point is right: big data packages (like bigmemory and ff) can't
be used directly with R functions (like lm).  And because of R's design you
can't extract subsets with more than 2^31-1 elements, even though the
big.matrix can be as large as you need (with filebacking).

I hope that helps.

Jay

-- 
John W. Emerson (Jay)
Associate Professor of Statistics
Department of Statistics
Yale University
http://www.stat.yale.edu/~jay

[[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] param:qsec in ggplot2

2009-07-22 Thread Mohan S
Hii

  i have been trying to do a scatter plot with ggplot2, like the plot 6 here
(http://had.co.nz/ggplot2/geom_point.html) .. where the points size vary
with values

 p + geom_point(aes http://had.co.nz/ggplot2/aes.html(size = qsec))


  but am not sure how to setup the parameter - qsec

  could anyone please give some pointers on how to define that

thanks
Mo.

[[alternative HTML version deleted]]

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


[R] how to predict dynamic model in R

2009-07-22 Thread Hongwei Dong
I have a dynamic time series model like this:
dyn$lm( y ~ lag(y,-1) + x + lag(x,-1)+lag(x,-2) )

I need to do an out of sample forecast with this model. Is there any way I
can do this with R?
It would be greatly appreciated if some one can give me an example. Thanks.


Harry

[[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 predict dynamic model in R

2009-07-22 Thread Gabor Grothendieck
Use dyn.predict like this:

 library(dyn)
 x - y - zoo(1:5)
 mod - dyn$lm(y ~ lag(x, -1))
 predict(mod, list(x = zoo(6:10, 6:10)))
 7  8  9 10
 7  8  9 10


On Thu, Jul 23, 2009 at 12:54 AM, Hongwei Dongpdxd...@gmail.com wrote:
 I have a dynamic time series model like this:
 dyn$lm( y ~ lag(y,-1) + x + lag(x,-1)+lag(x,-2) )

 I need to do an out of sample forecast with this model. Is there any way I
 can do this with R?
 It would be greatly appreciated if some one can give me an example. Thanks.


 Harry

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


  1   2   >