Re: [R] applying data generating function

2004-03-07 Thread Prof Brian Ripley
You need to run gc() before running such timings in R, as the first run often has to pay for a level-0 garbage collection. That is normally the cause of (1), although I haven't seen differences as large as 10 secs (but have no idea of the speed of your machine, and have seen 3 secs). On Sun, 7

Re: [R] applying data generating function

2004-03-07 Thread Gabor Grothendieck
Its possible that there was a garbage collection at the beginning or maybe this suggestion does not apply, given the precautions you took. As far as I know, all you can do is try it and see if it gives more consistent results. --- Date: Sun, 07 Mar 2004 20:15:41 -0800 From: Spencer Graves

Re: [R] applying data generating function

2004-03-07 Thread Spencer Graves
Hi, Gabor: Thanks for the "garbage collection" suggestion. In this case, I can't imagine how it would change the results: I developed the script in an S-Plus script window, then copied it into an R session that had recently just been started. Moreover, the times generally declined upon

Re: [R] drawing filled countries according to data using map('world')? - follow up

2004-03-07 Thread Spencer Graves
I have no experience with maps, but I can see a problem with "dv[state.to.map, year == 1980]" that would generate the error you got, "incorrect number of dimensions": This expression assumes "dv" is a 2-dimensional array, and R thinks you want the rows specified by "state.to.map" and the

Re: [R] applying data generating function

2004-03-07 Thread Gabor Grothendieck
Regarding your comment on speed varying when replicating the runs, try running gc() first. --- Date: Sun, 07 Mar 2004 17:56:46 -0800 From: Spencer Graves <[EMAIL PROTECTED]> To: Peter Dalgaard <[EMAIL PROTECTED]> Cc: Fred J. <[EMAIL PROTECTED]>,r-help <[EMAIL PROTECTED]> Subject: Re

Re: [R] Excel files

