Re: [R] Confidence Bands in nonlinear regression using optim and maximum likelihood

2010-08-02 Thread Peter Dalgaard
Cristian Montes wrote: > Hello, > > I am trying to plot confidence bands on the mean and prediction bands for the > following > nonlinear regression, using maximum likelihood via optim. A toy example with > data and > code of what I am trying to accomplish is: > > VOL<-c(0.01591475, 1.1914793

Re: [R] read SAS dataset using read.ssd()

2010-08-02 Thread Peter Dalgaard
array chip wrote: > Looks like the log file is not appropriately attached. Here it is again. > Thanks > for any suggestions. > > John Well, SAS isn't finding the file "test" in the SAS library ".\Desktop", presumably because it has the wrong extension. The obvious question is whether you c

Re: [R] Specifying interactions in rms package... error

2010-08-02 Thread Frank Harrell
Hi Rob, rms wants symmetry in the sense that the interactions need to use the same number and location of spline knots as the main effects. So if using the * notation omit the main effects (which are generated automatically) and live with the equal knots. Or use the restricted interaction

Re: [R] grep with search terms defined by a variable

2010-08-02 Thread Matt Shotwell
Daniel, If you want to search for each term at the beginning of a sting, using the regular expression construct '^', you might use the following > search.terms <- c("Emil", "Meryl") > names <- c("Emil Jannings", +"Charles Chaplin", +"Katherine Hepburn", +"M

Re: [R] grep with search terms defined by a variable

2010-08-02 Thread Daniel Malter
A beauty. Works a charm. Many many thanks. Daniel -- View this message in context: http://r.789695.n4.nabble.com/grep-with-search-terms-defined-by-a-variable-tp2311294p2311307.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-

Re: [R] grep with search terms defined by a variable

2010-08-02 Thread Joshua Wiley
Hi Daniel, What about this? # my.names <- c("Emil Jannings", "Charles Chaplin", "Katherine Hepburn", "Meryl Streep") search.term <- c("Emil", "Meryl") for(i in 1:length(search.term)){ print(grep(paste("^", search.term, sep="")[i], my.names)) } ## Chee

[R] grep with search terms defined by a variable

2010-08-02 Thread Daniel Malter
Hi, I have a good grasp of grep() and gsub() for finding and extracting character strings. However, I cannot figure out how to use a search term that is stored in a variable when the search string is more complex. #Say I have a string, and want to know whether the last name "Jannings" is in the s

[R] adding FORTRAN code to a package

2010-08-02 Thread Erin Hodgess
Dear R People: Hello! I'm putting together another RcmdrPlugin package and need to add a FORTRAN subroutine to speed things up a bit. I've never added compiled code to a package. Anyhow, I put my code into a /src directory. Here are the statements: * using log directory 'c:/R/R-2.11.1/bin/Rcmd

Re: [R] read the middle of a file

2010-08-02 Thread Michael Sumner
Try readGDAL in the rgdal package - best to use the GeoTIFF version of Etopo1 though - the GDAL functions are optimized for binary versions of large rasters like this, and with arguments to readGDAL you can read sub-windows or decimated versions. Cheers, Mike. On Tue, Aug 3, 2010 at 5:33 AM, R He

Re: [R] how to do a IF ELSE in a matrix format

2010-08-02 Thread Steven McKinney
Here's one way: edu[edu[, 1] < 0.5, 2] <- 1 > set.seed(1) > edu<-matrix(0,1000,2) > edu1<-runif(1000,0,1) > edu[,1]<-edu1 > head(edu) [,1] [,2] [1,] 0.26550870 [2,] 0.37212390 [3,] 0.57285340 [4,] 0.90820780 [5,] 0.20168190 [6,] 0.89838970 > edu[edu[, 1] < 0.5, 2

Re: [R] How to understand whether a class is a S3 class?

2010-08-02 Thread Adrian Waddell
Megh Dal yahoo.com> writes: > > Hi, is there any way to say: "this class 'x' is a S3 class?" For example what > is the type of class "data.frame"? > Is it a S3 class or S4? > > How can I get a complete list of all S3 classes currently available? > > Thanks, > > There is the isS4 function

Re: [R] sorting by date

2010-08-02 Thread Leigh E. Lommen
a <- c( 20071031,20071130, 20071231) sort(a) Or if you want convert to date: sort(strptime(a, '%Y%m%d')) Okay, but what if you have information in the other columns? For example: 20071031 information info 20071130 information info 20071231 information info Etc. Thanks. Le

Re: [R] how to do a IF ELSE in a matrix format

2010-08-02 Thread David Winsemius
On Aug 2, 2010, at 9:16 PM, Hey Sky wrote: Hey, Rers I am new to R and this question may has been asked many times or a very old one. I have checked the archive but found nothing (maybe I used the wrong key words). any advise is appreciated the question is: I try to replace a col vect

Re: [R] how to do a IF ELSE in a matrix format

2010-08-02 Thread Jorge Ivan Velez
Hi Nan, See ?ifelse edu[,2] <- ifelse(edu[,1] < 0.5, 1, 2) edu HTH, Jorge On Mon, Aug 2, 2010 at 9:16 PM, Hey Sky <> wrote: > Hey, Rers > > I am new to R and this question may has been asked many times or a very old > one. I have checked > > the archive but found nothing (maybe I used the wro

Re: [R] Specifying interactions in rms package... error

2010-08-02 Thread David Winsemius
On Aug 2, 2010, at 9:06 PM, Rob James wrote: model5 <- lrm( B_fainting ~ gender+ rcs(exactage, 7) + rcs(DW_nadler_bv, 7) + rcs(drawtimefrom8am, 7)+ DW_firsttime+ DW_race_eth + rcs(DW_BPS, 5)+ rcs(DW_BPD, 5)+ rcs(pulse3, 5)+ locat2+ (rcs(exactage, 3) * rcs(drawtimefrom8am

Re: [R] ggplot2 histograms... a subtle error found

2010-08-02 Thread Xu Wang
There is a google group dedicated to ggplot2. It might be worth making a post there: http://groups.google.com/group/ggplot2?pli=1 -- View this message in context: http://r.789695.n4.nabble.com/ggplot2-histograms-a-subtle-error-found-tp2305814p2311082.html Sent from the R help mailing list archi

[R] Disable options(echo=T) that was set in .Rprofile without showing anything to the screen

2010-08-02 Thread thmsfuller...@gmail.com
Hello All, I have the following line and some other lines in my .Rprofile. options(echo=T) To disable it, I have the following in the first line in the script. But 'Rscript a_script.R' still shows ">options(echo=F)", which I want to get rid of it as well. options(echo=F) I tried to use the fol

Re: [R] Is there paid support for R?

2010-08-02 Thread Matt Aldridge
Thanks for the message Raghu. We do indeed provide R support to a wide variety of customers. I have sent a message directly to Chris. Thanks Matt Mango Solutions Hadley Wickham, Creator of ggplot2 - first time teaching in the UK. 1st - 2nd November 2010. To book your seat please go to http://ma

[R] how to do a IF ELSE in a matrix format

2010-08-02 Thread Hey Sky
Hey, Rers I am new to R and this question may has been asked many times or a very old one. I have checked the archive but found nothing (maybe I used the wrong key words). any advise is appreciated the question is: I try to replace a col vector with some other values, see edu<-matrix(0,1000

Re: [R] sorting by date

2010-08-02 Thread Henrique Dallazuanna
a <- c( 20071031,20071130, 20071231) sort(a) Or if you want convert to date: sort(strptime(a, '%Y%m%d')) On Mon, Aug 2, 2010 at 9:03 PM, Leigh E. Lommen < leigh.lom...@courtesycorporation.com> wrote: > I am unsure how to sort a column by date if it is currently in the form: > > MMDD > > > >

[R] Specifying interactions in rms package... error

2010-08-02 Thread Rob James
I am encountering an error I do not know how to debug. The error arises when I try to add an interaction term involving two continuous variables (defined using rcs functions) to an existing (and working) model. The new model reads: model5 <- lrm( B_fainting ~ gender+ rcs(exactage, 7) +

Re: [R] sorting by date

2010-08-02 Thread Nikhil Kaza
> a <- c( 20071031,20071130, 20071231) b<- sort(as.Date(as.character(a), format="%Y%M%d")) On Aug 2, 2010, at 8:03 PM, Leigh E. Lommen wrote: I am unsure how to sort a column by date if it is currently in the form: MMDD For example the months: 20071031 20071130 20071231 Etc. Re

Re: [R] Linux Editor

2010-08-02 Thread Shige Song
Dear Michael, Thanks for the effort. I am running 64-bit Ubuntu Linux. Shige On Tue, Aug 3, 2010 at 8:17 AM, Michael Lachmann wrote: > > In general, yes. I work with it all the time, with the latest R (2.11.1) > However, I am using an older version of TeXmacs - 1.0.7.2, working > with the X11 i

Re: [R] Linux Editor

2010-08-02 Thread Michael Lachmann
In general, yes. I work with it all the time, with the latest R (2.11.1) However, I am using an older version of TeXmacs - 1.0.7.2, working with the X11 interface. When I try a newer version, 1.0.7.3 compiled with the QT interface on OSX, and 1.0.7.4, I seem to have problems. I'm still not sur

[R] sorting by date

2010-08-02 Thread Leigh E. Lommen
I am unsure how to sort a column by date if it is currently in the form: MMDD For example the months: 20071031 20071130 20071231 Etc. Regards, Leigh [[alternative HTML version deleted]] __ R-help@r-project.org mailing list htt

Re: [R] remove extreme values or winsorize – loop - dataframe

2010-08-02 Thread Glen Barnett
This might help some: RSiteSearch("winsorize") On Sun, Aug 1, 2010 at 11:39 AM, Cecilia Carmo wrote: > Hi everyone! > > #I need a loop or a function that creates a X2 variable that is X1 without > the extreme values (or X1 winsorized) by industry and year. > > #My reproducible example: > firm<-s

Re: [R] Linux Editor

2010-08-02 Thread Michael Bibo
alphaace comcast.net> writes: > > > Hi Everyone, > > I recently have started using R again on a Linux box after spending several > years on a Mac. Last I checked, the best way to use R was through EMACS > using something like ESS. I remember that being serviceable but not always > the most con

Re: [R] Linux Editor

2010-08-02 Thread Shige Song
Michael, Does TexMacs works with the latest R? Shige On Tue, Aug 3, 2010 at 1:16 AM, Michael Lachmann wrote: > > [shameless plug] > I use TeXmacs with R. You can have R in a session. And you can even insert > graphs into your session. > > http://www.texmacs.org/tmweb/plugins/statistics.en.html#

[R] Confidence Bands in nonlinear regression using optim and maximum likelihood

2010-08-02 Thread Cristian Montes
Hello, I am trying to plot confidence bands on the mean and prediction bands for the following nonlinear regression, using maximum likelihood via optim. A toy example with data and code of what I am trying to accomplish is: VOL<-c(0.01591475, 1.19147935 ,6.34102460, 53.68809287, 91.90143074,

Re: [R] read SAS dataset using read.ssd()

2010-08-02 Thread array chip
Looks like the log file is not appropriately attached. Here it is again. Thanks for any suggestions. John - Original Message From: array chip To: r-help@r-project.org Sent: Mon, August 2, 2010 2:18:32 PM Subject: [R] read SAS dataset using read.ssd() Hi, I am using read.ssd() from f

Re: [R] remove extreme values or winsorize – loop - dataframe

2010-08-02 Thread jim holtman
I had to look up winsorized; this should do it: > #My reproducible example: > firm<-sort(rep(1:1000,10),decreasing=F) > year<-rep(1998:2007,1000) > industry<-rep(c(rep(1,10),rep(2,10),rep(3,10),rep(4,10),rep(5,10),rep(6,10),rep(7,10),rep(8,10),rep(9,10), + rep(10,10)),1000) > X1<-rnorm(1) > da

Re: [R] remove extreme values or winsorize – loop - dataframe

2010-08-02 Thread Cecilia Carmo
Thank you again, but I think I need to do some homework about the split function, because I'm not understanding it very well. Besides, I think I still have a problem. I also need X2 = X1 winsorized: X2 is equal to X1 between 10%-90%, and is equal to the 10% value when < 10% and equal to the 90%

Re: [R] remove extreme values or winsorize – loop - dataframe

2010-08-02 Thread jim holtman
This is just following up with the example data you sent. This will create a list 'result' that will have the subset of data between the 10% & 90%-tiles of the data: > #My reproducible example: > firm<-sort(rep(1:1000,10),decreasing=F) > year<-rep(1998:2007,1000) > industry<-rep(c(rep(1,10),rep(2

Re: [R] Using apply for logical conditions

2010-08-02 Thread Alastair
Wow, Thanks for all the excellent (and fast) responses. That's really helped. Sorry I didn't supply a cut and paste-able example (noted for future reference) but your examples caught the essence of my problem. I ended up opting for the apply any solution. But I'll bear the Reduce function in m

Re: [R] Problems with normality req. for ANOVA

2010-08-02 Thread Frank Harrell
In addition the poster did not tell us what is wrong with a nonparametric test. Frank E Harrell Jr Professor and ChairmanSchool of Medicine Department of Biostatistics Vanderbilt University On Mon, 2 Aug 2010, Bert Gunter wrote: My sympathies, but I don't thin

Re: [R] remove extreme values or winsorize – loop - dataframe

2010-08-02 Thread Cecilia Carmo
Thank you for your help but I don't understand how can I have a dataframe with the columns: firm, year, industry, X1 and X2. Could you help me (again)? Cecília Carmo Em Sat, 31 Jul 2010 22:10:38 -0400 jim holtman escreveu: This will split the data by industry & year and then return the va

Re: [R] Using apply for logical conditions

2010-08-02 Thread Bert Gunter
Just for fun, here are another couple of versions that work for data frames. For Reduce with "|" do.call(pmax,c(mydata,na.rm=TRUE)) >0 and for "&" do.call(pmin,c(mydata,na.rm=TRUE)) >0  Cheers, Bert Gunter Genentech Nonclinical Biostatistics On Mon, Aug 2, 2010 at 2:28 PM, Joshua Wiley wr

Re: [R] Using apply for logical conditions

2010-08-02 Thread Michael Lachmann
Reduce() is really amazingly fast! Even with a much larger number of columns, it is still in the same ballpark (and much more readable): > boolean <- c(TRUE, rep(FALSE,10^3)) > a<-matrix(sample(boolean, 10^7, replace = TRUE),10^4,10^3) > b<-data.frame(a) > system.time({opt4 <- rowSums(a, na.rm =

Re: [R] Using apply for logical conditions

2010-08-02 Thread Joshua Wiley
On Mon, Aug 2, 2010 at 2:08 PM, Michael Lachmann wrote: > > Reduce() is much nicer, but I usually use > > rowSums(A) > 0 for 'or', and > rowSums(A) == ncols for 'and'. > > Which works slightly faster. For the sake of my own curiosity, I compared several of these options, but in case others are in

Re: [R] lm length

2010-08-02 Thread Erik Iverson
Trying To learn again wrote: Hi all, I wanto to run a plot about the levels of a variable parting on an ols regression. The regression in done on the rate of return of the variable. Imagine R_{t}=a+b*R_{t-1} So If P, the "estimated" price would be P_{t}=P_{t-1}*R_{t} Imagine that I obtain

Re: [R] Using apply for logical conditions

2010-08-02 Thread Bert Gunter
Yes, you must do the conversion. The reason is that Reduce requires its argument x, to be a vector; and a matrix is seen a vector obtained by columnwise concatenation. e.g. > Reduce("+",matrix(1:6,nr=3)) [1] 21 > Reduce("+",1:6) [1] 21 The data frame is seen as a list with elements the columns of

[R] read SAS dataset using read.ssd()

2010-08-02 Thread array chip
Hi, I am using read.ssd() from foreign package to read some SAS datasets. I have 2 types of SAS datasets, one with "sas7bdat" extension, the other with "ssd01" extension. I have no problem with the first dataset type, but got the following error message with the 2nd dataset type (with "ssd01" e

[R] lm length

2010-08-02 Thread Trying To learn again
Hi all, I wanto to run a plot about the levels of a variable parting on an ols regression. The regression in done on the rate of return of the variable. Imagine R_{t}=a+b*R_{t-1} So If P, the "estimated" price would be P_{t}=P_{t-1}*R_{t} Imagine that I obtain lm fitted values and the original

Re: [R] Using apply for logical conditions

2010-08-02 Thread Michael Lachmann
Reduce() is much nicer, but I usually use rowSums(A) > 0 for 'or', and rowSums(A) == ncols for 'and'. Which works slightly faster. I noticed, though, that Reduce() doesn't work on matrices. Is there an alternative for matrices, or do you have to convert the matrix first to a data.frame, and the

Re: [R] Problems with normality req. for ANOVA

2010-08-02 Thread Wu Gong
I have been struggling to make the sense of permutation test for weeks. It seems will work for you. - A R learner. -- View this message in context: http://r.789695.n4.nabble.com/Problems-with-normality-req-for-ANOVA-tp2310275p2310967.html Sent from the R help mailing list archive at Nabble.

Re: [R] Problems with normality req. for ANOVA

2010-08-02 Thread Stephan Kolassa
Hi, simulating would still require you to operationalize the "lack of normality". Are the tails too heavy? Is the distribution skewed? Does it have multiple peaks? I suspect that the specific choices you would make here would *strongly* influence the result. My condolences on the client you

Re: [R] Using apply for logical conditions

2010-08-02 Thread Joshua Wiley
In addition to Reduce(), you can take a look at ?any for '|' and ?all for '&'. Josh On Mon, Aug 2, 2010 at 1:43 PM, Allan Engelhardt wrote: > `|` is a binary operator which is why the apply will not work.  See > > help("Reduce") > > For example, > > set.seed(1) > data <- data.frame(A = runif(10)

Re: [R] Using apply for logical conditions

2010-08-02 Thread Erik Iverson
Alastair wrote: Hi, I've got some boolean data in a data.frame in the form: XYZA B C [1] T TFT F F [2] F TTF F F . . . What I want to do is create a new column which is the logical disjunction of several of the columns. Just like: new.

Re: [R] Using apply for logical conditions

2010-08-02 Thread Allan Engelhardt
`|` is a binary operator which is why the apply will not work. See help("Reduce") For example, set.seed(1) data <- data.frame(A = runif(10) > 0.5, B = runif(10) > 0.5, C = runif(10) > 0.5) Reduce(`|`, data) # [1] TRUE FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE Hope this helps.

Re: [R] ggplot2 histograms... a subtle error found

2010-08-02 Thread Brian Diggs
On 7/28/2010 5:04 PM, Mike Williamson wrote: Hello all, I have a peculiar and particular bug that I stumbled across with ggplot2. I cannot seem to replicate it with anything other than my specific data set. Here is the problem: - when I try to plot a histogram, allowing for ggpl

[R] Using apply for logical conditions

2010-08-02 Thread Alastair
Hi, I've got some boolean data in a data.frame in the form: XYZA B C [1] T TFT F F [2] F TTF F F . . . What I want to do is create a new column which is the logical disjunction of several of the columns. Just like: new.column <- data$X |

Re: [R] Problems with normality req. for ANOVA

2010-08-02 Thread Bert Gunter
My sympathies, but I don't think it's the business of list contributors to facilitate stupidity. "Confidence interval for the p-value" is nonsense. You could try sensitivity analyses via simulation, though. Cheers, Bert Gunter Genentech Nonclinical Biostatistics On Mon, Aug 2, 2010 at 11:31 AM,

Re: [R] Problems with normality req. for ANOVA

2010-08-02 Thread wwreith
I am testing normality on the studetized residuals that are generated after performing ANOVA and yes I used Levene's test to see if the variances can be assumed equal. They infact are not, but I have found a formula for determining whether the p-value for ANOVA will become larger or smaller as

Re: [R] Linux Editor

2010-08-02 Thread Joseph Magagnoli
In addition, there is SciViews for Komodo edit http://www.sciviews.org/SciViews-K/ Joe On Mon, Aug 2, 2010 at 10:35 AM, alphaace wrote: > > Hi Everyone, > > I recently have started using R again on a Linux box after spending several > years on a Mac. Last I checked, the best way to use R was t

[R] repeated measures with a group factor

2010-08-02 Thread Jerome L. Myers
I have a between-subjects factor, A, with three levels, and a within-subjects factor with 4 levels. There are 6 subjects at each A level. I get the correct F tests using the aov function with the stack form of the data frame but I want the epsilon adjustment (Greenhouse-Geisser, Huynh-Feldt).

Re: [R] Problems with normality req. for ANOVA

2010-08-02 Thread David Winsemius
In a general situation of observational studies, your point is undoubtedly true, and apparently you believe it to be true even in the setting of designed experiments. Perhaps I should have confined myself to my first sentence. -- David. On Aug 2, 2010, at 2:05 PM, Bert Gunter wrote: Dav

[R] read the middle of a file

2010-08-02 Thread R Heberto Ghezzo, Dr
Hello, The other day Justin Peter presented a mini program to plot a topographic map with an overlay of the worldHires. I seemed interesting so I checked the ETOPO5 site and find that there is a new file ETOPO1 with a 1 minute grid. I downloaded it and tried a similar procedure. Now the ETOPO1.g

Re: [R] Linux Editor

2010-08-02 Thread Liviu Andronic
On Mon, 2 Aug 2010 08:48:54 -0700 seeliger.c...@epamail.epa.gov wrote: > > Is there anything comparable to the mac version of R with its built > > in console, editor, etc?? > > Aside from ESS/EMACS, you might try JGR, Tinn-R and Eclipse with > StatET. The later has the most features and is the bes

Re: [R] Including a text file (JAGS model) in an R package

2010-08-02 Thread Ben Bolker
Prof Brian Ripley stats.ox.ac.uk> writes: > > Here is how I do it: > > write(" > model { >for (year in 1:N) { > D[year] ~ dpois(mu[year]) > log(mu[year]) <- b[1] + step(year - changeyear) * b[2] >} >for (j in 1:2) { b[j] ~ dnorm(0.0, 1.0E-6) } >changeyear ~ dunif

Re: [R] Problems with normality req. for ANOVA

2010-08-02 Thread Bert Gunter
David et. al: I take issue with this. It is the lack of independence that is the major issue. In particular, clustering, split-plotting, and so forth due to "convenience order" experimentation, lack of randomization, exogenous effects like the systematic effects due to measurement method/location

Re: [R] Linux Editor

2010-08-02 Thread Bos, Roger
I use RKWard and find it to be pretty good. It show the consol built-in and has good editing features. You can add custom shortcuts so I can make it work just like I make Tinn-R work (i.e. hit F10 to run selected code, etc.). Please note that Tinn-R is not available on Linux (to my knowledge), t

Re: [R] Is there paid support for R?

2010-08-02 Thread Tal Galili
As others have mentioned, A simple place to start looking at would be to go through the list on the wiki page: http://en.wikipedia.org/wiki/R_(programming_language)#Commercialized_versions_of_R And contacting the companies one by one. The other alternative I would check is to contact the statisti

Re: [R] Problems with normality req. for ANOVA

2010-08-02 Thread Frank Harrell
To add to David's note, the Kruskal-Wallis test is the nonparametric counterpart to one-way ANOVA. You can get a series of K-W tests for several grouping or continuous independent variables (but note these are SEPARATE analyses) using the Hmisc package's spearman2 function. The generalization

[R] Import data from dynamically changing spreadsheet

2010-08-02 Thread ShAkEs
Hello R List... I am seeking to continually make a call to an excel sheet and pull data from it. The data on the excel sheet keeps changing real time and I need to pull this data in R. Can someone please suggest me how to do the same. Thank you. -- View this message in context: http://r.789695

Re: [R] Convert an expression to a function

2010-08-02 Thread William Dunlap
I prefer to treat expressions as language objects as much as possible instead of converting them to text strings, using gsub() on the text strings, and then parsing the modified text strings. The following uses text processing to convert variable names like b3 to calls like b[3] but otherwise mani

Re: [R] Including a text file (JAGS model) in an R package

2010-08-02 Thread Prof Brian Ripley
Here is how I do it: write(" model { for (year in 1:N) { D[year] ~ dpois(mu[year]) log(mu[year]) <- b[1] + step(year - changeyear) * b[2] } for (j in 1:2) { b[j] ~ dnorm(0.0, 1.0E-6) } changeyear ~ dunif(1,N) } ", "coalmining.jags") which has the advantage that the model de

Re: [R] Problems with normality req. for ANOVA

2010-08-02 Thread David Winsemius
On Aug 2, 2010, at 9:33 AM, wwreith wrote: I am conducting an experiment with four independent variables each of which has three or more factor levels. The sample size is quite large i.e. several thousand. The dependent variable data does not pass a normality test but "visually" looks cl

[R] (no subject)

2010-08-02 Thread Millo Giovanni
Dear Hao-pang, it is impossible to really tell the problem without a reproducible example. Just guessing: this looks like you have too many regressors. In GMM, lags of variables are used as instruments, so you might have more regressors than observations. Try reducing the 'lag' argument (which, b

Re: [R] Linux Editor

2010-08-02 Thread Michael Lachmann
[shameless plug] I use TeXmacs with R. You can have R in a session. And you can even insert graphs into your session. http://www.texmacs.org/tmweb/plugins/statistics.en.html#r (But then, I wrote the interface between R and TeXmacs) Michael -- View this message in context: http://r.789695.n4.

Re: [R] Can saved R object .RData files be loaded by more than one R sessions for read only purpose?

2010-08-02 Thread Jens Oehlschlägel
Xiaobo.Gu, Shared reading should be fine. Shared writing is also possible, but it is important to understand that .RData files do only contain the meta-data of ff objects, not the ff data itself. This means you cannot have multiple processes updating the same .RData metadata but you can have m

[R] Including a text file (JAGS model) in an R package

2010-08-02 Thread Conor Lawless
Hello, I can`t figure out how to include a text file for use in an example in the .Rd help files of an R package I am writing. I want the examples section of one help file to look like this: \examples{ # Load the JAGS model mod <- jags.model("model.txt") } The function jags.model tries to re

Re: [R] Is there paid support for R?

2010-08-02 Thread raghu
I think Mango-solutions does it as well? On Mon, Aug 2, 2010 at 2:12 PM, Chris Murphy [via R] < ml-node+2310258-1288637364-309...@n4.nabble.com > wrote: > Hi, > > I am trying to get R installed at work and I was asked if there were any > companies that offered support. > > After searching on Goo

[R] Problems with normality req. for ANOVA

2010-08-02 Thread wwreith
I am conducting an experiment with four independent variables each of which has three or more factor levels. The sample size is quite large i.e. several thousand. The dependent variable data does not pass a normality test but "visually" looks close to normal so is there a way to compute the affect

Re: [R] Multibyte characters in (row) names

2010-08-02 Thread David Winsemius
On Aug 2, 2010, at 12:56 PM, Richard R. Liu wrote: I have an array with names which contain multibyte characters. When I try to write the array to a file using write.table and row.names = T I receive an error message when the first such name is encountered, saying that I have not specifie

Re: [R] Linux Editor

2010-08-02 Thread Scionforbai
Hi, > I recently have started using R again on a Linux box after spending several > years on a Mac. Last I checked, the best way to use R was through EMACS > using something like ESS. I remember that being serviceable but not always > the most convenient. > Is there anything comparable to the mac

Re: [R] Apply function to two variables

2010-08-02 Thread Erik Iverson
I would like to apply a function to two vectors For example, A<-c(NA,1,2,3,NA) B<-6:10 I would like C to be equal to A but if any A element is NA that corresponding c element is equal to B, i.e. C = c(6,1,2,3,10) #untested... C <- ifelse(is.na(A), B, A) __

[R] Apply function to two variables

2010-08-02 Thread Suphajak Ngamlak
Dear all, I would like to apply a function to two vectors For example, A<-c(NA,1,2,3,NA) B<-6:10 I would like C to be equal to A but if any A element is NA that corresponding c element is equal to B, i.e. C = c(6,1,2,3,10) Please note that this is a simplified example and the real vectors ar

[R] Multibyte characters in (row) names

2010-08-02 Thread Richard R. Liu
I have an array with names which contain multibyte characters.  When I try to write the array to a file using write.table and row.names = T I receive an error message when the first such name is encountered, saying that I have not specified the option to generate NA instead.  I really would be sati

[R] Error msg in optim : (list) object cannot be coerced to type 'double'

2010-08-02 Thread Shentu, Yue
Hi all, Thanks to the suggestion from Nikhil to use vector parameters, I have made some progress with my MLE code. I have however encountered another problem with the optimization step. The code is as follows: est.x<-as.vector(tapply(Diff_A1c_6_0,factor(Study_Compound_ID),mean)) ll<- f

Re: [R] Why do the results of paste() depend on how the argument

2010-08-02 Thread Michael Lachmann
Erik Iverson-3 wrote: > > > > Michael Lachmann wrote: >>> On 08/01/2010 08:48 PM, thmsfuller...@gmail.com wrote: Hi, The following two 'df's should be the same, although their constructions are different. >>> But they aren't the same. >>> >>> df1 <- data.frame(X=c(1, 2, 3),

Re: [R] Can saved R object .RData files be loaded by more than one R sessions for read only purpose?

2010-08-02 Thread Jens Oehlschlägel
Xiaobo.Gu, Shared reading should be fine. Shared writing is also possible, but it is important to understand that .RData files do only contain the meta-data of ff objects, not the ff data itself. This means you cannot have multiple processes updating the same .RData metadata but you can have m

[R] ff objects and ordinary analytical functions.

2010-08-02 Thread Jens Oehlschlägel
Xiaobo.Gu, > Can the plenty of analytical functions provided by base R and contributed > packages be called with ff objects as parameters directly, or do we have to > write special version of the functions for ff objects? If it is the latter > case, is there a list of functions which support ff

Re: [R] Dealing with a lot of parameters in a function

2010-08-02 Thread Wu Gong
Hi, Putting all parameters into a data frame would help. Code like: parameters <- data.frame(mu=1:24,b=(1:24)*2,tau=(1:24)/2,sigma=(1:24)^2,ro=sqrt(1:24)) ll<- function(parameters){ results <- numeric(24) for (i in 1:24){ mu <- parameters$mu[i] b <- parameters$b

Re: [R] Linux Editor

2010-08-02 Thread Seeliger . Curt
> Is there anything comparable to the mac version of R with its built in > console, editor, etc?? Aside from ESS/EMACS, you might try JGR, Tinn-R and Eclipse with StatET. The later has the most features and is the best IDE, and we're in the process of migrating to it from Tinn-R. cur -- Curt S

Re: [R] Why do the results of paste() depend on how the argument

2010-08-02 Thread Erik Iverson
Michael Lachmann wrote: On 08/01/2010 08:48 PM, thmsfuller...@gmail.com wrote: Hi, The following two 'df's should be the same, although their constructions are different. But they aren't the same. df1 <- data.frame(X=c(1, 2, 3), Y=c(4, 5, 6)) df2 <- data.frame(X=1:3, Y=4:6) identical(df1, d

Re: [R] Why do the results of paste() depend on how the argument

2010-08-02 Thread Michael Lachmann
> On 08/01/2010 08:48 PM, thmsfuller...@gmail.com wrote: >> Hi, >> >> The following two 'df's should be the same, although their >> constructions are different. > > But they aren't the same. > > df1 <- data.frame(X=c(1, 2, 3), Y=c(4, 5, 6)) > df2 <- data.frame(X=1:3, Y=4:6) > identical(df1, df2)

[R] Linux Editor

2010-08-02 Thread alphaace
Hi Everyone, I recently have started using R again on a Linux box after spending several years on a Mac. Last I checked, the best way to use R was through EMACS using something like ESS. I remember that being serviceable but not always the most convenient. Is there anything comparable to the mac

Re: [R] newton.method

2010-08-02 Thread sammyny
Thanks everyone for their help. I am able to see things more clearly now. cheers, Samit -- View this message in context: http://r.789695.n4.nabble.com/newton-method-tp2306111p2310426.html Sent from the R help mailing list archive at Nabble.com. __ R

Re: [R] newton.method

2010-08-02 Thread Berend Hasselman
sammyny wrote: > > I have this function: > function(x) > -0.3*x*exp(-(((log(x)+(0.03+0.3*0.3/2)*0.5)/(0.3*sqrt(0.5)))^2)/2)/(2*sqrt(2*pi*0.5)) > + > 0.03*exp(-0.03*0.5)*pnorm(-(log(x)+(0.03-0.3*0.3/2)*0.5)/(0.3*sqrt(0.5))) > .. > > The newton method is not generating good result. >> for( x

Re: [R] problem with indicators for switch

2010-08-02 Thread Charles C. Berry
On Mon, 2 Aug 2010, Roy Davy wrote: Hi, I am having some problems setting up some indicators and would appreciate any help. I have some data called 'lights' with 3 variables called x, a and b. x - is the date a - equals 1 to indicate an 'on' button is activated b - equals 1 to indicate an 'of

Re: [R] problem with indicators for switch

2010-08-02 Thread jim holtman
try this: > x <- read.table(textConnection("a b c d + 0 0 0 0 + 0 0 0 0 + 1 0 1 1 + 1 0 1 2 + 0 0 1 3 + 0 0 1 4 + 1 0 1 5 + 0 0 1 6 + 0 0 1 7 + 0 1 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 0 0 0 0 + 1 0 1 1 + 0 0 1 2 + 0 0 1 3 + 0 0 1 4 + 0 1 0 0 + 0 0 0 0"), header=TRUE) > closeAllConnections() > # in

Re: [R] Dealing with a lot of parameters in a function

2010-08-02 Thread nikhil kaza
use 24 length vectors as parameters instead of numbers e.g. mu=rep(0.5,24) On Mon, Aug 2, 2010 at 11:00 AM, Shentu, Yue wrote: > Hi all, > I'm trying to define and log-likelihood function to work with MLE. > There will be parameters like mu_i, sigma_i, tau_i, ro_i, for i between > 1 to 24. I

Re: [R] Is there paid support for R?

2010-08-02 Thread David Smith
On Mon, Aug 2, 2010 at 5:17 AM, Chris Murphy  wrote: > I am trying to get R installed at work and I was asked if there were any > companies that offered support. > > After searching on Google (many ways) and not find anything, I turn to you. > > BTW, I did see Revolution R supports their flavor. A

Re: [R] removing spatial auto correlation

2010-08-02 Thread nikhil kaza
Try r-sig-geo Look at spdep, geoR, splancs and sp packages for spatial autocorrelation. Also look at http://cran.r-project.org/web/views/Spatial.html On Mon, Aug 2, 2010 at 3:40 AM, nuncio m wrote: > Hi list, > I am trying to fit arima model for a grid of 360x161x338 points, > where

[R] Dealing with a lot of parameters in a function

2010-08-02 Thread Shentu, Yue
Hi all, I'm trying to define and log-likelihood function to work with MLE. There will be parameters like mu_i, sigma_i, tau_i, ro_i, for i between 1 to 24. Instead of listing all the parameters, one by one in the function definition, is there a neat way to do it in R ? The example is as follo

Re: [R] How to understand whether a class is a S3 class?

2010-08-02 Thread David Winsemius
On Aug 1, 2010, at 2:08 PM, Megh Dal wrote: Hi, is there any way to say: "this class 'x' is a S3 class?" For example what is the type of class "data.frame"? Is it a S3 class or S4? S3 and S4 refer to methods, i.e. functions; "class" is an attribute of objects. And I am not sure that the

Re: [R] Is there paid support for R?

2010-08-02 Thread Allan Engelhardt
On 02/08/10 13:17, Chris Murphy wrote: Hi, I am trying to get R installed at work and I was asked if there were any companies that offered support. There are. What country are you looking to support? What do you mean by "support"? (It can be anything from installation through SLAs for

Re: [R] reading dates in Excel into R

2010-08-02 Thread Erich Neuwirth
RExcel (available as an Excel Addin in Windows only) tries very hard to transfer dates and times faithfully to R. The package RExcelInstaller on CRAN will install it. On Jul 29, 2010, at 7:32 PM, Hongying Li wrote: > > I am reading dates in Excel2007 into R. > > Here are the functions I used:

Re: [R] Specify contrasts in R

2010-08-02 Thread peter dalgaard
On Aug 2, 2010, at 3:53 PM, Rebecca Ross wrote: > Could anyone advise if this is the 'correct' contrast matrix to use to make > contrasts between one treatment and the mean of 2 other treatments (in this > case, mid-parent values to the F1 and F2 from a line cross experiment)? > Desired contras

[R] contours: lines and colors

2010-08-02 Thread Cable, Samuel B Civ USAF AFMC AFRL/RVBXI
Is there a way to get both contour lines and filled colors on the same contour plot? My group here doesn't want me to use the lattice package (long story). I tried over-plotting with contour() on top of filled.contour(). This will work in principle, but the required manipulation of the plotting

  1   2   >