[R] possible problem with "endpoints"?

2011-03-16 Thread Erin Hodgess
Dear R People: Hello again! I found something unusual in the behavior of the "endpoints" function from the xts package: > x1 <- ts(1:24,start=2008,freq=12) > dat <- seq(as.Date("2008/01/01"),length=24,by="months") > library(zoo);library(xts) > x2 <- zoo(1:24,order=dat) > #Here is the surprise: >

Re: [R] Subset using grepl

2011-03-16 Thread Bill.Venables
subset(data, grepl("[1-5]", section) & !grepl("0", section)) BTW grepl("[1:5]", section) does work. It checks for the characters 1, :, or 5. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Kang Min Sent: Thursday, 17 March 20

Re: [R] Why doesn't this work ?

2011-03-16 Thread Phil Spector
Eric - What you mean to say is t <- 3 z <- ifelse(t %in% c(1,2,3),1,0) z [1] 1 t <- 4 z <- ifelse(t %in% c(1,2,3),1,0) [1] 0 Expressions don't recalculate themselves when you change the value of a variable that they use. For that, you would need a function: makez = function(t)ifelse(

Re: [R] Why doesn't this work ?

2011-03-16 Thread Bill.Venables
It doesn't work (in R) because it is not written in R. It's written in some other language that looks a bit like R. > t <- 3 > z <- t %in% 1:3 > z [1] TRUE > t <- 4 > z <- t %in% 1:3 > z [1] FALSE > -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-proje

[R] Why doesn't this work ?

2011-03-16 Thread eric
Why doesn't this work and is there a better way ? z <-ifelse(t==1 || 2 || 3, 1,0) t <-3 z [1] 1 t <-4 z [1] 1 trying to say ...if t == 1 or if t== 2 or if t ==3 then true, otherwise false -- View this message in context: http://r.789695.n4.nabble.com/Why-doesn-t-this-work-tp3383656p3383656.html

Re: [R] Subset using grepl

2011-03-16 Thread Kang Min
I have a new question, also regarding grepl. I would like to subset rows with numbers from 1 to 5 in the section column, so I used subset(data, grepl("[1:5]", section)) but this gave me rows with 10, 1 and 5. (Why is this so?) So I tried subset(data, grepl("[1,2,3,4,5]", section)) which worked.

Re: [R] date conversion

2011-03-16 Thread David Winsemius
On Mar 16, 2011, at 10:22 PM, Erin Hodgess wrote: Dear R People: I have a monthly time series which runs from January 1998 to December 2010. When I use tsp I get the following: tsp(ibm$ts) [1] 1998.000 2010.917 12.000 Is there an easy way to convert this to a seq.Date object, please

Re: [R] date conversion

2011-03-16 Thread Gabor Grothendieck
On Wed, Mar 16, 2011 at 10:22 PM, Erin Hodgess wrote: > Dear R People: > > I have a monthly time series which runs from January 1998 to December 2010. > > When I use tsp I get the following: > >> tsp(ibm$ts) > [1] 1998.000 2010.917   12.000 > > > Is there an easy way to convert this to a seq.Date

Re: [R] Strange R squared, possible error

2011-03-16 Thread Bert Gunter
On Wed, Mar 16, 2011 at 4:00 PM, derek wrote: > 1) In my very humble opinion R^2 can't be negative, at least for data for > which it sound to use linear model. !!! Your opinion, humble or not, counts for nothing. Thomas stated a mathematical fact. I suggest you make an effort to understand what h

Re: [R] Numeric vector converted mysteriously to characters in data frame?

2011-03-16 Thread Jim Holtman
take a look at what the output of your cbind is; my guess is that it is a character matrix. you probably want to do data.frame(...,...,...) without the cbind. Sent from my iPad On Mar 16, 2011, at 18:12, Martin Ralphs wrote: > Dear R Help, > > I would be very grateful if somebody could exp

Re: [R] date conversion

2011-03-16 Thread Joshua Wiley
Hi Erin, I am not sure what a "seq.Date object" is. My first thought is that you are talking about the date method for seq(), but there are hundreds of packages I do not know. In any case, here is what I think you want. Josh ## A small example is always nice dat <- ts(1:12, frequency = 12, s

[R] date conversion

2011-03-16 Thread Erin Hodgess
Dear R People: I have a monthly time series which runs from January 1998 to December 2010. When I use tsp I get the following: > tsp(ibm$ts) [1] 1998.000 2010.917 12.000 Is there an easy way to convert this to a seq.Date object, please? I would like to have something to the effect of 1998/0

Re: [R] Strange R squared, possible error

