Re: [R] Sweave for inclusion of p value in a sentence of a LaTeX document

2010-08-07 Thread Matthieu Dubois
Dear Julia, my way to do that is to attribute the t.test to an object, and then refer to its p.value with the function \Sexpr e.g. \documentclass{article} \usepackage{Sweave} \begin{document} <>= x<-cbind(1,2,3) y<-cbind(3,4,5) t <- t.test(x,y) @ The

Re: [R] Data frame reordering to time series

2010-08-07 Thread steven mosher
In the real data the months are all complete, but the years can be missing. So years can be missing up front, in the middle, at the end. but if a year is present than every month has a value or NA. To create regular R ts I had to plow through the data frame, collect a year caluculate an index to p

Re: [R] Data frame reordering to time series

2010-08-07 Thread Gabor Grothendieck
On Sat, Aug 7, 2010 at 9:18 PM, steven mosher wrote: > Very Slick. > Gabor this is a Huge speed up for me. Thanks. ha, Now I want to rewrite a > bunch of working code. > > > > Id<-c(rep(67543,4),rep(12345,3),rep(89765,5)) >  Years<-c(seq(1989,1992,by =1),1991,1993,1994,seq(1991,1995,by=1)) > Value

Re: [R] How to start R

2010-08-07 Thread Xu Wang
Hi satimis, I also use Ubuntu 10.04 and R. I just wanted to say that it is very hard to get started in R. I'm guessing you know this, but I just wanted to add some encouragement and mention that if you find yourself getting frustrated at times or taking a very long time to do things that are extre

[R] Sweave for inclusion of p value in a sentence of a LaTeX document

2010-08-07 Thread julia . jacobson
Dear R Users, I would like to include the p value in the results returned by the t.test function in a sentence of a LaTeX document. For this purpose, I use the following code (file.Rnw): \documentclass{article} \begin{document} The p value for my data was <>= x<-cbind(1,2,3) y<-cbind(3,4,5) t.

Re: [R] package for measurement error models

2010-08-07 Thread Christos Argyropoulos
I believe there was a fairly recent exchange (within the last 6 months) about linear measurement error models/error-in-variable models/Deming regression/total least squares/orthogonal regression.  Terry Therneau provided code for an R function that can estimate such models: http://www.mail-arc

Re: [R] Data frame reordering to time series

