[R] Incompleteness (or bug ?) in mAr.est for VAR estimation

2008-03-24 Thread Megh Dal
Hi all, I feel there is a incompleteness in mAr.est function in mAr package for VAR estimation. I does not cheak whether there is multicolinearity in data set. Here I used mAr.est function for following dataset : head(log(data1) + ) V1 V2 V3 V4 V5

Re: [R] Inverse t-distribution(TINV function in Excel)

2008-03-24 Thread Berend Hasselman
Felipe Carrillo wrote: I can't actually tell which function in R is the equivalent to TINV function in Excel. Anyone familiar with that function? Thanks help.search(t distribution) I think the quantile function is what you are looking for: qt Try qt(pt(5,10),10) Berend -- View

[R] What is the correct model formula for the results of piecewise linear function?

2008-03-24 Thread zhijie zhang
Dear friends, I used the B-spline (degree=1) method to fit the piecewise linear function and the results are listed below. m.glm-glm(mark~x+poly(elevation,2)+bs(distance,degree=1,knots=c(16.13,24)) +bs(y,degree=1,knots=c(-0.4357,-0.3202 )),family=binomial(logit),data=point)

Re: [R] Question about as.numeric with tclvalue

2008-03-24 Thread Prof Brian Ripley
It's not clear what is going on here, but one possibility is as.numeric(pi) [1] NA Warning message: NAs introduced by coercion OTOH, Inf works for me. The difference is that 'Inf' is a standard C99 value (like 1.23), whereas 'pi' is a variable in R. So if you want to allow expressions you

[R] update win FAQ q1?

2008-03-24 Thread Thomas Steiner
Hi, on http://cran.at.r-project.org/bin/windows/base/rw-FAQ.html#Where-can-I-find-the-latest-version_003f it says: ... The current release is distributed as an installer `R-2.6.1-win32.exe' of about 30Mb. ... however I find this file as well:

Re: [R] intraday OHLC plot

2008-03-24 Thread Thomas Steiner
Dear all, thank you very much for continuing to look into this issue! I checked the versions and in Gabor's code the spaces and tabs, but still the problem remains (see code and error below). To install quantmod, I used this time Rforge and it did not work. I had to install the Defaults package

[R] How to assign multiple return values

2008-03-24 Thread Tribo Laboy
Hi, I am moving from MATLAB, where one can easily assign a number of output values from a function like this: [x,y] = myfun(a,b) Then variables x and y can be directly used in the caller workspace. I understand that R functions return a single argument, which could be a list. This in a way

Re: [R] inheritence in S4

2008-03-24 Thread cgenolin
Hi Martin I am re reading all the mail we exchange with new eyes because of all the thing I learn in the past few weeks. That very interesting and some new question occurs... *** Once, you speak about callGeneric : setClass(A, representation(x=numeric))

Re: [R] update win FAQ q1?

2008-03-24 Thread Prof Brian Ripley
On Mon, 24 Mar 2008, Thomas Steiner wrote: Hi, on http://cran.at.r-project.org/bin/windows/base/rw-FAQ.html#Where-can-I-find-the-latest-version_003f it says: ... The current release is distributed as an installer `R-2.6.1-win32.exe' of about 30Mb. ... however I find this file as well:

Re: [R] Great difference for piecewise linear function between R and SAS

2008-03-24 Thread Duncan Murdoch
On 24/03/2008 5:23 AM, zhijie zhang wrote: Dear Rusers, I am now using R and SAS to fit the piecewise linear functions, and what surprised me is that they have a great differrent result. See below. You're using different bases. Compare the predictions, not the coefficients. To see the

Re: [R] How to assign multiple return values

2008-03-24 Thread Duncan Murdoch
On 24/03/2008 5:09 AM, Tribo Laboy wrote: Hi, I am moving from MATLAB, where one can easily assign a number of output values from a function like this: [x,y] = myfun(a,b) Then variables x and y can be directly used in the caller workspace. I understand that R functions return a

Re: [R] (no subject)