2011-03-16 Thread Ben Bolker
On 11-03-16 07:55 PM, Peter Ehlers wrote: > On 2011-03-16 15:02, Ben Bolker wrote: >> ria.buffalo.edu> writes: >> >>> >>> lm(y~x+0) yields the regression on x without the constant, i.e., y=bx+e, >>> not y = a +e >>> >>> derek gmail.com> >>> Sent by: r-help-bounces r-project.org >>> 03/16/201

Re: [R] Need to abstract changing name of column within loop

2011-03-16 Thread jctoll
On Wed, Mar 16, 2011 at 8:20 PM, David Winsemius wrote: > > On Mar 16, 2011, at 7:58 PM, jctoll wrote: > >> Hi, >> >> I'm struggling to figure out the way to change the name of a column >> from within a loop.  The problem is I can't refer to the object by its >> actual variable name, since that wi

Re: [R] Need to abstract changing name of column within loop

2011-03-16 Thread David Winsemius
On Mar 16, 2011, at 7:58 PM, jctoll wrote: Hi, I'm struggling to figure out the way to change the name of a column from within a loop. The problem is I can't refer to the object by its actual variable name, since that will change each time through the loop. My xts object is A. head(A)

Re: [R] Specify feature weights in model prediction (CARET)

2011-03-16 Thread Max Kuhn
> Using the 'CARET' package, is it possible to specify weights for features > used in model prediction? For what model? > And for the 'knn' implementation, is there a way > to choose a distance metric (i.e. Mahalanobis distance)? > No, sorry. Max __

Re: [R] linear regression in a data.frame using recast -- A fortunes candidate??

2011-03-16 Thread Abhijit Dasgupta, PhD
Seconded On 03/16/2011 05:37 PM, Bert Gunter wrote: Ha! -- A fortunes candidate? -- Bert If this is really a time series, then you will have serious validity problems due to auto-correlation among non-independent units. (But if you are just searching for a way to pull the wool over the eyes of

Re: [R] How to read "Cumulative proportion" in using princomp?

2011-03-16 Thread ian_zhangty
THANK U VERY MUCH!! -- View this message in context: http://r.789695.n4.nabble.com/How-to-read-Cumulative-proportion-in-using-princomp-tp3381881p3383396.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing l

[R] rJava software

2011-03-16 Thread LCOG1
Hey everyone, I just saw a demonstration of a model that is built entirely in R that allows for transportation greenhouse gas related scenario testing and it used an awesome GUI utilizing iplots, rJava and gWidgets libraries. Very cool stuff. I am a somewhat seasoned R user but cannot seem to

Re: [R] Saving summary outputs in a table form

2011-03-16 Thread Haillie
Thank you very much! I will check out help page for extraction operator. Many thanks, Haillie -- View this message in context: http://r.789695.n4.nabble.com/Saving-summary-outputs-in-a-table-form-tp3381959p3383316.html Sent from the R help mailing list archive at Nabble.com. __

[R] Numeric vector converted mysteriously to characters in data frame?

2011-03-16 Thread Martin Ralphs
Dear R Help, I would be very grateful if somebody could explain why this is happening. I am trying to plot a lattice barchart of a vector of numbers with age bandings that I have brought together into a data frame. When I plot the variables in their raw vector form, it works. When I try to plot

[R] Specify feature weights in model prediction (CARET)

2011-03-16 Thread Kendric Wang
Using the 'CARET' package, is it possible to specify weights for features used in model prediction? And for the 'knn' implementation, is there a way to choose a distance metric (i.e. Mahalanobis distance)? Thanks, ~Kendric [[alternative HTML version deleted]] ___

Re: [R] Strange R squared, possible error

2011-03-16 Thread derek
1) In my very humble opinion R^2 can't be negative, at least for data for which it sound to use linear model. Or the data would have to be utterly wrong to fit them with linear model. 2) I don't want to fit data with linear model of zero intercept. 3) I dont know if I understand correctly. Im 100%

[R] Autocorrelation in linear models

2011-03-16 Thread Arni Magnusson
I have been reading about autocorrelation in linear models over the last couple of days, and I have to say the more I read, the more confused I get. Beyond confusion lies enlightenment, so I'm tempted to ask R-Help for guidance. Most authors are mainly worried about autocorrelation in the resi

Re: [R] graph lines don;t appear

2011-03-16 Thread Sara Szeremeta
The values appear, indeed, however the grid has now shifted so that it is not aligned with the ticks on the axes. I'm using grid(nx=NULL, ny=NULL) that should do the trick to follow the axes' ticks, but it does not. I would appreciate any sugestions how to solve it. Regards, Sara pln <- read.t

