Re: [R] Value at Risk

2007-05-11 Thread gyadav
reply is inline Hello Gaurav, The function: VaR(tstock[,2],alpha=0.01) # gives the same VaR as above with historical simulation VaR -2.86 but i tried this function for normal distribution: VaR.norm (tstock[,2],p=0.99)$VaR Error in VaR.norm(tstock[, 2], p = 0.99) : Negative

Re: [R] Value at Risk

2007-05-11 Thread gyadav
Hi Saore ***Please always mark a copy to the R-help list, it may be helpfull to many, you have forgotten twice*** *** Do Reply to all with history *** :-) cheers YOU ARE THE BEST :) I have some problems understanding R, but R and I will be friends in the future hehe :) I have another

Re: [R] Read SAS data into R

2007-05-11 Thread Frank E Harrell Jr
John Kane wrote: Have a look at the Hmisc package:sas.get or sasxport.get. In either case you need to have a working SAS installation on the same machine. Another way, although you lose label is simply to export the SAS data file as a csv or delim file and import it. I'm also looking

Re: [R] apply( )

2007-05-11 Thread Greg Tarpinian
Thank you all for your answers... To summarize, 1. with(X, ifelse(V1 V2 | V1 V3, 1, 0)) 2. ifelse((foo$x foo$y) | (foo$x foo$z), 1, 0) 3. with(foo, (x y) * (x z)) were the responses to my question (see below). Kindly, Greg --- Original post --- I have a

Re: [R] Value at Risk

2007-05-11 Thread Soare Marcian-Alin
Oh sry, I forgot to add the R-help list. Thanks a lot for your help Guarav! 2007/5/11, [EMAIL PROTECTED] [EMAIL PROTECTED]: Hi Saore ***Please always mark a copy to the R-help list, it may be helpfull to many, you have forgotten twice*** *** Do Reply to all with history *** :-) cheers

[R] [R-pkgs] New package earth

2007-05-11 Thread Stephen Milborrow
The earth package is now available on CRAN. Earth builds models using Friedman's MARS. Earth's principal advantages over the existing function mda::mars are that it is much faster and provides plotting and printing methods. The general purpose model plotting function plotmo may also be useful

Re: [R] Quick question on merging two time-series of different frequencies

2007-05-11 Thread Gabor Grothendieck
Its not clear to me what you want but play around with these forms of merge.zoo: merge(x, y) # all = TRUE merge(x, y, all = FALSE) merge(x, y, all = c(TRUE, FALSE)) merge(x, y, all = c(FALSE, TRUE)) On 5/11/07, Patnaik, Tirthankar [EMAIL PROTECTED] wrote: Achim, Thanks so much! I

Re: [R] A simple question about PRINCOMP

2007-05-11 Thread Prof Brian Ripley
Yes, rounding error does happen in real-life computation. It would be extraordinary to compile the correlation of real data and get exactly 0: this would require that the data could be represented exactly, for example. You might find ?zapsmall helpful. On Thu, 10 May 2007, Takatsugu

Re: [R] apply( )

2007-05-11 Thread Petr PIKAL
Hi [EMAIL PROTECTED] napsal dne 10.05.2007 17:59:22: or with(foo, (x y) * (x z)) Should not it be with(foo, ((x y) | (x z))*1) Regards Petr On 5/10/07, jim holtman [EMAIL PROTECTED] wrote: You don't need apply. Just do foo$result - ifelse((foo$x foo$y) | (foo$x

[R] A simple question regarding plot of nls objects

2007-05-11 Thread Mielke Hans
Hi, I was trying to run the example of Indomethacin kinetics from the book: ## From Pinheiro/Bates, Mixed-Effects-Models in S and S-Plus, ## Springer, Second Printing 2001, Section 6.2 library(nlme) plot(Indometh) fm1Indom.nls - nls(conc~SSbiexp(time,A1,lrc1,A2,lrc2), data=Indometh)

[R] Odp: axis space

