[R] matrix manipulation

2015-07-16 Thread Therneau, Terry M., Ph.D.
This is as much a mathematics as an R question, in the this should be easy but I don't see it category. Assume I have a full rank p by p matrix V (aside: V = (X'X)^{-1} for a particular setup), a p by k matrix B, and I want to complete an orthagonal basis for the space with distance function

[R] (ordinal) logistic regression

2015-07-16 Thread Wolfgang Raffelsberger
Dear list, I've been looking at previous posts on the list, but I haven't found any close enough to my question/problem. My data can be seen as a matrix of mutiple individuals (columns) with (rather independent) measures (lines). Now based on supplemental information, the individuals are organized

Re: [R] Speeding up code?

2015-07-16 Thread jim holtman
Here is one improvement. Avoid dataframes in some of these cases. This create a character matrix and then converts to a dataframe after doing the transpose of the matrix. This just takes less than 10 seconds on my system: library(stringr) # create character matrix; avoid dataframes in

[R] matching strings in a list

2015-07-16 Thread tryingtolearn
Say I have a list: [[1]] I like google [[2]] Hi Google google [[3]] what's up and they are tweets. And I want to find out how many tweets mention google (the answer should be 2). If I string split and unlist them, then I would get the answer of 3. How do I make sure I get just 2? -- View

Re: [R] Speeding up code?

2015-07-16 Thread jim holtman
Actually looking at the result, you don't need the transpose; that was an artifact of how you were doing it before. xm - do.call(rbind, str_split(string = AllpairsTmp, pattern = -)) # convert to dataframe and do transpose on matrix and not dataframe separoPairs - as.data.frame((xm),

Re: [R] matrix manipulation

2015-07-16 Thread Peter Langfelder
Hi Terry, maybe I'm missing something, but why not define a matrix BB = V'B; then t(B) %*% V = t(BB), then your problem reduces to finding A such that t(BB) %*% A = 0? Peter On Thu, Jul 16, 2015 at 10:28 AM, Therneau, Terry M., Ph.D. thern...@mayo.edu wrote: This is as much a mathematics as an

Re: [R] matching strings in a list

2015-07-16 Thread Marc Schwartz
On Jul 16, 2015, at 12:40 PM, tryingtolearn inshi...@ymail.com wrote: Say I have a list: [[1]] I like google [[2]] Hi Google google [[3]] what's up and they are tweets. And I want to find out how many tweets mention google (the answer should be 2). If I string split and unlist

Re: [R] matching strings in a list

2015-07-16 Thread Ista Zahn
Why would you strsplit them? I would think length(grep(google, unlist(x), ignore.case = TRUE)) should do it. Best, Ista On Thu, Jul 16, 2015 at 1:40 PM, tryingtolearn inshi...@ymail.com wrote: Say I have a list: [[1]] I like google [[2]] Hi Google google [[3]] what's up and they are

Re: [R] matching strings in a list

2015-07-16 Thread John McKown
On Thu, Jul 16, 2015 at 12:40 PM, tryingtolearn inshi...@ymail.com wrote: Say I have a list: [[1]] I like google [[2]] Hi Google google [[3]] what's up and they are tweets. And I want to find out how many tweets mention google (the answer should be 2). If I string split and unlist them,

Re: [R] User defined function within a formula

