Re: [R] matrix computation???

2009-02-24 Thread Kutlwano Ramaboa
Hi Greg Thanks for responding. When I scale stackloss and compute the fitted values of the scaled data frame, the values are not the same: A-data.frame(scale(stackloss)) lm- lm(stack.loss ~ . -1, qr=T, data=A) summary(lm) fitted.values(lm) Or should I not be comparing the two? Greg

[R] Odp: Help How to use a loop to do pair comparison

2009-02-24 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 24.02.2009 06:23:23: Hi R users, I have a question. How can I use for loop to do pair comparisons. For example, x-c(1,2,3) result-matrix(data=NA, nrow=choose(3,2), ncol=1) for(i in 1: length(x)) +{ result[i,]-ifelse(x[i] x[i+1],

[R] Problem about plot scale

2009-02-24 Thread yk
There are 4 sets of array, each have 2 dimension data:x,y. And these data comes from bkde. I tried to plot them in one figure, but details of some lines, like peak and where it locate, have diminished since one set of array have fairly high y value.And another array have lots of y value near zero,

Re: [R] Problem about plot scale

2009-02-24 Thread yk
It has been solved On Feb 24, 5:05 pm, yk shiyuankun.deb...@gmail.com wrote: There are 4 sets of array, each have 2 dimension data:x,y. And these data comes from bkde. I tried to plot them in one figure, but details of some lines, like peak and where it locate, have diminished since one set

[R] Odp: if statement of a vector

2009-02-24 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 23.02.2009 18:31:32: right now I have a vector of about 1000 points. I'd like to iterate through each of these points and and test if it is greater than a certain value and if not, throw it out. x=vector y=empty vector j=0 for i

[R] Odp: Problem about plot scale

2009-02-24 Thread Petr PIKAL
Hi If you had issued axis break into CRAN fearch facility you would have find several options e.g. plotrix package. Also look at xlim or ylim and consider logarithmic axes regards Petr r-help-boun...@r-project.org napsal dne 24.02.2009 10:05:26: There are 4 sets of array, each have 2

Re: [R] lmer, estimation of p-values and mcmcsamp

2009-02-24 Thread Mark Difford
Hi Maureen, There is a specialist mailing list for mixed-models, where you are likely to get a well-informed answer to this, quite possibly from Prof. Bates himself (the author of lmer). https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models Regards, Mark. PS: R Hompage - Mailing Lists for

Re: [R] Help How to use a loop to do pair comparison

2009-02-24 Thread Patrick Burns
One possible first step could be: ifelse(outer(x, x, ''), 'Big', 'Small') Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of The R Inferno and A Guide for the Unwilling S User) Chunhao Tu wrote: Hi R users, I have a question. How can I use for loop

[R] problem understanding the result of pnorm2d()

2009-02-24 Thread jass
Hi all, I am using the fMultivar package for calculating probabilities of bivariate normal distribution. I use the manual's example to understand what is going on, but let's take it for smaller dimensions of x and y: ## Bivariate Normal Density: x = c(0.3,10) y = c(-10,0.2) X = grid2d(x,y) z

Re: [R] Help How to use a loop to do pair comparison

2009-02-24 Thread Patrick Burns
Patrick Burns wrote: One possible first step could be: ifelse(outer(x, x, ''), 'Big', 'Small') Second step: use 'lower.tri'. Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of The R Inferno and A Guide for the Unwilling S User) Chunhao Tu wrote:

Re: [R] An error in fitting a non linear regression

2009-02-24 Thread Saeed Ahmadi
Hi, Thank you for the reply and suggestions. I have two questions? 1) If I want to use log, it seems that I have to take log from both sides of the model which will lead to lm(log(q)~log(-depth)). What is tehdifference between this syntax and lm(log(q) ~ I(-depth))? 2) How can I calculate the

[R] Syntax in taking log to transfrom the data to fit Gaussian distribution

2009-02-24 Thread Saeed Ahmadi
Hi, I have a data set (weight) that does not follow the Gaussian (Normal) distribution. However, I have to transform the data before applying the Gaussian distribution. I used this syntax and used log(weight) as: posJy.model-glm(log(weight) ~ factor(pos), family=gaussian(link='identity'),

Re: [R] An error in fitting a non linear regression

2009-02-24 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 24.02.2009 11:31:22: Hi, Thank you for the reply and suggestions. I have two questions? 1) If I want to use log, it seems that I have to take log from both sides of the model which will lead to lm(log(q)~log(-depth)). What is tehdifference

