Re: [R] How do I test against a simple null that two regressions coefficients are equal?

2010-07-08 Thread markleeds
hi: no. it's not the same. if you read the paper that I referenced last night, that explains how to do the following test : Ho: R2 = R1 H1: R2 != R1 that's a different test from what you did but i think it's what you want. On Jul 8, 2010, chen jia chen_1...@fisher.osu.edu

Re: [R] How do I test against a simple null that two regressions coefficients are equal?

2010-07-07 Thread markleeds
wow chuck. you really know how to dig up the archives. I don't know if it's exactly relevant for what the OP is asking but i did use the ( or atleast a )Â paper by hotelling and it was titled the selection of variates for use in prediction with some comments on the general problem of

Re: [R] prcomp - principal components in R

2009-11-09 Thread markleeds
Hi: I'm not familar with prcomp but with the principal components function in bill revelle's psych package , one can specify the number of components one wants to use to build the closest covariance matrix I don't know what tol is doing in your example but it's not doing that.

Re: [R] Urgently needed Exercise solutions related to Practical Data Analysis Using R Statisctial Software

2009-10-03 Thread markleeds
__ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 regarding R scoping

2009-08-07 Thread markleeds
__ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 regarding R scoping

2009-08-07 Thread markleeds
__ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] interesting statistics article in NYT

2009-08-07 Thread markleeds
__ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Likelihood Function for Multinomial Logistic Regression and its partial derivatives

2009-08-02 Thread markleeds
Hi: John Fox's CAR book has some very nice examples of how the multinomial likelihood is estimated computationally speaking. But you mentioned multilevel earlier which sounds more complex ? On Aug 2, 2009, nikolay12 nikola...@gmail.com wrote: Thanks a lot. The info about

[R] error when installing rjags

2009-07-21 Thread markleeds
Hi All: I get the following error when trying to install the rjags package. I've installed the jags software and I'm using Fedora 10.0 and my sessionInfo is at the bottom of this email. I'm also sorry if this email ends up having control A's all over it. I still haven't figured

Re: [R] off topic but need your pointers about statistics

2009-06-18 Thread markleeds
agresti's book ( forget which one. there are two ) has an appendix about the history of categorical data that i remember being quite interesting. that's the only one i know of. On Jun 18, 2009, Michael comtech@gmail.com wrote: Hi all, I apologize for this off-topic

Re: [R] How to subset my dataframe? (a bit tricky)

2009-06-16 Thread markleeds
Hi Bill: I was trying to do below myself but was having problems. So I took your solution and made another one. yours was working a little weirdly because I don't think the person wants to keep rows where there are 2 dnv's in a row and he/she also wanted to keep the row if the

Re: [R] apply fn to many dataframes