2007-05-11 Thread Petr PIKAL
Hi [EMAIL PROTECTED] napsal dne 11.05.2007 11:30:28: Hello I have a problem. I have a plot, and have made the writing larger with cex.axis and cex.lab, and i is working great, BUT the writing is bigger than the window... for example, the y-axis writing misses the top of all letters.

Re: [R] A simple question regarding plot of nls objects

2007-05-11 Thread Peter Dalgaard
Mielke Hans wrote: Hi, I was trying to run the example of Indomethacin kinetics from the book: ## From Pinheiro/Bates, Mixed-Effects-Models in S and S-Plus, ## Springer, Second Printing 2001, Section 6.2 library(nlme) plot(Indometh) fm1Indom.nls - nls(conc~SSbiexp(time,A1,lrc1,A2,lrc2),

[R] axis space

2007-05-11 Thread Rina Miehs
Hello I have a problem. I have a plot, and have made the writing larger with cex.axis and cex.lab, and i is working great, BUT the writing is bigger than the window... for example, the y-axis writing misses the top of all letters. Does anyone know how to change the window or something so you

[R] Odp: A simple question regarding plot of nls objects

2007-05-11 Thread Petr PIKAL
Hi [EMAIL PROTECTED] napsal dne 11.05.2007 11:12:21: Hi, I was trying to run the example of Indomethacin kinetics from the book: ## From Pinheiro/Bates, Mixed-Effects-Models in S and S-Plus, ## Springer, Second Printing 2001, Section 6.2 library(nlme) plot(Indometh) fm1Indom.nls -

Re: [R] Odp: Anova

2007-05-11 Thread Peter Dalgaard
Petr PIKAL wrote: Hi [EMAIL PROTECTED] napsal dne 11.05.2007 07:26:00: Doea anyone know how to compute components of variance analysis? For example, I have the score of pupils on a test. Each pupil belongs to a school and within each school I may have several

Re: [R] A simple question regarding plot of nls objects

2007-05-11 Thread Stefan Grosse
The example works fine for me on R 2.5.0 and WinXP... Mielke Hans wrote: Hi, I was trying to run the example of Indomethacin kinetics from the book: ## From Pinheiro/Bates, Mixed-Effects-Models in S and S-Plus, ## Springer, Second Printing 2001, Section 6.2 library(nlme) plot(Indometh)

Re: [R] Cannot use an escape character in regexp

2007-05-11 Thread Duncan Murdoch
On 11/05/2007 7:07 AM, Vittorio wrote: Given the string mystr - (Preconsuntivo del giorno gas 10 maggio 2007)Tj I'm trying to detect and eliminate the string )Tj at the very end of mystr by means of gsub(rx2,,mystr) BUT preparing the matching regexp string a warning pops up rx2

[R] Cannot use an escape character in regexp

2007-05-11 Thread Vittorio
Given the string mystr - (Preconsuntivo del giorno gas 10 maggio 2007)Tj I'm trying to detect and eliminate the string )Tj at the very end of mystr by means of gsub(rx2,,mystr) BUT preparing the matching regexp string a warning pops up rx2 - \)Tj$ Warning messages: 1: '\)' is an

[R] Multivariate longitudinal sample data

2007-05-11 Thread hadley wickham
Hi, Can anyone recommend one or more good sample datasets for multivariate longitudinal data? (eg. a dataset containing a mixture of continuous, categorical and date/time variables) I'm looking for something which I can use for testing and examples for my ggplot graphics package. A selection of

[R] normal distribution from chisqrd

2007-05-11 Thread raymond chiruka
hie l have obtained a logrank statistic and would like to get the normal version from the same data eg sqrt(chiqsqr)with 1 df ~n(1,0) is this possibe using R or Do l have to programme it thanks - Bored stiff? Loosen up...

[R] Compilation of source package.