[R] Odp: Syntax in taking log to transfrom the data to fit Gaussian distribution

2009-02-24 Thread Petr PIKAL
Petr Pikal petr.pi...@precheza.cz 724008364, 581252140, 581252257 r-help-boun...@r-project.org napsal dne 24.02.2009 11:46:07: Hi, I have a data set (weight) that does not follow the Gaussian (Normal) distribution. However, I have to transform the data before applying the Gaussian

Re: [R] Syntax in taking log to transfrom the data to fit Gaussian distribution

2009-02-24 Thread Philipp Pagel
On Tue, Feb 24, 2009 at 02:46:07AM -0800, Saeed Ahmadi wrote: I have a data set (weight) that does not follow the Gaussian (Normal) distribution. However, I have to transform the data before applying the Gaussian distribution. I used this syntax and used log(weight) as:

Re: [R] An error in fitting a non linear regression

2009-02-24 Thread Saeed Ahmadi
Hi Peter, You are totally right and it was a miscalculating and misunderstanding from me. Regarding the R-squared calculation of non linear model (question 2), is there any way to do that? Regards Saeed Petr Pikal wrote: Hi r-help-boun...@r-project.org napsal dne 24.02.2009 11:31:22:

[R] Random number generation for Generalized Logistic distribution

2009-02-24 Thread Maithili Shiva
Dear R helpers How to generate random numbers for (a) Generalized logistic distribution (b) Generalized normal distribution (c) Pearson Type III distribution (d) Kappa Thanks in advance Maithili __ R-help@r-project.org mailing list

Re: [R] Syntax in taking log to transfrom the data to fit Gaussian distribution

2009-02-24 Thread Saeed Ahmadi
In order ot see if any of these syntaxes work or not, I made the QQ plot. Attached files are showing the QQ plots made when log was inside the model formulation and outside teh model formulation. You can see that when transformation were done outside, then I have a general better QQ plot

[R] Problems:ticks overlap with each other

2009-02-24 Thread yk
I have written the codes below. Unfortunately, the ticks generated by matplot A and matplot B overlap with each other. Does anyone have some idea to avoid it automatically? split_y=2.0e-4 layout(matrix(c(1,2),2,1,byrow=T),height=c(1,3)) par(mar=c(0.5,4.5,1.5,1.5)) x_row=max(row(x_m))

Re: [R] Help How to use a loop to do pair comparison

2009-02-24 Thread Chun-Hao Tu
Hi Patrick, Thank you for your hint. I got it works. x-1:3 result-ifelse(test=outer(X=x,Y=x,FUN=), yes=Big, + ifelse(test=outer(X=x,Y=x,FUN=), yes=Small, Equal)) result [,1][,2][,3] [1,] Equal Small Small [2,] Big Equal Small [3,] Big Big Equal

Re: [R] Random number generation for Generalized Logistic distribution

2009-02-24 Thread William Asquith
See the lmom package by J.R.M Hosking or lmomco package by W.H.Asquith -wha On Feb 24, 2009, at 5:46 AM, Maithili Shiva wrote: Dear R helpers How to generate random numbers for (a) Generalized logistic distribution (b) Generalized normal distribution (c) Pearson Type III distribution

[R] using perl regular expression

2009-02-24 Thread Katrine Damgaard
Hello everybody! I'm using Perl regular Expression for find pattern in my data set. The pattern is: NaQxy, where a=E, F, G or H and xy != 29. I have tried this: pattern - ^N[E-H]Q[0-9]{2,2} index - grep(pattern, X, perl=T) #where X is my vector But the problem is the xy should not be 29. How

[R] Inference for R Spam

2009-02-24 Thread Dieter Menne
Dear List, I registered for the useR conference in Rennes today; half an hour after the confirmation I received a first requested newsletter from a company selling a product named Inference for R. This coincidence might be spurious. Or not, depending on frequency. Dieter

Re: [R] Inference for R Spam

2009-02-24 Thread Duncan Murdoch
On 24/02/2009 8:06 AM, Dieter Menne wrote: Dear List, I registered for the useR conference in Rennes today; half an hour after the confirmation I received a first requested newsletter from a company selling a product named Inference for R. This coincidence might be spurious. Or not, depending

