Re: [R] Is there something wrong with R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"?

2013-10-16 Thread tom soyer
Ok. Thanks Peter. It was my bad - typo. You caught it. Sorry everyone. On Wed, Oct 16, 2013 at 10:03 AM, peter dalgaard wrote: > > On Oct 16, 2013, at 16:54 , tom soyer wrote: > > > Hi, > > > > pnorm(-1.53,0,1) under version 3.0.2 gives 0.05155075. I am pretty su

[R] Is there something wrong with R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"?

2013-10-16 Thread tom soyer
Hi, pnorm(-1.53,0,1) under version 3.0.2 gives 0.05155075. I am pretty sure it should be 0.063. Is there something wrong with this version of R? I am using: R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: i686-pc-linux-gnu

[R] help with durbin.watson

2008-07-27 Thread tom soyer
Hi, I have two time series, y and x. Diff(y) and Diff(x) both show no autocorrelation. But durbin.watson(lm(Diff(y)~lag(Diff(x),k=-4)) gives a DW value of zero. How come the residule is autocorrelated while Diff(y) and Diff(x) are not? Does anyone know if in my case a DW of zero indicates serial c

[R] RMSE and lm

2008-05-09 Thread tom soyer
Hi, Does anyone know if the RMSE is one of the values provided by the lm model, or do we have to calculate it by hand from the residuals? Thanks, -- Tom [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.e

[R] Which gls models to use?

2008-05-09 Thread tom soyer
Hi, I need to correct for ar(1) behavior of my residuals of my model. I noticed that there are multiple gls models in R. I am wondering if anyone has experience in choosing between gls models. For example, how should one decide whether to use lm.gls in MASS, or gls in nlme for correcting ar(1)? Do

[R] cross-correlation lag.plot?

2008-05-07 Thread tom soyer
Hi, Does anyone know if R has a function that is similar to lag.plot but instead of auto-correlation, it plots cross-correlation with lags? Thanks, -- Tom [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat

Re: [R] function to generate weights for lm?

2008-04-29 Thread tom soyer
If the > model I described isn't appropriate then you should look at Ch 5 of > P&B to learn about the other varFunc classes. > > good luck, > > Kingsford > > ps - would you mind forwarding to r-help in case this others have the > same question. > > > On T

[R] function to generate weights for lm?

2008-04-29 Thread tom soyer
Hi, I would like to use a weighted lm model to reduce heteroscendasticity. I am wondering if the only way to generate the weights in R is through the laborious process of trial and error by hand. Does anyone know if R has a function that would automatically generate the weights need for lm? Thank

[R] Confidence intervals of log transformed data

2008-04-16 Thread tom soyer
Hi I have a general statistics question on calculating confidence interval of log transformed data. I log transformed both x and y, regressed the transformed y on transformed x: lm(log(y)~log(x)), and I get the following relationship: log(y) = alpha + beta * log(x) with se as the standard error

[R] for loop help

2008-04-10 Thread tom soyer
Hi, I am trying to find a solution in R for the following C++ code that allows one to skip ahead in the loop: for (x = 0; x <= 13; x++){ x=12; cout << "Hello World"; } Note that "Hello World" was printed only twice using this C++ loop. I tried to do the same in R: for(i in 1:13){ i=12 print

[R] function to calculate networkdays?

2008-04-10 Thread tom soyer
Hi, Does anyone know if R has a built-in function that is similar to Excel's NETWORKDAYS function? i.e., Returns the number of whole working days between two dates. Working days exclude weekends. Thanks, -- Tom [[alternative HTML version deleted]] _

[R] diagonally fill a rectangle with color gradient

2008-04-08 Thread tom soyer
Hi, Is it possible to diagonally fill a rectangle with a color gradient? I noticed that the gradient.rect of plotrix could fill a rect either up and down or from side to side. I am looking for something similar but fills diagonally instead, e.g., from the upper left corner to the bottom right. Doe

[R] How to add background color of a 2D chart by quadrant

2008-04-07 Thread tom soyer
Hi, I have a 2D chart that is divided into four quadrants, I, II, III, IV: plot(1:10,ylim=c(0,10),xlim=c(0,10),type="n") abline(v=5,h=5) text(x=c(7.5,7.5,2.5,2.5),y=c(2.5,7.5,7.5,2.5),labels=c("I","II","III","IV")) I would like to fill each quadrant with a background color unique to the quadrant.

[R] format numbers using 1000 separator

2008-04-04 Thread tom soyer
Hi, Does anyone know how one could format numbers using 1000 separator in R? For example, format 1000 as 1,000 and 10 as 100,000, etc. Thanks, -- Tom [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.

[R] format numbers into percentages

2008-03-09 Thread tom soyer
Hi, I am currently using the following to formate numbers into percentages: x=0.00112 paste(round(x*100,2),"%",sep="") I am wondering if there is a built in R function that does the same. Does anyone know? Thanks, -- Tom [[alternative HTML version deleted]] _

Re: [R] help with oop in R - class structure and syntex

2008-02-06 Thread tom soyer
ss affect the global environment please give a > code example. > > On Feb 6, 2008 12:11 PM, tom soyer <[EMAIL PROTECTED]> wrote: > > Thanks Hardley. I see what you mean. You are right, I am not an expert > in > > oop AND I don't really know how R oo works, so certainly I sho

Re: [R] help with oop in R - class structure and syntex

2008-02-06 Thread tom soyer
n't affect the global environment. That was all I meant. On 2/6/08, hadley wickham <[EMAIL PROTECTED]> wrote: > > On Feb 6, 2008 10:13 AM, tom soyer <[EMAIL PROTECTED]> wrote: > > Thanks Gabor. I guess true oo encapsulation is not possible in R. > > Before

Re: [R] help with oop in R - class structure and syntex

2008-02-06 Thread tom soyer
Thanks Gabor. I guess true oo encapsulation is not possible in R. It seems that there is an IDE for S+ in Eclipse... On 2/6/08, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > > On Feb 6, 2008 9:45 AM, tom soyer <[EMAIL PROTECTED]> wrote: > > Thanks Gabor for illustra

Re: [R] help with oop in R - class structure and syntex

2008-02-06 Thread tom soyer
d > # mountainBike will inherit the bicycle method by default > applyBrake <- function(x, decrement) UseMethod("applyBrake") > applyBrake.bicycle <- function(x, decrement) { x$speed <- x$speed - > decrement } > > # list the applyBrake methods available > methods(apply

[R] help with oop in R - class structure and syntex

2008-02-05 Thread tom soyer
Hi, I read section 5, oop, of the R lang doc, and I am still not sure I understand how to build a class in R for oop. I thought that since I understand the oop syntex of Java and VB, I am wondering if the R programmig experts could help me out by comparing and contrasting the oop syntex in R with

Re: [R] ARCH LM test for univariant time series

2008-02-04 Thread tom soyer
7303)), lag=12) > >> > >>ARCH test (univariate) > >> > >> data: Residual of y1 equation > >> Chi-squared = 13.1483, df = 12, p-value = 0.3584 > >> > >> Warning message: > >> In VAR(s, p = 1, type = "const") : > &

Re: [R] ARCH LM test for univariant time series

2008-02-02 Thread tom soyer
mn names supplied in y, using: y1, y2, y3, y4, y5, y6, y7, y8, > y9, y10, y11, y12 , instead. > > > TOM: What can you tell me about the warning message? > > Thanks for your help with this. > Spencer Graves > > tom soyer wrote: > > Spencer, > &g

Re: [R] ARCH LM test for univariant time series

2008-02-02 Thread tom soyer
OK, it's no good. Here is the result: > data(m.intc7303) > archTest(log(1+as.numeric(m.intc7303)), lags=12) ARCH test (univariate) data: Residual of y1 equation Chi-squared = 13.1483, df = 12, p-value = 0.3584 On 2/2/08, tom soyer <[EMAIL PROTECTED]> wrote: >

Re: [R] ARCH LM test for univariant time series

2008-02-02 Thread tom soyer
because the expected value > of the F distribution is close to 1 [d2/(d2-2), where d2 = denominator > degrees of freedom; http://en.wikipedia.org/wiki/F-distribution], while > the expected value for a chi-square is the number of degrees of freedom > > Unfortunately, I don&#x

Re: [R] ARCH LM test for univariant time series

2008-02-01 Thread tom soyer
n > example on p. 103 that could be used for a reference. > > Hope this helps. > Spencer Graves > > tom soyer wrote: > > Hi, > > > > Does anyone know if R has a Lagrange multiplier (LM) test for ARCH > > effects for univariant time series? >

[R] ARCH LM test for univariant time series

2008-02-01 Thread tom soyer
Hi, Does anyone know if R has a Lagrange multiplier (LM) test for ARCH effects for univariant time series? Thanks! -- Tom [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

[R] Is there a formal test for long vs short memory processes?

2008-01-31 Thread tom soyer
Hi, Does anyone know if there are formal tests for long vs short memory processes? i.e., quantitative tests instead of visual examination of corellograms produced by acf. Thanks! -- Tom [[alternative HTML version deleted]] __ R-help@r-project

[R] how to simulate seasonal cointegrated series

2008-01-28 Thread tom soyer
Hi, does anyone know how to simulate two seasonal data series that are cointegrated? Thanks! -- Tom [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the pos

[R] how to choose between adf and pp

2008-01-27 Thread tom soyer
Hi, I was wondering if there is a test that would help one choose whether adf or pp should be used. Would the shapiro.test work for this purpose? Thanks! -- Tom [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https:

Re: [R] Is there a safe mode?

2008-01-26 Thread tom soyer
There is a "vanilla" > options to start R, e.g. > > Rterm --vanilla > > that you might wanna try. > > /Henrik > > > > On Jan 26, 2008 3:54 PM, tom soyer <[EMAIL PROTECTED]> wrote: > > Hi, > > > > My R just froze. I can't get it to do a

[R] Is there a safe mode?

2008-01-26 Thread tom soyer
Hi, My R just froze. I can't get it to do anything. It gives "Error: band value" message to everything I type. Does anyone know if R has a safe mode that I could check for errors and perform diagnostics? I am using R 2.6.1 on Windows XP. > ls() Error: bad value > search() Error: bad value > ?ls Er

Re: [R] plot help

2008-01-24 Thread tom soyer
axt="n",type="n") #1st plot > par(mar=c(0, 5.1, 0, 5.1)) > plot(y2,xaxt="n",type="n") #2nd plot > > #try to draw lines onto each plot on the screen > lines(y2) #draws a line in the 2nd plot > par(mfg=c(1, 1)) > lines(y1,col=2) #also

[R] plot help

2008-01-23 Thread tom soyer
Hi, Suppose I already have two plots on the same screen, and I want to draw lines in each of them. Is that possible in R? It seems that once you have two plots on the screen, you can only draw lines in the the last plot, never the 1st. Here is what I mean: #some data y1=rnorm(1:3) y2=rnorm(1:3)

Re: [R] How to do more advanced cross tabulation in R?

2008-01-22 Thread tom soyer
Thanks Charles and Gabor! Sorry Charles, the numbers were wrong in my example. You had the correct one. On 1/22/08, Charles C. Berry <[EMAIL PROTECTED]> wrote: > > On Tue, 22 Jan 2008, tom soyer wrote: > > > Hi, > > > > I am trying to reproduce some function

[R] How to do more advanced cross tabulation in R?

2008-01-22 Thread tom soyer
Hi, I am trying to reproduce some functionalities of Excel pivot table in R, sadly, I couldn't figure out how to do it. I am wondering if this is even possible in R. Does anyone know? Here is an example: year=rep(2003,16) quarter=rep(1:4,each=4) sales=1:16 company=rep(c("a","b","c","d"),4) df=da

Re: [R] how to extract data by specific months from a monthly ts object

2008-01-20 Thread tom soyer
Thanks Marc and Gabor, I got it! On 1/20/08, Marc Schwartz <[EMAIL PROTECTED]> wrote: > > tom soyer wrote: > > Hi, > > > > I am trying to extract data from a ts object by month, e.g., extract > Jan, > > Feb, and Aug data from a monthly ts object. I tri

[R] how to extract data by specific months from a monthly ts object

2008-01-20 Thread tom soyer
Hi, I am trying to extract data from a ts object by month, e.g., extract Jan, Feb, and Aug data from a monthly ts object. I tried the following but it didn't work: > xa=1:50 > ta=ts(xa,start=c(1990,1),frequency=12) > ta[cycle(ta)==c(1,2)] # this method works but it's not what I want [1] 1 2 13

Re: [R] show overstruck in plot legend

2008-01-19 Thread tom soyer
Thanks Marc! On 1/19/08, Marc Schwartz <[EMAIL PROTECTED]> wrote: > > tom soyer wrote: > > Hi, > > > > I have a plot with type="o", or overstruck. Now I am trying to add the > > legend, but I couldn't figure out how to show the overstruck ty

[R] show overstruck in plot legend

2008-01-19 Thread tom soyer
Hi, I have a plot with type="o", or overstruck. Now I am trying to add the legend, but I couldn't figure out how to show the overstruck type in the legend. It seems that the legend only allows one to set lty. Does anyone know how to show overstruck in the legend? Thanks! -- Tom [[alter

[R] question about order selection of ar

2008-01-14 Thread tom soyer
Hi, I have an AR(1) series, so I thought that the order of the series should be 1. A simple lm fit with one period lag predicts the series pretty well. But when I tried ar, I got different orders: ar.mle selected order 6, ar.burgselected order 14, and ar.yw selected order 6. So I am wondering mayb

Re: [R] question about xreg of arima

2008-01-13 Thread tom soyer
Thanks Richard. I am just trying to understand exactly what is R's arima doing, and I am having a hard time. It seems that xreg is necessary to force arima to include the constant term, but it appears that exactly how this is done is not documented. If a series is not differenced, e.g. AR(1), then

[R] question about xreg of arima

2008-01-11 Thread tom soyer
Hi, I am trying to understand exactly what xreg does in arima. The documentation for xreg says:"xreg Optionally, a vector or matrix of external regressors, which must have the same number of rows as x." What does this mean with regard to the action of xreg in arima? Apparently somehow xreg made t

Re: [R] question about subset and join ts object(s)

2008-01-10 Thread tom soyer
Thanks Achim. Data manipulation in zoo and coerce back to ts. Sounds good! On 1/10/08, Achim Zeileis <[EMAIL PROTECTED]> wrote: > > On Thu, 10 Jan 2008, tom soyer wrote: > > > Hi, > > > > I have two questions about ts. > > > > (1) How do I subset a ts

[R] question about subset and join ts object(s)

2008-01-10 Thread tom soyer
Hi, I have two questions about ts. (1) How do I subset a ts object and still preserve the time index? for example: > x=ts(1:10, frequency = 4, start = c(1959, 2)) # the ts object > x Qtr1 Qtr2 Qtr3 Qtr4 1959 123 19604567 196189 10 I don't want the 1

Re: [R] Constrained minimization solver for nonlinear programming

2008-01-09 Thread tom soyer
Thanks Paul. I will try it. On 1/9/08, Paul Smith <[EMAIL PROTECTED]> wrote: > > On Jan 9, 2008 2:13 PM, tom soyer <[EMAIL PROTECTED]> wrote: > > Thanks Paul. I thought constrOptim does not do equality. I will check > again. > > Indeed, constrOptim does not do

Re: [R] Constrained minimization solver for nonlinear programming

2008-01-09 Thread tom soyer
r the smoothing constant that instead of minimizes the root mean square error (RMSE), it targets a particular value of RMSE. Is this possible in R? On 1/9/08, Paul Smith <[EMAIL PROTECTED]> wrote: > > On Jan 9, 2008 1:14 PM, tom soyer <[EMAIL PROTECTED]> wrote: > > Th

Re: [R] Constrained minimization solver for nonlinear programming

2008-01-09 Thread tom soyer
ead of min and max? Is there a function like that in R? Thanks! On 1/9/08, Paul Smith <[EMAIL PROTECTED]> wrote: > > On Jan 9, 2008 4:01 AM, tom soyer <[EMAIL PROTECTED]> wrote: > > I noticed that R has a few bound-constrained nonlinear min and max > solvers, > > such

[R] Constrained minimization solver for nonlinear programming

2008-01-08 Thread tom soyer
Hi, I noticed that R has a few bound-constrained nonlinear min and max solvers, such as optim, nlm, etc. But I could not find a constrained min and max solver that is not LP. Does this mean R do not have this capability? It is hard to believe that R may not be as advanced as Excel in certain areas

Re: [R] aggregate.ts help

2008-01-06 Thread tom soyer
Thanks Gabor!! On 1/6/08, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > > On Jan 6, 2008 5:17 PM, tom soyer <[EMAIL PROTECTED]> wrote: > > Hi, > > > > I have a ts object with a frequency of 4, i.e., quarterly data, and I > would > > like to calcul

[R] aggregate.ts help

2008-01-06 Thread tom soyer
Hi, I have a ts object with a frequency of 4, i.e., quarterly data, and I would like to calculate the mean for each quarter. So for example: > ts.data=ts(1:20,start=c(1984,2),frequency=4) > ts.data Qtr1 Qtr2 Qtr3 Qtr4 1984 123 19854567 198689 10 11

[R] Is there a R function for seasonal adjustment

2008-01-06 Thread tom soyer
Hi, I just discovered decompose() and stl(), both are very nice! I am wondering if R also has a function that calculates the seasonal index, or make the seasonal adjustment directly using the results generated from either decompose() or stl(). It seems that there should be one, but I couldn't find

Re: [R] question about scale() function

2008-01-03 Thread tom soyer
oops, it should be: rms=(sum((x-mean(x))^2)/(length(x)-1))^(1/2) On 1/3/08, tom soyer <[EMAIL PROTECTED]> wrote: > > Thanks Jim. Yes it does... but I calculated the root mean square (rms), > and couldn't reproduce the result without multiplying the rms by 2. I don't

Re: [R] question about scale() function

2008-01-03 Thread tom soyer
[1,] -1.6 > [2,] 0.4 > [3,] -0.6 > [4,] 0.4 > [5,] 1.4 > attr(,"scaled:center") > [1] 3.6 > > > > Default is to performance scaling: "If scale is TRUE then scaling is > done by dividing the (centered) columns of x by their > root-mean-square, and if sc

Re: [R] question about scale() function

2008-01-03 Thread tom soyer
Never mind. I forgot the scale= parameter. On 1/3/08, tom soyer <[EMAIL PROTECTED]> wrote: > > Hi, > > The documentation for scale() states:"If center is TRUE then centering is > done by subtracting the column means (omitting NAs) of x from their > corresponding col

[R] question about scale() function

2008-01-03 Thread tom soyer
Hi, The documentation for scale() states:"If center is TRUE then centering is done by subtracting the column means (omitting NAs) of x from their corresponding columns". But it seems that R is subtracting something else instead of the column mean: > x=c(2,4,3,4,5) > mean(x) [1] 3.6 > x-mean(x) [1

Re: [R] stack charts right on top of each other

2007-12-31 Thread tom soyer
par(mar=c(4,4,0,2)) > plot(rnorm(1:3)) > > On Dec 31, 2007 1:16 PM, tom soyer <[EMAIL PROTECTED]> wrote: > > Thanks Jim! It seems layout() is necessary in addition to mar=. I have a > > follow up question: is there a way to specify the height of each chart > so &

Re: [R] stack charts right on top of each other

2007-12-31 Thread tom soyer
Sorry Gabor, you are right, using mar= alone is enough to do the stacking. I was wrong. On 12/31/07, tom soyer <[EMAIL PROTECTED]> wrote: > > Thanks Gabor. mar= and oma= by themselves won't be able to do it. layout() > is necessary per Jim's post. But now I am stuck wi

Re: [R] stack charts right on top of each other

2007-12-31 Thread tom soyer
ECTED]> wrote: > > Check out: > > http://research.stowers-institute.org/efg/R/Graphics/Basics/mar-oma/index.htm > > On Dec 31, 2007 11:53 AM, tom soyer <[EMAIL PROTECTED]> wrote: > > Hi, > > > > I tried to stack two charts on top of each other using the following > &

Re: [R] stack charts right on top of each other

2007-12-31 Thread tom soyer
)) > plot(rnorm(1:3)) > > On Dec 31, 2007 11:53 AM, tom soyer <[EMAIL PROTECTED]> wrote: > > Hi, > > > > I tried to stack two charts on top of each other using the following > > R functions: > > > > par(mfrow=c(2,1)) > > plot(rnorm(1:3),xaxt=

[R] stack charts right on top of each other

2007-12-31 Thread tom soyer
Hi, I tried to stack two charts on top of each other using the following R functions: par(mfrow=c(2,1)) plot(rnorm(1:3),xaxt="n",xlab="") plot(rnorm(1:3)) This created two charts, one on top of the other, but there is too much space between them. Does anyone know how to elimiate the space in bet

Re: [R] questions about plot.zoo

2007-12-26 Thread tom soyer
Thanks Gabor! Also, can you give an example of customizing the major tick marks on the x-axis and adding minor tick marks between major tick marks? On 12/26/07, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > > On Dec 26, 2007 10:55 PM, tom soyer <[EMAIL PROTECTED]> wrot

[R] questions about plot.zoo

2007-12-26 Thread tom soyer
Hi, I have been having very good results using plot.zoo to chart time series data. But I have three questions about plot.zoo and I am wondering if anyone knows the answers. (1) when I tried to use semi-log scale, via log="y", R issued a warning, although it looked like plot.zoo plotted in semi-lo

Re: [R] question about the aggregate function with respect to order of levels of grouping elements

2007-12-16 Thread tom soyer
t; > > agg2=aggregate(df[,2],list(year=years(df[,1]),month=fmonth),sum) > > levels(agg2$month) # even if a factor with levels in the correct order > is supplied, aggregate(), sortsthe levels by alphabet regardless. > [1] "Jan" "Feb" "Mar" "Apr&

[R] format numbers in a contingency table

2007-12-16 Thread tom soyer
Hi, I am constructing a contingency table using xtabs. The function works great: mo yr Sep Oct Nov Dec 1950 -7.164486e-02 3.152674e-02 -1.283389e-02 1.570382e-01 1951 3.054293e-02 4.665234e-02 -2.445499e-04 8.720204e-02 1952 3.937034e-0

[R] question about the aggregate function with respect to order of levels of grouping elements

2007-12-16 Thread tom soyer
Hi, I am using aggregate() to add up groups of data according to year and month. It seems that the function aggregate() automatically sorts the levels of factors of the grouping elements, even if the order of the levels of factors is supplied. I am wondering if this is a bug, or if I missed someth

[R] counting weekday in a month in R

2007-12-13 Thread tom soyer
Hi, I am trying to count weekday of the month using R. For example, 1/4/2001 is the 4th weekday of Jan, and 1/5/2001 is the 5th weekday of the month, and 1/8/2001 is the 6th weekday of the month, etc. I get as far as extracting the weekdays from a sequence of dates (see below). But I have not yet

Re: [R] Alternative to For Loop?

2007-12-11 Thread tom soyer
> > -- > Mango Solutions > data analysis that delivers > Tel: +44(0) 1249 467 467 > Mob: +44(0) 1249 467 468 > Fax: +44(0) 7813 526 123 > > > > -Original Message- > From: [EMAIL PROTECTED] on behalf of tom soyer > Sent: Tue 11/12/2007 11:17 > To: r-

[R] Alternative to For Loop?

2007-12-11 Thread tom soyer
Hi, I am doing a calculation on a long series using a For Loop. Here is an example of the calculation: accumulate=function(x){ y=0 z=0 for(i in 1:length(x)){ y=y+x[i] z=c(z,y) } return(z[2:length(z)]) } > x=c(1:10) > x [1] 1 2 3 4 5 6 7 8 9 10 > accumulate(x) [1] 1 3 6 10

Re: [R] R function for percentrank

2007-12-01 Thread tom soyer
m I > missunderstanding what Excel's percentrank does ? > > aa <- rnorm(25); aa # data vector > percentrank <- function(x) { > var <- sort(x) > p.rank <- 1:length(var)/length(var)*100 > dd <- cbind(var,p.rank) > } > pr <- percentrank(aa); pr > &

[R] R function for percentrank

2007-12-01 Thread tom soyer
Hi, Does anyone know if R has a built-in function that is equvalent to Excel's percentrank, i.e., returns the rank of a value in a data set as a percentage of the data set? Thanks, -- Tom [[alternative HTML version deleted]] __ R-help@r-proj

Re: [R] how to find critical values of t in R

2007-11-30 Thread tom soyer
Thanks Peter! On 11/30/07, Peter Dalgaard <[EMAIL PROTECTED]> wrote: > > tom soyer wrote: > > Hi, > > > > I am trying to find a function in R that would calculate the critical > value > > of t for a given probability and df. For example, if p=5% and df=2

[R] how to find critical values of t in R

2007-11-30 Thread tom soyer
Hi, I am trying to find a function in R that would calculate the critical value of t for a given probability and df. For example, if p=5% and df=20, then does R have a function to calculate the t value? I tried: > dt(0.05,df=20) [1] 0.3934718 That doesn't look right to me. Could someone tell me

[R] what to do if residuals produced by lm() have long tails?

2007-11-29 Thread tom soyer
Hi, I am using lm() for regression analysis of my data set. My regression results look pretty good, i.e., the coefficient is significant and the p value is much less than 0.05. But when I checked the residuals, both using qqnorm() and hist(), the distribution does not look normal. It looks like t

Re: [R] How to create data frame from data with unequal length

2007-11-28 Thread tom soyer
Merge worked! Thanks!!! On 11/28/07, Matthew Keller <[EMAIL PROTECTED]> wrote: > > Tom, > > Check out ?merge. Does exactly what you need > > Matt > > On Nov 28, 2007 11:27 AM, tom soyer <[EMAIL PROTECTED]> wrote: > > Hi, > > > > I have two s

[R] How to create data frame from data with unequal length

2007-11-28 Thread tom soyer
Hi, I have two sets of data that I would like to put into a data frame. But since they have different length, I am not sure how to do this. Here is an example of my data: data set one: date growth 1/1/2007 10 1/2/2007 10.2 1/3/2007 10.4 1/4/2007 10.6 data set two: date g