2010-08-07 Thread steven mosher
Very Slick. Gabor this is a Huge speed up for me. Thanks. ha, Now I want to rewrite a bunch of working code. Id<-c(rep(67543,4),rep(12345,3),rep(89765,5)) Years<-c(seq(1989,1992,by =1),1991,1993,1994,seq(1991,1995,by=1)) Values2<-c(12,NA,34,21,NA,65,23,NA,13,NA,13,14) Values<-c(12,14,34,21,5

Re: [R] Data frame reordering to time series

2010-08-07 Thread steven mosher
Thanks Gabor, I probably should have done an example with fewer columns. i will rework the example and post it up so the next guys who has this issue can have a clear example with a solution. On Sat, Aug 7, 2010 at 5:04 PM, Gabor Grothendieck wrote: > On Sat, Aug 7, 2010 at 4:49 PM, steven mos

Re: [R] Data frame reordering to time series

2010-08-07 Thread Gabor Grothendieck
On Sat, Aug 7, 2010 at 4:49 PM, steven mosher wrote: > Given a data frame, or it could be a matrix if I choose to. > The data consists of an ID, a year, and data for all 12 months. > Missing values are a factor AND missing years. > > Id<-c(rep(67543,4),rep(12345,3),rep(89765,5)) >  Years<-c(seq(19

Re: [R] basic question about t-test with adjusted p value

2010-08-07 Thread John Sorkin
ANOVA will give you an adjusted t-test. For example: fit<-lm(height~sex+age) summary(fit) Will give an age-adjusted t-test of the heights of men and women. John John Sorkin Chief Biostatistics and Informatics Univ. of Maryland School of Medicine Division of Gerontology and Geriatric Medicine jsor..

Re: [R] plot the dependent variable against one of the predictors with other predictors as constant

2010-08-07 Thread Frank Harrell
There are many ways to do this. Here is one. install.packages('rms') require(rms) dd <- datadist(x, y); options(datadist='dd') f <- ols(z ~ x + y) plot(Predict(f))# plot all partial effects plot(Predict(f, x)) # plot only the effect of x plot(Predict(f, y)) # plot only the effect of y f <-

[R] plot the dependent variable against one of the predictors with other predictors as constant

2010-08-07 Thread Yi
Hi, folks, Happy work in weekends >_< My question is how to plot the dependent variable against one of the predictors with other predictors as constant. Not for the original data, but after prediction. It means y is the predicted value of the dependent variables. The constane value of the other p

[R] Data frame reordering to time series

2010-08-07 Thread steven mosher
Given a data frame, or it could be a matrix if I choose to. The data consists of an ID, a year, and data for all 12 months. Missing values are a factor AND missing years. Id<-c(rep(67543,4),rep(12345,3),rep(89765,5)) Years<-c(seq(1989,1992,by =1),1991,1993,1994,seq(1991,1995,by=1)) Values2<-c(12

Re: [R] basic question about t-test with adjusted p value

2010-08-07 Thread Erik Iverson
On 08/07/2010 03:08 PM, josef.kar...@phila.gov wrote: I have read the R manual and help archives, sorry but I'm still stuck. How would I do a t-test with an adjusted p-value? Please be more specific about what you mean by 'adjusted p-value'. See below... Suppose that I use t.test ( ) , with

Re: [R] basic question about t-test with adjusted p value

2010-08-07 Thread Philipp Pagel
On Sat, Aug 07, 2010 at 04:08:40PM -0400, josef.kar...@phila.gov wrote: > I have read the R manual and help archives, sorry but I'm still stuck. > > How would I do a t-test with an adjusted p-value? > > Suppose that I use t.test ( ) , with the function argument alternative = > "two.sided", and

Re: [R] basic question about t-test with adjusted p value

2010-08-07 Thread Joshua Wiley
On Sat, Aug 7, 2010 at 1:08 PM, wrote: > I have read the R manual and help archives, sorry but I'm still stuck. > > How would I do a t-test with an adjusted p-value? > > Suppose that I use t.test ( ) , with the function argument alternative = > "two.sided",  and data such that degrees of freedom

[R] basic question about t-test with adjusted p value

2010-08-07 Thread Josef . Kardos
I have read the R manual and help archives, sorry but I'm still stuck. How would I do a t-test with an adjusted p-value? Suppose that I use t.test ( ) , with the function argument alternative = "two.sided", and data such that degrees of freedom = 20. The function calculates a t-statistic of

Re: [R] [Q] a dummy variable used with sapply

2010-08-07 Thread Erik Iverson
On 08/07/2010 01:00 PM, GMail (KU) wrote: Hello, While learning how to manipulate data with R, I found one example that I could not understand. In the following example, the function definition of "maxcor" has an argument named "i" and I don't understand why. Could someone explain why the maxco

[R] [Q] a dummy variable used with sapply

2010-08-07 Thread KU
Hello, While learning how to manipulate data with R, I found one example that I could not understand. In the following example, the function definition of "maxcor" has an argument named "i" and I don't understand why. Could someone explain why the maxcor function definition needs to have this

[R] Fwd: quantmod Example-google data download-problems

2010-08-07 Thread Velappan Periasamy
-- Forwarded message -- From: Velappan Periasamy Date: Sat, Aug 7, 2010 at 11:20 PM Subject: quantmod Example-google data download-problems To: r-sig-fina...@stat.math.ethz.ch getSymbols("YHOO",src="google") is working getSymbols("NSE:RCOM",src="google") is not working. then ho

Re: [R] Colours on conditional levelplots in package "lattice"

2010-08-07 Thread Dieter Menne
gordon.morrison wrote: > > I am having difficulty in getting the colours on a conditional levelplot > in > the package lattice to work as I want them to - I wonder if someone could > help me. > I did not understand exactly what you wanted because the example was a bit complext, but the follow

Re: [R] apply family functions

2010-08-07 Thread Jeff Newmiller
Sapply is not significantly faster than a for loop. Vectorization generally is, but you pay for it in RAM. > dat.oc <- oc[dat$Class,] > dat$Flag <- ifelse(with(dat.oc,(Open<=dat$Close_date & dat$Close_date<=Close) | (Open1<=dat$Close_date & dat$Close_date<=Close1)),"Valid","Invalid") If you

Re: [R] package for measurement error models

2010-08-07 Thread Charles C. Berry
On Sat, 7 Aug 2010, Carrie Li wrote: Hi,all, I posted this question couple of days again, but haven't gotten any answers back. I would like to post it again, and if you have any ideas, please let me know. Any helps and suggestions are very much appreciated. Start by reading the Posting Guide.

Re: [R] eval-parse and lme in a loop

2010-08-07 Thread Dieter Menne
Connolly, Colm wrote: > > Hi everybody, > > I'm having trouble getting an eval-parse combination to work with lme in a > for loop. > > I have not checked in detail, but it looks like another case for what we call "Ripley's game": http://finzi.psych.upenn.edu/R/Rhelp02a/archive/16599.html D

Re: [R] apply family functions

2010-08-07 Thread Wu Gong
Hi Steven, You code has two problems. One is loop structure which should be for(i in 1:length). The second is that you loop the process twice (for and sapply). Hope followed code will work. for (i in 1:length(ind)) { x <- dat$Close_date[i] dat[["Flag"]][i] <- ifelse((x >= oc[ind[[i

Re: [R] How to start R

2010-08-07 Thread Stephen Liu
Hi Erik, Thanks for your advice and URL q() is on the last line of the printout on starting R Type 'q()' to quit R. Sorry I overlook it B.R. Stephen - Original Message From: Erik Iverson To: Stephen Liu Cc: Steve Lianoglou ; R-help@r-project.org Sent: Sat, August 7, 2010 11:45:44

Re: [R] How to start R

2010-08-07 Thread Erik Iverson
On 08/07/2010 10:29 AM, Stephen Liu wrote: Hi steve, After starting R which command shall I use to exit it rather than close the console. exit/quit did not work. Thanks What does "did not work" mean? help.search("quit") leads you to: ?quit > quit() or > q() should terminate the R ses

Re: [R] How to start R

2010-08-07 Thread Stephen Liu
Hi steve, After starting R which command shall I use to exit it rather than close the console. exit/quit did not work. Thanks B.R. Stephen - Original Message From: Steve Lianoglou To: Stephen Liu Cc: Tim Gruene ; R-help@r-project.org Sent: Sat, August 7, 2010 9:18:42 PM Subject:

[R] package for measurement error models

2010-08-07 Thread Carrie Li
Hi,all, I posted this question couple of days again, but haven't gotten any answers back. I would like to post it again, and if you have any ideas, please let me know. Any helps and suggestions are very much appreciated. The problem is about linear regression with both y and x have measurement, a

Re: [R] Confidence Intervals for logistic regression

2010-08-07 Thread Ben Bolker
manchester.ac.uk> writes: > > On 07-Aug-10 09:29:41, Michael Bedward wrote: > > Thanks for that clarification Peter - much appreciated. > > > > Is there an R function that you'd recommend for calculating > > more valid CIs ? > > Michael > > It depends on what you want to mean by "more valid"!

Re: [R] image plot but data not on grid.

2010-08-07 Thread Michael Bedward
> If it's regular, but incomplete, that method will work.  If it's > irregular, then no image method will work without first interpolating > a regular grid. Thanks Hadley. As I suspected, but ggplot2 is so very clever that I thought it was worth asking :) Michael ___

Re: [R] image plot but data not on grid.

2010-08-07 Thread Hadley Wickham
On Sat, Aug 7, 2010 at 2:54 AM, Michael Bedward wrote: > On 7 August 2010 06:26, Hadley Wickham wrote: > >> library(ggplot2) >> qplot(x, y, fill = z, data = df, geom = "tile") > > Hi Hadley, > > I read the original question as being about irregularly spaced data. > The above method doesn't seem to

Re: [R] How to start R

2010-08-07 Thread Steve Lianoglou
Hi, On Sat, Aug 7, 2010 at 8:56 AM, Stephen Liu wrote: > Hi Tim, > > I got it.  Thanks for reminding me.  It should be R (capital letter) not r. Indeed, you were typing in a "little r", as opposed to a capital R. Now, note the package list you installed: r-base littler r-cran-plotrix r-cran-qtl

Re: [R] How to start R

2010-08-07 Thread Stephen Liu
Hi Tim, I got it. Thanks for reminding me. It should be R (capital letter) not r. On console:- ~$ R R version 2.10.1 (2009-12-14) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redi

Re: [R] How to start R

2010-08-07 Thread Tim Gruene
What exactly do you mean with 'just hanging there'? Do you expect anything else? When I start R on Debian squeeze (with the command 'R'), I see R version 2.11.1 (2010-05-31) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTEL

[R] How to start R

2010-08-07 Thread Stephen Liu
Hi folks, Just finished installing R on Ubuntu 10.04, running on a VM, download following packages on repo; r-base littler r-cran-plotrix r-cran-qtl r-cran-rggobi But I could not get R started. r is on /usr/bin/r On console evoking it just hanging there. Any additional packages I need to ins

Re: [R] Confidence Intervals for logistic regression

2010-08-07 Thread Peter Dalgaard
Michael Bedward wrote: > On 7 August 2010 19:56, Martin Maechler wrote: > >> I'm coming late to the thread, >> but it seems that nobody has yet given the advice which I would >> very *strongly* suggest to anyone asking for confidence >> intervals in GLMs: >> >> Use confint() > > confint was actu

Re: [R] several figures from one Sweave chunk? [solved]

2010-08-07 Thread Liviu Andronic
(on-list) Hello Cameron On Fri, 6 Aug 2010 19:02:22 +0100 Liviu Andronic wrote: > On Fri, 6 Aug 2010 11:30:59 -0600 > Cameron Bracken wrote: > > There is no real good way to deal with this in Sweave. Sweave does > > not actually know anything about the graphics it is creating, all > > it knows i

Re: [R] Confidence Intervals for logistic regression

2010-08-07 Thread Ted Harding
On 07-Aug-10 09:29:41, Michael Bedward wrote: > Thanks for that clarification Peter - much appreciated. > > Is there an R function that you'd recommend for calculating > more valid CIs ? > Michael It depends on what you want to mean by "more valid"! If you have a 95% CI for the linear predictor (

Re: [R] Confidence Intervals for logistic regression

2010-08-07 Thread Michael Bedward
On 7 August 2010 19:56, Martin Maechler wrote: > I'm coming late to the thread, > but it seems that nobody has yet given the advice which I would > very *strongly* suggest to anyone asking for confidence > intervals in GLMs: > > Use  confint() confint was actually mentioned in the second post on

Re: [R] Confidence Intervals for logistic regression

2010-08-07 Thread Martin Maechler
> "PD" == Peter Dalgaard > on Sat, 07 Aug 2010 10:37:49 +0200 writes: PD> Michael Bedward wrote: >>> I was aware of this option. I was assuming it was not ok to do fit +/- 1.96 >>> se when you requested probabilities. If this is legitimate then all the >>> better.

[R] rJava question

2010-08-07 Thread Wincent
In a HTML file, a java applet can be launch by What is the equivalent rJava command(s) to do the same? Thank you Best -- Wincent Rong-gui HUANG Doctoral Candidate Dept of Public and Social Administration City University of Hong Kong http://asrr.r-forge.r-project.org/rghuang.html _

Re: [R] Confidence Intervals for logistic regression

2010-08-07 Thread Michael Bedward
Thanks for that clarification Peter - much appreciated. Is there an R function that you'd recommend for calculating more valid CIs ? Michael On 7 August 2010 18:37, Peter Dalgaard wrote: > > Probably, neither is optimal, although any transformed scale is > asymptotically equivalent. E.g., neith

Re: [R] Confidence Intervals for logistic regression

2010-08-07 Thread Peter Dalgaard
Michael Bedward wrote: >> I was aware of this option. I was assuming it was not ok to do fit +/- 1.96 >> se when you requested probabilities. If this is legitimate then all the >> better. > > I don't think it is. I understood that you should do the calculation > in the scale of the linear predi

Re: [R] image plot but data not on grid.

2010-08-07 Thread Michael Bedward
On 7 August 2010 06:26, Hadley Wickham wrote: > library(ggplot2) > qplot(x, y, fill = z, data = df, geom = "tile") Hi Hadley, I read the original question as being about irregularly spaced data. The above method doesn't seem to for me in such a case but perhaps I'm constructing my example incorr

Re: [R] Confidence Intervals for logistic regression

2010-08-07 Thread Troy S
Stefano, I was aware of this option. I was assuming it was not ok to do fit +/- 1.96 se when you requested probabilities. If this is legitimate then all the better. Thanks! Troy On 6 August 2010 22:25, Guazzetti Stefano wrote: > a closer look to the help on predict.glm will reveal that the fu

Re: [R] Confidence Intervals for logistic regression

2010-08-07 Thread Michael Bedward
> I was aware of this option.  I was assuming it was not ok to do fit +/- 1.96 > se when you requested probabilities.  If this is legitimate then all the > better. I don't think it is. I understood that you should do the calculation in the scale of the linear predictor and then transform to proba