2004-03-07 Thread Gabor Grothendieck
Just a minor correction and a simplification. The header=T is missing from read.table and as.is=1:2 could be added to avoid having to use as.character in chron. Also in your data (but not in Grace's) the default chron format is used so the format specifier can be omitted: require(chron) x <- r

Re: [R] applying data generating function

2004-03-07 Thread Spencer Graves
Peter's enumeration of alternatives inspired me to compare compute times for N = 10^(2:5), with the following results: *** R 1.8.1 under Windows 2000, IBM Thinkpad T30: 10 100 1000 1 1e+05 for loop 0 0.01 0.09 1.27 192.05 gen e + for l

Re: [R] Excel files

2004-03-07 Thread Robert W. Baer, Ph.D.
This might get you started on reading and plotting the dates and times for levels of a gender factor: # I assume the following Excel data date time Sex Value 1 5/5/1999 10:00:00 male 14.987685 2 7/3/1998 20:00:00 female 17.667527 3 8/6/1999 3:23:00 male 3.428401 4 12/7/1997 6:36:00 male 14.977503 5

[R] drawing filled countries according to data using map('world')? - follow up

2004-03-07 Thread Jens Hainmueller
Hello, this is a follow up on my previous inquiry regarding the use of the map library (Becker and Wilks 1993). Using the 'world' database I would like to draw filled countries in a world map so that the filling colors of each country corresponds to the value of a policy variable "fix.float" at a

[R] Excel files

2004-03-07 Thread Grace Conlon
Hello, I was trying to import data from an Excel file. After I imported the data, I was trying to make a scatter plot. The X axes variable is a time variable, which occupies two columns, one is date, another one is time. Example 21-Apr-03, 4:10 PM. My qestion is: 1. How can I access the

Re: [R] drawing filled countries according to data using map('world')?

2004-03-07 Thread Ray Brownrigg
> My question then is, how to compute a similar procedure using the 'world' > database. Specifically, how can I access the country names in the 'world' > database to accomplish the translation to the country names in my dataset? > Is there any way to unpack the 'world' database to do the matching i

Re: [R] applying data generating function

2004-03-07 Thread Peter Dalgaard
Christophe Pallier <[EMAIL PROTECTED]> writes: > Fred J. wrote: > > >I need to generate a data set based on this equation > >X(t) = 3.8x(t-1) (1-x(t-1)) + e(t), where e(t) is a > >N(0,0,001) random variable > >I need say 100 values. > > > > How do I do this? > > I assume X(t) and x(t) are the sa

[R] Frequency ploygon help

2004-03-07 Thread Robert W. Baer, Ph.D.
I can't figure out how to get the x-axis to contain the category lables for my frequency polygon. I'm also not sure if there is a more elegant approach. Any insights on the labels? I tried this: #generate some pseudo data x=c(sort(sample(1:1500,5)),sort(sample(1:1500,3),dec=T)) # assign names

Re: [R] applying data generating function

2004-03-07 Thread Spencer Graves
I'd use a for loop: set.seed(123) e <- 0.001*rnorm(100) x <- rep(0, 100) for(i in 2:100) x[i] <- (3.8*x[i-1]*(1-x[i-1])+e[i]) plot(x, type="l") plot(x[-100], x[-1]) "R" is great for standard vector and matrix operations, but recursions are not so easy. hope this helps. spen

Re: [R] applying data generating function

2004-03-07 Thread Christophe Pallier
Fred J. wrote: I need to generate a data set based on this equation X(t) = 3.8x(t-1) (1-x(t-1)) + e(t), where e(t) is a N(0,0,001) random variable I need say 100 values. How do I do this? I assume X(t) and x(t) are the same (?). f<-function (x) { 3.8*x*(1-x) + rnorm(1,0,.001) } v=c() x=.1

RE: [R] applying data generating function

2004-03-07 Thread Phineas Campbell
It may be possible to do this without a loop but I haven't found a way ###Generate an array of 100 N(0,1) RVs z<-rnorm(100) ###Build the array to store output x<-vector(length=100) ###Create initial value x[1]<-z[1] ###Loop though building series for(i in 2:100){ x[i]<-3.8*x[i-1]*(1-x[i-1

Re: [R] missing values

2004-03-07 Thread Peter Dalgaard
Grace Conlon <[EMAIL PROTECTED]> writes: > How can I deal with missing values in the excel file? > I used read.csv to imports data, how ever there are missing values in the csv file. > When I use names(), it turns out a error message: " names attribute must be the same > length as the vector"

[R] drawing filled countries according to data using map('world')?

2004-03-07 Thread Jens Hainmueller
Hello, I am looking for somebody who has experience with the map library (Becker and Wilks 1993) and might be able to help me with the following problem: Using the 'world' database I would like to draw filled countries in a world map so that the filling colors of each country corresponds to the v

[R] missing values

2004-03-07 Thread Grace Conlon
How can I deal with missing values in the excel file? I used read.csv to imports data, how ever there are missing values in the csv file. When I use names(), it turns out a error message: " names attribute must be the same length as the vector" What can i do with the missing values? Thanks --

[R] applying data generating function

2004-03-07 Thread Fred J.
Hello Coming from matlab background, I could use some help on this one. I need to generate a data set based on this equation X(t) = 3.8x(t-1) (1-x(t-1)) + e(t), where e(t) is a N(0,0,001) random variable I need say 100 values. How do I do this? Thanks _

Re: [R] graphic device MetaPost

2004-03-07 Thread Itay Furman
The TeX world offers several comapnion systems to typeset graphics; metapost, xy-pic, and PSTricks are the most powerful, and have facilities for typesetting data plots. Recently, the pgf LaTeX package, that can coop with PDF and PS from the same source, was submitted to CTAN; but it is more r

Re: [R] graphic device MetaPost

2004-03-07 Thread Gabor Grothendieck
Users may have insights that the developers may not have and those ideas may usefully find their way into R, even if the promoter of the idea does not have the capabilities or resources to implement it. Surely, good ideas such as this one should be mentioned. Maybe that user will implement

Re: [R] graphic device MetaPost

2004-03-07 Thread Prof Brian Ripley
On Sun, 7 Mar 2004, [gb2312] Jinsong Zhao wrote: > By default, MetaPost passes all text through TeX. This has the > advantage of allowing essentially any TeX symbols in titles and labels. > It give us, who use the multibyte character in ordinary communication, > much convenience. Gnuplot has fulfi

Re: [R] "Statistiques avec R"

2004-03-07 Thread pallier
Shigeru Mase wrote: Probably you may be curious about the mysterious author of "Statistiques avec R" as well as me. He seems a mathematician. I found one more extraordinary work of him. http://tex.loria.fr/prod-graph/zoonekynd/metapost/metapost.html He made Metapost (a kind of Metafont software

Re: [R] Installing packages

2004-03-07 Thread Uwe Ligges
"Fred J." wrote: > > yes, I loged in as admin. and that fixed the problem, > but when I type ?fdim I don't get the help docs, why? > even though I have all the htmls under > C:\Program Files\R\rw1081\library\fdim\html > > thanks Either you forgot to load the package library(fdim) or your insta

[R] graphic device MetaPost

2004-03-07 Thread Jinsong Zhao
Hi all, By default, MetaPost passes all text through TeX. This has the advantage of allowing essentially any TeX symbols in titles and labels. It give us, who use the multibyte character in ordinary communication, much convenience. Gnuplot has fulfilled this function, and it give me a deep impress

Re: [R] Plot is lost when fitting block as error

2004-03-07 Thread Prof Brian Ripley
You second fit is of class c("aov", "lm"), the first of class "aovlist". There is no way to plot a series of aov fits in different strata, but you can plot aspects of the individual fits: there is an example in (MASS4, p.284). In your case there is only one stratum of interest and plot(model[["Wit

Re: [R] Using character vectors to call data in the "cbind" command

2004-03-07 Thread Prof Brian Ripley
On Sat, 6 Mar 2004, alex pegucci wrote: > I have searched the forum but could not find a thread about the way to > solve my problem. I am trying to find a way to use a subset of a list of > variable names I have when I call the "cbind" command to create a data > matrix, after I have attached a da