Re: [R] Generalized Cholesky Inverse

2013-07-02 Thread Tjun Kiat Teo
Yap. I did load the package bdsmatrix On Fri, Jun 21, 2013 at 8:26 AM, Pascal Oettli kri...@ymail.com wrote: Hi, Did you load bdsmatrix? Regards, Pascal 2013/6/21 Tjun Kiat Teo teotj...@gmail.com What are the possible options I have for Generalized choleksy Inverse in R. I tried to

[R] Cross validation in R

2013-07-02 Thread Eddie Smith
Guys, I select 70% of my data and keep 30% of it for model validation. mydata - read.csv(file.choose(), header=TRUE) select - sample(nrow(mydata), nrow(mydata) * .7) data70 - mydata[select,] # select data30 - mydata[-select,] # testing temp.glm - glm(Death~Temperature, data=data70,

Re: [R] Generalized Cholesky Inverse

2013-07-02 Thread Pascal Oettli
Hi, Good. But you probably didn't carefully read the help page. The function used is solve, not solve.gchol. For an object of class gchol, solve will call solve.gchol. Regards, Pascal 2013/7/2 Tjun Kiat Teo teotj...@gmail.com Yap. I did load the package bdsmatrix On Fri, Jun 21, 2013 at

Re: [R] Optimum of lm

2013-07-02 Thread S Ellison
I am trying to do some D o E. I would like to find the optima (maxima) of a 2 dimensional lm with quadratic terms. I'm sure there is a really simple solution but i can't find it. At least part of this problem is solved by the rsm package; that fits a quadratic response surface

Re: [R] Cross validation in R

2013-07-02 Thread Adams, Jean
This code is untested, since you did not provide any example data. But it may help you get started. Jean mydata - read.csv(file.choose(), header=TRUE) library(ROCR) # ROC curve and assessment of my prediction plot(0:1, 0:1, type=n, xlab=False positive rate, ylab=True positive rate) abline(0,

[R] Replacing strings to numbers

2013-07-02 Thread Jeremy Ng
Hi guys, I was wondering if any one is able to help me on a problem that I was stuck with for a long time. It involves the replacement of character strings with numbers. The character string can take on only 3 possible values, for instance: AA AT TT I would want R to replace AT with 0. Between

Re: [R] Comparing each level of a factor to the global mean

2013-07-02 Thread Adams, Jean
You could subtract the mean from the response before fitting, then fit a model without an intercept. That would give you four parameters (one for each level) relative to the mean ... summary(lm(weight-mean(weight) ~ Diet -1, ChickWeight)) Jean On Thu, Jun 27, 2013 at 5:47 PM, Shaun Jackman

[R] Word occurrence rate in a tweet

2013-07-02 Thread Bembi Prima
Hi all, Currently I am working on a code that will calculate word occurrence rate in a tweet. First, I have 'tweets' that contains all the tweet I grabbed and I make 'words' that contains all unique word in 'tweets'. After that I use sapply to calculate probability of a word appearing in

[R] ComBat: Error in solve.default(t(des) %*% des) : Lapack routine dgesv: system is exactly singular

2013-07-02 Thread giulia benedetti
Hello, I have been trying to run the ComBat function for a while on my gene array data but don't manage to make it work. I always get the following error: Error in solve.default(t(des) %*% des) : Lapack routine dgesv: system is exactly singular: U[34,34]=0. I know it is an error of matrice but I

Re: [R] functions and matrices

2013-07-02 Thread Naser Jamil
Thanks to everyone for such nice illustrations. It will guide me for sure. On 2 July 2013 02:56, David Winsemius dwinsem...@comcast.net wrote: With permission I offer this exchange. Rolf and I have different notions of what u %*% v should mean, but the arbiter is obviously the original

[R] passing of longitude and lattitude arguments to read URL in Google Maps and extract routes

2013-07-02 Thread Franckx Laurent
Dear all I try to use Google Maps to calculate travel times per transit between an origin an destination. The guidelines for the search can be found at: https://developers.google.com/maps/documentation/directions/#TravelModes When I submit the latitude and the longitude of the origin and

Re: [R] Replacing strings to numbers