2008-03-24 Thread Jim Lemon
Donna Tucker wrote: Is there any way to use more than one color or shape in the same plot. I would like to make the points different colors for various levels of a variable. I have tried a simple 'if' statement in the plot command, but I get an error message. Here is what I have tried

Re: [R] little subplot in corner

2008-03-24 Thread Thomas Steiner
Henrique, Although your solution is perfect, I had later a problem with setting the background. Perhaps you know how to get this as well: set.seed(24032008) plot(rnorm(10),type=l,col=red) grid() front=c(0.5, .97, 0.5, .97) par(fig=front, new=T)#, bg=skyblue does not work

Re: [R] Great difference for piecewise linear function between R and SAS

2008-03-24 Thread zhijie zhang
Dear Murdoch, Compare the predictions, not the coefficients., this is the key point. I have checked their predicted probability and their results are the same. What do you mean by You're using different bases? Could you please give me a little more info on it, so that i can go to find

Re: [R] Inverse t-distribution

2008-03-24 Thread Alberto Monteiro
Bert Gunter wrote: Yes. And, amazingly, one can find out about it by typing help.search(t distribution) . Why don't you try it for yourself? Maybe because the obvious search is help.search(t) :-) Alberto Monteiro __ R-help@r-project.org

Re: [R] intraday OHLC plot