Re: [R] Inference for R Spam

2009-02-24 Thread Wacek Kusnierczyk
Dieter Menne wrote: Dear List, I registered for the useR conference in Rennes today; half an hour after the confirmation I received a first requested newsletter from a company selling a product named Inference for R. This coincidence might be spurious. Or not, depending on frequency.

[R] creating bar charts with nested groups

2009-02-24 Thread levyofi
I'm looking for a way to create bar charts with nested groups levels. I have data that is seperated to this factors: 1. Day part - day/night. 2. Season - summer/winter. 3. habitat - Cover/Open I have created in Excel the following chart which I would like to create in R:

Re: [R] using perl regular expression

2009-02-24 Thread jim holtman
Do it in two steps: x - c(NEQ23, NHQ29, NGQ00, NFQ123) pat - N[E-H]Q[0-9]{2} bad - N[E-H]Q29 all - grep(pat, x, perl=TRUE) x29 - grep(bad, x, perl=TRUE) setdiff(all, x29) [1] 1 3 4 On Tue, Feb 24, 2009 at 7:57 AM, Katrine Damgaard katrine.damga...@kunnskapssenteret.no wrote: Hello

[R] replace zeros in a block diagonal matrix with small random values?

2009-02-24 Thread Rick DeShon
Hi All. Imagine you have a large block diagonal matrix. I'd like to replace the zeros in this matrix with small random (runif) numbers. Any ideas for a simple and efficient way to do this? Best regards, Rick DeShon __ R-help@r-project.org mailing

Re: [R] [Rd] Semantics of sequences in R

2009-02-24 Thread Wacek Kusnierczyk
Berwin A Turlach wrote: G'day Dimitris, On Tue, 24 Feb 2009 11:19:15 +0100 Dimitris Rizopoulos d.rizopou...@erasmusmc.nl wrote: in my opinion the point of the whole discussion could be summarized by the question, what is a design flaw? This is totally subjective, and it happens almost

Re: [R] Inference for R Spam

2009-02-24 Thread ronggui
I received it too without the conference registration. 2009/2/24 Wacek Kusnierczyk waclaw.marcin.kusnierc...@idi.ntnu.no: Dieter Menne wrote: Dear List, I registered for the useR conference in Rennes today; half an hour after the confirmation I received a first requested newsletter from a

Re: [R] replace zeros in a block diagonal matrix with small random values?

2009-02-24 Thread Dimitris Rizopoulos
say 'mat' is your matrix, then you could try something like (untested): ind - mat == 0 mat[ind] - runif(sum(ind)) I hope it helps. Best, Dimitris Rick DeShon wrote: Hi All. Imagine you have a large block diagonal matrix. I'd like to replace the zeros in this matrix with small random

Re: [R] Inference for R Spam

2009-02-24 Thread Thomas Lumley
The same company caused a complaint about a year ago https://stat.ethz.ch/pipermail/r-help/2008-March/157423.html The mailing company they are using (iContact.com) claims to have a tough antispam policy. So does everyone, of course. -thomas Thomas Lumley Assoc.

[R] Tracing gradient during optimization

2009-02-24 Thread Shimrit Abraham
Hi everyone, I am currently using the function optim() to maximize/minimize functions and I would like to see more output of the optimization procedure, in particular the numerical gradient of the parameter vector during each iteration. The documentation of optim() describes that the trace

Re: [R] Inference for R Spam

2009-02-24 Thread Simon Pickett
I got the same spam message today and I havent signed up for anything except this forum mailing list. The software they are trying to sell doesnt seem to cover any new ground anyway. Simon. - Original Message - From: Thomas Lumley tlum...@u.washington.edu To: ronggui

[R] data file - function write.fwf - library gdata

2009-02-24 Thread Paulo Barata
Dear R-list members, I have a data file with thousands of lines (cases), where each line contains the values of several variables. I would like to separate these lines in small groups, with each group followed by a blank line, to ease the visual inspection of the data in some situations. I am

[R] Odfweave

2009-02-24 Thread Irina Ursachi
Dear all, When using odfWeave, I get the following error: odfWeave(file.in,file.out) Copying Example2.odt Setting wd to /tmp/Rtmp8ekeDC/odfWeave24145003519 Unzipping ODF file using unzip -o Example2.odt Archive: Example2.odt End-of-central-directory signature not found. Either this

Re: [R] All the products of common factors