2007-05-11 Thread BXC (Bendix Carstensen)
I have a samll package that works well and complies nicly on WinXP, using R-2.4.1 Now I want to add a document so i make a folder inst\doc and put the .tex and .pdf in there. But the complation then crashes. Is this because the installin expects some file to be present in inst if an inst folder

Re: [R] Compilation of source package.

2007-05-11 Thread Peter Dalgaard
BXC (Bendix Carstensen) wrote: I have a samll package that works well and complies nicly on WinXP, using R-2.4.1 Now I want to add a document so i make a folder inst\doc and put the .tex and .pdf in there. But the complation then crashes. Is this because the installin expects some file to

[R] EM covergence problem

2007-05-11 Thread sun
Hi, R users I am trying to use EM algorithmto estimate a latent class model of discrete choice. The basic model is a logit model which has two variables X=(X1,X2) and the utility is defined as v = Beta*X. There are 3 classes of individuals each has its own Beta values, so Beta is a 3*2

[R] incorrect MCMC CIs in pvals.fnc (languageR) ?

2007-05-11 Thread Mike Allerhand
library(lme4) library(coda) library(languageR) fit = lmer(Reaction~Days + (1|Subject) + (0+Days|Subject), data=sleepstudy) pvals.fnc(fit)$random # compare with... samp = mcmcsamp(fit, n=1, trans=FALSE) HPDinterval(samp) densityplot(samp, plot=F) # 'pvals.fnc' reports sigma instead of

Re: [R] Allocating shelf space

