Re: [R] Pairwise T-Tests and Dunnett's Test (possibly using multcomp)

2011-03-01 Thread Joshua Wiley
Hi Paul, Changing the factor levels will work (as you saw). In this case, you could also edit the contrast matrix. ## look at default contrasts contrasts(gad$dosegrp) model1 <- lm(hama ~ dosegrp, data = gad) summary(model1) ## choose group 3 as base (comparison) contrasts(gad$dosegrp) <- contr.

Re: [R] Difference in numeric Dates between Excel and R

2011-03-01 Thread Prof Brian Ripley
On Wed, 2 Mar 2011, Luis Felipe Parra wrote: Hello. I am using some dates I read in excel in R. I know the excel origin is supposed to be 1900-1-1. But when I used as.Date with origin=1900-1-1 the dates that R reported me where two days ahead than the ones I read from Excel. I noticed that when

[R] Pairwise T-Tests and Dunnett's Test (possibly using multcomp)

2011-03-01 Thread Paul Miller
Hello Everyone,   Figured out one part of the code. Setting the reference level for a factor is accomplished using the relevel funtion (pg. 383 of MASS; pg. 70 of Data Manipulation with R):   gad$dosegrp <- relevel(gad$dosegrp,3)   This works very well. Much better than using a format in SAS proc

[R] a question on sqldf's handling of missing value and factor

2011-03-01 Thread xin wei
Dear subscribers: I am using the following code to read a large number of big text files: library(sqldf) tempd <- file() tempdx <- sqldf("select * from tempd", dbname = tempfile(), file.format = list(header = T, sep="\t", row.names = F)) The problem is: all my numberical variable become facto

Re: [R] getting attributes of list without the "names".

2011-03-01 Thread Jeroen Ooms
Thank you, this is very helpful. I am a little confused now about the structure of a list though. If the names of the list-elements is truly an attribute that is stored in another list this would lead to an infintely recursing object? How could I iterate over the full object tree, without getting

Re: [R] accessing variables inside a function, inside a loop