2009-05-25 Thread markleeds
Hi:Â you have to return the dataframe inside the lapply. I also changed = to - but I doubt that matters. d1 - data.frame(x1=1,x3=4) d2 - data.frame(x1=2,x3=5) d3 - data.frame(x1=3,x3=6) d4 - data.frame(x1=4,x3=7) a = list(d1,d2,d3,d4) print(a) lapply(a,function(.df) {

Re: [R] how to insert NULLs in lists?

2009-05-22 Thread markleeds
Hi Kynn: this oddity is discussed in Patrick Burn's document called The R Inferno. I don't recall the fix so I'm not sure if below is the same as what his book says to do but it seems to do what you want. x - list() x[[1]] - 2 x length(x) print(str(x)) x[2] -

Re: [R] I'm offering $300 for someone who know R-programming to do the assignments for me.

2009-05-09 Thread markleeds
I hate to start a whole war about this but isn't there some percent chance ( not much but non zero ) that she's willing to pay the 300.00 so that she can get a nice solution that she can then learn from ? I'm definitely guilty of this behavior as a non-student and i forget to

[R] to the person who asked about dividing by the base row

2009-05-04 Thread markleeds
to whomever that was. i deleted your email but I think below does what you want. as always, there's probably some improvement that could be done. whether it's  minor or major, i'm not sure ? also, 3 things:  A)there are some Inf's in the output because of division by zero but

Re: [R] comparing columns in a dataframe

2009-04-04 Thread markleeds
Hi: you've got to create a setdiff in both directions in order to get the lone ones in each column because setdiff is not commutative meaning that setdiff(a,b) does not equal setdiff(b,a). once you do that, then ( setdiff1 + setdiff2 - intersect ) should equal the union. if

Re: [R] embed?

2009-04-03 Thread markleeds
Hi kevin: one use ( there are probably many others ) is for use inside a vector autoregression model where the RHS is lags of the independent variable. So, x_t is the 3rd column, x_t-1 is the second, x_t-2 is the third etc. On Apr 3, 2009, rkevinbur...@charter.net wrote: I

Re: [R] Removing backslashes from data

2009-04-03 Thread markleeds
Below works but it has two backslashes in the word. maybe someone can explain why the 4 and 2 works but 2 1 doesn't ? thanks. gsub(,,Hello\\World,perl=TRUE) On Apr 3, 2009, Andrew Conway agc...@nyu.edu wrote: I am trying to check for backslashes in data, then remove them

Re: [R] Learning development concepts in R for newbie users

2009-04-01 Thread markleeds
Hi: I have had a similar issue so below are ways that I deal with that.  i don't think there are manuals/ documentation for becoming more of a developer ( someone can correct me if I'm wrong and I'd be happy to be wrong ) but there are other ways: 1) Staying on this

Re: [R] Scatter plot

2009-04-01 Thread markleeds
Hi Stephen: If you want to take tem out of quotes, you can use deparse substitute as in below. Maybe there are other ways also but that's the one I often see used. I hope this email ends up looking okay because my mailer has been acting strangely lately.          Â

[R] error when going through Alan Lenarcic's package Tutorial

2009-03-31 Thread markleeds
Hi Everyone: I've been going through Alan Lenarcic's package tutorial but when I did R CMD SHLIB Xdemo.cc Xdemo_main.cc -o Xdemo.dll I got the following error: XDemo_res.rc:15:38: warning: missing terminating character XDemo_res.rc:23:34: warning: missing terminating '

Re: [R] error when going through Alan Lenarcic's package Tutorial

2009-03-31 Thread markleeds
apologies for my screwed up send. it looks really funked when I read it so my mail settings must be messed up. I'll resend it later tonight from a different computer. On Mar 31, 2009, markle...@verizon.net wrote: Hi Everyone: I've been going through Alan Lenarcic's package

[R] problems with package tutorial

2009-03-31 Thread markleeds
Hi: Here's my revised attempt at explaining my problem. Hopefully it won't get sent out weirdly like it did earlier.  The link to what I'm trying to follow is http://www.stat.columbia.edu/~gelman/stuff_for_blog/AlanRPackageTutorial.pdf  I've been going through the tutorial but

Re: [R] Fisher test problem

2009-03-21 Thread markleeds
by definition, the one tailed p-value has to be = 0.5 so there is still something wrong with your OpenEpi calc. Most likely it's calculating the 2 tailed p-value and then mistakenly multiplying by 2. For example: A) Suppose you are testing Ho: u = u_0

Re: [R] Fisher test problem

2009-03-21 Thread markleeds
at 10:42 PM, Ben Bolker wrote: markleeds at verizon.net writes: by definition, the one tailed p-value has to be = 0.5 so there is still something wrong with your OpenEpi calc. Most likely it's calculating the 2 tailed p-value and then mistakenly multiplying by 2. For example: For what

Re: [R] Fisher test problem

2009-03-21 Thread markleeds
Thanks berwin. See what I sent to Ben. I better start looking up my stat textbooks or going back to class before I start using stat terms. You guys are on top of things . On Sat, Mar 21, 2009 at 10:50 PM, Berwin A Turlach wrote: G'day Mark, On Sat, 21 Mar 2009 22:08:21 -0500 (CDT)

Re: [R] Taking diff of character vectors

2009-03-13 Thread markleeds
Hi: For A, you can use head and tail but you have to add a zero the front. For B, you can use the same function, but put it inside an sapply and run over the columns and then cbind it back with the original dataframe. A) nm2 - c(rep(SPZ8, 10), rep(SPX9, 10)) -1.0*c(0,as.numeric((head(nm2,-1)

Re: [R] Writing xls - multiple sheets

2009-03-12 Thread markleeds
I think that Gabor sent something earlier today ( or atleast something related ) so check the archives for his solution. On Thu, Mar 12, 2009 at 4:29 PM, Ferry wrote: Hi, Is there a package I can use to write to multiple sheets on xls file, other than using the paid version of

[R] FW: Re: Writing xls - multiple sheets

2009-03-12 Thread markleeds
Jorge was kind enough to point out that I made a mistake in referencing gabor's solution. See below. Thanks Jorge. Begin forwarded message Subject: Re: [R] Writing xls - multiple sheets Date: 3/12/2009 6:03:13 PM From: Jorge Ivan Velez To: markle...@verizon.net Hi Mark,

Re: [R] Converting a dataframe to a matrix

2009-03-11 Thread markleeds
Hi: Below works but it's extremely ugly and overly complicated. i'm sure someone else will send you something better and I'll be waiting also. Also, the way I named the rows and columns works for below but it won't hold in the general case if you don't have nice ordered names like you do

Re: [R] mean reverting model

2009-03-09 Thread markleeds
i think there's confusion here between a time series that reverts to its long term mean and an ornstein uhlenbeck type of mean reversion. they're not the same thing and I don't want to go into the difference because I would probably just add to the confusion. you might be better off sending

[R] link for OU versus AR

2009-03-09 Thread markleeds
below is one link for an explanation of the equivalence between AR(1) and OU so I was wrong about needing an AR(2). at a quick glance, i think OU's that can always be written as AR(1)'s ( with a correct mapping of parameters ) but not every AR(1) can be written as an OU ?

Re: [R] how to omit NA without using ifelse

2009-03-05 Thread markleeds
Hi: what you want to do is not recommended if you're doing a statistical computation ( many threads on this. search the archives if you want more details ) but if you really want to do that below should work: mat[is.na(mat)]-0 On Thu, Mar 5, 2009 at 11:22 PM, Manli Yan wrote: I have a

[R] regular expression question

2009-03-02 Thread markleeds
can someone show me how to use a regular expression to break the string at the bottom up into its three components : (-0.791,-0.263] (-38,-1.24] (0.96,2.43] I tried to use strplit because of my regexpitis ( it's not curable. i've been to many doctors all over NYC. they tell me there's no cure

Re: [R] learning R

2009-02-25 Thread markleeds
David, Wacek: Just so everyone knows, I just looked and this is explained quite clearly in the R Language Reference manual, very similarly to what Wacek did below. On Wed, Feb 25, 2009 at 3:42 AM, Wacek Kusnierczyk wrote: David Winsemius wrote: On Feb 24, 2009, at 11:36 PM, Fuchs Ira

Re: [R] learning R

2009-02-25 Thread markleeds
Hi Wacek: Somewhere I remember reading that environments have functionality like lists EXCEPT for the names part. IIRC, I think that I read this in the R Language Reference manual also. On Wed, Feb 25, 2009 at 4:32 AM, Wacek Kusnierczyk wrote: a quick follow-up: e = new.env()

Re: [R] learning R

2009-02-25 Thread markleeds
Thanks Berwin. You're correct in that I meant the R Language Definition. Well, it may be a draft but I read it for the first time a few months ago and it was very enlightening so, whether it's a draft or not, I highly recommend it. ( but not for total beginners. The R-intro is better for a

Re: [R] R question - combine values

2009-02-25 Thread markleeds
Hi: John Fox's recode function in his car package provides a convenient way for doing what you need. I don't know what your factor is specifically but below is mostly taken out of the help for recode and shows how to take a factor and recode it to make it a new factor. you can apply that for

Re: [R] R question - combine values

2009-02-25 Thread markleeds
oops, then i guess i should not have sent the recode suggestion. choonhong: I only sent it as an example of how to recode your factor. I didn't mean to imply ( nor did i even give it much thought ) that what you're doing is statistically/philosophically correct. I'm a friend but I think what

Re: [R] bigest part of vector

2009-02-24 Thread markleeds
There's probably something built in to R but you can change the values of the percentiles (p) below to get the value that corresponds to it. rounding might be problematic also. temp - c(1,4,8,3,5) p - 0.8 temp[order(temp)][round(length(temp)*p)] On Tue, Feb 24, 2009 at 2:36 PM, Peterko

Re: [R] how to NULL multiple variables of a df efficiently?

2009-02-24 Thread markleeds
One way is to use %in% like below: df-data.frame(var.a=rnorm(10), var.b=rnorm(10),var.c=rnorm(10)) print(df) df - df[,!(names(df) %in% c('var.a','var.b')),drop=FALSE] print(df) On Tue, Feb 24, 2009 at 3:10 PM, Sean Zhang wrote: Dear R-helpers: I am an R novice and would appreciate answer

Re: [R] Multiple merge, better solution?

2009-02-19 Thread markleeds
Hi: Below is a TOTAL HACK and I don't recommend it but it does seem to do what you want. I think that I remember Gabor saying that you can merge multiple data frames using zoo but I don't know the specifics. I'm sure he'll respond with the correct way. Below uses a global variable to access

Re: [R] type III effect from glm()

2009-02-19 Thread markleeds
Hi Simon: In below , test1 spelled out is count ~ siteall + yrs + district + yrs:district so this is fine. but in test2 , you have years interacting with district but not the main effect for years. this is against the rules of marginality so I still think there's a problem. I would wait for

Re: [R] Insert value in a Vector Alternately

2009-02-18 Thread markleeds
Hi Gundala: Below works but I was trying to figure out a way to not have to add the last line and I gave up. dat-c(0.00377467,0.00377467,0.00377467,0.00380083,0.00380083,0.00380083,0.00380959, 0.00380959,0.00380959,0.00380083,0.00380083,0.00380083) # MAKE A TEMPORARY MATRIX temp -

Re: [R] Outlier Detection for timeseries

2009-02-14 Thread markleeds
Doug Martin et al ( he may not be the first author ) has a book called Robust Regression and I vaguely recall seeing a chapter in there related to outlier detection. in time series. Given that there's an S+ package associated with the book, maybe that package has been or can be translated to

Re: [R] Extending each element in a list, or rbind()-ing arrays of different length without recycling

2009-02-12 Thread markleeds
Hi Jason: below seems to work. you have to take the transpose because the apply returns the rows transposed. i'm also not sure how to make the NAs be the last ones but maybe someone can show us how to do that. mat - matrix(c(2,7,2,7,9,10,10,6,8,6,1,9,7,2,0),byrow=TRUE,nrow=3) print(mat)

Re: [R] Extending each element in a list, or rbind()-ing arrays of different length without recycling

2009-02-12 Thread markleeds
Thanks Rolf. very nice but pretty easy is ALWAYS a relative statement. On Thu, Feb 12, 2009 at 3:59 PM, Rolf Turner wrote: On 13/02/2009, at 9:06 AM, markle...@verizon.net wrote: Hi Jason: below seems to work. you have to take the transpose because the apply returns the rows transposed.

Re: [R] Aggregrate function

2009-02-12 Thread markleeds
it does and you get exactly what monica wanted if you take out the sp and just return the whole thing. thanks. On Thu, Feb 12, 2009 at 5:52 PM, David Winsemius wrote: aggregate and by are convenience functions of tapply. Consider this alternate solution: xveg[which(xveg$tot %in%

Re: [R] loglik and arima()

2009-02-10 Thread markleeds
hi: maybe it's minimizing the negative of the likeihood rather than maximizing the likelihood ? other than that, i don't see that being possible because of what you said. see what happens if you estimate an arima(1,1,3) ? On Tue, Feb 10, 2009 at 12:51 PM, Stephen Collins wrote: All - I

Re: [R] OT: A test with dependent samples.

2009-02-10 Thread markleeds
Hi: Bert: can you do that because the null is that they are equal before and after, not that the proportion is zero ? Thank for any clarification to my lack of understanding. On Tue, Feb 10, 2009 at 5:43 PM, Bert Gunter wrote: Ah, experimental units,again ... a subject little taught by

Re: [R] OT: A test with dependent samples.

2009-02-10 Thread markleeds
Hi Bert: I think what you said about a prior guess for the NULL is also similar to what Chuck said about people looking with a blank stare. Thanks for the clarification. On Tue, Feb 10, 2009 at 7:06 PM, Bert Gunter wrote: The only question at issue (i.e. capable of being addressed)

[R] sorting a matrix by the column

2009-02-10 Thread markleeds
this is a bad question but I can't figure it out and i've tried. if i sort the 2 column matrix , temp1, by the first column, then things work as expected. But, if I sort the 1 column matrix, temp2, then it gets turned coerced to a vector. I realize that I need to use drop=FALSE but i've put it

[R] error in my previous message

2009-02-10 Thread markleeds
i'm sorry. i had an error in my previous code because i left out a letter in the rownames. while fixing that, i also found a solution. so i'm sorry for the confusion. below is my fix. temp2 - matrix(rnorm(10),nc=1,nrow=10) rownames(temp2) - c(a,b,c,d,e,f,g,h,i,j) print(temp2) temp2 -

Re: [R] non-numeric argument to binary operator

2009-02-04 Thread markleeds
hi: it's not clear to me what you're trying to do but maybe outer is what you want ? outer(x,y) it takes every value in x and pairs it with every value in y and the default operation is multiply. see details by doing ?outer. On Wed, Feb 4, 2009 at 10:36 PM, cruz wrote: Hi, I compute

Re: [R] Re : standard error of logit parameters

2009-01-28 Thread markleeds
I'm sure below is fine but john fox's CAR book has some nice examples of how to compute the logit parameters and variances from scratch using iteratively weighted least squares. On Thu, Jan 29, 2009 at 1:54 AM, justin bem wrote: Run outfit-nlm(..., hessian=T) and then standards error

[R] evaluation revisited

2009-01-27 Thread markleeds
I'm still going over old emails and trying to get my head around evaluation so I'm persistent if nothing else. A while back , an expert sent me below as an exercise in understanding and I only got around to it tonight. I understand some of the output but not all of it and I put Why not Zero

Re: [R] how to vectorize this?

2009-01-25 Thread markleeds
Hi: if i understand, i think newx-x[ x %in% key] should give you what you want. On Sun, Jan 25, 2009 at 10:27 PM, Akshaya Jha wrote: Hi, I have the following datasets: x=data I am looking through key=a set of data with the codes I want I have the following issue: I want the subset of x

Re: [R] Gentleman and Ihaka's integrity in question

2009-01-19 Thread markleeds
Hi: I think I saw a link where the author clarified the original article and explained more clearly that the design of R had it roots in S/S+. I don't remember where I saw it but it's somewhere. Also, I think it's jumping the gun to claim that anyone lied to anyone before doing the research

[R] lazy evaluation question

2009-01-18 Thread markleeds
I've been going back to old difficult R-list evaluation emails that I save in order to understand evaluation better and below still confuses me. Could someone explain why A) works and B) doesn't. A variant of below is in the Pat's Inferno book also but I'm still not clear on what is

Re: [R] Comparing elements for equality

2009-01-13 Thread markleeds
Hi Harold: Below works on your data set but check it a lot because I am a little worried that I could have missed something. Hopefully someone can send a a little clearer way. dat - data.frame(id = c(1,1,2,2,2), var1 = c(10,10,20,20,25), var2 = c('foo', 'foo', 'foo', 'foobar', 'foo'))

[R] basic sweave question

2009-01-12 Thread markleeds
I am trying to learn the basics of Sweave so I read some things and a friend gave me his Rnw file to play with. I am able to do R CMD Sweave mark-example.Rnw. That works. But, then when I do latex mark-example.tex, I get the message below. I looked in the archives and Martin Morgan mentioned

Re: [R] basic sweave question

2009-01-12 Thread markleeds
In my original message, I forot to include my Session Info so it is below. I apologize for that. sessionInfo() R version 2.8.0 (2008-10-20) i386-redhat-linux-gnu locale:

Re: [R] basic sweave question

2009-01-12 Thread markleeds
Martin Morgan kindly explained to me off-list that I need to use R CMD pdflatex mark-example.tex. That fixed my problem. On Mon, Jan 12, 2009 at 11:25 PM, markle...@verizon.net wrote: In my original message, I forot to include my Session Info so it is below. I apologize for that.

Re: [R] Matrix: Problem with the code

2009-01-09 Thread markleeds
Charlotte: I ran your code because I wasn't clear on it and your way would cause more matrices than the person requested. So I think the code below it, although not too short, does what the person asked. Thanks though because I understand outer better now. temp - matrix(c(1,2,3,4,5,6),ncol=2)

Re: [R] Matrix: Problem with the code

2009-01-09 Thread markleeds
Thanks Kingsford. I thought the column power was supposed to be just for that column but you're probably correct. English has its oddities because if one reads the actual sentence the person wrote it's still not clear, atleast to me. Actually I want to have a matrix with p columns such that

Re: [R] Parsing unusual date format

2008-12-17 Thread markleeds
hi: i tried regular expressions and , as usual, failed. but below does do the job uglily using strsplit. i'd still be curious and appreciate if someone could do the regular expression method. thanks. dts - c(1990m12, 1992m8) #March 1990 and Aug 1992 #SPLIT IT USING m temp - strsplit(dts,m) #

Re: [R] sliding window over a large vector

2008-12-16 Thread markleeds
Hi: Veslot: I'm too tired to even try to figure out why but I think that there is something wrong with your sl function. see below for an empirical proof of that statement. OR maybe you're definition of sliding window is different than rollapply's definition but rollapply's answer makes more

Re: [R] opening a PDF document

2008-12-14 Thread markleeds
i guess it depends on what you have installed on your linux OS but xpdf works for me. i use fedora. On Sun, Dec 14, 2008 at 7:18 PM, Dennis Fisher wrote: Colleagues, I am interesting in opening a PDF document via the command line from both Windows, OS X, and Linux ( R version 2.8.0).

Re: [R] how to create duplicated ID in multi-records per subject dataset

2008-12-14 Thread markleeds
hi: change your dots to NAs and then use na.locf in the zoo package. i didn't test it but i think that should work. DF$ID[DF$ID == .]-NA DF$ID-na.locf(DF$ID) On Sun, Dec 14, 2008 at 8:56 PM, Zhixin Liu wrote: Hi R helpers, If I have a dataset looks like: ID record 120 .

Re: [R] how to create duplicated ID in multi-records per subject dataset

2008-12-14 Thread markleeds
andrew has a point which makes my solution wrong. you'd have to change the factors to numerics and I'm not sure what would happen when you did that. if you want to send a sample file of your data, that would be best but andrew's suggestion may work right off the bat. On Sun, Dec 14, 2008 at

[R] odd behavior when multiplying data frame by an element

2008-12-12 Thread markleeds
could someone explain what is happening below ? I was trying to solve a related question on the list and then , as I was solving it, I was getting strange answers and then I noticed below. It's obviously not a bug but I don't get it. Thanks. m - data.frame(class = c(birds, planes), feather =

Re: [R] odd behavior when multiplying data frame by an element

2008-12-12 Thread markleeds
disregard my last question. i forgot that d1 was a dataframe and was thinkiing it was a vector. i think i can fix what i was doing now. On Fri, Dec 12, 2008 at 8:52 PM, markle...@verizon.net wrote: could someone explain what is happening below ? I was trying to solve a related question

[R] feather and jet problem

2008-12-12 Thread markleeds
to the person who just asked about the feather and jet problem: i lost your email but below works. there should be a shorter way by avoiding the last statement and doing everything in the lapply but I've had enough of feathers and jets tonight. m - data.frame(class = c(birds, planes), feather

[R] weird pasting of .value when list is returned

2008-12-12 Thread markleeds
could someone explain why the name of FPVAL gets .value concatenated onto it when the code below is run and temp is returned. I've been trying to figure this out for too long. It doesn't matter when I put the FPVAL in the return statement. It happens regardless of whether it's first or last.

[R] not R but consumer choice contest that has statistical implications

2008-11-23 Thread markleeds
a friend of mine sent me the following and I'm thinking that there are people on this list that might be interested and could also hit the 10% improvement mark possibly ? i don't know any more about it than the article says so, if someone is interested, I guess you would have to contact

[R] comparing rows

2008-11-10 Thread markleeds
hi chris: i'm betting that there is a better/shorter more R'ish way to do it ( if someone could provide that, it's appreciated ) but below will get the output in the format you need. the all function tests whether all the elements are equal so you don't need setequal although i guess it's a

Re: [R] comparing rows - a possible solution

2008-11-10 Thread markleeds
Hi Oliver: if I understood Chris's email correctly , he wanted to compare all possible row ( row1 with the other 4 rows of the other matrix, row 2 with the 4 rows of the other matrix, etc, etc, ) combinations of the two matrices, not the individual elements of the matrix. That's just my

Re: [R] how to vectorize a for loop

2008-11-09 Thread markleeds
hi: below almost gets you there except for the endpoints. see filter for more information. d=0.5 L=20 x=seq(20, by=1, length.out=20) temp - as.numeric(filter(x,filter=c(d,(1-2*d),d),sides=2)) print(temp) On Sun, Nov 9, 2008 at 10:57 PM, stephen sefick wrote: #Is there a way to vectorize

[R] strange list structure question

2008-11-03 Thread markleeds
my problem is more complex than below but I think below can suffice. i have a list and the name of it at the top level is GGG. so, if i do an lapply and operate on lower components in the sublist, then I can do as shown in EXAMPLE 1 and what will come back will be named GGG at the top level.

Re: [R] strange list structure question

2008-11-03 Thread markleeds
Hi Rolf: it's not what's inside the lapplys that i was interested in which probably made my question more confusing. all i was trying to show was that, in EXAMPLE 1, the name comes back at the top level of the result. in EXAMPLE 2, i can use the name GGG inside the lapply functon to do

Re: [R] regex question

2008-11-03 Thread markleeds
Hi: Gabor's solution does do it in a single line. he just used paste to make the line. see below. John's is sort of a single line also but he called sub twice. I doubt that it's possible to make it shorter than those solutions. # Gabor's solution spelled out. patReg1 - (^[ *]+) patReg2 - ([

Re: [R] Cómo convertir un objeto data frame en una tab la csv

2008-11-02 Thread markleeds
hi ricardo: you're english is fine. i'll cc the list because i haven't done that and i don't know what a geodata object is but my guess is that you can use write.table. you can see the details of that function by doing ?write.table. On Sun, Nov 2, 2008 at 9:02 PM, Ricardo Bandin wrote:

[R] FW: Re: linux batch question

2008-10-29 Thread markleeds
Hi Phil: That's EXACTLY what it is. Thanks so much. It's nice to know that the R Gods don't hate me. I hope it's okay that I'm going to cc r-help in case this thread comes up in the future and also so that other people who might want to help know that it's solved. Thanks again. On Wed,

Re: [R] linux batch question

2008-10-29 Thread markleeds
thanks Rolf. Yes, I meant temp.R. I was going to use test.R but then I realized that I already had a program named that. I think the R gods are really hating me !!! it's a very odd thing. I'll grep the file because maybe the output is in there somewhere and i'm missing it ? On Wed,

Re: [R] odd behaviour of identical

2008-10-26 Thread markleeds
the str function shows that x is an int and y is a num so it's probably not a bug. or maybe the conversion to num is but probably not the identical. x = 1:10 y = 1:10 all.equal(x,y) identical(x,y) y[11] = 11 y = y[1:10] all.equal(x,y) identical(x,y) print(str(y)) print(str(x)) On

[R] following up on infinite email server loop

2008-10-24 Thread markleeds
just to add to ted's explanation in case it helps to fix the email server problem: below are the two Recipients and one of the two is always contained in the repeated emails that I'm receiving. Also, of course i don't mean to claim that the names contained in below are doing anything to

Re: [R] how to simply the procedure of creating a group of data.frame?

2008-10-24 Thread markleeds
if you do below, then d[[1]] is the first, d[[2]] is the second etc. d - lapply(1:50,function(.index) { data.frame(x=factor(),y=numeric()) }) print(d) print(str(d)) On Fri, Oct 24, 2008 at 4:36 AM, tedzzx wrote: Dear R users, I want to creat a group of data frames, such as:

Re: [R] R random number generation

2008-10-23 Thread markleeds
below i think semi does what you want but it's never going to repeat a value because it's sampling without replacement ? in that sense, it's not as general as what you asked for. if you need the repeating thing, then i'm not sure how to do that. hopefully someone else does. lapply(1:30,

Re: [R] A matrix automation problem

2008-10-22 Thread markleeds
megh: assuming that i understand what you want, i think below does it but check it carefully because i didn't. i = 1:9 a = matrix(1:9, 3) tempa - lapply(i,function(.index) { a^.index }) tempb - lapply(seq(1,dim(a)[1]*dim(a)[2],by=dim(a)[1]),function(.index) {

Re: [R] R: in-place appending to a matrix.

2008-10-16 Thread markleeds
that's extremely rude , especially to all the people who made and make R what it is. If you don't like R, noone is forcing you to use it. On Thu, Oct 16, 2008 at 5:50 PM, repkakala Gazeta.pl wrote: On 10/16/2008 10:50 AM, culpritNr1 wrote: Now, modern high level languages like the

[R] string to numeric question

2008-09-24 Thread markleeds
this seems l ike it shouldn't be that hard but i give up. if i have a string say, temp-01, I want to increase it by 1 so that it becomes 02. but the following code obviously won't work when the input string is say 10 because then it gives 011 when I just want 11. uuugh. does someone know

[R] perl expression question

2008-09-22 Thread markleeds
If I have the string below. does someone know a regular expression to just get the BLC.NYSE. I bought the O'Reilley book and read it when I can and I study the solutions on the list but I'm still not self sufficient with these things. Thanks.

[R] FW: RE: arima and xreg

2008-09-10 Thread markleeds
hi: you should probably send below to R-Sig-Finance because there are some econometrics people over there who could also possibly give you a good answer and may not see this email ? Also, there's package called mar ( I think that's the name ) that may do what you want ? Finally, I don't

[R] multinomial estimation output stat question - not R question

2008-09-01 Thread markleeds
I am estimating a multinomial model with two quantitative predictors, X1 and X2, and 3 responses. The responses are called neutral, positive and negative with neutral being the baseline. There are actually many models being estimated because I estimate the model over time and also for various

Re: [R] remove low frequent rows

2008-08-31 Thread markleeds
DF-cbind(c(a,b,a),c(4,3,6)) DF[(DF[,1] %in% names(which(table(DF[,1]) = 2))),] On Sun, Aug 31, 2008 at 2:19 AM, Yuan Jian wrote: Hi, � I have a matrix. a-cbind(c(a,b,a),c(4,3,6)) [,1] [,2] [1,] a� 4 [2,] b� 3 [3,] a� 6 I want to remove rows in matrix a whose first column has

[R] variance covariance matrix in GLM

2008-08-28 Thread markleeds
this is for the person who asked me about prediction confidence intervals in a GLM because I lost your email. Below follows a simple example in CAR and the variance covariance of the beta coefficients is in the summary. So, I think, given that output, it should be pretty straightforward to do

Re: [R] Two envelopes problem

2008-08-26 Thread markleeds
Duncan: Just one more thing which Heinz alerted me to. Suppose that we changed the game so that instead of being double or half of X, we said that one envelope will contain X + 5 and the other contains X-5. So someone opens it and sees 10 dollars. Now, their remaining choices are 5 and 15 so

Re: [R] Two envelopes problem

2008-08-26 Thread markleeds
beautiful. now, i think i got it. the fact that the calculation works in the additive case doesn't make the calculation correct. the expected value calculation is kind of assuming that the person putting the things in the envelopes chooses what's in the second envelope AFTER knowing

Re: [R] Two envelopes problem

2008-08-25 Thread markleeds
i haven't looked at your code and I'll try when I have time but, as you stated, that's an EXTREMELY famous problem that has tried to be posed in a bayesian way and all sorts of other things have been done to try solve it. Note that if you change the utility function so that its log(X) rather

Re: [R] vector operation using regexpr?

2008-08-20 Thread markleeds
Hi: I think you want regexpr so below does what you want but it doesn't handle the case when L isn't in the second column. I'm still trying to figure that out but don't count on it. Hopefully someone else will reply with that piece. DF - data.frame(col1=L,col2=MAIL,col3=PLOY) print(DF) index

  1   2   >