2008-03-24 Thread Gabor Grothendieck
You need zoo 1.5-0 and you are using 1.4-2. Also note that the DF - line is not needed (though it doesn't hurt either) and was just there to check your similar statement. On Mon, Mar 24, 2008 at 4:48 AM, Thomas Steiner [EMAIL PROTECTED] wrote: Dear all, thank you very much for continuing to

Re: [R] Great difference for piecewise linear function between R and SAS

2008-03-24 Thread Duncan Murdoch
On 24/03/2008 7:06 AM, zhijie zhang wrote: Dear Murdoch, Compare the predictions, not the coefficients., this is the key point. I have checked their predicted probability and their results are the same. What do you mean by You're using different bases? Could you please give me a

Re: [R] Great difference for piecewise linear function between R and SAS

2008-03-24 Thread Duncan Murdoch
On 3/24/2008 9:03 AM, zhijie zhang wrote: Dear Murdoch, Thanks very much for your rapid response. It helps me greatly. If i want to write the model formula according to the estimets from R, Is it correct for the below formula? I'm not very sure about it, and i also hope that you can

[R] ARCH(1,0) with t-residuals

2008-03-24 Thread Elena M.
Dear R users, I need to estimate an ARCH(1,0) model with t-residuals. To do this I use garchFit function from fGarch library. However, I get the following error message: Error in.garchInitParameters (formula.mean = formula.mean, formula.var = formula.var, ): object alpha not found I tried to

[R] vlookup in R

2008-03-24 Thread Sachin J
Hi, Is there are function similar to excel vlookup in R. Please let me know. Thanks, Sachin [[alternative HTML version deleted]] __

Re: [R] vlookup in R

2008-03-24 Thread Henrique Dallazuanna
I think that merge is what you want: set.seed(24032008) x - data.frame(ID=sample(10), Value=rnorm(10)) idx - sample(5) merge(idx, x, by.x=1, by.y=1) On 24/03/2008, Sachin J [EMAIL PROTECTED] wrote: Hi, Is there are function similar to excel vlookup in R. Please let me know. Thanks,

Re: [R] vlookup in R

2008-03-24 Thread jim holtman
?findInterval On 3/24/08, Sachin J [EMAIL PROTECTED] wrote: Hi, Is there are function similar to excel vlookup in R. Please let me know. Thanks, Sachin [[alternative HTML version

Re: [R] [PS] vlookup in R

2008-03-24 Thread Ben Fairbank
Another way: If x is a two column matrix, as suggested by Henrique D., IDValue 1 7 0.000656733 2 6 0.201764789 3 1 0.671113391 4 10 -0.739727826 5 9 -1.111310154 6 5 -0.859455833 7 2 -1.408229877 8 8 0.993126295 9 3 -0.171906808 10 4 -0.140107677 And you are

Re: [R] vlookup in R

2008-03-24 Thread David Winsemius
Sachin J [EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED]: Is there are function similar to excel vlookup in R. Please let me know. Caveat: definition of VLOOKUP done from memory and by checking OO.o Calc function of same name. (Don't have Excel on this machine.) VLOOKUP looks up a

Re: [R] [PS] Re: vlookup in R

2008-03-24 Thread Ben Fairbank
Quite right, there is an optional 4th argument, and the table must be sorted ascending on the first column in Excel. Thus these functions only approximately duplicate the Excel functions (improve on them IMHO). BTW, I pasted the wrong formula in my reply; though it works, simpler is ID - 4

Re: [R] inheritence in S4

2008-03-24 Thread Martin Morgan
[EMAIL PROTECTED] wrote: Hi Martin I am re reading all the mail we exchange with new eyes because of all the thing I learn in the past few weeks. That very interesting and some new question occurs... *** Once, you speak about callGeneric : setClass(A,

Re: [R] vlookup in R

2008-03-24 Thread Sachin J
Hi Henrique, This is what I am trying to accomplish: I want to read values in V1 and V2 and populate the column V4 with R or B based on the values in V3 i.e. if its A,B,C then its R else if D,F then B. You can assume V1, V2 are dataframe1 and V3, V4 are in dataframe2 (note V4 is empty initially

Re: [R] function for the average or expected range?; CORECTION

2008-03-24 Thread Greg Snow
Well it looks like you found your answer. Further the fact that my suggestions of possibilities did not help and the fact that noone else has chimed in would suggest that there is not any easier way to get your answer. I was thinking that taking into account the correlation between the min and

Re: [R] vlookup in R

2008-03-24 Thread Henrik Bengtsson
# Setup the translation map transMap - c(A=R, B=R, C=R, D=B, F=B); # The input data v3 - c(A, C, D, F, A, C, B, B, B, B, A, D); # The translated data v4 - transMap[v3]; df2 - data.frame(V3=v3, V4=v4); I recommend you to read 'An Introduction to R' that comes with any R installation. There is

Re: [R] vlookup in R

2008-03-24 Thread jim holtman
Is this what you want? control - data.frame(V1=c(A,B,C,D,F), V2=c(R,R,R,B,B)) test - data.frame(V3=sample(c(A,B,C,D,F), 10, TRUE), v4='') test V3 v4 1 A 2 F 3 B 4 F 5 B 6 B 7 C 8 F 9 F 10 B test$V4 - control$V2[match(test$V3, control$V1)] test V3 v4 V4 1 A R 2

Re: [R] spreading out a numeric vector

2008-03-24 Thread Greg Snow
Levi, Here is one possible function: spread - function(x, mindiff) { df - x[-1] - x[-length(x)] i - 1 while (any(df mindiff)) { x[c(df mindiff, FALSE)] - x[c(df mindiff, FALSE)] - mindiff/10 x[c(FALSE, df mindiff)] - x[c(FALSE, df mindiff)] + mindiff/10 df - x[-1] -

Re: [R] vlookup in R

2008-03-24 Thread Sachin J
Thank you all for your help. I will definately go through the suggested document. Thanks again. Sachin - Original Message From: Henrik Bengtsson [EMAIL PROTECTED] To: Sachin J [EMAIL PROTECTED] Cc: Henrique Dallazuanna [EMAIL PROTECTED]; r-help@r-project.org Sent: Monday, March 24,

Re: [R] inheritence in S4

2008-03-24 Thread cgenolin
callGeneric is an advanced topic. Ok, when I will be older :-) * This works : setMethod(initialize,B, function(.Object,..., yValue){ callNextMethod(.Object, ..., y=yValue) return(.Object) }) new(B,yValue=3) but this

[R] as.numeric with tclvalue redux

2008-03-24 Thread Erin Hodgess
Hi again R People: This works fine: library(tcltk) a - tclVar(4.5) as.numeric(tclvalue(a)) [1] 4.5 #But if you have: b - tclVar(pi) as.numeric(tclvalue(b)) [1] NA Warning message: NAs introduced by coercion Is anyone aware of a way around this, please? thanks, Erin -- Erin Hodgess

[R] make error: ../../../bin/R: bad substitution

2008-03-24 Thread tomkur2006-takehome
Hi, I am getting this error when I run 'make' under src/library/base: ../../../library/base/R/base is unchanged ../../../bin/R: bad substitution make: *** [all] Error 1 I traced it down to the following line in src/library/base/Makefile: @cat $(srcdir)/makebasedb.R | \

Re: [R] inheritence in S4

2008-03-24 Thread Martin Morgan
[EMAIL PROTECTED] wrote: callGeneric is an advanced topic. Ok, when I will be older :-) * This works : setMethod(initialize,B, function(.Object,..., yValue){ callNextMethod(.Object, ..., y=yValue) return(.Object) })

Re: [R] as.numeric with tclvalue redux

2008-03-24 Thread Sundar Dorai-Raj
Erin Hodgess said the following on 3/24/2008 10:39 AM: Hi again R People: This works fine: library(tcltk) a - tclVar(4.5) as.numeric(tclvalue(a)) [1] 4.5 #But if you have: b - tclVar(pi) as.numeric(tclvalue(b)) [1] NA Warning message: NAs introduced by coercion Is anyone aware

Re: [R] [Rd] resampling from string when it runs across multiple lines

2008-03-24 Thread Dimitris Rizopoulos
try this: y - as.matrix(read.table(textConnection( A C G T T G C A G C A C G F F F F F F G A C G S S S S S G A A C G T T G C A G G A B B

Re: [R] as.numeric with tclvalue redux

2008-03-24 Thread Peter Dalgaard
Erin Hodgess wrote: Hi again R People: This works fine: library(tcltk) a - tclVar(4.5) as.numeric(tclvalue(a)) [1] 4.5 #But if you have: b - tclVar(pi) as.numeric(tclvalue(b)) [1] NA Warning message: NAs introduced by coercion Is anyone aware of a way around

Re: [R] as.numeric with tclvalue redux

2008-03-24 Thread Erin Hodgess
Thank you! On 3/24/08, Peter Dalgaard [EMAIL PROTECTED] wrote: Erin Hodgess wrote: Hi again R People: This works fine: library(tcltk) a - tclVar(4.5) as.numeric(tclvalue(a)) [1] 4.5 #But if you have: b - tclVar(pi) as.numeric(tclvalue(b)) [1] NA Warning message:

Re: [R] make error: ../../../bin/R: bad substitution

2008-03-24 Thread Prof Brian Ripley
Since you have posted about this before with errors earlier in the build process and not told us those were resolved, very likely something prior to this is the problem. You will find people here more responsive if you don't disregard the posting guide, e.g. by sending HTML mail. On Mon, 24

Re: [R] inheritence in S4

2008-03-24 Thread cgenolin
The code example is incomplete, so I don't really know why one version assigned y=3 for you and the other did not; for me, neither version did the assignment. I probably add the return in the mail without imagining il will change things. My question was more on the use of ... versus the

Re: [R] Great difference for piecewise linear function between R and SAS

2008-03-24 Thread Andrew Robinson
On Mon, Mar 24, 2008 at 01:09:35PM -0500, Paul Johnson wrote: On Mon, Mar 24, 2008 at 8:11 AM, Duncan Murdoch [EMAIL PROTECTED] wrote: On 3/24/2008 9:03 AM, zhijie zhang wrote: Dear Murdoch, Thanks very I would use predict() instead. What you have there doesn't look as

Re: [R] inheritence in S4

2008-03-24 Thread Martin Morgan
[EMAIL PROTECTED] wrote: The code example is incomplete, so I don't really know why one version assigned y=3 for you and the other did not; for me, neither version did the assignment. I probably add the return in the mail without imagining il will change things. My question was more

Re: [R] Simple problem in R

2008-03-24 Thread Charles C. Berry
On Mon, 24 Mar 2008, Chaser wrote: I found a package on www.bioconductor.com that allows me to install using this line: source(http://bioconductor.org/biocLite.R;) biocLite(MassSpecWavelet) The prompt showed me the following message: Running biocinstall version 2.1.10 with R version

Re: [R] spreading out a numeric vector

2008-03-24 Thread Levi Waldron
*Thank you* Greg, this function works perfectly! I had imagined that the ideal solution would iteratively modify the vector to fix new violations of mindiff created by each subsequent spreading of tight clusters, but couldn't figure how to do it. A small note, the vector x must be sorted before

[R] Newbie help with Sweave

2008-03-24 Thread Zembower, Kevin
I think I've gotten my Emacs/Sweave/R system set up correctly, thanks to Vincent and Jim, but I haven't been successful getting my first document produced. I'm trying to use one of Friedrich Leisch's examples, http://www.ci.tuwien.ac.at/~leisch/Sweave/example-1.Snw. I cut and pasted the text into

Re: [R] spreading out a numeric vector

2008-03-24 Thread Levi Waldron
Would this function be worth submitting to some existing cran library? I'd be willing to document it and add error-checking if there is somewhere that it belongs (with credit to Greg of course, unless Greg wants to submit it himself). I am using it in conjunction with a function I wrote which

[R] Plotting matrix rows with lattice graphics?

2008-03-24 Thread Ron Bonner
Sorry if this is an FAQ, but I haven't found the answer (yet)... I'm trying to plot each row of a simple numeric matrix in a separate panel using the layout features of lattice, but can't make it work - help would be appreciated! Example: m - matrix(seq(1:20), nrow=4) m [,1] [,2]

Re: [R] R GUI question

2008-03-24 Thread jeffreya
Thanks so much for all the input; I appreciate it. I think I'll stick with Tcl/Tk for now primarily on the basis of installation issues. I'm not sure that many of these users would have Java, so the other alternatives all seemed to add another level of complexity on to the installation task

[R] Running rpy produces the error message undefined symbol: KillAllDevices

2008-03-24 Thread Bob and Deb
Hello All, I've been using R for a while and decided to test R from the svn trunk. I know that trunk is not stable, but I wanted to see if I can install and run the latest rpy on my Ubuntu 7.10 box. It installed ok, but I got the runtime error message: $ python Python 2.5.1 (r251:54863, Mar 7

Re: [R] Simple problem in R

2008-03-24 Thread Chaser
I never knew to enter that command in. Thanks guys! -- View this message in context: http://www.nabble.com/Simple-problem-in-R-tp16259116p16260713.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

[R] derivatives in R

2008-03-24 Thread Lavan
Hi, I posted this message earlier in Rmetrics and I don't know whether I posted in the wrong place, so I'm posting it again in Rhelp. I have a function in x and y and let's call it f(x,y). I need to get the Hessian matrix. i.e I need (d^2f/dx^2), (d^2f/dxdy), (d^2f/dydx), (d^2f/dy^2).I can get

Re: [R] derivatives in R

2008-03-24 Thread David Winsemius
Lavan [EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED]: Hi, I posted this message earlier in Rmetrics and I don't know whether I posted in the wrong place, so I'm posting it again in Rhelp. I have a function in x and y and let's call it f(x,y). I need to get the Hessian matrix. i.e I

[R] Passing (Optional) Arguments

2008-03-24 Thread Jason Q. McClintic
Dear List: In short, I am writing a number of functions as building blocks for other functions and have some questions about scoping and passing arguments. Suppose I have functions foo1, foo2, and foo3 such that: foo1-function(a=1,b=TRUE,c=FALSE){#do stuff};

[R] peak finding

2008-03-24 Thread Research Scholar
Hi all Is there a function that can find the start and end position of peaks in a set of numbers. eg. x=c(14,15,12,11,12,13,14,15,16,15,14,13,12,11,14,12) y=somefunction(x) y 4 14 Thanks John [[alternative HTML version deleted]] __

Re: [R] peak finding

2008-03-24 Thread Bill.Venables
It's hard to see how positions 4 and 14 correspond to 'peaks', they look like troughs to me. So perhaps this is what you mean: x - c(14,15,12,11,12,13,14,15,16,15,14,13,12,11,14,12) y - which(x == min(x)) y [1] 4 14 as a function: somefunction - function(x) which(x == min(x)) Bill

[R] help with rowsum/aggregate type functions

2008-03-24 Thread Charles Murtaugh
Hi-- This is a question with a trivial and obvious answer, I'm sure, but I can't seem to find it in the help files and books that I have handy. I have a dataframe consisting of two columns, Gene_Name, a list of gene symbols, and Number, a numeric measure of how frequently a tag representing

Re: [R] peak finding

2008-03-24 Thread Research Scholar
Hi Thanks for replying. I meant x[4] is the start of a peak shape and x[14] is the end of that peak and x[9] is the maxima of the peak. Thanks, John On Mon, Mar 24, 2008 at 11:09 PM, [EMAIL PROTECTED] wrote: It's hard to see how positions 4 and 14 correspond to 'peaks', they look like

Re: [R] peak finding

2008-03-24 Thread Bill.Venables
Then the answer is pretty simple: 'no'. The idea probably needs a lot more refining to make it workable, too. Why do you discard he peak at 2, with the shape starting at 1 and finishing at 4, for example? In thinking about this it might be useful for you to look at signs of successive

Re: [R] peak finding

2008-03-24 Thread Christos Hatzis
John, There is a peak finding algorithm attributed to Prof. Ripley in the R-help archive. It has a span parameter which might give you something close to what you seem to be looking for. http://finzi.psych.upenn.edu/R/Rhelp02a/archive/33097.html -Christos -Original Message- From:

Re: [R] Partition data into clusters

2008-03-24 Thread Suhaila Zainudin
Hi, Thanks for your reply. I have tried yr suggestions with success. TQVM. I have another query, say I want to write each cluster into a csv file such as follows: clus1 - my.clusters[[1]] write.csv(clus1, file = clus1.csv) . . clus10 - my.clusters[[10]] write.csv(clus10,file =

[R] Output of order() incorrectly ordered?

2008-03-24 Thread Shirley Wu
Hello, I have a data frame consisting of four columns and would like to sort based on the first column and then write the sorted data frame to a file. df - read.table(file.txt, sep=\t) where file.txt is simply a tab-delimited file containing 4 columns of data (first 2 numeric, second 2

[R] Subset of matrix

2008-03-24 Thread dinesh kumar
Dear R users I have a big matrix like 6021118879029011741015199066136288 100714 602110.6580.6880.4740.2620.1630.1370.32 0.2520.206 11880.65810.9170.2450.3310.1220.1480.194 0.1680.171

Re: [R] peak finding

2008-03-24 Thread Andrew Robinson
Another approach that involves more infrastructure is to fit a smooth line to your points, compute the first derivative, and look for change in sign in the first derivative. eg x - c(14,15,12,11,12,13,14,15,16,15,14,13,12,11,14,12) smoothed.dx - predict(smooth.spline(x), deriv=1)$y

Re: [R] derivatives in R

2008-03-24 Thread Lavan
hi thanks, pls see the code below. the elements of matrix Il should be the derivatives in matrix h (in Boldface) plus some additional terms, here I did calculate derivatoves in the matrix, but I want R to calculate it for me. pid- function (tau1,tau2,sigma=10,n=100,x_bar=20) { library(akima)

Re: [R] Partition data into clusters

2008-03-24 Thread Suhaila Zainudin
Hi, Just to inform you that I found the solution for the write.csv task I mentioned earlier. Searching thru the r-help leads me to this solution.. ###Your soln starts xx - max(cl2$cl.kmr10.cluster) # find out how many clusters there are. my.clusters - list(NULL) # set up an empty list for