2015-07-16 Thread William Dunlap
This might do what you want: OPoly - function(x, degree=1, weight=1, coefs=NULL, rangeX=NULL){ weight - round(weight,0)# weight need to be integer if(length(weight)!=length(x)) { weight - rep(1,length(x)) } if (is.null(rangeX)) { rangeX - range(x) } p -

Re: [R] powerTransform warning message?

2015-07-16 Thread Bert Gunter
I suggest you consult a local statistician. You are (way) over your head statistically here, and statistical matters are off topic on this list. The brief answer to your question is: you are almost certainly producing nonsense. Cheers, Bert Bert Gunter Data is not information. Information is

Re: [R] powerTransform warning message?

2015-07-16 Thread John Fox
Dear Brittany, On Thu, 16 Jul 2015 17:35:38 -0600 Brittany Demmitt demmi...@gmail.com wrote: Hello, I have a series of 40 variables that I am trying to transform via the boxcox method using the powerTransfrom function in R. I have no zero values in any of my variables. When I run the

[R] problem with wilcox.test()

2015-07-16 Thread Ivan Calandra
Dear useRs, I am running a wilcox.test() on two subsets of a dataset and get exactly the same results although the raw data are different in the subsets. mydata - structure(list(cat1 = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L), .Label = c(high, low),

Re: [R] cronbachs alpha and missing values

2015-07-16 Thread John Kane
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example and http://adv-r.had.co.nz/Reproducibility.html Currently we don't even know what version of Cronbach's alpha you are using. Also use google as well as help() Try R statistics Cronbach's alpha John Kane

Re: [R] Speeding up code?

2015-07-16 Thread Ignacio Martinez
Hi Collin, The objective of the gen.names function is to generate N *unique *random names, where N is a *large *number. In my computer `gen.names(n = 5)` takes under a second, so is probably not the root problem in my code. That said, I would love to improve it. I'm not exactly sure how you

Re: [R] Problem Regarding R Packages installation

2015-07-16 Thread MacQueen, Don
the first error message is configuration failed for package RCurl immediately before that it said Cannot find curl-config. It would appear that you don't have curl installed on your computer. Unfortunately, I cannot help you with that. But you might look at the documentation for RCurl

Re: [R] problem with wilcox.test()

2015-07-16 Thread peter dalgaard
On 16 Jul 2015, at 15:13 , Ivan Calandra ivan.calan...@univ-reims.fr wrote: Dear useRs, I am running a wilcox.test() on two subsets of a dataset and get exactly the same results although the raw data are different in the subsets. mydata - structure(list(cat1 = structure(c(2L, 2L, 2L,

[R] (no subject)

2015-07-16 Thread prabir das
I am trying to analyse time-series .netcdf (3D lat,long and time domain) climate data. I want to apply the SPEI package (calculation of standardized precipitation evapotranspiration index) on it. But unable to arrange my data in the required data frame. As I am a beginner in R, it will be very

[R] R 3.2.0 - Windows 8, 1 - SSL certificate problem installing course in swirl

2015-07-16 Thread MH
Hello, I try to install a course for swirl and got a SSL problem: install_from_swirl(R Programming) Error in function (type, msg, asError = TRUE) : SSL certificate problem: self signed certificate in certificate chain Found this answer with Google but does not work either: set_config(

Re: [R] nls singular gradient matrix - fit parameters in integral's upper limits

2015-07-16 Thread ProfJCNash
The list rejects almost all attachments. You could dput the data and put it in your posting. You may also want to try a Marquardt solver. In R from my nlmrt or compiled in Kate Mullen's minpack.lm. They are slightly different in flavour and the call is a bit different from nls. JN On 15-07-16

[R] nls singular gradient matrix - fit parameters in integral's upper limits

2015-07-16 Thread Laura Teresa Corredor Bohórquez
---The las post rejected two files I had attached, so I modified it.--- Hi. I am trying to make a nls fit for a little bit complicated expression that includes two integrals with two of the fit parameters in their upper limits. I got the error Error in nlsModel(formula, mf,

[R] Weighted skewness and curtosis

2015-07-16 Thread Dimitri Liakhovitski
Is there an R package that allows one to calculate skewness and curtosis - but weighted with individual level weights (one weight per observation)? Thank you! -- Dimitri Liakhovitski __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more,

[R] removing the columns with 0 or NA or 1or NA or 2 or NA

2015-07-16 Thread Lida Zeighami
I have ma matrix which its elements are NA,0,1,2 ! I got my answer bout removing the columns with 0 or NA or both values but now I want to add additional condition for deleting the columns! I have to delete the columns which contain the same value. delete the columns with NA or 0 or both and the

Re: [R] R 3.2.0 - Windows 8, 1 - SSL certificate problem installing course in swirl

2015-07-16 Thread Duncan Murdoch
On 16/07/2015 3:08 AM, MH wrote: Hello, I try to install a course for swirl and got a SSL problem: install_from_swirl(R Programming) Error in function (type, msg, asError = TRUE) : SSL certificate problem: self signed certificate in certificate chain Found this answer with Google

Re: [R] Weighted skewness and curtosis

2015-07-16 Thread Dimitri Liakhovitski
Unfortunately not - more like 0.7654, 1.2345. I understand that I could multiply each number by 100, round it to no decimal point and then unroll my data in proportion. I was just hoping someone has done it in C and put it into a package... On Thu, Jul 16, 2015 at 11:27 AM, David Winsemius

Re: [R] Weighted skewness and curtosis

2015-07-16 Thread Bert Gunter
rep() **does** do it essentially in C !! See also the moments package, which I found instantly by googling sample moments in R, though I don't know whether it does what you want (but probably shouldn't do). Of course, sample skewness and kurtosis are basically useless, but that's another, off

Re: [R] Weighted skewness and curtosis

2015-07-16 Thread David Winsemius
On Jul 16, 2015, at 8:10 AM, Dimitri Liakhovitski wrote: Is there an R package that allows one to calculate skewness and curtosis - but weighted with individual level weights (one weight per observation)? Integer weights? -- David Winsemius Alameda, CA, USA

[R] NLOPTR

2015-07-16 Thread Olu Ola via R-help
Hello, I have been running a nonlinear GMM using the nloptr wrapper since the last 7 days. The maximum time I have to run the code on the server that I am using to run this code is 7 days which expires in about an hour when the server automatically terminates it. I will like to know if there is

Re: [R] Weighted skewness and curtosis

2015-07-16 Thread Bert Gunter
David: I think you missed my point. As I understand him, Dmitri mentioned rounding off to e.g. 2 decimal digits and multiplying by 100 to produce integer weights, which would then lead to unrolling the vector via rep(). Your weighted moments reference is probably closer to what he sought,

Re: [R] NLOPTR

2015-07-16 Thread Bert Gunter
1. I have no idea. 2. However, I doubt that your strategy would work anyway. If there is not an outright error, you are probably stuck in some endless loop or are wandering around at random on an essentially flat hypersurface. You would need to change convergence criteria or change the

Re: [R] rgl 3d surface

2015-07-16 Thread S Ellison
-Original Message- I compute its regression surface doing polynomical regression (fit) ... fit - lm(z ~ poly(x,2) + poly(y,2)) . So I want to repressent the surface How could I do it? Any idea?? You need to write a function f of x and y that produces the fitted

Re: [R] Weighted skewness and curtosis

2015-07-16 Thread Dimitri Liakhovitski
Thank you! On Thu, Jul 16, 2015 at 11:45 AM, Bert Gunter bgunter.4...@gmail.com wrote: rep() **does** do it essentially in C !! See also the moments package, which I found instantly by googling sample moments in R, though I don't know whether it does what you want (but probably shouldn't

Re: [R] Weighted skewness and curtosis

2015-07-16 Thread David Winsemius
On Jul 16, 2015, at 8:37 AM, Dimitri Liakhovitski wrote: Unfortunately not - more like 0.7654, 1.2345. I understand that I could multiply each number by 100, round it to no decimal point and then unroll my data in proportion. I was just hoping someone has done it in C and put it into a

Re: [R] matrix manipulation -solved

2015-07-16 Thread Therneau, Terry M., Ph.D.
Yes it is obvious --- once someone else pointed it out. Thanks for the hint. Terry T. On 07/16/2015 12:52 PM, Peter Langfelder wrote: Hi Terry, maybe I'm missing something, but why not define a matrix BB = V'B; then t(B) %*% V = t(BB), then your problem reduces to finding A such that t(BB)

Re: [R] User defined function within a formula

2015-07-16 Thread William Dunlap
Read about the 'makepredictcall' generic function. There is a method, makepredictcall.poly(), for poly() that attaches the polynomial coefficients used during the fitting procedure to the call to poly() that predict() makes. You ought to supply a similar method for your xpoly(), and xpoly() needs

[R] User defined function within a formula

2015-07-16 Thread Kunshan Yin
Hello, I have a question about the formula and the user defined function: I can do following: ###Case 1: clotting - data.frame( + u = c(5,10,15,20,30,40,60,80,100), + lot1 = c(118,58,42,35,27,25,21,19,18), + lot2 = c(69,35,26,21,18,16,13,12,12)) g1=glm(lot1 ~ log(u) + poly(u,1),

[R] Adjusting Probability for Oversampling

2015-07-16 Thread Riya Mehra via R-help
I am developing a marketing (Churn) model that has an event rate of 0.5%. So i thought to perform oversampling. I mean making the number of events equal to number of non-events by reducing non-events (50-50 after sampling). After oversampling, we need to adjust predicted probabilities as it

Re: [R] matching strings in a list

2015-07-16 Thread John McKown
On Thu, Jul 16, 2015 at 1:00 PM, John McKown john.archie.mck...@gmail.com wrote: On Thu, Jul 16, 2015 at 12:40 PM, tryingtolearn inshi...@ymail.com wrote: Say I have a list: [[1]] I like google [[2]] Hi Google google [[3]] what's up and they are tweets. And I want to find out how many

Re: [R] Speeding up code?

2015-07-16 Thread Ignacio Martinez
Thank Jim! This makes a huge difference. Can you explain why are data frame slower than a matrix? Any other suggestions on how to improve the code would be greatly appreciated. Thanks again! Ignacio On Thu, Jul 16, 2015 at 1:42 PM jim holtman jholt...@gmail.com wrote: Actually looking at the

Re: [R] (ordinal) logistic regression

2015-07-16 Thread Duncan Mackay
Hi your example is not reproducible. With ordinal regression the type of the y values is important sometimes an ordered factor is required. Ordinal regression depends on your hypothesis see Ananth and Kleinbaum 1997 functions/packages to look at apart from ordinal VGAM polr::MASS

Re: [R] [FORGED] Re: Weighted skewness and curtosis

2015-07-16 Thread Rolf Turner
On 17/07/15 03:45, Bert Gunter wrote: SNIP Of course, sample skewness and kurtosis are basically useless, but that's another, off topic, issue. Fortune nomination! cheers, Rolf -- Technical Editor ANZJS Department of Statistics University of Auckland Phone: +64-9-373-7599 ext. 88276

[R] powerTransform warning message?

2015-07-16 Thread Brittany Demmitt
Hello, I have a series of 40 variables that I am trying to transform via the boxcox method using the powerTransfrom function in R. I have no zero values in any of my variables. When I run the powerTransform function on the full data set I get the following warning. Warning message: In

Re: [R] User defined function within a formula

2015-07-16 Thread William Dunlap
OPoly-function(x,degree=1,weight=1){ weight=round(weight,0)# weight need to be integer if(length(weight)!=length(x))weight=rep(1,length(x)) p=poly(4*(rep(x,weight)-mean(range(x)))/diff(range(x)),degree) Z-(t(t(p[cumsum(weight),])*sqrt(attr(p,coefs)$norm2[- seq(2)]))[,degree])

Re: [R-es] Operaciones entre conjuntos

2015-07-16 Thread Olivier Nuñez
Estas comparando listas, prueba más bien a[,yld:=mapply(setequal,y,z)] Un saludo. Olivier - Mensaje original - De: Patricio Fuenmayor Viteri patricio.fuenma...@outlook.com Para: r-help-es r-help-es@r-project.org Enviados: Jueves, 16 de Julio 2015 2:48:35 Asunto: [R-es] Operaciones

Re: [R-es] Conservar el nombre de la variable entre varias funciones: ejemplos de resultados: solucion defmacro

2015-07-16 Thread Griera
Hola: He probado otra solución: con defmacro del paquete gtools: = DATOS - data.frame(SE=c(M, H, M, M, H), ED=c(50, 60, 20, 18, 30), GRP=c(B, B, A, A, B)) library(gtools) MRL - defmacro(XDADES, XVD, XVI,