Re: [R] r package to solve for Nash equilibrium

2013-11-13 Thread Rolf Turner
On 11/12/13 02:49, Dereje Fentie wrote: Is there an r package out there that solves for pure strategy* Nash equilibrium of a two-person game*? A search for Nash equilibrium in r provides a link to the *GNE* package which solves for the Generalized Nash equilibrium. But what I would like to solve

Re: [R] Bar Graph

2013-11-13 Thread Keniajin Wambui
The serialno represents each individual in the data set.The total count of the serialno will represent the whole sample I want to do a graph to compare the total data (serialno) vs each of the remaining five variables yearly. i.e to show the total data (serialno) vs available data for one of the

[R] Setting x-axis of a plot on each loop

2013-11-13 Thread Baro
I have a block of code: window-5 start-3 n-1 seq1 - seq(1:40) mat-matrix(seq1,40) while(1+window=length(mat[,1])) { kd-matrix(as.integer(mat[n:(n+window-1),1])) Sys.sleep(0.2) plot(kd,col=blue,xlab=Rohdaten,ylab=values,xlim=c(start+n,start+n+window-1) ) n-n+1 } I have this

Re: [R] Different output from lm() and lmPerm lmp() if categorical variables are included in the analysis

2013-11-13 Thread Rolf Turner
RTFM!!! :-) The help explicitly says The default contrasts are set internally to (contr.sum, contr.poly) . Set options(contrasts=c(contr.sum,contr.poly)) before your call to lm() and atest will agree with aptest all down the line. cheers, Rolf Turner On 11/08/13 21:35,

Re: [R] Bar Graph

2013-11-13 Thread Jim Lemon
On 11/13/2013 07:20 PM, Keniajin Wambui wrote: The serialno represents each individual in the data set.The total count of the serialno will represent the whole sample I want to do a graph to compare the total data (serialno) vs each of the remaining five variables yearly. i.e to show the

[R] Generalized Additive Models - gamma against overfitting

2013-11-13 Thread Mike.lang
Dear listeners, in order to analyze a dataset, which includes more than 30k records, I'm using a general GAMM like y~s(x)+s(y)+z+e with a underlying normal distribution. Unfortunately, I have some problems with over- and underfittings in smooth-functions at the same time. In general there is

[R] Negative binomial parameterisation in mgcv

2013-11-13 Thread Mark Payne
Dear R-help, The negative binomial distribution has several different parameterisations, but I can't seem to figure out what the exact one used in mgcv's negbin family is? negbin() requires a theta argument, but its not clear anywhere in the documentation (that I can find), how this parameter

Re: [R] Negative binomial parameterisation in mgcv

2013-11-13 Thread Prof Brian Ripley
On 13/11/2013 09:38, Mark Payne wrote: Dear R-help, The negative binomial distribution has several different parameterisations, but I can't seem to figure out what the exact one used in mgcv's negbin family is? negbin() requires a theta argument, but its not clear anywhere in the documentation

[R] Grid type of sampling in geodata

2013-11-13 Thread Alaios
Hi all, I have spatial field created with grf and I was wondering if I can sample in lines, something that can resemble sampling outdoors at the streets. Random sampling looks to far of what I want to have. there is in geodata package the sample.geodata but this looks like to be random samples.

[R] making a barplot with table of experimental conditions underneath (preferably ggplot2)

2013-11-13 Thread N.Hubner
Dear all, my data looks the following: df - data.frame (experiment=c(E1,E2,E3,E4), mean = c(3,4,5,6), stdev=c(0.1,0.1,0.05,0.2), method = c(STD,STD, FP, FP), enzyme =c (T,T/L,T,T/L), denaturation=c(U,U,0.05%RG, 0.1%RG)) I would like to make a bar plot with standard deviation which I

[R] issues with calling predict.coxph.penal (survival) inside a function - subset-vector not found. Because of NextMethod?

