[R] dynlm question: How to predefine formula for call to dynlm(formula) call

2009-04-18 Thread Ron Burns
I want to set up a model with a formula and then run dynlm(formula) because I ultimately want to loop over a set of formulas (see end of post) R> form <- gas~price R> dynlm(form) Time series regression with "ts" data: Start = 1959(1), End = 1990(4) Works OK without a Lag term R> dynlm(gas ~

Re: [R] get() versus getAnywhere()

2009-04-18 Thread David Winsemius
I doubt that it will cure all of the R documentation complaints, but this R-news article by Ligges answered all on my questions on the topic of accessing source (see page 43): www.r-project.org/doc/Rnews/Rnews_2006-4.pdf I learned to use methods() and then to use the full function names to

Re: [R] how to control lattice plot parameters

2009-04-18 Thread Sunil Suchindran
We can see the plotting options using trellis.par.get(). For example, one listed parameter is $superpose.line for which we can set col, lty, and lwd. Load the mlmRev package to obtain the Gcsemv data (used in Lattice book). One way to set the parameters is data(Gcsemv, package = "mlmRev") my.font

Re: [R] get() versus getAnywhere()

2009-04-18 Thread Rolf Turner
On 17/04/2009, at 10:21 PM, Duncan Murdoch wrote: Benjamin Tyner wrote: Many thanks Duncan. Perhaps this merits a more explicit note in the documentation? The quote I gave is from the documentation. How could it be more explicit? This is unfortunately typical of the attitude of R-core

[R] nonparametric regression

2009-04-18 Thread A.B
>i want just make a program to compute the estimator of nonparametric > density with Gaussian kernel! i need to compute the function of regression. >any help for this [[alternative HTML version deleted]] __ R-help@r-project.org mailing

[R] Tow to perform diallel analysis in R?

2009-04-18 Thread Eli Meyer
I want to use a diallel analysis in R, for some of my own data. I've been through the primary literature and textbooks, and remain stumped as to how to implment this in R. I can illustrate the problem using a published example dataset: [Cockerham and Weir (1977) Quadratic Analyses of Reciprocal Cr

Re: [R] Modelling an "incomplete Poisson" distribution ?

2009-04-18 Thread Ben Bolker
Emmanuel Charpentier bacbuc.dyndns.org> writes: > > I forgot to add that yes, I've done my homework, and that it seems to me > that answers pointing to zero-inflated Poisson (and negative binomial) > are irrelevant ; I do not have a mixture of distributions but only part > of one distribution, o

[R] [R-pkgs] igraph 0.5.2

2009-04-18 Thread Gábor Csárdi
igraph is a package for graphs/networks. It has a C core and uses a simple and fast graph representation allowing millions of vertices and edges. LINKS Release notes for the 0.5.2 version: http://igraph.sourceforge.net/relnotes-0.5.2.html Release notes for the 0.5.1 version: http://igraph.source

Re: [R] Dummy (factor) based on a pair of variables

2009-04-18 Thread David Winsemius
> df <- read.table(textConnection("y,i,j + 1,AUT,BEL + 2,AUT,GER + 3,BEL,GER"), header=T,sep=",", as.is=T) > df y i j 1 1 AUT BEL 2 2 AUT GER 3 3 BEL GER > countries <- unique(c(df$i,df$j)) > countries [1] "AUT" "BEL" "GER" > df[countries] <- sapply(countries, function(x) df[x] <<- df$i ==

Re: [R] From daily series to monthly and viceversa

2009-04-18 Thread manta
Thanks so much -- View this message in context: http://www.nabble.com/From-daily-series-to-monthly-and-viceversa-tp23064454p23116875.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.e

Re: [R] Dummy (factor) based on a pair of variables

2009-04-18 Thread Jason Morgan
On 2009.04.18 15:58:30, Jason Morgan wrote: > On 2009.04.18 13:52:35, Serguei Kaniovski wrote: > > I can generate the above dummies but can this design be imputed in a > > reg. model directly? Oops, I apologize for not reading the whole question. Can you do the following: lm(y ~ I(ifelse(df$i=="

Re: [R] Dummy (factor) based on a pair of variables

2009-04-18 Thread Jason Morgan
On 2009.04.18 13:52:35, Serguei Kaniovski wrote: > Bernardo: this is not quite what I am looking for, > > Let the data be: > y,i,j > 1,AUT,BEL > 2,AUT,GER > 3,BEL,GER > > then the dummies sould look like: > > y,i,j,d_AUT,d_BEL,d_GER > 1,AUT,BEL,1,1,0 > 2,AUT,GER,1,0,1 > 3,BEL,GER,0,1,1 > > I ca

Re: [R] Can't read table encoded in Unicode (R-2.8.1)

2009-04-18 Thread Duncan Murdoch
On 18/04/2009 1:18 PM, Hilmar Berger wrote: Hi all, I have problems reading Unicode (UTF-16) coded tables in R 2.8.1 under Windows Vista. Imagine the following table: abcd X1,21,31,4 Y2,22,32,4 Z3,23,33,4 Usually I would use the following code

Re: [R] Loop question

2009-04-18 Thread Stavros Macrakis
On Fri, Apr 17, 2009 at 10:12 PM, Brendan Morse wrote: > ...I would like to automatically generate a series of matrices and > give them successive names. Here is what I thought at first: > > t1<-matrix(0, nrow=250, ncol=1) > > for(i in 1:10){ >        t1[i]<-rnorm(250) > } > > What I intended was

Re: [R] (no subject)

2009-04-18 Thread Stavros Macrakis
> mylist <- c( 2,1,3,5,4 )<<< make a vector of numbers > sort(mylist) [1] 1 2 3 4 5 <<< in sorted order > mylist <- c( "this", "is", "a", "test") > sort(mylist) [1] "a""is" "test" "this" <<< in sorted order > order(mylist) [1] 3 2 4 1

Re: [R] (no subject)

2009-04-18 Thread Ranjan Maitra
Welcome to R! I don't quite know what you mean by size order. But if you have five numbers: a <- c(2, 1, 3, 5, 4) then sort(a) will do what you want? HTH! Ranjan On Sat, 18 Apr 2009 14:46:04 + Dan Cary wrote: > > Hi, as a newcomer to R i have what probably is a very simple issue but i

[R] Can't read table encoded in Unicode (R-2.8.1)

2009-04-18 Thread Hilmar Berger
Hi all, I have problems reading Unicode (UTF-16) coded tables in R 2.8.1 under Windows Vista. Imagine the following table: abcd X1,21,31,4 Y2,22,32,4 Z3,23,33,4 Usually I would use the following code to read the table: t = read.table("test.txt

[R] (no subject)

2009-04-18 Thread Dan Cary
Hi, as a newcomer to R i have what probably is a very simple issue but i have been to solve it for hours: all i want to know is how to arrange a set of numbers in size order without putting them in a table. just arranging them from for e.g. 2,1,3,5,4 into 1,2,3,4,5 - it must be simple but i can

Re: [R] Dummy (factor) based on a pair of variables

2009-04-18 Thread Serguei Kaniovski
Bernardo: this is not quite what I am looking for, Let the data be: y,i,j 1,AUT,BEL 2,AUT,GER 3,BEL,GER then the dummies sould look like: y,i,j,d_AUT,d_BEL,d_GER 1,AUT,BEL,1,1,0 2,AUT,GER,1,0,1 3,BEL,GER,0,1,1 I can generate the above dummies but can this design be imputed in a reg. model dir

Re: [R] From daily series to monthly and viceversa

2009-04-18 Thread Gabor Grothendieck
Try this: library(zoo) # z is CPI. Just use 1, 2, 3, ... for example. z <- zooreg(1:12, as.yearmon("2008-01"), freq = 12) # z2 contains z and lags of z and days.in.month # It has a Date class time index, rather than yearmon. days.in.month <- as.numeric(as.Date(time(z), frac = 1) - as.Date(tim

Re: [R] Modelling an "incomplete Poisson" distribution ?

2009-04-18 Thread Emmanuel Charpentier
I forgot to add that yes, I've done my homework, and that it seems to me that answers pointing to zero-inflated Poisson (and negative binomial) are irrelevant ; I do not have a mixture of distributions but only part of one distribution, or, if you'll have it, a "zero-deflated Poisson". An answer b

Re: [R] From daily series to monthly and viceversa

2009-04-18 Thread manta
Well Gabor, this is actually a really good help, thanks so much. There is only one problem, I'm getting what you say, but in the code there are a couple of errors time(z2) <- as.Date(time(zz)) #probably z2 z3 <- na.locf( cbind(zz, zoo(, dd), #dd object not

Re: [R] Welcome to the "R-help" mailing list

2009-04-18 Thread Uwe Ligges
Qifei Zhu wrote: Hi all, I'm a newbie R developer, am trying to dotplot a few graphs using a for loop. The following code works fine but once I wanna plot inside a loop, nothing happens. for(i in 1:1){dotplot(y~x)} y <- c(1,2,3) x <- c('a','b','c') dotplot(y~x) for (i in 1:3) {dotplot(y~x

Re: [R] Welcome to the "R-help" mailing list

2009-04-18 Thread Qifei Zhu
It works. Thanks! -Original Message- From: mike.lw...@gmail.com [mailto:mike.lw...@gmail.com] On Behalf Of Mike Lawrence Sent: Saturday, April 18, 2009 1:30 PM To: Qifei Zhu Cc: r-help@r-project.org Subject: Re: [R] Welcome to the "R-help" mailing list When plotting in loops, you need to

Re: [R] Welcome to the "R-help" mailing list

2009-04-18 Thread Mike Lawrence
When plotting in loops, you need to wrap your plot call in print(). On Sat, Apr 18, 2009 at 2:14 PM, Qifei Zhu wrote: > Hi all, > > I'm a newbie R developer, am trying to dotplot a few graphs using a for > loop. > > The following code works fine but once I wanna plot inside a loop, nothing > happ

[R] Modelling an "incomplete Poisson" distribution ?

2009-04-18 Thread Emmanuel Charpentier
Dear list, I have the following problem : I want to model a series of observations of a given hospital activity on various days under various conditions. among my "outcomes" (dependent variables) is the number of patients for which a certain procedure is done. The problem is that, when no relevant

Re: [R] Loop question

2009-04-18 Thread Jun Shen
Brendan, Matrix is atomic. Once you define t1 in matrix, t1[1]=0 rather than the whole column. I would just convert t1 to a data frame, which is a special list, by adding t1<- data.frame(t1). Now t1[1] represents the whole column. Then you can use your loop to add more columns. Jun On Fri, Apr

Re: [R] Welcome to the "R-help" mailing list

2009-04-18 Thread Qifei Zhu
Hi all, I'm a newbie R developer, am trying to dotplot a few graphs using a for loop. The following code works fine but once I wanna plot inside a loop, nothing happens. > for(i in 1:1){dotplot(y~x)} > y <- c(1,2,3) > x <- c('a','b','c') > dotplot(y~x) > for (i in 1:3) {dotplot(y~x)} (y and x de

Re: [R] Monotone Transformation

2009-04-18 Thread spencerg
An alternative to "isoreg" is "smooth.monotone" in the "fda" package, though it would doubtless require more work to use "smooth.monotone". Hope this helps. Spencer Martin Maechler wrote: "FJ" == Feng Jingyu on Fri, 17 Apr 2009 11:22:01 -0700 (PDT) writes: FJ> Hi, I a

Re: [R] Monotone Transformation

2009-04-18 Thread Martin Maechler
> "FJ" == Feng Jingyu > on Fri, 17 Apr 2009 11:22:01 -0700 (PDT) writes: FJ> Hi, I am trying to use R to mimic what I did in SAS. FJ> proc transreg data=x ; FJ> model identity(GSI)=monotone(group1); FJ> output out=d2 pprefix=M; FJ> run; FJ> Accroding to

Re: [R] Neural Networks in R - Query

2009-04-18 Thread ronggui
More specifically, it is nnet package. Best 2009/4/18 Tobias Verbeke : > Hi Lars, > >> I'd like to ask your guidance regarding the following two questions: (i) I >> just finished reading Chris Bishop's book "Neural Networks for Pattern >> Recognition". Although the book gave me good theoretical f

Re: [R] matching subvectors in vector sets

2009-04-18 Thread David Winsemius
xlist <-list() for (i in 2:length(x.s)){ x.seq <- embed(length(x.s):1, i) xlist[[i]] <- table(apply(x.seq, 1, function(z){ paste(x.s[z], collapse=":") })) } xlist -- David Winsemius On Apr 18, 2009, at 11:46 AM, Albert Vilella wrote: that works very well. how d

Re: [R] Binomial simulation

2009-04-18 Thread Ranjan Maitra
This sounds like a potential homework problem. You don't quite need to simulate anything if your question is all you have been asked to do. dbinom(x = 1:10, size = 10, prob = 0.25) Perhaps you have been asked to simulate 1000 realizations and compare the relative frequencies with these probabilit

Re: [R] Create histogram from data matrix

2009-04-18 Thread hadley wickham
On Fri, Apr 17, 2009 at 2:07 PM, Paul Warren Simonin wrote: > Thank you all for your advice. >  I have received some good tips, but it was suggested I write back with a > small simulated data set to better illustrate my needs. So, currently my > data frame looks something like: > > ID (date)  Temp

Re: [R] matching subvectors in vector sets

2009-04-18 Thread Albert Vilella
that works very well. how do I store the results into a variable instead of doing a print? On Fri, Apr 17, 2009 at 5:51 PM, jim holtman wrote: > How about this: > > > x <- "A00096:A00096:A00096:A00096:A02178:A02178:A07776" > > x.s <- unlist(strsplit(x, ":")) > > for (i in 2:length(x.s)){ > +

Re: [R] Neural Networks in R - Query

2009-04-18 Thread Tobias Verbeke
Hi Lars, I'd like to ask your guidance regarding the following two questions: (i) I just finished reading Chris Bishop's book "Neural Networks for Pattern Recognition". Although the book gave me good theoretical foundation about NN, I'm now looking for something more practical regarding architec

[R] Neural Networks in R - Query

2009-04-18 Thread Lars Bishop
Dear R users, I'd like to ask your guidance regarding the following two questions: (i) I just finished reading Chris Bishop's book "Neural Networks for Pattern Recognition". Although the book gave me good theoretical foundation about NN, I'm now looking for something more practical regarding archi

Re: [R] how can i program this???

2009-04-18 Thread Sarah Goslee
This list is very good with _specific_ questions, but yours is rather vague. Perhaps you should read the posting guide, then ask us about what you are specifically having a problem with. Sarah On Sat, Apr 18, 2009 at 8:41 AM, A.B wrote: > Hi all; > i want to programm the no-parametric regression

Re: [R] Rd: how to put a prime in a code fragment?

2009-04-18 Thread Duncan Murdoch
On 18/04/2009 8:49 AM, Dan Kelley wrote: I have written a function for my 'oce' package that creates a data.frame containing a variable name with a prime in it. (I use prime to indicate coordinate rotation, a reasonably standard convention that motivates the odd variable name.) How can I name t

[R] Rd: how to put a prime in a code fragment?

2009-04-18 Thread Dan Kelley
I have written a function for my 'oce' package that creates a data.frame containing a variable name with a prime in it. (I use prime to indicate coordinate rotation, a reasonably standard convention that motivates the odd variable name.) How can I name that in an Rd file? I tried \code{u'} but

[R] how can i program this???

2009-04-18 Thread A.B
Hi all; i want to programm the no-parametric regression estimator with R, any help for this ??? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

Re: [R] Dummies: Call function or script

2009-04-18 Thread David Winsemius
"xyz" does not look to me like a valid directory for Windows. Try a complete directory string: setwd("C://username/My Documents/r-work/") # might be something more likely Note the forward slashes. Backslashes are special characters in R. The interpreter would need to see each backslash do

Re: [R] Tinn-R (Version 2.2.0.2) dose not support R 2.9.0 very well

2009-04-18 Thread Stefan Grosse
LI Qi schrieb: > I found that Tinn-R (Version 2.2.0.2) dose not support R 2.9.0 very well. > Maybe, somebody who have solved this problem can help me. > > What do you mean with doeas not support very well. I have no problems with Vista + R 2.9.0 + Tinn-R 2.2.0.2 Try to start Rterm instead of

[R] Dummies: Call function or script

2009-04-18 Thread Ali Faisal
Hello all, I am new to R and therefore this question is sort of very basic. Could you kindly let me know how can I call a function or script from R GUI(Windows), my directory where these functions/scripts are located is suppose xyz and I have tried setwd("xyz") but still it gives me the "Error: ob

Re: [R] Dummy (factor) based on a pair of variables

2009-04-18 Thread Bernardo Rangel Tura
On Sat, 2009-04-18 at 08:55 +0200, Serguei Kaniovski wrote: > > Dear All! > > my data is on pairs of countries, i and j, e.g.: > > y,i,j > 1,AUT,BEL > 2,AUT,GER > 3,BEL,GER > > I would like to create a dummy (indicator) variable for use in regression > (using factor?), such that it takes the va

Re: [R] Tinn-R (Version 2.2.0.2) dose not support R 2.9.0 very well

2009-04-18 Thread Erich Neuwirth
I also had some problems with tinn-R and switched to Notepad++ with NppToR. It works with R 2.9.0, though I have to admit that I have not extensively tested yet. Since I am not using Vista, I cannot tell anything about its Vista performance. The relevant links are http://www.stat.tamu.edu/~aredd/s

[R] Dummy (factor) based on a pair of variables

2009-04-18 Thread Serguei Kaniovski
Dear All! my data is on pairs of countries, i and j, e.g.: y,i,j 1,AUT,BEL 2,AUT,GER 3,BEL,GER I would like to create a dummy (indicator) variable for use in regression (using factor?), such that it takes the value of 1 if the country is in the pair (i.e. EITHER an i-country OR an j-country).

Re: [R] Binomial simulation

2009-04-18 Thread beetle2
Not being entirely sure what you mean, I think rbinom(1000, 10, .25) may be what you want. Hi, Thanks for your reply. It is close to that but I need to know the probabilty of how many judges pick a certain brand. Just say x= 6 judges pick brand A which has P=0.25. Using R it would be: > db