[R] pacf

2007-04-28 Thread tom soyer
Hi, I wanted to understand exactly how acf and pacf works, so I tried to calculate ac and pac manually. For ac, I used the standard acf formula: acf(k) = sum(X(t)-Xbar)(X(t-k)-Xbar))/sum(X(t)-Xbar)^2. But for pac, I could not figure out how to calculate it by hand. I understand that in both R and

[R] acf and pacf plot

2007-04-27 Thread tom soyer
Hi, I noticed that whenever I ran acf or pacf, the plot generated by R always includes two horizontal blue doted lines. Furthermore, these two lines are not documented in the acf documentation. I don't know what they are for, but it seems that they are important. Could someone tell me what they

Re: [R] acf and pacf plot

2007-04-27 Thread tom soyer
. Eric On 4/27/07, tom soyer [EMAIL PROTECTED] wrote: Hi, I noticed that whenever I ran acf or pacf, the plot generated by R always includes two horizontal blue doted lines. Furthermore, these two lines are not documented in the acf documentation. I don't know what

Re: [R] Construct time series objects from raw data stored in csv files

2007-04-13 Thread tom soyer
Thanks Gabor!! On 4/12/07, Gabor Grothendieck [EMAIL PROTECTED] wrote: On 4/12/07, tom soyer [EMAIL PROTECTED] wrote: What should I do for weekly and daily data series? Are there functions similar to yearmon() for other time intervals? I see that there is a built-in yearqtr() function

[R] Construct time series objects from raw data stored in csv files

2007-04-12 Thread tom soyer
Hi, I have time series data stored in csv files (see below for an example of the data). I understand that in order to analyze my data in R, I need to first transform it into a ts object. Howeve, I could not find an example on how exactly to do that. Is ts the only function I need? What are the

Re: [R] Construct time series objects from raw data stored in csv files

2007-04-12 Thread tom soyer
come R does not recognize z as a ts object? It is a ts object, isn't it? On 4/12/07, Gabor Grothendieck [EMAIL PROTECTED] wrote: On 4/12/07, tom soyer [EMAIL PROTECTED] wrote: Hi, I have time series data stored in csv files (see below for an example of the data). I understand that in order

Re: [R] Construct time series objects from raw data stored in csv files

2007-04-12 Thread tom soyer
Oh yes, I forgot. Thanks!! On 4/12/07, Gabor Grothendieck [EMAIL PROTECTED] wrote: On 4/12/07, tom soyer [EMAIL PROTECTED] wrote: Thanks Gabor! I think your example works, but check this out: as.ts(z) Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec 1921 19.0 18.4

Re: [R] Construct time series objects from raw data stored in csv files

2007-04-12 Thread tom soyer
Gabor, What should I do for weekly and daily data series? Are there functions similar to yearmon() for other time intervals? I see that there is a built-in yearqtr() function for quarterly data, but that's it. Thanks! On 4/12/07, Gabor Grothendieck [EMAIL PROTECTED] wrote: On 4/12/07, tom

[R] two questions about ccf

2007-03-29 Thread tom soyer
Hi, I have two questions about ccf. 1) does it return correlation value for each lag? The documentation states the following: The lag is returned and plotted in units of time, and not numbers of observations. There are printand subsetting methods for objects of class acf . Does this mean only lag

[R] ccf time units

2007-03-29 Thread tom soyer
Hi, I am using ccf but I could not figure out how to calculate the actual lag in number of periods from the returned results. The documentation for ccf says:The lag is returned and plotted in units of time. What does units of time mean? For example: x=ldeaths x1=lag(ldeaths,1)

Re: [R] Problem with data type recognition and conversion

2006-11-01 Thread tom soyer
Thanks Jim, Brian, and Petr. I found a non-number, ., in my CSV file that prevented R from reading the data correctly. Once I got rid of it, R works fine. Thanks! On 11/1/06, Jim Lemon [EMAIL PROTECTED] wrote: tom soyer wrote: Hi, I have a CSV file with two columns; the first column

[R] Problem with data type recognition and conversion