2011-03-01 Thread Joshua Wiley
Hi Alan, Other more knowledgeable people may have better opinions on this than I do. Manipulating language and call objects is seriously stretching my skills. \ In any case, two ways come to mind, both of them sufficiently cumbersome I would seriously question the value (btw, this is a complete

[R] the features of the truth

2011-03-01 Thread Alexy Khrabrov
This is really a statistics problem, so I wonder which R packages can be employed best to solve and visualize it. I run a lot of simulations to approach the truth. The truth is a result of very complex computations, and is a real number. The closer it is to 0, the truthier it is. Each simula

Re: [R] merge in data.tables -- "non-visible"

2011-03-01 Thread Steve Lianoglou
Hi Ted, On Tue, Mar 1, 2011 at 9:45 PM, Ted Rosenbaum wrote: > Hi, > I am trying to use the merge command in the data.tables package. > However, when I run the command I am not sure if it is running the merge > command from the base package or the merge command from data.tables. > When I run "met

Re: [R] problems with playwith

2011-03-01 Thread Michael Lawrence
Do you get an error message in a dialog box? My guess is that you just need to update your GTK+. On Tue, Mar 1, 2011 at 8:58 AM, R Heberto Ghezzo, Dr < heberto.ghe...@mcgill.ca> wrote: > hello, i tried to run playwith but : > > > library(playwith) > Loading required package: lattice > Loading req

Re: [R] accessing variables inside a function, inside a loop

2011-03-01 Thread zListserv
Joshua Great solution. Taking off on your code, the following works but does not display the names of the variables in the formula. Any suggestions about how to modify the function so that it displays the correct formula (e.g., "glm(formula = y1 ~ x1 * x2, data = dat)" instead of "glm(formula

[R] merge in data.tables -- "non-visible"

2011-03-01 Thread Ted Rosenbaum
Hi, I am trying to use the merge command in the data.tables package. However, when I run the command I am not sure if it is running the merge command from the base package or the merge command from data.tables. When I run "methods(generic.function="merge")' it informs me that 'merge.data.table" is

[R] Plotting a 3D histogram

2011-03-01 Thread Robert A'gata
Hi - I am wondering if there is any package that does plotting of joint histogram between 2 variables, i.e. f(x,y). I found rgl but it seems not so intuitive to use. I'm wondering if there is any alternative. Thank you. Robert __ R-help@r-project.org ma

Re: [R] Difference in numeric Dates between Excel and R

2011-03-01 Thread David Scott
On 2/03/2011 12:31 p.m., Nordlund, Dan (DSHS/RDA) wrote: -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Luis Felipe Parra Sent: Tuesday, March 01, 2011 3:07 PM To: r-help Subject: [R] Difference in numeric Dates between Excel and

[R] does rpy support R 2.12.2

2011-03-01 Thread Pete Shepard
Hi, I am getting the following error when I try to run import rpy from the the python IDE: Traceback (most recent call last): File "", line 1, in File "/usr/lib/python2.6/dist-packages/rpy.py", line 134, in """ % RVERSION) RuntimeError: No module named _rpy2122 RPy module can not

Re: [R] Difference in numeric Dates between Excel and R

2011-03-01 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Luis Felipe Parra > Sent: Tuesday, March 01, 2011 3:07 PM > To: r-help > Subject: [R] Difference in numeric Dates between Excel and R > > Hello. I am using some dates I read in e

Re: [R] glht() used with coxph()

2011-03-01 Thread array chip
In case anyone is interested, I figure it out that when strata is used, I have to specify the comparison matrix manually: > (fit<-coxph(Surv(stop, status>0)~treatment+strata(enum),bladder1)) > coef(fit) treatmentpyridoxine treatmentthiotepa 0.1877925 -0.2097894 > glht(fit,li

Re: [R] inefficient ifelse() ?

2011-03-01 Thread William Dunlap
Try using [<- more, instead of ifelse(). I rarely find myself really using both of the calls to [<- that ifelse makes. E.g., I use x[x==999] <- NA instead of x <- ifelse(x==999, NA, x) But if you find yourself using ifelse in a certain way often, try writing a function that only allows tha

Re: [R] How to prove the MLE estimators are normal distributed?

2011-03-01 Thread Bill.Venables
This is a purely statistical question and you should try asking it on some statistics list. This is for help with using R, mostly for data analysis and graphics. A glance at the posting guide (see the footnote below) might be a good idea. -Original Message- From: r-help-boun...@r-pro

[R] Difference in numeric Dates between Excel and R

2011-03-01 Thread Luis Felipe Parra
Hello. I am using some dates I read in excel in R. I know the excel origin is supposed to be 1900-1-1. But when I used as.Date with origin=1900-1-1 the dates that R reported me where two days ahead than the ones I read from Excel. I noticed that when I did in R the following: > as.Date("2011-3-4")

Re: [R] error in saved .csv

2011-03-01 Thread Don McKenzie
If you have ONE data frame that you want to export to excel (I believe that was the original request), you probably don't need to change any of the default arguments to write.csv(), except "row.names", which will give you an extra column. On Mar 1, 2011, at 2:50 PM, Tamas Barjak wrote: > Yes, t

Re: [R] Logistic Stepwise Criterion

2011-03-01 Thread Mano Gabor Toth
Thanks a lot for your last letter, you're right, I wasn't clear enough. I've already tried AIC before, but I thought that comparing models based on this criterion would be applicable if I had good models and I wanted to find the best fitting one. However, I only have poor models with high AIC, and

Re: [R] splitting and stacking matrices

2011-03-01 Thread Gabor Grothendieck
On Tue, Mar 1, 2011 at 4:55 PM, Darcy Webber wrote: > Dear R users, > > I am having some difficulty arranging some matrices and wondered if > anyone could help out. As an example, consider the following matrix: > > a <- matrix(1:32, nrow = 4, ncol = 8) > a >     [,1] [,2] [,3] [,4] [,5] [,6] [,7]

Re: [R] error in saved .csv

2011-03-01 Thread Tamas Barjak
Yes, the format is incorrect. I have already tried the write.table, but it didn't work. 2011/3/1 jim holtman > I am not sure what you are saying your problem is? Is the format > incorrect? BTW, notice that write.csv does not have a 'sep' > parameter. Maybe you should be using write.table. >

[R] How to prove the MLE estimators are normal distributed?

2011-03-01 Thread Ning Cheng
Dear List, I'm now working on MLE and OSL estimators.I just noticed that the textbook argues they are joint normal distributed.But how to prove the conclusion? Thanks for your time in advance! Best, Ning __ R-help@r-project.org mailing list https://sta

Re: [R] Logistic Stepwise Criterion

2011-03-01 Thread Bill.Venables
The "probability OF the residual deviance" is zero. The significance level for the residual deviance according to its asymptotic Chi-squared distribution is a possible criterion, but a silly one. If you want to minimise that, just fit no variables at all. That's the best you can do. If you wa

Re: [R] error in saved .csv

2011-03-01 Thread Peter Langfelder
On Tue, Mar 1, 2011 at 1:36 PM, Tamas Barjak wrote: > Help me please! > > I would like to be saved a data table: > > write.csv(random.t1, "place", dec=",", append = T, quote = FALSE, sep = " ", > qmethod = "double", eol = "\n", row.names=F) > > It's OK! > > But the rows of file >  1,1,21042,-4084

Re: [R] error in saved .csv

2011-03-01 Thread jim holtman
I am not sure what you are saying your problem is? Is the format incorrect? BTW, notice that write.csv does not have a 'sep' parameter. Maybe you should be using write.table. On Tue, Mar 1, 2011 at 4:36 PM, Tamas Barjak wrote: > Help me please! > > I would like to be saved a data table: > > wr

Re: [R] inefficient ifelse() ?

2011-03-01 Thread ivo welch
yikes. you are asking me too much. thanks everybody for the information. I learned something new. my suggestion would be for the much smarter language designers (than I) to offer us more or less blissfully ignorant users another vector-related construct in R. It could perhaps be named %if% %el

Re: [R] inefficient ifelse() ?

2011-03-01 Thread Thomas Lumley
On Wed, Mar 2, 2011 at 9:36 AM, ivo welch wrote: > thanks, Henrique.  did you mean > >    as.vector(t(mapply(function(x, f)f(x), split(t, ((t %% 2)==0)), > list(f, g   ? > > otherwise, you get a matrix. > > its a good solution, but unfortunately I don't think this can be used > to redefine ife

Re: [R] inefficient ifelse() ?

2011-03-01 Thread William Dunlap
An ifelse-like function that only evaluated what was needed would be fine, but it would have to be different from ifelse itself. The trick is to come up with a good parameterization. E.g., how would it deal with things like ifelse(is.na(x), mean(x, na.rm=TRUE), x) or ifelse(x>1, log(x), run

[R] splitting and stacking matrices

2011-03-01 Thread Darcy Webber
Dear R users, I am having some difficulty arranging some matrices and wondered if anyone could help out. As an example, consider the following matrix: a <- matrix(1:32, nrow = 4, ncol = 8) a [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [1,]159 13 17 21 25 29 [2,]26

Re: [R] How to understand output from R's polr function (ordered logistic regression)?

2011-03-01 Thread Dan Frankowski
Also posted as http://stats.stackexchange.com/questions/7720/how-to-understand-output-from-rs-polr-function-ordered-logistic-regression . Also, I read section 7.3 of "Modern Applied Statistics with S" by Venables and Ripley (who wrote polr?), and I can still not answer many of these questions. On

[R] How to understand output from R's polr function (ordered logistic regression)?

2011-03-01 Thread Dan Frankowski
I am new to R, ordered logistic regression, and polr. The "Examples" section at the bottom of the help page for polr(that fits a logistic or probit regression model to an ordered factor response) shows options(contrasts = c("cont

Re: [R] Lattice: useOuterStrips and axes

2011-03-01 Thread Jim Price
Thank you, that's exactly what I needed. -- View this message in context: http://r.789695.n4.nabble.com/Lattice-useOuterStrips-and-axes-tp3330338p3330613.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing lis

[R] Pairwise T-Tests and Dunnett's Test (possibly using multcomp)

2011-03-01 Thread Paul Miller
Hello Everyone,   I've been learning to use R in my spare time over the past several months. I've read about 7-8 books on the subject. Lately I've been testing what I've learned by trying to replicate the analyses from some of my SAS books. This helps me make sure I know how to use R properly an

[R] Logistic Stepwise Criterion

2011-03-01 Thread Mano Gabor Toth
Dear R-help members, I'd like to run a binomial logistic stepwise regression with ten explanatory variables and as many interaction terms as R can handle. I'll come up with the right R command sooner or later, but my real question is whether and how the criterion for the evaluation of the differen

Re: [R] Export R dataframes to excel

2011-03-01 Thread maxsilva
Thx, but im looking for a more direct solution... my problem is very simple, I have a dataframe and I want to create a standard excel spreadsheet. My dataframe could be something like this id sex weight 1 M 5'8 2 F6'2 3 F5'5 4 M 5'7 5 F

Re: [R] Regression with many independent variables

2011-03-01 Thread Matthew Douglas
Hi Greg, Thanks for the help, it works perfectly. To answer your question, there are 339 independent variables but only 10 will be used at one time . So at any given line of the data set there will be 10 non zero entries for the independent variables and the rest will be zeros. One more question:

[R] [R-pkgs] Major update to rms package

2011-03-01 Thread Frank Harrell
A new version of rms is now available on CRAN for Linux and Windows (Mac will probably be available very soon). Largest changes include latex methods for validate.* and adding the capability to force a subset of variables to be included in all backwards stepdown models (single model or vali

Re: [R] inefficient ifelse() ?

2011-03-01 Thread Dennis Murphy
Hi: As far as I can see, the problem has to do with the way you wrote f and g: > f(2) f for 2 [1] 4 > g(5) g for 5 [1] 15 You output an unsaved character string with a numeric result, but the character string is not part of the return object since it is neither saved as a name or an attribute. I

[R] error in saved .csv

2011-03-01 Thread Tamas Barjak
Help me please! I would like to be saved a data table: write.csv(random.t1, "place", dec=",", append = T, quote = FALSE, sep = " ", qmethod = "double", eol = "\n", row.names=F) It's OK! But the rows of file 1,1,21042,-4084.87179487179,2457.66483516483,-582.275562799881 2,2,23846,-6383.8648018

Re: [R] Export R dataframes to excel

2011-03-01 Thread Iain Gallagher
This appeared today on the r-bloggers site and might be useful for you. http://www.r-bloggers.com/release-of-xlconnect-0-1-3/ cheers i --- On Tue, 1/3/11, Steve Taylor wrote: > From: Steve Taylor > Subject: Re: [R] Export R dataframes to excel > To: r-help@r-project.org, "maxsilva" > Date:

Re: [R] Regression with many independent variables

2011-03-01 Thread Greg Snow
You can use ^2 to get all 2 way interactions and ^3 to get all 3 way interactions, e.g.: lm(Sepal.Width ~ (. - Sepal.Length)^2, data=iris) The lm.fit function is what actually does the fitting, so you could go directly there, but then you lose the benefits of using . and ^. The Matrix package

Re: [R] expression help

2011-03-01 Thread Dennis Murphy
Hi: 1. expression() in plotmath ignores control characters such as \n. 2. The workaround, discussed a couple of times on this list (hence in the archives), is to use the atop function, so try something like plot(0:1,0:1,xaxt="n") axis(side=1,at=.3,expression(paste("IFN-", gamma, "\n", "TNF-", alp

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

2011-03-01 Thread Dennis Murphy
...and this is where we cue the informative article on least squares calculations in R by Doug Bates: http://cran.r-project.org/doc/Rnews/Rnews_2004-1.pdf HTH, Dennis On Tue, Mar 1, 2011 at 10:52 AM, AjayT wrote: > Hey thanks alot guys !!! That really speeds things up !!! I didn't know %*% > a

Re: [R] inefficient ifelse() ?

2011-03-01 Thread ivo welch
thanks, Henrique. did you mean as.vector(t(mapply(function(x, f)f(x), split(t, ((t %% 2)==0)), list(f, g ? otherwise, you get a matrix. its a good solution, but unfortunately I don't think this can be used to redefine ifelse(cond,ift,iff) in a way that is transparent. the ift and iff

Re: [R] Lattice: useOuterStrips and axes

2011-03-01 Thread Peter Ehlers
On 2011-03-01 10:29, Jim Price wrote: Consider the following: library(lattice) library(latticeExtra) temp<- expand.grid( subject = factor(paste('Subject', 1:3)), var = factor(paste('Variable', 1:3)), time = 1:10 )

Re: [R] Export R dataframes to excel

2011-03-01 Thread Don McKenzie
Or ?write.csv which excel will import On 1-Mar-11, at 12:17 PM, Berend Hasselman wrote: maxsilva wrote: Thx, but im looking for a more direct solution... my problem is very simple, I have a dataframe and I want to create a standard excel spreadsheet. My dataframe could be something like th

Re: [R] Export R dataframes to excel

2011-03-01 Thread Berend Hasselman
maxsilva wrote: > > Thx, but im looking for a more direct solution... my problem is very > simple, I have a dataframe and I want to create a standard excel > spreadsheet. My dataframe could be something like this > More or less the same question was answered several hours ago. See http://rwik

Re: [R] Export R dataframes to excel

2011-03-01 Thread Steve Taylor
You can copy it with the following function and then paste into Excel... copy = function (df, buffer.kb=256) { write.table(df, file=paste("clipboard-",buffer.kb,sep=""), sep="\t", na='', quote=FALSE, row.names=FALSE) } >>> From: maxsilva To: Date: 2/Mar/2011 8:50a Subject: [R] Export

Re: [R] Data type problem when extract data from SQLite to R by using RSQLite

2011-03-01 Thread Seth Falcon
On Tue, Mar 1, 2011 at 10:06 AM, chen jia wrote: > Hi Seth, > > Thanks so much for identifying the problem and explaining everything. > I think the first solution that you suggest--make sure the schema has > well defined types--would work the best for me. But, I have one > question about how to im

Re: [R] Export R dataframes to excel

2011-03-01 Thread KATSCHKE, ADRIAN CIV DFAS
write.table() using the sep="," and file extension as .csv works great to pull directly into excel. ?write.table Without more detail as to the problem, it is difficult to give a more specific answer. Adrian -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...

[R] odbcConnectExcel2007 creates corrupted files

2011-03-01 Thread Mark Lyman
I tried creating a .xlsx file using odbcConnectExcel2007 and adding a worksheet with sqlSave. This seems to work, I am even able to query the worksheet, but when I try opening the file in Excel I get the following message: "Excel cannot open the file 'test.xlx' because the file format or file e

[R] expression help

2011-03-01 Thread Daryl Morris
Hello, I am trying to write math-type on a plot. Due to space limitations on the plot, I want 2 short expressions written on top of each other. It is certainly possible to write them in two separate calls, but that involves fine-tuning locations and a lot of trial and error (and I'm trying

[R] Export R dataframes to excel

2011-03-01 Thread maxsilva
I'm trying to do this in several ways but havent had any result. Im asked to install python, or perl etc. Can anybody suggest a direct, easy and understandable way? Every help would be appreciated. Thx. -- View this message in context: http://r.789695.n4.nabble.com/Export-R-dataframes-to-

[R] glht() used with coxph()

2011-03-01 Thread array chip
Hi, I am experimenting with using glht() from multcomp package together with coxph(), and glad to find that glht() can work on coph object, for example: > (fit<-coxph(Surv(stop, status>0)~treatment,bladder1)) coxph(formula = Surv(stop, status > 0) ~ treatment, data = bladder1)

Re: [R] inefficient ifelse() ?

2011-03-01 Thread Henrique Dallazuanna
Try this: mapply(function(x, f)f(x), split(t, t %% 2), list(g, f)) On Tue, Mar 1, 2011 at 4:19 PM, ivo welch wrote: > dear R experts--- > > t <- 1:30 > f <- function(t) { cat("f for", t, "\n"); return(2*t) } > g <- function(t) { cat("g for", t, "\n"); return(3*t) } > s <- ifelse( t%%2==0, g

[R] inefficient ifelse() ?

2011-03-01 Thread ivo welch
dear R experts--- t <- 1:30 f <- function(t) { cat("f for", t, "\n"); return(2*t) } g <- function(t) { cat("g for", t, "\n"); return(3*t) } s <- ifelse( t%%2==0, g(t), f(t)) shows that the ifelse function actually evaluates both f() and g() for all values first, and presumably then just p

Re: [R] bootstrap resampling - simplified

2011-03-01 Thread Dennis Murphy
Hi: On Tue, Mar 1, 2011 at 8:22 AM, Bodnar Laszlo EB_HU < laszlo.bod...@erstebank.hu> wrote: > Hello there, > > I have a problem concerning bootstrapping in R - especially focusing on the > resampling part of it. I try to sum it up in a simplified way so that I > would not confuse anybody. > > I

Re: [R] Finding pairs with least magnitude difference from mean

2011-03-01 Thread rex.dwyer
No, that's not what I meant, but maybe I didn't understand the question. What I suggested would involve sorting y, not x: "sort the *distances*". If you want to minimize the sd of a subset of numbers, you sort the numbers and find a subset that is clumped together. If the numbers are a function of

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

2011-03-01 Thread AjayT
Hey thanks alot guys !!! That really speeds things up !!! I didn't know %*% and crossprod, could operate on matrices. I think you've saved me hours in calculation time. Thanks again. > system.time({C=matrix(0,50,50);for(i in 1:n)C = C + (X[i,] %o% X[i,])}) user system elapsed 0.450.00

[R] Lattice: useOuterStrips and axes

2011-03-01 Thread Jim Price
Consider the following: library(lattice) library(latticeExtra) temp <- expand.grid( subject = factor(paste('Subject', 1:3)), var = factor(paste('Variable', 1:3)), time = 1:10 ) temp$resp <- rnorm(nrow(temp), 10 * as.

[R] more boa plots questions

2011-03-01 Thread emj83
I have MCMC output chains A and B for example, I want to produce trace plots for them using the boa command line... #loads boa boa.init() #reads in chains boa.chain.add(boa.importMatrix('A'), 'A') boa.chain.add(boa.importMatrix('B'), 'B') #plot trace plot problems arise here! I know I can get tra

Re: [R] bootstrap resampling question

2011-03-01 Thread Jonathan P Daily
I'm not sure that is equivalent to sampling with replacement, since if the first "draw" is 1, then the probability that the next draw will be one is 4/100 instead of the 1/20 it would be in sampling with replacement. I think the way to do this would be what Greg suggested - something like: bigs

Re: [R] boa library and plots

2011-03-01 Thread emj83
Many thanks for your response, and I am sorry I did not post correctly. I have found dev.copy2eps() useful. Emma -- View this message in context: http://r.789695.n4.nabble.com/boa-library-and-plots-tp3322508p3330299.html Sent from the R help mailing list archive at Nabble.com. ___

Re: [R] Does POSIXlt extract date components properly?

2011-03-01 Thread Prof Brian Ripley
On Tue, 1 Mar 2011, Seth W Bigelow wrote: I would like to use POSIX classes to store dates and extract components of dates. Following the example in Spector ("Data Manipulation in R"), I create a date mydate = as. POSIXlt('2005-4-19 7:01:00') I then successfully extract the day with the comm

[R] Adjusting values via vectorization

2011-03-01 Thread Albert Vernon Smith
I'm adjusting values in a list based on a couple of matrixes. One matrix specifies the row to be taken from the adjustment matrix, while using the aligned column values. I have an approach which works, but I might find an approach with vectorization. Here is code with my solution: -- nids <

Re: [R] Data type problem when extract data from SQLite to R by using RSQLite

2011-03-01 Thread chen jia
Hi Seth, Thanks so much for identifying the problem and explaining everything. I think the first solution that you suggest--make sure the schema has well defined types--would work the best for me. But, I have one question about how to implement it, which is more about sqlite itself. First, I foun

Re: [R] SetInternet2, RCurl and proxy

2011-03-01 Thread Manta
It says the function does not exist. The version is around 2.8, cant check right now. Is it because it's an older version? If so, is there any way to do it in a different way then? -- View this message in context: http://r.789695.n4.nabble.com/SetInternet2-RCurl-and-proxy-tp3248576p3330244.html

Re: [R] nls not solving

2011-03-01 Thread Peter Ehlers
On 2011-03-01 06:38, Schatzi wrote: Here is a reply by Bart: Yes you're right (I should have taken off my glasses and looked closer). However, the argument is essentially the same: Suppose you have a solution with a,b,k,l. Then for any positive c, [a+b-bc] + [bc] + (bc) *exp(kl')exp(-kx) is also

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

2011-03-01 Thread Doran, Harold
Isn't the following the canonical (R-ish) way of doing this: X = matrix(rnorm(1000*50),1000,50) system.time({C1 = t(X) %*% X}) # Phil's example C2 <- crossprod(X) # use crossprod instead > all.equal(C1,C2) [1] TRUE > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help

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

2011-03-01 Thread Phil Spector
What you're doing is breaking up the calculation of X'X into n steps. I'm not sure what you mean by "very slow": X = matrix(rnorm(1000*50),1000,50) n = 1000 system.time({C=matrix(0,50,50);for(i in 1:n)C = C + (X[i,] %o% X[i,])}) user system elapsed 0.096 0.008 0.104 Of course, you

Re: [R] SetInternet2, RCurl and proxy

2011-03-01 Thread Uwe Ligges
On 01.03.2011 12:00, Manta wrote: Dear all, I am facing a problem. I am trying to install packages using a proxy, but I am not able to call the setInternet2 function, either with the small or capital s. What package do I have to call then? And, could there be a reason why this does not functio

Re: [R] Does POSIXlt extract date components properly?

2011-03-01 Thread Luke Miller
Month counts from 0 in POSIXlt objects, so that April is month 3 in your example, January being month 0. Year counts from 1900 in POSIXlt objects, so that 2005 should return as 105 in your example. All of the other fields in POSIXlt should return values that you might expect them to a priori. Kee

Re: [R] Is there any Command showing correlation of all variables in a dataset?

2011-03-01 Thread Liviu Andronic
On Tue, Mar 1, 2011 at 11:41 AM, JoonGi wrote: > > Thanks in advance. > > I want to derive correlations of variables in a dataset > > Specifically > > library(Ecdat) > data(Housing) > attach(Housing) > cor(lotsize, bathrooms) > > this code results only the correlationship between two variables. >

Re: [R] problems with playwith

2011-03-01 Thread Liviu Andronic
On Tue, Mar 1, 2011 at 5:58 PM, R Heberto Ghezzo, Dr wrote: > hello, i tried to run playwith but : > >> library(playwith) > Loading required package: lattice > Loading required package: cairoDevice > Loading required package: gWidgetsRGtk2 > Loading required package: gWidgets > Error in inDL(x, as

Re: [R] Is there any Command showing correlation of all variables in a dataset?

2011-03-01 Thread Scott Chamberlain
cor.prob function gives matrix of correlation coefficients and p-values together ### Function for calculating correlation matrix, corrs below diagonal, ### and P-values above diagonal cor.prob <- function(X, dfr = nrow(X) - 2) { R <- cor(X) above <- row(R) < col(R) r2 <- R[above]^2 Fsta

Re: [R] mlogit.data

2011-03-01 Thread Mark Difford
My previous posting seems to have got mangled. This reposts it. On Mar 01, 2011; 03:32pm gmacfarlane wrote: >> workdata.csv >> The code I posted is exactly what I am running. What you need is this >> data. Here is the code again. > hbwmode<-mlogit.data("worktrips.csv", shape="long", choice="CHOS

[R] Speed up sum of outer products?

2011-03-01 Thread AjayT
Hi, I'm new to R and stats, and I'm trying to speed up the following sum, for (i in 1:n){ C = C + (X[i,] %o% X[i,]) # the sum of outer products - this is very slow according to Rprof() } where X is a data matrix (nrows=1000 X ncols=50), and n=1000. The sum has to be calcula

[R] Does POSIXlt extract date components properly?

2011-03-01 Thread Seth W Bigelow
I would like to use POSIX classes to store dates and extract components of dates. Following the example in Spector ("Data Manipulation in R"), I create a date > mydate = as. POSIXlt('2005-4-19 7:01:00') I then successfully extract the day with the command > mydate$day [1] 19 But when I try to

[R] problems with playwith

2011-03-01 Thread R Heberto Ghezzo, Dr
hello, i tried to run playwith but : > library(playwith) Loading required package: lattice Loading required package: cairoDevice Loading required package: gWidgetsRGtk2 Loading required package: gWidgets Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared object 'H

Re: [R] bootstrap resampling question

2011-03-01 Thread Giovanni Petris
A simple way of sampling with replacement from 1:20, with the additional constraint that each number can be selected at most five times is > sample(rep(1:20, 5), 20) HTH, Giovanni On Tue, 2011-03-01 at 11:30 +0100, Bodnar Laszlo EB_HU wrote: > Hello there, > > I have a problem concerning bootst

Re: [R] bootstrap resampling question

2011-03-01 Thread Greg Snow
Here are a couple of thoughts. If you want to use the boot package then the statistic function you give it just receives the bootstrapped indexes, you could test the indexes for your condition of not more than 5 of each and if it fails return an NA instead of computing the statistic. Then in y

[R] Problem on flexmix when trying to apply signature developed in one model to a new sample

2011-03-01 Thread Jon Toledo
Problem on flexmix when trying to apply signature developed in one model to a new sample. Dear R Users, R Core Team, I have a problem when trying to know the classification of the tested cases using two variables with the function of flexmix: After importing the database and creating a

[R] bootstrap resampling - simplified

2011-03-01 Thread Bodnar Laszlo EB_HU
Hello there, I have a problem concerning bootstrapping in R - especially focusing on the resampling part of it. I try to sum it up in a simplified way so that I would not confuse anybody. I have a small database consisting of 20 observations (basically numbers from 1 to 20, I mean: 1, 2, 3, 4,

Re: [R] Is there any Command showing correlation of all variables in a dataset?

2011-03-01 Thread rex.dwyer
?cor answers that question. If Housing is a dataframe, cor(Housing) should do it. Surprisingly, ??correlation doesn't point you to ?cor. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of JoonGi Sent: Tuesday, March 01, 2011 5:41 A

[R] Quantreg model error and goodness of fit

2011-03-01 Thread sadz a
Hi All, I am using the package quantreg to create a 'model' that I can then use to predict the response variable (volume) from a larger set of explanatory variables (environmental factors): ie- #model- >fit <- rqss(volume~qss(env.factor1,lambda=1)+ qss(env.factor2,lambda=1), tau = 0.9) >summary(

Re: [R] nls not solving

2011-03-01 Thread Schatzi
Here is a reply by Bart: Yes you're right (I should have taken off my glasses and looked closer). However, the argument is essentially the same: Suppose you have a solution with a,b,k,l. Then for any positive c, [a+b-bc] + [bc] + (bc) *exp(kl')exp(-kx) is also a solution, where l' = l - log(c)/k

Re: [R] Robust variance estimation with rq (failure of the bootstrap?)

2011-03-01 Thread Matt Shotwell
Jim, Thanks for pointing me to this article. The authors argue that the bootstrap intervals for a robust estimator may not be as robust as the estimator. In this context, robustness is measured by the breakdown point, which is supposed to measure robustness to outliers. Even so, the authors fou

Re: [R] High standard error

2011-03-01 Thread John Kane
Sure why not? You do realize, do you not that no one has the slightest idea of what you are doing? PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. --- On Tue, 3/1/11, danielepippo wrote: > From

[R] High standard error

2011-03-01 Thread danielepippo
Hi to everyone, if the estimate of the parameter results in 0.196 and his standard error is 0.426, can I say that this parameter is not significant for the model? Thank you very much Pippo -- View this message in context: http://r.789695.n4.nabble.com/High-standard-error-tp3329903p3

Re: [R] How to Save R library data into xls or dta format

2011-03-01 Thread Gabor Grothendieck
On Tue, Mar 1, 2011 at 4:27 AM, JoonGi wrote: > > Thanks in advance. > > I'm having a trouble with data saving. > > I want to run the same data which is in Ecdat library at different statistic > programs(excel, stata and matlab) > > The data I want to use is > > library(Ecdat) > data(Housing) > >

Re: [R] what does the "S.D." returned by {Hmisc} rcorr.cens measure?

2011-03-01 Thread Frank Harrell
Vikki, The formula you used for std. error of C is not correct. C is not a simple per-observation proportion. SD in the output is the standard error of Dxy. Dxy = 2(C - .5). Backsolve for std err of C. Variation in Dxy or C comes from the usual source: sampling variability. You can also se

Re: [R] Explained variance for ICA

2011-03-01 Thread rex.dwyer
You determine the variance explained by *any* unit vector by taking its inner product with the data points, then finding the variance of the results. In the case of FastICA, the variance explained by the ICs collectively is exactly the same as the variance explained by the principal components

Re: [R] unicode&pdf font problem RESOLVED

2011-03-01 Thread Ben Madin
Just to add to this (I've been looking through the archive) problem with display unicode fonts in pdf document in R If you can use the Cairo package to create pdf on Mac, it seems quite happy with pushing unicode characters through (probably still font family dependant whether it will display)

Re: [R] mlogit.data

2011-03-01 Thread gmacfarlane
http://r.789695.n4.nabble.com/file/n3329821/workdata.csv workdata.csv The code I posted is exactly what I am running. What you need is this data. Here is the code again. > hbwmode<-mlogit.data("worktrips.csv", shape="long", choice="CHOSEN", > alt.var="ALTNUM") > hbwmode<-mlogit.data(hbwtrips, sh

Re: [R] Components of variance with lme

2011-03-01 Thread Scott Chamberlain
VarCorr() and then calculate percentage variance for each component from output of VarCorr On Tuesday, March 1, 2011 at 6:55 AM, John Sorkin wrote: > R 2.10 > Windows Vista > > Is it possible to run a variance-components analysis using lme? I looked at > Pinheiro and Bates' book and don't see c

Re: [R] nested case-control study

2011-03-01 Thread Terry Therneau
1. Using offset(logweight) in coxph is the same as using an "offset logweight;" statement in SAS, and neither is the same as case weights. 2. For a nested case control, which is what you said you have, the "strata" controls who is in what risk set. No trickery with start,stop times is needed. It

[R] Components of variance with lme

2011-03-01 Thread John Sorkin
R 2.10 Windows Vista Is it possible to run a variance-components analysis using lme? I looked at Pinheiro and Bates' book and don't see code that will perform these analyses. If the analyses can not be done using lme, what package might I try? Thanks, John John David Sorkin M.D., Ph.D. Chief,

Re: [R] Simulation

2011-03-01 Thread Mike Marchywka
> Date: Mon, 28 Feb 2011 19:18:18 -0800 > From: kadodamb...@hotmail.com > To: r-help@r-project.org > Subject: [R] Simulation > > I tried looking for help but I couldn't locate the exact solution. > I have data that has several variables. I want to do se

  1   2   >