[R] Need to abstract changing name of column within loop

2011-03-16 Thread jctoll
Hi, I'm struggling to figure out the way to change the name of a column from within a loop. The problem is I can't refer to the object by its actual variable name, since that will change each time through the loop. My xts object is A. > head(A) A.Open A.High A.Low A.Close A.Volume A.

Re: [R] Strange R squared, possible error

2011-03-16 Thread Peter Ehlers
On 2011-03-16 15:02, Ben Bolker wrote: ria.buffalo.edu> writes: lm(y~x+0) yields the regression on x without the constant, i.e., y=bx+e, not y = a +e derek gmail.com> Sent by: r-help-bounces r-project.org 03/16/2011 03:49 PM Would someone like to (please!) write this up and submi

Re: [R] R² for non-linear model

2011-03-16 Thread Changbin Du
How about using the prediction accuracy or ROC curve if you have validation data set? On Wed, Mar 16, 2011 at 11:42 AM, Alexx Hardt wrote: > Am 16.03.2011 19:34, schrieb Anna Gretschel: > >> Am 16.03.2011 19:21, schrieb Alexx Hardt: >> >> And to be on-topic: Anna, as far as I know anova's are

Re: [R] making dataframes

2011-03-16 Thread Bill.Venables
Firstly, the way you have constructed your data frame in the example will convert everything to factors. What you need to do is actually a bit simpler: ### dum <- data.frame(date, col1, col2) ### One way to turn this into the kind of data frame you want is to convert the main part of i

[R] limited number of graphs in Quartz window

2011-03-16 Thread Nick Matzke
Hi all, I'm using the R GUI on a Mac. It is easy to produce a number of plots and put them into a Quartz window, and then use Command-left or Command-right to flip between them. However, Quartz seems to hold a maximum of about 15 plots, and then discards anything plotted before that. This

[R] Regex query (Apache logs)

2011-03-16 Thread Saptarshi Guha
Hello R users, I have this regex see [1] for apache log lines. I tried using R to parse some data (only because I wanted to stay in R). A sample line is [2] (a) I saved the line in [1] into "~/tmp/a.txt" and [2] into "/tmp/a.txt" pat <- readLines("~/tmp/a.txt") test <- readLines("/tmp/a.txt") te

Re: [R] Singularity problem

2011-03-16 Thread Feng Li
Thanks all of you for the very interesting discussion. I think I get it now. Feng On 03/16/2011 09:25 PM, rex.dw...@syngenta.com wrote: Feng, Your matrix is *not* (practically) singular; its inverse is. The message said that the *system* was singular, not the matrix. Remember Cramer's Rule:

Re: [R] Strange R squared, possible error

2011-03-16 Thread Ben Bolker
ria.buffalo.edu> writes: > > lm(y~x+0) yields the regression on x without the constant, i.e., y=bx+e, > not y = a +e > > derek gmail.com> > Sent by: r-help-bounces r-project.org > 03/16/2011 03:49 PM > Would someone like to (please!) write this up and submit it to Kurt Hornik for inclu

Re: [R] Strange R squared, possible error

2011-03-16 Thread Thomas Lumley
On Thu, Mar 17, 2011 at 10:01 AM, derek wrote: > It states summary.lm: > > r.squared       R^2, the ‘fraction of variance explained by the model’, > > R^2 = 1 - Sum(R[i]^2) / Sum((y[i]- y*)^2), > > where y* is the mean of y[i] if there is an intercept and zero otherwise. > > Why to use different f

Re: [R] Does R have a "const object"?

2011-03-16 Thread Gabor Grothendieck
On Wed, Mar 16, 2011 at 1:12 PM, wrote: > On Wed, 16 Mar 2011, Gabor Grothendieck wrote: > >> On Wed, Mar 16, 2011 at 12:16 PM,   wrote: >>> >>> On Wed, 16 Mar 2011, Gabor Grothendieck wrote: >>> On Wed, Mar 16, 2011 at 11:49 AM,   wrote: > > Just as a heads-up: it is likely that unl

Re: [R] How to make sure R's g++ compiler uses certain C++ flags when making a package

2011-03-16 Thread solomon.mess...@gmail.com
Looks like the problem may be that R is automatically passing this flag to the g++ compiler: "-arch x86_64" which appears to be causing trouble for opencv. Does anyone know how to suppress this flag? -- View this message in context: http://r.789695.n4.nabble.com/How-to-make-sure-R-s-g-compiler

Re: [R] linear regression in a data.frame using recast -- A fortunes candidate??