2009-02-24 Thread Ben Bolker
Fox, Gordon gfox at cas.usf.edu writes: Example: 40 and 80 have these factors: c(1,2,2,2,5) and c(1,2,2,2,2,5). We can use match() to get the common factors c(1,2,2,2,5). What we want to be able to get from this is the list of all the possible products, which should be the concatenation of

Re: [R] Tracing gradient during optimization

2009-02-24 Thread Ravi Varadhan
Hi, If you look at the source code for optim() in the optim.c file, you will see the following lines for BFGS: if (trace (iter % nREPORT == 0)) Rprintf(iter%4d value %f\n, iter, f); This means that BFGS does not output gradient values when you trace the iterations. Let us

[R] Decision Function of Support Vector Machine

2009-02-24 Thread Meir Preiszler
Hi, As a number of people suggested, I downloaded the e071 package and am using the function svm for my classification problem. I now want to take the classifier outside the R environment, for example to a C program, and use it. I know that the classifer is of the form WTX+b where W is defined

[R] odfWeave problem Error in xmlEventParse

2009-02-24 Thread Fredrik Karlsson
Dear list, Sorry for bothering you with a pure odfSweave question, but I just ran into a problem that I cannot find the cause of. Anyonse seen this before? This file used to work, but not anymore. Would apreciate all the help I could get. /Fredrik

Re: [R] Tracing gradient during optimization

2009-02-24 Thread Shimrit Abraham
Hi Ravi, Thanks for your great suggestion, it does exactly what I need as it provides more insight into what is going on in the 'black box'. In addition, it's much faster than optim(). I will use this function in the future. Kind Regards, Shimrit On Tue, Feb 24, 2009 at 2:33 PM, Ravi

[R] Help with t.test

2009-02-24 Thread Amit Patel
Hi I have managed to do a paired t-test with a data set i have 5 colums of data im dealing with GENE SampA SampB SampC SampVehicle ctcc 859 na145 24 gtcg 45 5 54 69 and so on but they are much larger

[R] control data symbols in pairs function