2006-10-31 Thread tom soyer
Hi, I have a CSV file with two columns; the first column is date, second column is numbers. I used read.csv() to load the file into the variable temp. Somehow, R could not recognize my numbers as double. Instead, it thinks these numbers are integer even though they all have decimal points (isn't

[R] Problem with very old dates

2006-10-29 Thread tom soyer
Hi, I noticed that as.Date() could not convert date string to date type if the dates are very old. For example, if the date string is 1-Mar-50, then as.Date() would convert this to 2050-03-01, NOT 1950-03-01. This seems to be the behavior of as.Date() for dates older than 1969-1-1, and it is not

Re: [R] Problem with very old dates

2006-10-29 Thread tom soyer
Thanks Marc and Gabor for the clarification. On 10/29/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: On 10/29/06, Marc Schwartz [EMAIL PROTECTED] wrote: On Sun, 2006-10-29 at 10:31 -0600, tom soyer wrote: Hi, I noticed that as.Date() could not convert date string to date type

Re: [R] object(s) are masked from package - what does it mean?

2006-10-22 Thread tom soyer
Thanks Peter. That make sense. On 22 Oct 2006 09:26:27 +0200, Peter Dalgaard [EMAIL PROTECTED] wrote: tom soyer [EMAIL PROTECTED] writes: Thanks Marc and Gregor for the detailed explanation. You are right, the masking is potentially dangerous. Since R is object oriented, I am surprised

[R] how do I find the row index number, or row name, of a given value in a vector?

2006-10-21 Thread tom soyer
Hi, I noticed that max(x) returns the maximum value of a vector, but the function doesn't give the user the option of retrieving the row index number instead. If I used max(x) to find the maximum value of vector x, then is there a function I can use to find the index number, or row name, of the

Re: [R] how do I find the row index number, or row name, of a given value in a vector?

2006-10-21 Thread tom soyer
Thanks John! I got it. On 10/21/06, John Kane [EMAIL PROTECTED] wrote: --- tom soyer [EMAIL PROTECTED] wrote: Hi, I noticed that max(x) returns the maximum value of a vector, but the function doesn't give the user the option of retrieving the row index number instead. If I used

[R] object(s) are masked from package - what does it mean?

2006-10-21 Thread tom soyer
Hi, Sometime when I attach a dataset, R gives me the following message/warning:The following object(s) are masked from package:datasets: column_name. Does anyone know what it means? Since it seems that the dataset was attached and I could manipulate the data from the dataset without problems, I

Re: [R] object(s) are masked from package - what does it mean?

2006-10-21 Thread tom soyer
-21 at 18:43 -0500, tom soyer wrote: Hi, Sometime when I attach a dataset, R gives me the following message/warning:The following object(s) are masked from package:datasets: column_name. Does anyone know what it means? Since it seems that the dataset was attached and I could manipulate

Re: [R] cross tabs with percents?

2006-10-21 Thread tom soyer
try prop.table() On 10/21/06, ronggui [EMAIL PROTECTED] wrote: Maybe _CrossTable_ in gmodels package is what you want. 2006/10/22, Larry White [EMAIL PROTECTED]: -- apologies if this is a dup - i got a bounce saying the message was unprocessed. Is there a straightforward way to get

Re: [R] Question about random sampling in R

2006-10-20 Thread tom soyer
Harding [EMAIL PROTECTED] wrote: On 19-Oct-06 tom soyer wrote: Hi, I looked up the help file on sample(), but didn't find the info I was looking for. When sample() is used to resample from a distribution, e.g., bootstrap, how does it do it? Does it use an uniform distribution, e.g

[R] help with coef

2006-10-20 Thread tom soyer
Hi, I am trying to get R to return just the slope of a linear regression line, but it seems that R has to return both the slope and the name of the slope. For example, a=coef(lm(y~miles)) a (Intercept) miles 360.3778 -7.2875 names(a) [1] (Intercept) miles a[1] (Intercept)

Re: [R] help with coef

2006-10-20 Thread tom soyer
Grothendieck [EMAIL PROTECTED] wrote: Using the builtin BOD data frame: as.vector(coef(lm(demand ~ Time, BOD)))[2] On 10/21/06, tom soyer [EMAIL PROTECTED] wrote: Hi, I am trying to get R to return just the slope of a linear regression line, but it seems that R has to return both

Re: [R] help with coef

2006-10-20 Thread tom soyer
PROTECTED] On Behalf Of tom soyer Sent: Saturday, October 21, 2006 1:00 AM To: Gabor Grothendieck Cc: r-help Subject: Re: [R] help with coef Gabor, Thanks for the code example, but it seems that BOD is not needed. I still don't understand what is going on with the data structure returned

[R] Question about random sampling in R

2006-10-19 Thread tom soyer
Hi, I looked up the help file on sample(), but didn't find the info I was looking for. When sample() is used to resample from a distribution, e.g., bootstrap, how does it do it? Does it use an uniform distribution, e.g., runif(), or something else? And, when the help file says:sample(x)

[R] use date as x-axis

2006-10-18 Thread tom soyer
Hi, I have the following data in two columns. The first column is the date, the second is data. Date Data 3-Jan-95 459.21 4-Jan-95 459.13 5-Jan-95 460.73 6-Jan-95 460.38 9-Jan-95 460.67 10-Jan-95 460.9 11-Jan-95 461.68 12-Jan-95 461.64 13-Jan-95 461.64 16-Jan-95 465.97 17-Jan-95 469.38 18-Jan-95

Re: [R] use date as x-axis

2006-10-18 Thread tom soyer
to learn more about dates. On 10/18/06, tom soyer [EMAIL PROTECTED] wrote: Hi, I have the following data in two columns. The first column is the date, the second is data. Date Data 3-Jan-95 459.21 4-Jan-95 459.13 5-Jan-95 460.73 6-Jan-95 460.38 9-Jan-95 460.67 10-Jan-95

[R] help with plot()

2006-10-16 Thread tom soyer
Hi, I am new to R and I have been trying it out. I ran into a problem with the plot() function. Below is my code: d - read.table(c:/test/sp.txt,header=0) spval - d[,2] plot(spval,type=l) Warning messages: 1: graphical parameter type is obsolete in: plot.window(xlim, ylim, log, asp, ...) 2:

Re: [R] help with plot()

2006-10-16 Thread tom soyer
some sample data with which we can reproduce the error? On 16/10/06, tom soyer [EMAIL PROTECTED] wrote: Hi, I am new to R and I have been trying it out. I ran into a problem with the plot() function. Below is my code: d - read.table(c:/test/sp.txt,header=0) spval - d[,2] plot

Re: [R] help with plot()

2006-10-16 Thread tom soyer
at 10:54 -0500, tom soyer wrote: Hi David and Duncan, Thanks for the reply. I am using R-2.4.0 for windows. All I am trying to do is follow an online tutorial ( http://www.onlamp.com/pub/a/onlamp/2005/11/17/r_for_statistics.html) step by step. spval is just an array of numbers. I also