2013-11-13 Thread julian.bothe
Hello everyone, I got an issue with calling predict.coxph.penal inside a function. Regarding the context: My original problem is that I wrote a function that uses predict.coxph and survfit(model) to predict a lot of survival-curves using only the basis-curves for the strata (as

Re: [R] issues with calling predict.coxph.penal (survival) inside a function - subset-vector not found. Because of NextMethod?

2013-11-13 Thread Simon Zehnder
Works for me: predicting_function(fit2,test1) 1 2 3 4 5 6 7 -1.0481141 0.1495946 0.4492597 0.4492597 0.9982492 -0.4991246 -0.4991246 Best Simon On 13 Nov 2013, at 15:46, julian.bo...@elitepartner.de wrote: Hello everyone,

Re: [R] Data transformation to list for event occurence

2013-11-13 Thread William Dunlap
Or, f3 - function (dat1) { i - dat1$Event_Occurence == 1 split(dat1$Week[i], dat1$ID[i]) } in addition to the previously mentioned f1 - function(dat1) { with(dat1,tapply(as.logical(Event_Occurence),ID,FUN=which )) } f2 - function(dat1){ lapply(split(dat1,dat1$ID),function(x)

Re: [R] Negative binomial parameterisation in mgcv

2013-11-13 Thread Simon Wood
var(y) = mu + mu^2/theta where E(y) = mu. best, Simon On 13/11/13 10:38, Mark Payne wrote: Dear R-help, The negative binomial distribution has several different parameterisations, but I can't seem to figure out what the exact one used in mgcv's negbin family is? negbin() requires a theta

Re: [R] Double Pareto Log Normal Distribution DPLN

2013-11-13 Thread b. alzahrani
Hi I found this paper http://cs.stanford.edu/people/jure/pubs/dpln-kdd08.pdf that models the DPLN distribution as in equation 8. I implemented this in R but cannot get the same curve as in Figure 4. can you please check if my code below is correct: e.g. is the use of pnorm() correct here?

Re: [R] Setting x-axis of a plot on each loop

2013-11-13 Thread David Winsemius
On Nov 13, 2013, at 12:24 AM, Baro wrote: I have a block of code: window-5 start-3 n-1 seq1 - seq(1:40) mat-matrix(seq1,40) while(1+window=length(mat[,1])) { kd-matrix(as.integer(mat[n:(n+window-1),1])) Sys.sleep(0.2)

[R] What is the difference between Mean Decrease Accuracy produced by importance(foo) vs foo$importance in a Random Forest Model?

2013-11-13 Thread Lopez, Dan
Hi R Expert Community, My question: What is the difference between Mean Decrease Accuracy produced by importance(foo) vs foo$importance in a Random Forest Model? I ran a Random Forest classification model where the classifier is binary. I stored the model in object FOREST_model. I than ran

Re: [R] codenls

2013-11-13 Thread Prof J C Nash (U30A)
The expression has b[1] and b[2] while start has b[2] and b[3]. The expression needs a different form, for example: # fit-nlrob(y ~ x1 / (1+ b[1]*x2^b[2]),data = xx, start = # list(b[2],b[3])) fit-nlrob(y ~ x1 / (1+ b1*x2^b2),data = xx, start = list(b1=b[2],b2=b[3])) This works,

[R] ggplot2: geom_boxplot. Mapping aes factor but with different color scale and hatching

2013-11-13 Thread Anna Zakrisson Braeunlich
Dear all, I have a geom_boxplot where I have the boxes colored according to a factor. The color scale given is very lovely and colorful, but I need it in grayscale. how do I change this? I also am worried that the grayscale may be too similar (black/white is also not an option as in my real

[R] .First in R.app (on Mac) vs R in Terminal

2013-11-13 Thread Ricardo Saporta
Hello, I am noticing different behavior with respect to .First when working in Terminal or working with the R gui on Mac OSX, and I am wondering if someone might clarify for me the intention behind this. In both cases, I am running 3.0.2 on the same machine. In my ~/.Rprofile I have a function

[R] Fitting arbitrary curve to 1D data with error bars

2013-11-13 Thread Erkcan Özcan
Dear R experts, I was wondering how I could do a fit (say minimum chi2) to a 1D data with error bars. I searched quite a lot on the web, found out about the fitdistr() function in MASS, etc., but none of the things I found gives what I am really looking for. Perhaps I do not exactly know the

[R] Linux Java and R not working together

2013-11-13 Thread Uwe Bohne
Dear community, I almost tried for 3 days now to install rJava and package FSelector on my Linux machine but couldn't do so. I searched all the forums and tried some tricks ... but unfortunately couldn't find any solution. First of all I did try to install rJava in my rkward

[R] Survival analysis with truncated data.

2013-11-13 Thread Nicolas Palix
Hi, I would like to know how to handle truncated data. My intend is to have the survival curve of a software fault in order to have some information about fault lifespan. I have some observations of a software system between 2004 and 2010. The system was first released in 1994. The event

Re: [R] simplex

2013-11-13 Thread arun
Hi Sven, May be this helps: If you look into ?simplex.object solved This indicates whether the problem was solved.  A value of   ‘-1’ indicates that no feasible solution could be found.  A   value of ‘0’ that the maximum number of iterations was   reached without

Re: [R] Double Pareto Log Normal Distribution DPLN

2013-11-13 Thread David R Forrest
Looks like there are typos in equation 8 of http://cs.stanford.edu/people/jure/pubs/dpln-kdd08.pdf (expo2 doesn't depend on 'v') or equation 9 of http://www.math.uvic.ca/faculty/reed/dPlN.3.pdf ('a' is not specified). Dave On Nov 13, 2013, at 11:43 AM, b. alzahrani cs_2...@hotmail.com

[R] R Beginner - Need Perhaps 5 - 10 Minutes of R User Time to Learn Few Basics

2013-11-13 Thread Zach Feinstein
I have finally decided that I will learn R and learn it very well. For now I am using a program that a friend of mine developed to do some advanced statistical analyses. I downloaded RStudio to my machine. [Perhaps RStudio is not the best platform to work from - I have heard that Rattle is

[R] kernlab multicore usage

2013-11-13 Thread Liam Roche
I am hoping there are other users of the kernlab package in R who will be able to solve a puzzle. In the past, I've used the relevance vector machine engine (rvm) in kernlab and was pleased to see it use all four cores on my PC (running Windows 8). But now it only runs on one core and I can't

Re: [R] Readjusting frequencies

2013-11-13 Thread arun
Hi Katherine, Check if this works: fraud_data = data.frame(no_of_frauds = c(1, 2, 4, 6, 7, 9, 10), frequency = c(3, 1, 7, 11, 13, 1, 4)) fraud_data1 - rbind(fraud_data,c(11,10)) fun1 - function(dat) {  sum1 - 0  for(i in 1:nrow(dat)){  sum1 - sum1 + dat[i, frequency]  dat[i,frequency] - sum1  

Re: [R] R Beginner - Need Perhaps 5 - 10 Minutes of R User Time to Learn Few Basics

2013-11-13 Thread Bert Gunter
Type the following into your console window: install.packages(fortunes) library(fortunes) fortune(brain surgery) (It's not quite apposite, but close enough). Cheers, Bert On Wed, Nov 13, 2013 at 5:57 AM, Zach Feinstein zfeinst...@isgmn.com wrote: I have finally decided that I will learn R

Re: [R] R Beginner - Need Perhaps 5 - 10 Minutes of R User Time to Learn Few Basics

2013-11-13 Thread Mitchell Maltenfort
Bert: Yet another reason I'm a fan of Frank Harrell. Does anyone know when I get to buy the next edition of Regression Modeling Strategies? Zach: Check www.coursera.org. They have some nice R-centric classes. I signed up myself since my own R skills are self-taught. Also consider investing in

Re: [R] Double Pareto Log Normal Distribution DPLN

2013-11-13 Thread David R Forrest
...Additionally...your set of parameters match none of the curves in figure 4. I think the ordering of the parameters as listed on the graphs is different than in the text of the article. The 'v' parameter controls the location of the 'elbow' and should be near log(x) in each graph, while the

Re: [R] How to sum a function over a specific range in R?

2013-11-13 Thread Adams, Jean
On Tue, Nov 12, 2013 at 11:45 AM, umair durrani umairdurr...@outlook.comwrote: I am new to R and have already posted this question on stack overflow. The problem is that I did not understand the answers as the R documentation about the discussed functions (e.g. 'convolve') is quite complicated

Re: [R] Update a variable in a dataframe based on variables in another dataframe of a different size

2013-11-13 Thread Lopez, Dan
This is a great solution! Love the conciseness of your solution. And easy to understand. Thanks again. Dan -Original Message- From: arun [mailto:smartpink...@yahoo.com] Sent: Monday, November 11, 2013 6:31 PM To: Lopez, Dan Subject: Re: [R] Update a variable in a dataframe based on

[R] Real frequencies in a 'set' problem

2013-11-13 Thread Stefan Petersson
I have three media channels where I can push public health information (tv, radio and newspaper). Any given citizen can be touched by the information from one, two or three channels (let's ignore for the moment that citizens might miss the information all together). Hence these sets:

Re: [R] making a barplot with table of experimental conditions underneath (preferably ggplot2)

2013-11-13 Thread Jim Lemon
On 11/14/2013 01:24 AM, n.hub...@ncmls.ru.nl wrote: Dear all, my data looks the following: df- data.frame (experiment=c(E1,E2,E3,E4), mean = c(3,4,5,6), stdev=c(0.1,0.1,0.05,0.2), method = c(STD,STD, FP, FP), enzyme =c (T,T/L,T,T/L), denaturation=c(U,U,0.05%RG, 0.1%RG)) I would like to

Re: [R] Real frequencies in a 'set' problem

2013-11-13 Thread David Winsemius
On Nov 13, 2013, at 1:35 PM, Stefan Petersson wrote: I have three media channels where I can push public health information (tv, radio and newspaper). Any given citizen can be touched by the information from one, two or three channels (let's ignore for the moment that citizens might miss the

Re: [R] How to sum a function over a specific range in R?

2013-11-13 Thread Bert Gunter
?filter perhaps. -- Bert On Wed, Nov 13, 2013 at 1:10 PM, Adams, Jean jvad...@usgs.gov wrote: On Tue, Nov 12, 2013 at 11:45 AM, umair durrani umairdurr...@outlook.comwrote: I am new to R and have already posted this question on stack overflow. The problem is that I did not understand the

[R] On ^ returning a matrix when operated on a data.frame

2013-11-13 Thread Arunkumar Srinivasan
Dear R-users, I am wondering why ^ operator alone returns a matrix, when operated on a data.frame (as opposed to all other arithmetic operators). Here's an example: DF - data.frame(x=1:5, y=6:10) class(DF*DF) # [1] data.frame class(DF^2) # [1] matrix I posted here on SO:

[R] (sin asunto)

2013-11-13 Thread Elisa Frutos Bernal
Hi! I need to print a graph that I have in a window. Previously I used: try(win.print(), silent = TRUE) if (geterrmessage() != Error in win.print() : unable to start device devWindows\n) { plotFunctiond(screen = FALSE) dev.off() but now it is not possible. Can

[R] volume of ellipsoid

2013-11-13 Thread Yuanzhi Li
Hi, everyone! I have a matrix X(n*p) which is n samples from a p-dimensional normal distribution. Now I want to make the ellipsoid containing (1-α)% of the probability in the distribution based on Mahalanobis distance: μ:(x-μ)'Σ^(-1)(x-μ)≤χ2p(α) where x and Σ is the mean and

Re: [R] On ^ returning a matrix when operated on a data.frame

2013-11-13 Thread Duncan Murdoch
On 13-11-13 6:00 PM, Arunkumar Srinivasan wrote: Dear R-users, I am wondering why ^ operator alone returns a matrix, when operated on a data.frame (as opposed to all other arithmetic operators). Here's an example: DF - data.frame(x=1:5, y=6:10) class(DF*DF) # [1] data.frame class(DF^2) # [1]

Re: [R] On ^ returning a matrix when operated on a data.frame

2013-11-13 Thread Arunkumar Srinivasan
Duncan, Thank you. What I meant was that ^ is the only *arithmetic operator* to result in a matrix on operating in a data.frame. I understand it's quite old code. Also, your explanation makes sense, with the exception of / operator, I suppose (I could be wrong here). Arun On Thursday,

Re: [R] On ^ returning a matrix when operated on a data.frame

2013-11-13 Thread Duncan Murdoch
On 13-11-13 6:52 PM, Arunkumar Srinivasan wrote: Duncan, Thank you. What I meant was that ^ is the only *arithmetic operator* to result in a matrix on operating in a data.frame. I understand it's quite old code. Also, your explanation makes sense, with the exception of / operator, I suppose (I

Re: [R] Update a variable in a dataframe based on variables in another dataframe of a different size

2013-11-13 Thread MacQueen, Don
Dan, Gabor's solution is of course good, but here's a solution that uses only base R capabilities, and doesn't sort as merge() does. Essentially the same as A.K.'s, but slightly more general. tmp1 - match( paste(T_DF$FY,T_DF$ID) , paste(H_DF$FY,H_DF$ID) ) H_DF$TT[tmp1] - T_DF$TT gg -

[R] Analysis

2013-11-13 Thread Jim Silverton
Hi, I have 187 urine cultures which were subjected to culture and microscopy methods. Video were used to 'verify' the findings. Culture is considered the gold method. But Microscopy is another method which may be cheaper. I checked the videos to determine whether bacteria was growing on both

[R] oblique.scores argument for fa function in psych package

2013-11-13 Thread Mark Seeto
Dear R help, I'm using version 1.3.10.12 of the psych package. The help page for fa says that when calculating factor scores, oblique.scores=FALSE causes the pattern matrix to be used, and oblique.scores=TRUE causes the structure matrix to be used. However, when I try it, it seems to be the other

Re: [R] Fitting arbitrary curve to 1D data with error bars

2013-11-13 Thread Suzen, Mehmet
If you are after adding error bars in a scatter plot; one example is given below : #some example data set.seed(42) df - data.frame(x = rep(1:10,each=5), y = rnorm(50)) #calculate mean, min and max for each x-value library(plyr) df2 - ddply(df,.(x),function(df)

Re: [R] Analysis

2013-11-13 Thread Ranjan Maitra
Don't know if the data will support the result that you want but the only way to get some sort of answer is to hire a statistician. ranjan On Wed, 13 Nov 2013 20:58:30 -0400 Jim Silverton jim.silver...@gmail.com wrote: Hi, I have 187 urine cultures which were subjected to culture and

Re: [R] Update a variable in a dataframe based on variables in another dataframe of a different size

2013-11-13 Thread arun
Hi Don, In cases like: H_DF - H_DF[-4,] tmp1 - match( paste(T_DF$FY,T_DF$ID) , paste(H_DF$FY,H_DF$ID) )  H_DF$TT[tmp1] - T_DF$TT #Error in `[-.factor`(`*tmp*`, tmp1, value = c(2L, 2L, 2L)) : Probably, this works: H_DF$TT[tmp1[!is.na(tmp1)]] - unique(T_DF$TT) A.K. On Wednesday, November

[R] MM estmator

2013-11-13 Thread IZHAK shabsogh
hi I have a nonlinear regression model with two parameter, i have estimated using nls in R and i want to also find the estimate using MM, someone refer me to this function nlrob but this is main for only M estimate. can you please help me findout  a function in R for MM nonlinear regression

[R] Replace NA's with value in the next row

2013-11-13 Thread dila radi
Hi all, I have a data set which treat missing value as NA and now I need to replace all these NA's by using number in the same row but different column. Here is the part of my data: V1 V2 V3 V4 V5 V6 V7 0 0 0 1.2 0 0 0.259 0 0 12.8 0 23.7 0 8.495 6 0 81.7 0.2 0 20 19.937 0 1.5 60.9 0 0 15.5

Re: [R] MM estmator

2013-11-13 Thread Simon Zehnder
Check the gmm package with a weighting matrix equal to the identity. Best Simon On 14 Nov 2013, at 04:37, IZHAK shabsogh ishaqb...@yahoo.com wrote: hi I have a nonlinear regression model with two parameter, i have estimated using nls in R and i want to also find the estimate using MM,