2011-03-16 Thread Bert Gunter
Ha! -- A fortunes candidate? -- Bert > > If this is really a time series, then you will have serious validity > problems due to auto-correlation among non-independent units. (But if you > are just searching for a way to pull the wool over the eyes of the > statistically uninformed, then I guess th

[R] plotting multiple figures on one page

2011-03-16 Thread scarlet
I am new to the R language. I am trying to plot multiple figures on one page through a loop, but the code just produce one graph on one page. Can someone show some light on what's wrong? Here is my code: library("quantreg") tcdata<-read.table("mydata.txt",header=TRUE) postscript("myfigure.ps") ba

Re: [R] Strange R squared, possible error

2011-03-16 Thread derek
It states summary.lm: r.squared R^2, the ‘fraction of variance explained by the model’, R^2 = 1 - Sum(R[i]^2) / Sum((y[i]- y*)^2), where y* is the mean of y[i] if there is an intercept and zero otherwise. Why to use different formula when intercept is set to zero? I tried to compute R^2

Re: [R] linear regression in a data.frame using recast

2011-03-16 Thread David Winsemius
On Mar 16, 2011, at 3:19 PM, Justin Haynes wrote: I have a very large dataset with columns of id number, actual value, predicted value. This used to be a time series but I have dropped the time component. So I now have a data.frame where the id number is repeated but each value in the actual

Re: [R] Singularity problem

2011-03-16 Thread Berend Hasselman
On 16-03-2011, at 21:11, David Winsemius wrote: > > On Mar 16, 2011, at 1:32 PM, Berend Hasselman wrote: >> . >> svd(a) indicates the problem. >> >> largest singular value / smallest singular value=1e17 (condition number) >> --> reciprocal condition number=1e-17 >> and the standard solve c

Re: [R] Singularity problem

2011-03-16 Thread William Dunlap
You can get fairly bad results from solve() and other linear algebra routines without warning. E.g., the following function makes a 2 by 2 matrix which would have determinate 1.0 if we had infinite precision arithmetic and actually will produce one of determinant 1 on a computer if you use the "ri

Re: [R] fetch uneven

2011-03-16 Thread Henrique Dallazuanna
Try this: a <- m[c(TRUE, FALSE)] On Wed, Mar 16, 2011 at 11:43 AM, rens wrote: > Hi > I have a vector m: >  m >  [1] "ABC transporters" >  [2] "2" >  [3] "Acetyl-CoA" >  [4] "1" >  [5] "Energie" >  [6] "1" >  [7] "FAD Biosynthese" >  [8] "1" >  [9] "Glyoxylate and dicarboxylate metabolism" > [10

Re: [R] Strange R squared, possible error

2011-03-16 Thread JLucke
lm(y~x+0) yields the regression on x without the constant, i.e., y=bx+e, not y = a +e derek Sent by: r-help-boun...@r-project.org 03/16/2011 03:49 PM To r-help@r-project.org cc Subject [R] Strange R squared, possible error k=lm(y~x) summary(k) returns R^2=0.9994 lm(y~x) is supposed

Re: [R] calculating AUCs for each of the 1000 boot strap samples

2011-03-16 Thread Brian Diggs
On 3/16/2011 8:04 AM, taby gathoni wrote: data<-data.frame(id=1:(165+42),main_samp$SCORE, x=rep(c("BAD","GOOD"),c(42,165))) > f<-function(x) { + str.sample<-list() + for (i in 1:length(levels(x$x))) + { + str.sample[[i]]<-x[x$x==levels(x$x)[i] ,][sample(tapply(x$x,x$x,length)[i],20,rep=T),] +

Re: [R] Strange R squared, possible error

2011-03-16 Thread Bert Gunter
?summary.lm The R^2 section explains that R^2 is computed differently depending on whether or not an intercept is in the model. -- Bert On Wed, Mar 16, 2011 at 12:49 PM, derek wrote: > k=lm(y~x) > summary(k) > returns R^2=0.9994 > > lm(y~x) is supposed to find coef. a anb b in y=a*x+b > > l=lm

Re: [R] Strange R squared, possible error

2011-03-16 Thread Ista Zahn
Hi Derek, R^2 doesn't mean the same thing when you omit the intercept, as has been discussed on this list before. See http://r.789695.n4.nabble.com/lm-without-intercept-td3312429.html Best, Ista On Wed, Mar 16, 2011 at 3:49 PM, derek wrote: > k=lm(y~x) > summary(k) > returns R^2=0.9994 > > lm(y~

Re: [R] Singularity problem

2011-03-16 Thread rex.dwyer
Feng, Your matrix is *not* (practically) singular; its inverse is. The message said that the *system* was singular, not the matrix. Remember Cramer's Rule: xi = |Ai| / |A| The really, really large determinant of your matrix is going to appear in the denominator of your solutions, so, essentially,

[R] Strange R squared, possible error

2011-03-16 Thread derek
k=lm(y~x) summary(k) returns R^2=0.9994 lm(y~x) is supposed to find coef. a anb b in y=a*x+b l=lm(y~x+0) summary(l) returns R^2=0.9998 lm(y~x+0) is supposed to find coef. a in y=a*x+b while setting b=0 The question is why do I get better R^2, when it should be otherwise? Im sorry to use the wor

Re: [R] File > Save As...

2011-03-16 Thread Gene Leynes
Thanks for showing me the link to the code / your response / your work in general. It seems that the real magic is happening in the call to the function attributes, via the line attr(x, "srcref") I'm guessing that attributes must be defined somewhere deep inside the R machinery (since I didn't fin

[R] linear regression in a data.frame using recast

2011-03-16 Thread Justin Haynes
I have a very large dataset with columns of id number, actual value, predicted value. This used to be a time series but I have dropped the time component. So I now have a data.frame where the id number is repeated but each value in the actual and predicted columns are unique. I assume I need to

Re: [R] Cox model, model averaging and survival curve

2011-03-16 Thread Martin Patenaude-Monette
Thanks a lot for your answer. Martin Patenaude-Monette MSc. Candidate Département de biologie Université du Québec à Montréal 2011/3/15 Terry Therneau > --- included text -- > I have done model selection between candidate Cox models, using AICc > calculated with penalized log likelihoods. The

[R] Quantmod getSymbol.MySQL

2011-03-16 Thread priyadarshee sukhwal
I am trying to read a table from MySQL, I have loaded the file in "ts" database, in table name ACC. but i am unable to read it in R through getSymbol function. mysql> show databases; ++ | Database | ++ | information

Re: [R] Speed up sum of outer products?

2011-03-16 Thread AjayT
Hi Stefan, thats really interesting - I never though of trying to benchmark Linux-64 against OSX (a friend who works on large databases, says OSX performs better than Linux in his work!). Thanks for posting your comparison, and your hints :) i) I guess you have a very fast CPU (Core i7 or so, I g

Re: [R] adding linear regression data to plot

2011-03-16 Thread derek
Thank you that is very helpful. -- View this message in context: http://r.789695.n4.nabble.com/adding-linear-regression-data-to-plot-tp3357946p3382615.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list ht

Re: [R] Reorganize data frame

2011-03-16 Thread Scott Chamberlain
require(reshape2) dcast(stock.returns, Date ~ Ticker) The numbers were changed from their original values, but if you originally created the values Return as.numeric they should stay the same On Wednesday, March 16, 2011 at 9:37 AM, chris99 wrote: Hi group, > > I am trying to convert the organi

Re: [R] Singularity problem

2011-03-16 Thread David Winsemius
On Mar 16, 2011, at 1:32 PM, Berend Hasselman wrote: Peter Langfelder wrote: On Wed, Mar 16, 2011 at 8:28 AM, Feng Li wrote: Dear R, If I have remembered correctly, a square matrix is singular if and only if its determinant is zero. I am a bit confused by the following co

Re: [R] fetch uneven

2011-03-16 Thread David Winsemius
On Mar 16, 2011, at 1:21 PM, Henrik Bengtsson wrote: See ?seq for generating index vectors of different kinds. /Henrik Most people will probably understand seq(...) better than they understand modulo arithmetic, but logical indexing could also be used for the task: ((1:12) %/% 2) ==

Re: [R] export list to csv

2011-03-16 Thread andrija djurovic
Thanks everyone for different solutions. Every solution works very well. For my purpose, this function sink does what I was looking for. Andrija On Wed, Mar 16, 2011 at 4:23 PM, Roman Luštrik wrote: > How about? > > sink("andrija.csv") > l > sink() > > -- > View this message in context: > http:

Re: [R] read.table() with "\t" as seperator, all other programs report equal fields each row, read.table() returns unequal row length error

2011-03-16 Thread peter dalgaard
On Mar 16, 2011, at 17:37 , Yong Wang wrote: > hi, list > > R is undoudtedly my favorite statistic tool, however, the data > inputnpart has long been a pain. most data I have to deal with are > irregular and contains special character. > > Recently I get a tab delimited data, read.table(filenam

Re: [R] a question

2011-03-16 Thread Greg Snow
If you do ?Startup then you get the help page that describes all that R does as it starts up and there are a few places in there that it describes where you can put things to be run automatically. I have done this for a doctor before who wanted to show the demonstration I showed him to others,

Re: [R] graph lines don;t appear

2011-03-16 Thread Sara Szeremeta
Thanks a lot!! It helped! 2011/3/15 Sara Szeremeta > Hi > > I am trying to plot two simple graphs with a grid in background. The axis > and grid appears in correct position, but the actual data are not there > Can somebody provide me a hint what is missing? > > The code is: > > pln <- rea

Re: [R] Reorganize data frame

2011-03-16 Thread Henrique Dallazuanna
Try this: xtabs(Return ~ Date + Ticker, stock.returns) On Wed, Mar 16, 2011 at 11:37 AM, chris99 wrote: > Hi group, > > I am trying to convert the organization of a data frame so I can do some > correlations between stocks, > > I have something like this: > > stock.returns <- > data.frame(rbind(

Re: [R] R² for non-linear model

2011-03-16 Thread Alexx Hardt
Am 16.03.2011 19:34, schrieb Anna Gretschel: Am 16.03.2011 19:21, schrieb Alexx Hardt: And to be on-topic: Anna, as far as I know anova's are only useful to compare a submodel (e.g. with one less regressor) to another model. thanks! i don't get it either what they mean by fortune... It's an

Re: [R] export list to csv

2011-03-16 Thread Kenn Konstabel
The optimal way of doing it depends on how you want to use the result. An easy way has been recommended - if you have boo <- list(first=data.frame(a=1:5, b=2:6), second=data.frame(a=6:10, b=7:11)) .. then sink("boo.txt") boo # or: print(boo) sink() ... will put it all in the same file, the sa

Re: [R] R² for non-linear model + comparing linear + non-linear models

2011-03-16 Thread Anna Gretschel
Am 16.03.2011 19:29, schrieb Heiman, Thomas J.: Hi Anna, AIC and BIC are good criteria for determining degree of model fit.. Sincerely, tom Thomas Heiman, PhD Info Systems Eng, Sr The MITRE Corporation | Center for Enterprise Modernization Office: 703-983-2951 | thei...@mitre.org -Origin

Re: [R] R² for non-linear model

2011-03-16 Thread Alexx Hardt
Am 16.03.2011 19:11, schrieb Joshua Wiley: (Are fortunes determined by voting? There is precedence for seconding desired fortunes at least) Wait, what do you mean by fortune? Is there a statistics-quote-package-something for the unix shell program 'fortune' ? If so, I want want want! And

Re: [R] R² for non-linear model

2011-03-16 Thread Joshua Wiley
On Wed, Mar 16, 2011 at 10:54 AM, Bert Gunter wrote: > Is there any way that this could be made into a fortune -- perhaps by > omitting the poster's identity? > > "yes there are threads concidering this topic but they are all about the > theory not about how to get the value of r^2 for a non-linea

Re: [R] adding linear regression data to plot

2011-03-16 Thread Peter Ehlers
On 2011-03-16 08:47, derek wrote: I know I can add line to graph with abline(), but I would like to print R-squared, F-test value, Residuals and other statistics from lm() to a graph. I don't know how to access the values from summary(), so that I can use them in a following code or print them i

Re: [R] R² for non-linear model + comparing linear + non-linear models

2011-03-16 Thread Anna Gretschel
Dear Bert, so what can I do to obtain a goodness of fit for a non-linear model if r² does not work? And here comes my next question: is it apropriate to comopare a linear and a non-linear model with anova()? Thank you so much for answering, Anna Am 16.03.2011 18:54, schrieb Bert Gunter:

Re: [R] Saving summary outputs in a table form

2011-03-16 Thread Ivan Calandra
Hi, You should carefully and thoroughly read the help page for the extraction operators. See ?"[" Let's say your output below is in a data.frame called df. You can do something like this: df[, "Mean"] To select only some specific "phi" rows, you probably need to set some regular expression

Re: [R] Reorganize data frame

2011-03-16 Thread Phil Spector
Here's one way: ans = reshape(stock.returns,idvar='Date', +varying=list(names(stock.returns)[-1]), +direction='long', +times=names(stock.returns)[-1], +v.names='Return',timevar='Ticker') rownames(ans) = NULL ans Date Ticke

Re: [R] R² for non-linear model

2011-03-16 Thread Bert Gunter
Is there any way that this could be made into a fortune -- perhaps by omitting the poster's identity? "yes there are threads concidering this topic but they are all about the theory not about how to get the value of r^2 for a non-linear model in R." :=) Cheers, Bert Anna: I say this because you

Re: [R] adding linear regression data to plot

2011-03-16 Thread Martyn Byng
Hi, ?summary.lm describes what summary statistics get calculated and returned, so ll <- lm(y ~ x) ss <- summary(ll) ss$fstatistic for example would give the F statistic Martyn -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of d

[R] Data frame loop

2011-03-16 Thread Hosack, Michael
R users, I found a solution to my own question. I just needed to insert (j+(j-1)):(2*j) as the indices for vector s3. No need to respond. Thank you __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the po

Re: [R] Does R have a "const object"?

2011-03-16 Thread Hadley Wickham
>> Its useful for being able to set defaults for arguments that do not >> have defaults.  That cannot break existing programs. > > Until the next program decides do co change those defaults and either > can't or does and you end up with incompatible assumptions.  It also > make the code with the ad

Re: [R] R² for non-linear model

2011-03-16 Thread Anna Gretschel
Am 16.03.2011 18:19, schrieb Joshua Wiley: Dear Anna, What is your goal in obtaining a value for R^2 ? I believe it is not provided for a non-linear model, because it does not make much sense. It certainly will not have the same interpretation as in a linear model, and all the ways it *could* b

Re: [R] R² for non-linear model

2011-03-16 Thread Bert Gunter
You can't. R^2 has no (consistent, sensible) meaning for nonlinear models. If you don't understand why not, get local help or do some reading. Cheers, Bert On Wed, Mar 16, 2011 at 9:53 AM, Anna Gretschel wrote: > Dear List, > > how can I obtain the value of r suqared for a non-linear model? Fo

Re: [R] R² for non-linear model

2011-03-16 Thread Anna Gretschel
Am 16.03.2011 18:15, schrieb David Winsemius: On Mar 16, 2011, at 12:53 PM, Anna Gretschel wrote: Dear List, how can I obtain the value of r suqared for a non-linear model? For linear models it can be found in the summary() of the model but for non-linear models I just don't know. Please help

Re: [R] R² for non-linear model

2011-03-16 Thread Joshua Wiley
Dear Anna, What is your goal in obtaining a value for R^2 ? I believe it is not provided for a non-linear model, because it does not make much sense. It certainly will not have the same interpretation as in a linear model, and all the ways it *could* be "defined" come with their own sets of probl

Re: [R] How to read "Cumulative proportion" in using princomp?

2011-03-16 Thread Peter Ehlers
On 2011-03-16 10:31, Martyn Byng wrote: Hi, The values are calculated on the fly in the summary function stats:::print.summary.princomp using vars<- result$sdev^2 vars<- vars/sum(vars) cumsum(vars) Or you could use the prcomp summary function (maybe you should use prcomp() for you model?):

Re: [R] R² for non-linear model

2011-03-16 Thread David Winsemius
On Mar 16, 2011, at 12:53 PM, Anna Gretschel wrote: Dear List, how can I obtain the value of r suqared for a non-linear model? For linear models it can be found in the summary() of the model but for non-linear models I just don't know. Please help! You should do more searching. I can remembe

Re: [R] Does R have a "const object"?

2011-03-16 Thread luke-tierney
On Wed, 16 Mar 2011, Gabor Grothendieck wrote: On Wed, Mar 16, 2011 at 12:16 PM, wrote: On Wed, 16 Mar 2011, Gabor Grothendieck wrote: On Wed, Mar 16, 2011 at 11:49 AM,   wrote: Just as a heads-up: it is likely that unlocking the bindings in base for pi, T, F, probably all BULTIN and SPEC

Re: [R] Singularity problem

2011-03-16 Thread Berend Hasselman
Peter Langfelder wrote: > > On Wed, Mar 16, 2011 at 8:28 AM, Feng Li wrote: >> Dear R, >> >> If I have remembered correctly, a square matrix is singular if and only >> if >> its determinant is zero. I am a bit confused by the following code error. >> Can someone give me a hint? >>

Re: [R] How to read "Cumulative proportion" in using princomp?

2011-03-16 Thread Martyn Byng
Hi, The values are calculated on the fly in the summary function stats:::print.summary.princomp using vars <- result$sdev^2 vars <- vars/sum(vars) cumsum(vars) Martyn -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of ian_zhangty

[R] read.table() with "\t" as seperator, all other programs report equal fields each row, read.table() returns unequal row length error

2011-03-16 Thread Yong Wang
hi, list R is undoudtedly my favorite statistic tool, however, the data inputnpart has long been a pain. most data I have to deal with are irregular and contains special character. Recently I get a tab delimited data, read.table(filename,sep="\t") constantly return erors for certain rows does not

Re: [R] fetch uneven

2011-03-16 Thread Henrik Bengtsson
See ?seq for generating index vectors of different kinds. /Henrik On Wed, Mar 16, 2011 at 7:43 AM, rens wrote: > Hi > I have a vector m: >  m >  [1] "ABC transporters" >  [2] "2" >  [3] "Acetyl-CoA" >  [4] "1" >  [5] "Energie" >  [6] "1" >  [7] "FAD Biosynthese" >  [8] "1" >  [9] "Glyoxylate and

[R] cross validation? when rlm, lmrob or lmRob

2011-03-16 Thread agent dunham
Dear community, I have fitted a model using comands above, (rlm, lmrob or lmRob). I don't have new data to validate de models obtained. I was wondering if exists something similar to CVlm in robust regression. In case there isn't, any suggestion for validation would be appreciated. Thanks, u...

Re: [R] changing one character in the name of dataframes repeatedly

2011-03-16 Thread Laszlo
Hello Ivan, Thank you very much for your comments, they were really useful and I’ll try to memorize and use them in the future. Getting back to my problem… well, I try to put it in a different way because I’m afraid this is gonna be a little bit more difficult than I thought. So, here is my refr

[R] Bootstrap memory use?

2011-03-16 Thread Matthew Vernon
Hi, the boot function from the "boot" library seems to use an implausible quantity of memory; is this to be expected, or am I doing something wrong? Specifically, the vector I wish to bootstrap off is about 17000 entries long length(fes) [1] 16988 bm <- function(x,indexes) mean(x[indexes]) then

Re: [R] export list to csv

2011-03-16 Thread Roman Luštrik
How about? sink("andrija.csv") l sink() -- View this message in context: http://r.789695.n4.nabble.com/export-list-to-csv-tp3381992p3382062.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat

Re: [R] table() reading problem

2011-03-16 Thread Allan Engelhardt
On 16/03/11 09:20, fre wrote: I have the following problem: I have some string with numbers like k. I want to have a table like the function table() gives. However I am not able to call the first row, the 1, 2, 3, 5, 6 or 9. I tried to do that by a data.frame, but that doesn't seem The first

Re: [R] adding linear regression data to plot

2011-03-16 Thread derek
I know I can add line to graph with abline(), but I would like to print R-squared, F-test value, Residuals and other statistics from lm() to a graph. I don't know how to access the values from summary(), so that I can use them in a following code or print them in a graph. -- View this message in

[R] fetch uneven

2011-03-16 Thread rens
Hi I have a vector m: m [1] "ABC transporters" [2] "2" [3] "Acetyl-CoA" [4] "1" [5] "Energie" [6] "1"

Re: [R] generate bivariate or multivariate gamma distribution in R

2011-03-16 Thread He, Yulei
Hi, there: Is there any quick function to generate bivariate or multivariate gamma distribution? Thanks. Yulei __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org

[R] suppress GUI window when loading a library

2011-03-16 Thread Gregory Carey
When some libraries (e.g., VIM and Rcmdr) are loaded, they automatically display a GUI window. Is there a way to load the library but suppress the window? greg gregory carey university of colorado __ R-help@r-project.org mailing list https://stat.ethz

[R] Reorganize data frame

2011-03-16 Thread chris99
Hi group, I am trying to convert the organization of a data frame so I can do some correlations between stocks, I have something like this: stock.returns <- data.frame(rbind(c("MSFT","20110301",0.05),c("MSFT","20110302",0.01),c("GOOG","20110301",-0.01),c("GOOG","20110302",0.04))) colnames(stock.

Re: [R] Scope of variable?

2011-03-16 Thread Ravi Kulkarni
Of course! Works fine now. Thanks, Martyn and Jim... Ravi -- View this message in context: http://r.789695.n4.nabble.com/Scope-of-variable-tp3381485p3381932.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing

[R] How to read "Cumulative proportion" in using princomp?

2011-03-16 Thread ian_zhangty
Dear all, > result<-summary(princomp(x,cor=TRUE)) >result Importance of components: Comp.1Comp.2 Comp.3 Comp.4 Standard deviation 1.642136 1.0114376 0.45146892 0.27669119 Proportion of Variance 0.674153 0.2557515 0.05095605 0.01913950 Cumulative Proportion

[R] Saving summary outputs in a table form

2011-03-16 Thread Haillie
Dear R help, Is there a way to extract a variable ( one column) from my summary statistics to save it in a table form? My post-factor analysis summary statistics gave me the output below. Is there anyway to just save the mean of all the phi? The filename of this summary output is postun2010sum. Al

  1   2   >