2007-05-11 Thread S Ellison
Isn't this rather closely related to the (more or less classic) bin packing and knapsack problems? The 'hardness' of the problem is combinatoric (NP) and that is statistical, but the answers aren't particularly statistical. Both have been studied quite a lot for pragmatic reasons (packing

Re: [R] Create an AR(1) covariance matrix

2007-05-11 Thread Dimitris Rizopoulos
one option is the following: times - 1:5 rho - 0.5 sigma - 2 ### H - abs(outer(times, times, -)) V - sigma * rho^H p - nrow(V) V[cbind(1:p, 1:p)] - V[cbind(1:p, 1:p)] * sigma V I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of

Re: [R] Create an AR(1) covariance matrix

2007-05-11 Thread Peter Dalgaard
Dimitris Rizopoulos wrote: one option is the following: times - 1:5 rho - 0.5 sigma - 2 ### H - abs(outer(times, times, -)) V - sigma * rho^H p - nrow(V) V[cbind(1:p, 1:p)] - V[cbind(1:p, 1:p)] * sigma V Hmm, I'd rather use x - diag(5) x - sigma *

[R] model seleciton by leave-one-out cross-validation

2007-05-11 Thread 李俊杰
Hi, all When I am using mle.cv(wle), I find a interesting problem: I can't do leave-one-out cross-validation with mle.cv(wle). I will illustrate the problem as following: xx=matrix(rnorm(20*3),ncol=3) bb=c(1,2,0) yy=xx%*%bb+rnorm(20,0,0.001)+0

[R] Create an AR(1) covariance matrix

2007-05-11 Thread Rick DeShon
Hi All. I need to create a first-order autoregressive covariance matrix (AR(1)) for a longitudinal mixed-model simulation. I can do this using nested for loops but I'm trying to improve my R coding proficiency and am curious how it might be done in a more elegant manner. To be clear, if there

Re: [R] Read SAS data into R

2007-05-11 Thread kseefeld
Kim’s EZ Recipe for…. SAS TO R, perfectly formatted table with no loss of data • In SAS: Export SAS DB as access db • In R go to directory where access db is stored • Use package RODBC #R code #Create connection object (Can set up DSN but I’m too lazy to)

[R] Initializing lists with n objects

2007-05-11 Thread Sam Field
Hopefully quick question. I would like to populate a list with n objects using a for loop, so within the loop (i to n) I need to refer to a list as example.list[[i]] . This requires that I create a example.list[[i]] with n objects before the for loop. How do I do this? With matrices it

[R] names of objects in .rda

2007-05-11 Thread Benilton Carvalho
Hi everyone, sorry if this was discussed before (and in this situation, could you please point me to the discussion in the archive? My search didn't seem to be effective). Is there a way of getting the names of objects in a .rda file without having to load it? Thank you very much,

Re: [R] model seleciton by leave-one-out cross-validation

2007-05-11 Thread Prof Brian Ripley
What is 'cv.glm'? That's almost certainly where the time is going, and there are fast methods of LOO cross-validation for linear models (as distinct from glms). If this is the function of that name from package boot, that comment certainly applies. Do you know about the relationship between

Re: [R] Initializing lists with n objects (never mind)

2007-05-11 Thread Sam Field
sorry every one. I figured it out. I didn't realize that you could add objects so easily. I just went with example.list - list(1) Sam Sam Field wrote: Hopefully quick question. I would like to populate a list with n objects using a for loop, so within the loop (i to n) I need to refer

[R] Java vs. C speed

2007-05-11 Thread Peter Muhlberger
I tried writing a textual comparison program in R, but found that it is too slow for my purposes. I need to make about 145 million comparisons of the word patterns in pieces of text. I basically compare vectors that contain count data on a multitude of words and find ones that are similar to

Re: [R] Initializing lists with n objects

2007-05-11 Thread John Kane
mylist - as.list (matrix(1:5)) might work. Note the elements of the list are not empty --- Sam Field [EMAIL PROTECTED] wrote: Hopefully quick question. I would like to populate a list with n objects using a for loop, so within the loop (i to n) I need to refer to a list as

Re: [R] names of objects in .rda

2007-05-11 Thread Duncan Murdoch
On 5/11/2007 11:53 AM, Benilton Carvalho wrote: Hi everyone, sorry if this was discussed before (and in this situation, could you please point me to the discussion in the archive? My search didn't seem to be effective). Is there a way of getting the names of objects in a .rda file

Re: [R] names of objects in .rda

2007-05-11 Thread Douglas Bates
On 5/11/07, Benilton Carvalho [EMAIL PROTECTED] wrote: Hi everyone, sorry if this was discussed before (and in this situation, could you please point me to the discussion in the archive? My search didn't seem to be effective). Is there a way of getting the names of objects in a .rda file

Re: [R] names of objects in .rda

2007-05-11 Thread Christos Hatzis
An approach would be to attach it and then use ls() attach(myarchive.rda) ls(pos=2) detach(myarchive.rda) -Christos Christos Hatzis, Ph.D. Nuvera Biosciences, Inc. 400 West Cummings Park Suite 5350 Woburn, MA 01801 Tel: 781-938-3830 www.nuverabio.com -Original Message- From:

Re: [R] getting informative error messages

2007-05-11 Thread Tony Plate
Prof Brian Ripley wrote: It is not clear to me what you want here. I just wanted to be able to quickly find the expression in which an error occurred when it was inside a lengthy function. I now know that 'debug()' can help with this (debug() allows me to easily step through the function and

Re: [R] names of objects in .rda

2007-05-11 Thread Prof Brian Ripley
On Fri, 11 May 2007, Benilton Carvalho wrote: Hi everyone, sorry if this was discussed before (and in this situation, could you please point me to the discussion in the archive? My search didn't seem to be effective). Is there a way of getting the names of objects in a .rda file without

Re: [R] Follow-up about ordinal logit with mixtures: how about 'continuation ratio' strategy?

2007-05-11 Thread Paul Johnson
On 5/10/07, Frank E Harrell Jr [EMAIL PROTECTED] wrote: Paul Johnson wrote: This is a follow up to the message I posted 3 days ago about how to estimate mixed ordinal logit models. I hope you don't mind that I am just pasting in the code and comments from an R file for your feedback.

Re: [R] can't use Sweave in a function?

2007-05-11 Thread Tao Shi
Thank you very much for the pointer, Duncan! BTW, one comment. While testing your suggestion, I found that only 'save' works (exactly like you said!), not 'save.image' (see the following R session). 'save.image' only sees .globalEnv. So I guess the statement--'save.image()' is just a

Re: [R] names of objects in .rda

2007-05-11 Thread Seth Falcon
Christos Hatzis [EMAIL PROTECTED] writes: An approach would be to attach it and then use ls() No, that really is not an approach. If you load it, then there is no problem to read the names. The point is not to load it. This is important when dealing with large objects or large collections

Re: [R] names of objects in .rda

2007-05-11 Thread Christos Hatzis
You're right. I didn't realize that what happens when attaching is that a new environment is created on the search path and the elements of a list (including columns of a data frame) or objects in a save file or an environment are *** copied *** into the new environment Thanks. -Christos

[R] OT: Predicted probabilities from ordinal regressions

2007-05-11 Thread Andrew Perrin
Sorry if this is too off-topic, as we may not implement this in R (although we may do so). A student of mine is looking at some public opinion data in which there appears to be a statistically significant difference between levels of support for a proposal based on which of two question

[R] geeting name of an object to which a variable refers?

2007-05-11 Thread new ruser
#Sorry for the convoluted subject line. #I have: a=c(1,2,3) x=a #example of user supplied input #Is there any function that will tell me the name of the object x refers to, referring only to x itself? #i.e. the answer I want is a #I want: #fun(x) == 'a' #(I don't think this is possible,

Re: [R] Read SAS data into R

2007-05-11 Thread Marc Schwartz
On Fri, 2007-05-11 at 13:43 -0500, Frank E Harrell Jr wrote: kseefeld wrote: Kim’s EZ Recipe for…. SAS TO R, perfectly formatted table with no loss of data • In SAS: Export SAS DB as access db • In R go to directory where access db is stored • Use package RODBC #R code

Re: [R] geeting name of an object to which a variable refers?

2007-05-11 Thread Liaw, Andy
Something like this? R f - function(x) deparse(substitute(x)) R a - 1:3 R f(a) [1] a Andy From: new ruser #Sorry for the convoluted subject line. #I have: a=c(1,2,3) x=a #example of user supplied input #Is there any function that will tell me the name of the object x refers

[R] control margin when plotting polygons?

2007-05-11 Thread Shengde Liang
Hello everyone, I have some difficulties on controling the margin of a plot. For example, the following code from the help of maptools: library(maptools) xx - readShapePoly(system.file(shapes/sids.shp, package=maptools)[1], IDvar=FIPSNO, proj4string=CRS(+proj=longlat +ellps=clrk66)) plot(xx,

[R] conditional across frames of a data fram

2007-05-11 Thread Jason Vytlacil
I'm a newbie, so please forgive me: I have a data frame that includes two long columns of x and y coordinate values thusly: ... ... ... x y ... ... ... ... ... 115 127 ... ... ... ... ... 120 129 ... ... ... ... ... 0 0 ... ... ... ... ...

[R] how to get column/row info from a dist object?

2007-05-11 Thread Pedro Mardones
Dear R users; Is it possible to get the row and column number of a particular entry in a dist object? Let's say that I want to find the position of the value 1.1837 (the last entry on the dist object below), that is [6,3]. Can I get those values without transforming the object to a matrix?, i.e.

[R] PRESS criterion in leaps

2007-05-11 Thread Andrew Smith
I'm interested in writing some model selection functions (for linear regression models, as a start), which incorporate the PRESS criterion since it, to my knowledge, is not currently implemented in any available model selection procedure. I thought it would be simplest to build on already

Re: [R] how to get column/row info from a dist object?

2007-05-11 Thread Francisco J. Zagmutt
But the dist object is not structured with rows and columns. i.e. x=1:4 d=dist(x) 1 2 3 2 1 3 2 1 4 3 2 1 str(d) Class 'dist' atomic [1:6] 1 2 3 1 2 1 ..- attr(*, Size)= int 4 ..- attr(*, Diag)= logi FALSE ..- attr(*, Upper)= logi FALSE ..- attr(*, method)= chr euclidean ..-

Re: [R] how to get column/row info from a dist object?

2007-05-11 Thread Pedro Mardones
Thanks Francisco; I'm trying to avoid the step of converting a dist object into a matrix because I'm working with matrices of more than 5000 rows x 5000 columns. I just was wondering if someone knew any trick to do that. On 5/11/07, Francisco J. Zagmutt [EMAIL PROTECTED] wrote: But the dist

[R] shell.exec() on Windows, unexpected behavior

2007-05-11 Thread Richard M. Heiberger
I have Windows XP machines with different software configurations. My laptop has Adobe Reader 8 and Adobe Acrobat 6. My desktop has Adobe Reader 8 and does not have Adobe Acrobat. On both machines, PDF extensions are registered to Adobe Reader 8.0, and double-clicking a pdf file in Windows

Re: [R] shell.exec() on Windows, unexpected behavior

2007-05-11 Thread Gabor Grothendieck
Just a guess but perhaps it opens the file with the association that existed when R was installed and that association was different from the current association? Try re-installing R and see if that changes it. On 5/11/07, Richard M. Heiberger [EMAIL PROTECTED] wrote: I have Windows XP machines

Re: [R] shell.exec() on Windows, unexpected behavior

2007-05-11 Thread Duncan Murdoch
On 11/05/2007 7:37 PM, Richard M. Heiberger wrote: I have Windows XP machines with different software configurations. My laptop has Adobe Reader 8 and Adobe Acrobat 6. My desktop has Adobe Reader 8 and does not have Adobe Acrobat. On both machines, PDF extensions are registered to Adobe

Re: [R] how to get column/row info from a dist object?

2007-05-11 Thread jim holtman
which(..., arr.ind=TRUE) On 5/11/07, Pedro Mardones [EMAIL PROTECTED] wrote: Dear R users; Is it possible to get the row and column number of a particular entry in a dist object? Let's say that I want to find the position of the value 1.1837 (the last entry on the dist object below), that

Re: [R] how to get column/row info from a dist object?

2007-05-11 Thread Gabor Grothendieck
On 5/11/07, Pedro Mardones [EMAIL PROTECTED] wrote: Dear R users; Is it possible to get the row and column number of a particular entry in a dist object? Let's say that I want to find the position of the value 1.1837 (the last entry on the dist object below), that is [6,3]. Can I get those

[R] There might be something wrong with cv.lm(DAAG)

2007-05-11 Thread 李俊杰
Hi, everyone When I was using cv.lm(DAAG) , I found there might be something wrong with it. The problem is that we can't use it to deal with a linear model with more than one predictor variable. But the usage documentation hasn't informed us about this. You can find it by excuting the following

[R] Fwd: Re: shell.exec() on Windows, unexpected behavior

2007-05-11 Thread Richard M. Heiberger
Duncan is on the right track. Thanks. In the CMD window start c:\Program Files\R\R-2.5.0\doc\manual\R-admin.pdf opens another CMD window with the quoted string as title. In the CMD window start c:\Progra~1\R\R-2.5.0\doc\manual\R-admin.pdf (with the 8.3 name and no embedded blanks) opens

Re: [R] Fwd: Re: shell.exec() on Windows, unexpected behavior

2007-05-11 Thread Gabor Grothendieck
This is yet another guess but it might be that its not a matter of whether its installed or not but whether its running (possibly in the background). If that were the case then forcing a new instance might solve it. Have a look at the last page of the following for the command line switches:

[R] Newbie's question

2007-05-11 Thread onthetopo
Hi guys, I've brand new to the R scene. I have hundreds of csv files that has field 1 ,/MM/DD as index How to generate a graph of distribution and calculate the standard deviation of field2 for all of the files in a directory? I'm wondering if R could do this. Thanks a lot. -- View this