2013-07-02 Thread Prof Brian Ripley
On 02/07/2013 13:31, Jeremy Ng wrote: Hi guys, I was wondering if any one is able to help me on a problem that I was stuck with for a long time. It involves the replacement of character strings with numbers. The character string can take on only 3 possible values, for instance: AA AT TT I

[R] Recursive partitioning on censored data

2013-07-02 Thread Vicent Giner-Bosch
I am interested in applying a classification tree analysis where the response variable is a censored variable (survival data). I've discovered the package 'party' through this page: http://www.statmethods.net/advstats/cart.html. However, as my sample is not very big I would like to apply

[R] Help with heatmap hclust

2013-07-02 Thread sara sadozai
hello i have a problem since days with the heatmap function and my own cluster function... i try to put it like this but it is not working : heatmap(data, hclustfun=function(x)myclust(x)) where myclust is a simple fonction myclust= function(data){ #D=dist(data) hc=hclust(D) #mclust=

[R] Multiple Comparison Kruskal-Wallis Test on a dataframe

2013-07-02 Thread Tom Oates
Hi I have a dataframe of genomic positions something like below: chrstartendstrand1a2a3a1b2b3b1c 2c3c1d2d3d chr1201199522201199523-516263465358 537837276562 chr1201199584

[R] Linear mixed effect model doubt:

2013-07-02 Thread Paqui GG
We have a doubt on whether we are applying a lme model correctly. Our experimental/sampling design is as follows: We are studying the relationship between two quantitative and continuous variables at different sampling stations along a transect in the ocean. At each station, we take three

[R] Non-linear modelling with several variables including a categorical variable

2013-07-02 Thread Robbie Weterings
Hello everyone, I am trying to model some data regarding a predator prey interaction experiment (n=26). Predation rate is my response variable and I have 4 explanatory variables: predator density (1,2,3,4 5), predator size, prey density (5,10,15,20,25,30) and prey type (3 categories). I started

Re: [R] Replacing strings to numbers

2013-07-02 Thread arun
Hi, Not sure how your data looks like.  May be this helps. dat1- read.table(text= col1 AA-50 AT-34 TT-57 TT-45 TA-42 ,sep=,header=TRUE,stringsAsFactors=FALSE) vec1-gsub(\\-.*,,dat1[,1]) vec2- ifelse(vec1==AA,-1,ifelse(vec1==AT,0, ifelse(vec1==TT,1,NA))) library(stringr)  

Re: [R] Recursive partitioning on censored data

2013-07-02 Thread Achim Zeileis
On Tue, 2 Jul 2013, Vicent Giner-Bosch wrote: I am interested in applying a classification tree analysis where the response variable is a censored variable (survival data). I've discovered the package 'party' through this page: http://www.statmethods.net/advstats/cart.html. However, as my

[R] Creating DAGS with plate notation in R

2013-07-02 Thread Raghu Naik
I am trying to create a directed graph with plate notation (like the one shown below) in R. [image: The output image] Could someone direct to me an example code that will get me started. I could not see any reference to plate notations in igraph, qgraph packages though I may be wrong. The above

Re: [R] KalmanForecast (stats)

2013-07-02 Thread Giovanni Petris
If you read the 'Warning' section of the help page for KalmanLike, it explicitely says that begin quote These functions are designed to be called from other functions which check the validity of the arguments passed, so very little checking is done. end quote So, (1) these

Re: [R] passing of longitude and lattitude arguments to read URL in Google Maps and extract routes

2013-07-02 Thread David Winsemius
On Jul 2, 2013, at 1:59 AM, Franckx Laurent wrote: Dear all I try to use Google Maps to calculate travel times per transit between an origin an destination. The guidelines for the search can be found at: https://developers.google.com/maps/documentation/directions/#TravelModes When

Re: [R] subset of factors in a regression

2013-07-02 Thread David Winsemius
On Jul 1, 2013, at 9:39 PM, Ben Bolker wrote: Philip A. Viton viton.1 at osu.edu writes: suppose state is a variable in a dataframe containing abbreviations of the US states, as a factor. What I'd like to do is to include dummy variables for a few of the states, (say, CA and MA) among

Re: [R] Recursive partitioning on censored data

2013-07-02 Thread Vicent Giner-Bosch
On 2 July 2013 15:34, Achim Zeileis achim.zeil...@uibk.ac.at wrote: On Tue, 2 Jul 2013, Vicent Giner-Bosch wrote: I am interested in applying a classification tree analysis where the response variable is a censored variable (survival data). I've discovered the package 'party' through this

Re: [R] matching similar character strings

2013-07-02 Thread A M Lavezzi
Dear Arun, please excuse me for this late reply, we had to stop working on this temporaririly. Let me reproduce here two examples of rows from F1 and F2 (sorry, but with dput() I am not able to produce a clear example) F1_ex Nome.azienda Indirizzo 17 Alterego

Re: [R] Cross validation in R

2013-07-02 Thread Max Kuhn
How do i make a loop so that the process could be repeated several time, producing randomly ROC curve and under ROC values? Using the caret package http://caret.r-forge.r-project.org/ -- Max __ R-help@r-project.org mailing list

Re: [R] passing of longitude and lattitude arguments to read URL in Google Maps and extract routes

2013-07-02 Thread Franckx Laurent
Dear David Thank you for the suggestion. The following works fine: or_dest - paste0(origin=,lat_or,,,long_or,destination=,lat_des,,,long_des) url_to_google - paste(

Re: [R] Creating DAGS with plate notation in R

2013-07-02 Thread Raghu Naik
The image did not come through as pointed out by a list member. I have attached a pdf image file; the link is http://stackoverflow.com/questions/3461931/software-to-draw-graphical-models-in-plate-notation . Cheers. Raghu On Tue, Jul 2, 2013 at 9:42 AM, Raghu Naik naik.ra...@gmail.com wrote:

[R] What package to use to download pictures and its description from server?

2013-07-02 Thread C W
Hi R community, What package would you recommend to download pictures and descriptions of the pictures? I have looked at package XML and RCurl so far. Is this what everyone uses? Thanks, Mike __ R-help@r-project.org mailing list

[R] Outer function in R

2013-07-02 Thread Dzu
Dear members I am trying to apply the function kl.dist (Kullback-Leibler Distance measure) to multiple matrixes. I tried the following : veckldist - Vectorize(kl.dist) distancematrix - outer (matrix1,matrix2, veckldist) But the code is complaining that the list of the object does not match.

[R] acf question...

2013-07-02 Thread Venkatesh Nagarajan
I am trying to understand lagged correlations.   x= 1:100; y = c(rep(NA,40), 1:60)ccf(x = x, y = y, lag.max=100, na.action=na.pass, type = correlation)   I was hoping to see max cor at lag = 40. But I am not. What am I doing wrong?   Thanks VN [[alternative HTML version deleted]]

Re: [R] Outer function in R

2013-07-02 Thread Jeff Newmiller
Read the Posting Guide. The example you provide below is not reproducible [1], so we cannot tell what you're giving to the outer() function. [1] http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

[R] spped up a function

2013-07-02 Thread Santiago Guallar
Hi, I have written a function to assign the values of a certain variable 'wd' from a dataset to another dataset. Both contain data from the same time period but differ in the length of their time intervals: 'GPS' has regular 10-minute intervals whereas 'xact' has irregular intervals. I

Re: [R] spped up a function

2013-07-02 Thread David Winsemius
On Jul 2, 2013, at 10:47 AM, Santiago Guallar wrote: Hi, I have written a function to assign the values of a certain variable 'wd' from a dataset to another dataset. Both contain data from the same time period but differ in the length of their time intervals: 'GPS' has regular

Re: [R] What package to use to download pictures and its description from server?

2013-07-02 Thread Jeff Newmiller
Wouldn't this be highly dependent on how the pictures and descriptions were formatted online, as well as what you planned to do with them? I generally find that a web browser is quite sufficient for my needs. --- Jeff

[R] Multinomial model and p-values

2013-07-02 Thread Luciano La Sala
Hello everyone, I have a dataset which consists of Pathology scores (Absent, Mild, Severe) as outcome variable, and two main effects: Age (two factors: twenty / thirty days old) and Treatment Group (four factors: infected without ATB; infected + ATB1; infected + ATB2; infected + ATB3). First I

[R] Recoding variables based on reference values in data frame

2013-07-02 Thread kathleen askland
I'm new to R (previously used SAS primarily) and I have a genetics data frame consisting of genotypes for each of 300+ subjects (ID1, ID2, ID3, ...) at 3000+ genetic locations (SNP1, SNP2, SNP3...). A small subset of the data is shown below: SNP_ID SNP1 SNP2 SNP3 SNP4 Maj_Allele C G C A

Re: [R] Recoding variables based on reference values in data frame

2013-07-02 Thread Rui Barradas
Hello, I'm not sure I understood, but try the following. Kgeno - read.table(text = SNP_ID SNP1 SNP2 SNP3 SNP4 Maj_Allele C G C A Min_Allele T A T G ID1 CC GG CT AA ID2 CC GG CC AA ID3 CC GGncAA ID4 _ _ _ _ ID5 CC GG CC AA ID6 CC GG CC

Re: [R] Recoding variables based on reference values in data frame

2013-07-02 Thread Rui Barradas
Hello, If you have read in the data as factors (stringsAsFactors = TRUE, the default), change the function to the following. fun - function(x){ x[x %in% c(nc, _)] - NA MM - paste0(as.character(x[1]), as.character(x[1])) # Major Major Mm - paste0(as.character(x[1]),

Re: [R] acf question...

2013-07-02 Thread Jeff Newmiller
Then you are posting in the wrong forum, since this is a forum about getting R to do things for which you already understand the theory. As to the results you are getting, I highly recommend reading the details section of ?ccf. BTW The Posting Guide indicates that you should post in text

Re: [R] acf question...

2013-07-02 Thread Rolf Turner
On 03/07/13 04:21, Venkatesh Nagarajan wrote: I am trying to understand lagged correlations. x= 1:100; y = c(rep(NA,40), 1:60)ccf(x = x, y = y, lag.max=100, na.action=na.pass, type = correlation) I was hoping to see max cor at lag = 40. But I am not. What am I doing wrong? Well, I

[R] Deviance explained by individual terms in GAM

2013-07-02 Thread garth
Hello, I am fitting GAMs using mgcv. My models have both linear and functional effects, for instance: b-gam(y~s(x0)+s(x1)+s(x2)+s(x3) + x4 + as.factor(x5),data=dat) I would like to extract the proportion of deviance explained by a single term in the model, for instance, s(x1). Having read

Re: [R] Multinomial model and p-values

2013-07-02 Thread Duncan Mackay
Hi Luciano There are a number of types of ordinal regression and you need to be specific about that. There are a number of ordinal packages to do ordinal regression. MASS::polr arm::bayespolr ordinal VGAM repolr geepack etc Each of them has specific requirements about coding of the variables

Re: [R] Changing legend to fill colour in ggplot

2013-07-02 Thread Suparna Mitra
Thanks a lot Biran, This is exactly what I was looking for. Thanks a ton. B est wishes, Mitra On 29 June 2013 02:51, Brian Diggs dig...@ohsu.edu wrote: On 6/27/2013 12:34 AM, Suparna Mitra wrote: Hello R experts, I am having a problem to edit legend in ggplot using four variables.

[R] nth root of matrix

2013-07-02 Thread Sachinthaka Abeywardana
Hi all, I want to do the following: a=matrix(c(-1,-2,-3)) a^(1/3) #get 3rd root of numbers[,1] [1,] NaN [2,] NaN [3,] NaN All I get is NaNs, what is the proper way of doing this? Would like to retain the fact that it is a matrix if possible (not a requirement though). Thanks, Sachin

Re: [R] nth root of matrix

2013-07-02 Thread David Winsemius
On Jul 2, 2013, at 8:11 PM, Sachinthaka Abeywardana wrote: Hi all, I want to do the following: a=matrix(c(-1,-2,-3)) a^(1/3) #get 3rd root of numbers[,1] [1,] NaN [2,] NaN [3,] NaN All I get is NaNs, what is the proper way of doing this? Would like to retain the fact that

[R] advice on big panel operations with mclapply?

2013-07-02 Thread ivo welch
dear R experts: I have a very large panel data set, about 2-8GB. think NU - 3;NT - 3000 ds - data.frame( unit= rep(1:NU, each=NT ), time=NA, x=NA) ds$time - rep( 1:NT, NU ) ds$x - rnorm(nrow(ds)) I want to do a couple of operations within each unit first, and then do some list operations