2009-02-24 Thread Kirk Wythers
How does one control the size and type of data symbols in pairs()? I am trying to use the little dot (as in type=.) with absolutely no success. Here is the pairs call I am using: pairs(data.frame, panel=function(x,y) {points(x,y); lines(lowess(x,y))}) or even simpler: pairs(data.frame,

Re: [R] Tracing gradient during optimization

2009-02-24 Thread Shimrit Abraham
Yes, initially, it didn't work and thanks to one of the examples in the help file, I found out that I need to set maximize = T...but thanks for your suggestion anyway. I mainly work with state space models and I'm currently dealing with a case where the estimation time is halved (!!!) by spg().

Re: [R] Inference for R Spam

2009-02-24 Thread Tony Breyal
Cheers for that information; I've just registered for the useR meeting in London and then about 10 minutes later got that same bit of spam too which made me a wee bit suspicious. On 24 Feb, 13:39, Thomas Lumley tlum...@u.washington.edu wrote: The same company caused a complaint about a year

[R] RODBC connectivity

2009-02-24 Thread Rad Nag
I am using R to access .mdb files (created in Microsoft access 2003)  through RODBC. I am able to view the Tables and also list their attributes through the sql. commands. However, when try to acces the primary keys (using sqlPrimaryKeys /odbcPrimaryKeys) I get a value of  '-1' on

Re: [R] Inference for R Spam

2009-02-24 Thread Gabor Grothendieck
On Tue, Feb 24, 2009 at 9:58 AM, Martin Maechler maech...@stat.math.ethz.ch wrote: TL == Thomas Lumley tlum...@u.washington.edu     on Tue, 24 Feb 2009 05:39:33 -0800 (PST) writes:    TL The same company caused a complaint about a year ago    TL

Re: [R] control data symbols in pairs function

2009-02-24 Thread Uwe Ligges
Kirk Wythers wrote: How does one control the size and type of data symbols in pairs()? I am trying to use the little dot (as in type=.) with absolutely no success. I guess you mean pch=. and hence pairs(data.frame, panel=panel.smooth, pch=.) Uwe Ligges Here is the pairs call I am

Re: [R] Initialize varFunc in R

2009-02-24 Thread ONKELINX, Thierry
Dear Tania, Shouldn't that be varIdent(form = ~species.group) instead of varIdent(form = ~1|species.group)? Notice that this is untested as you did not provide a self-contained example (as de posting guide asked you to do). HTH, Thierry PS Next time try the mixed-models mailing list with

[R] any function for package searching?

2009-02-24 Thread Zheng, Xin (NIH) [C]
Hi there, I wanted to search some packages related with 'genetics'. I know I can do it on CRAN webpage. I'm just wondering if there's some function in R could do that. Debian apt offers one way. It would be perfect if R has some builtin function like Debian apt. Appreciate any help. Xin

[R] subsetting a matrix based on condition

2009-02-24 Thread A Ezhil
Dear All, I have matrix of size 2500 x 12. I would like to select all the rows if 6 out 12 values are 0. How can I do that in R? Thanks in advance. Kind regards, Ezhil __ R-help@r-project.org mailing list

Re: [R] matrix computation???

2009-02-24 Thread Greg Snow
The same as what? It is not clear what you are trying to compare. Is this the comparison that you are looking for?: A - scale(stackloss) fit1 - lm( stack.loss ~ . - 1, data=as.data.frame(A)) tmp1 - fitted(fit1) fit2 - svd(A[,-4]) tmp2 - fit2$u %*% t(fit2$u) %*% A[,4] all.equal(

Re: [R] subsetting a matrix based on condition

2009-02-24 Thread Dimitris Rizopoulos
one way is: mat - matrix(rnorm(2500*12), 2500, 12) ind - rowSums(mat 0) 6 mat[ind, ] I hope it helps. Best, Dimitris A Ezhil wrote: Dear All, I have matrix of size 2500 x 12. I would like to select all the rows if 6 out 12 values are 0. How can I do that in R? Thanks in advance.

Re: [R] any function for package searching?

2009-02-24 Thread Wacek Kusnierczyk
Zheng, Xin (NIH) [C] wrote: Hi there, I wanted to search some packages related with 'genetics'. I know I can do it on CRAN webpage. I'm just wondering if there's some function in R could do that. Debian apt offers one way. It would be perfect if R has some builtin function like Debian

[R] statistical significance of accuracy increase in classification

2009-02-24 Thread Monica Pisica
Hi everyone, I would like to test for the statistical significance(for what it worth ...) in increasing classification accuracy and kappa statistics from different land classifications. The classifications were done using other software (like eCognition and See5), but the results were sampled

[R] R, Shapley Values and TURF

2009-02-24 Thread Data Analytics Corp.
Hi, I'm looking for any information on calculating and using Shapley Values in a TURF context. A paper was presented at an S-Plus conference about this: Conklin M., Lipovetsky S. Modern Marketing Research Combinatorial Computations: Shapley Value versus TURF Tools, Proceedings of 1998

Re: [R] reading text files compressed by gzip

2009-02-24 Thread jim holtman
What did the data appear like when it was read in? Have you just tried to read in the lines (readLines) to see if the decompression is working? Does this compare to what you get if you decompress the file outside of R? Not exactly sure what you mean by force since the command it probably

Re: [R] any function for package searching?

2009-02-24 Thread Gabor Grothendieck
On Tue, Feb 24, 2009 at 10:56 AM, Zheng, Xin (NIH) [C] zheng...@mail.nih.gov wrote: Hi there, I wanted to search some packages related with 'genetics'. I know I can do it on CRAN webpage. I'm just wondering if there's some function in R could do that. Debian apt offers one way. It would be

Re: [R] Tracing gradient during optimization

2009-02-24 Thread Greg Snow
It looks like you found a solution, but if you find yourself in this situation again using optim, then one approach is to modify your function that you are optimizing (or write a wrapper for it) to produce the tracing information for you. -- Gregory (Greg) L. Snow Ph.D. Statistical Data

Re: [R] odfWeave problem Error in xmlEventParse

2009-02-24 Thread Dieter Menne
Fredrik Karlsson dargosch at gmail.com writes: Dear list, Sorry for bothering you with a pure odfSweave question, but I just ran into a problem that I cannot find the cause of. Anyonse seen this before? This file used to work, but not anymore. Would apreciate all the help I could get.

Re: [R] Odfweave

2009-02-24 Thread Dieter Menne
Irina Ursachi irina.ursachi at itwm.fraunhofer.de writes: Dear all, When using odfWeave, I get the following error: odfWeave(file.in,file.out) Copying Example2.odt Setting wd to /tmp/Rtmp8ekeDC/odfWeave24145003519 Unzipping ODF file using unzip -o Example2.odt Archive:

[R] useR Group Meeting - London

2009-02-24 Thread Sharon Lazenby
All Mango Solutions are pleased to announce the first meeting of the London useR Group. DateTuesday 31st March Time4pm to 7pm Venue The Wall 45 Old Broad St London EC2N 1HU Tel 020 7588 4845

Re: [R] All the products of common factors

2009-02-24 Thread Jorge Ivan Velez
Dear Gordon, Try also, unique(apply(expand.grid(commfac,commfac),1,prod)) [1] 1 2 5 4 10 25 HTH, Jorge On Mon, Feb 23, 2009 at 9:52 PM, Fox, Gordon g...@cas.usf.edu wrote: This is a seemingly simple problem - hopefully someone can help. Problem: we have two integers. We want (1) all

Re: [R] Tracing gradient during optimization

2009-02-24 Thread Shimrit Abraham
Rob Steele suggested the same thing but I'm not sure I understand how to implement this exactly. Is there any documentation that you could suggest? This might be something that could be useful for the future. Thanks, Shimrit On Tue, Feb 24, 2009 at 5:09 PM, Greg Snow greg.s...@imail.org wrote:

Re: [R] Inference for R Spam

2009-02-24 Thread Dieter Menne
Tony Breyal tony.breyal at googlemail.com writes: Cheers for that information; I've just registered for the useR meeting in London and then about 10 minutes later got that same bit of spam too which made me a wee bit suspicious. Welcome in the Fooled by Randomness society. 2:0 is a bit away from

Re: [R] statistical significance of accuracy increase in classification

2009-02-24 Thread Monica Pisica
Hi again, Looking more into test statistics i realized that maybe i can use the power.prop.test to see if the difference between the 2 accuracies are zero or not. Do you have any comments about that? Also, should i considered kappa statistics also a kind of proportion and use the same test?

[R] samr-package: problem with large sample size multiclass data

2009-02-24 Thread Rainer Tischler
Dear all, I'm using the samr-package to identify significantly differentially expressed genes in microarray data. So far, I had no problems, but when I used a large multiclass data set with 327 samples, I obtained the following error/warning message: Warning message: Inf In

[R] growing dataframes with rbind

2009-02-24 Thread Alexy Khrabrov
I'm growing a large dataframe by composing new rows and then doing row - compute.new.row.somehow(...) d - rbind(d,row) Is this a fast/preferred way? Cheers, Alexy __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] Tracing gradient during optimization

2009-02-24 Thread Greg Snow
Here is a simple example (finding the parameters of a normal) that shows one way to do it: x - rnorm(25, 100, 5) tmpfun - function(x) { steps - matrix( 0:1, nrow=1 ) myfn - function(param) { print(param)

Re: [R] Transpose array

2009-02-24 Thread Greg Snow
Try aperm(x, c(2,1,3)) -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of MarcioRibeiro Sent: Tuesday, February

[R] Leave one out Cross validation (LOO)

2009-02-24 Thread Alex Roy
Dear R user, I am working with LOO. Can any one who is working with leave one out cross validation (LOO) could send me the code? Thanks in advance Alex [[alternative HTML version deleted]] __ R-help@r-project.org

Re: [R] growing dataframes with rbind

2009-02-24 Thread Greg Snow
If you know the final size that your matrix will be, it is better to preallocate the matrix, then insert the rows into the matrix: mymat - matrix( nrow=100, ncol=10 ) for( i in 1:100 ){ mymat[i, ] - rnorm(10) } Even better than this is to use replicate or sapply if you can, they will

Re: [R] Leave one out Cross validation (LOO)

2009-02-24 Thread Frank E Harrell Jr
Alex Roy wrote: Dear R user, I am working with LOO. Can any one who is working with leave one out cross validation (LOO) could send me the code? Thanks in advance Alex I don't think that LOO adequately penalizes for model uncertainty. I recommend the bootstrap or 50

Re: [R] Transpose array

2009-02-24 Thread Peter Dalgaard
MarcioRibeiro wrote: Hi Listers, Is there a way that I can transpose an array... Suppose I have the following array... x-array(c(1,2,3,4),dim=c(1,2,2)) , , 1 [,1] [,2] [1,]12 , , 2 [,1] [,2] [1,]34 And I would like to get the following result... , , 1 [,1] [1,]

Re: [R] Leave one out Cross validation (LOO)

2009-02-24 Thread milton ruser
Hi Alex, Give a look at: http://search.r-project.org/cgi-bin/namazu.cgi?query=leave+one+outmax=20result=normalsort=scoreidxname=Rhelp02aidxname=functionsidxname=docs Cheers miltinho astronauta brazil On Tue, Feb 24, 2009 at 3:07 PM, Alex Roy alexroy2...@gmail.com wrote: Dear R user,

Re: [R] Inference for R Spam

2009-02-24 Thread Dieter Menne
And, since my son asked me and I am basketball ignorant: Why are basketball scores mostly much too close to equality? The arguments (loose power when leading) Ted.Harding at manchester.ac.uk writes: Or: Once you are in the lead, become much more defensive against attacking play by

Re: [R] growing dataframes with rbind

2009-02-24 Thread Gabor Grothendieck
Suppose we want 3 rows and the ith row should have 5 columns of i. Create a list whose ith component is the ith row and rbind them: rows - 1:3 do.call(rbind, lapply(rows, rep, 5)) [,1] [,2] [,3] [,4] [,5] [1,]11111 [2,]22222 [3,]3333

Re: [R] growing dataframes with rbind

2009-02-24 Thread Jorge Ivan Velez
Dear all, Here is one more way to go though using rep() and then matrix(): rows - 1:3 matrix(rep(rows,5),ncol=5) [,1] [,2] [,3] [,4] [,5] [1,]11111 [2,]22222 [3,]33333 HTH, Jorge On Tue, Feb 24, 2009 at 1:43 PM, Gabor

Re: [R] 3D or 4D plot

2009-02-24 Thread Duncan Murdoch
One more followup on this: I just added a function shapelist3d() to rgl (so far only on R-forge, not CRAN) that automates a lot of this. To get the plot as below, the following code works: x - rep(1:5, each=25) y - rep(rep(1:5, each=5), 5) z - rep(1:5, 25) shapelist3d(cube3d(), x,y,z,

Re: [R] matrix computation???

2009-02-24 Thread Kutlwano Ramaboa
Thank you Greg! Yes this is the comparison I was looking for. Greg Snow greg.s...@imail.org 2009/02/24 06:07 PM The same as what? It is not clear what you are trying to compare. Is this the comparison that you are looking for?: A - scale(stackloss) fit1 - lm( stack.loss ~ . - 1,

Re: [R] Insurance data in library(MASS)

2009-02-24 Thread choonhong ang
Hi, In the result shown, the District 1 is used as the base category. How to change to make District 4 as a base category ? On Mon, Feb 23, 2009 at 11:05 AM, choonhong ang angie.bear...@gmail.comwrote: I have used the insurance data from R library and I have 2 questions: I use the following:

[R] bigest part of vector

2009-02-24 Thread Peterko
Hi, may be simle question, but a do not find it anywhere. Is there same function like max() ,but giving more results. max() give 1number-maximum I need funcion what give p bigest number. many thanks -- View this message in context:

Re: [R] Insurance data in library(MASS)

2009-02-24 Thread Richardson, Patrick
Try ?relevel -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of choonhong ang Sent: Tuesday, February 24, 2009 2:33 PM To: r-help@r-project.org Subject: Re: [R] Insurance data in library(MASS) Hi, In the result shown, the District

Re: [R] bigest part of vector

2009-02-24 Thread seelenhirt
On Tue, 24 Feb 2009 11:36:06 -0800 (PST) (SO, 55 Chs 3175 YOLD) Peterko lanikpe...@gmail.com wrote: Hi, may be simle question, but a do not find it anywhere. Is there same function like max() ,but giving more results. max() give 1number-maximum I need funcion what give p bigest number.

Re: [R] bigest part of vector

2009-02-24 Thread Jorge Ivan Velez
Dear Peter, Perhaps: set.seed(1) # For reproducibility p-2 # Two biggest values of x x-rnorm(10) tail(sort(x),p) [1] 0.7383247 1.5952808 In a function mode, foo-function(x,p=2) tail(sort(x),p) foo(x,p=3) [1] 0.5757814 0.7383247 1.5952808 HTH, Jorge On Tue, Feb 24, 2009 at 2:36

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] Simulating contingency table (Basic question, help please)

2009-02-24 Thread Achim Zeileis
On Tue, 24 Feb 2009, bbbnc wrote: I'd like to carry out a Monte Carlo simulation test where given data is a contingency table. I think this is something to do with using rmultinonom(), but I'm not sure how to code this, to simulate contingency tables. Could anyone please help with how to use R

Re: [R] bigest part of vector

2009-02-24 Thread Bert Gunter
Nothing wrong with prior suggestions, but strictly speaking, (fully) sorting the vector is unnecessary. y[y quantile(y, 1- p/length(y))] will do it without the (complete) sort. (But sorting is so efficient anyway, I don't think you could notice any difference). -- Bert Gunter Genentech

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

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

2009-02-24 Thread Sean Zhang
Dear R-helpers: I am an R novice and would appreciate answer to the following question. Want to delete many variables in a dataframe. Am able to delete one variable by assigning it as NULL Have a large number of variables and would like to delete them without using a for loop. Is there a

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

2009-02-24 Thread Christos Hatzis
Setting to NULL works only if a single column is selected. More generally, df[, !(colnames(df) %in% c(var.b, var.c)), drop=FALSE] -Christos -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Sean Zhang Sent: Tuesday, February

[R] Installing archived package alongisde current one

2009-02-24 Thread Manuel Morales
Hi list, I'd like to install an archived version of lmer to compare results with the current version. I guess one way to do this would be to download the source, rename the package and then install it. Is there a better alternative? -- http://mutualism.williams.edu signature.asc Description:

Re: [R] Installing archived package alongisde current one

2009-02-24 Thread Uwe Ligges
Manuel Morales wrote: Hi list, I'd like to install an archived version of lmer to compare results with the current version. I guess one way to do this would be to download the source, rename the package and then install it. Is there a better alternative? Yes: Install into a different

[R] Help with Latex (Hmisc)

2009-02-24 Thread jimdare
Dear R Users, I have three questions. 1) Is there a way to get the output tex file to include \documentclass{report} \begin{document} and \end{document} so I can generate a PDF straight away. (I am trying to generate hundreds of these and don't want to have to manually type this in

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

2009-02-24 Thread Stavros Macrakis
On Tue, Feb 24, 2009 at 3:10 PM, Sean Zhang wrote: ...Want to delete many variables in a dataframe df-data.frame(var.a=rnorm(10), var.b=rnorm(10),var.c=rnorm(10)) df[,'var.a']-NULL #this works for one single variable df[,c('var.a','var.b')]-NULL #does not work for multiple variables

[R] biplot.princomp - changing score labels

2009-02-24 Thread Axel Strauß
Dear R helpers, When producing a PCA biplot, vectors of environmental variables (as red arrows with labels) and scores of the observations (black labels (observation names)) are plotted by default. How can I change the graphical output? Let's say I would like that the scores are plottet only

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

2009-02-24 Thread Christos Hatzis
You're right. The help page is somewhat misleading at first read. ?`[-.data.frame` states that (with added emphasis) value A suitable replacement value: it will be repeated a whole number of times if necessary and it may be coerced: see the Coercion section. *** If NULL, deletes the column if

Re: [R] bigest part of vector

2009-02-24 Thread Stavros Macrakis
On Tue, Feb 24, 2009 at 3:01 PM, Bert Gunter gunter.ber...@gene.com wrote: Nothing wrong with prior suggestions, but strictly speaking, (fully) sorting the vector is unnecessary. y[y quantile(y, 1- p/length(y))] will do it without the (complete) sort. (But sorting is so efficient anyway, I

Re: [R] bigest part of vector

2009-02-24 Thread Bert Gunter
Well, yes to all -- that's why I pointed this out. Sorting is (depending on details) = O(n log(n)) while the quantile algorithm uses R's partial sort option, which I think would be O(n) for a single quantile. For n of a few thousand or so, the difference shouldn't be noticeable. For large n, of

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

2009-02-24 Thread Wacek Kusnierczyk
Stavros Macrakis wrote: On Tue, Feb 24, 2009 at 3:10 PM, Sean Zhang wrote: ...Want to delete many variables in a dataframe df-data.frame(var.a=rnorm(10), var.b=rnorm(10),var.c=rnorm(10)) df[,'var.a']-NULL #this works for one single variable df[,c('var.a','var.b')]-NULL #does not

  1   2   >