[R] loop causes syntax error in print()

2007-07-03 Thread Ivan Baxter
I am having trouble printing a table out to the GUI display when the table is created and printed within a loop. I get a Error: syntax error message If I comment out the print statement, the loop runs fine and I can print out the last iteration of the table. ...[multiple loops and

[R] What is parameter display (windows/grDevices)

2007-07-03 Thread Dieter Menne
In the docs of window/grDevices: All these devices are implemented as windows devices, the _display_ parameter selects which is actually used. What is the display parameter? Dieter Menne __ R-help@stat.math.ethz.ch mailing list

[R] MatchIt package on Ubuntu 7.04 (Feisty Fawn)

2007-07-03 Thread Daniel Nordlund
UseRs, I tried to install the MatchIt package on Ubuntu 7.04. When loading required dependencies I got the following error message: Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load shared library '/usr/local/lib/R/site-library/optmatch/libs/optmatch.so':

Re: [R] help again

2007-07-03 Thread Ingmar Visser
On Jul 2, 2007, at 6:22 PM, umarporn charusombat wrote: hi i try to use arima and holtwinter to predict drought from 1895-2006 unless you have access to time-travel isn't this better called retrodiction? ingmar but i cannot read whole period of time and i try to do the exponent

Re: [R] What is parameter display (windows/grDevices)

2007-07-03 Thread Prof Brian Ripley
On Tue, 3 Jul 2007, Dieter Menne wrote: In the docs of window/grDevices: Do you mean 'windows' (sic) in package 'grDevices'? All these devices are implemented as windows devices, the _display_ parameter selects which is actually used. What is the display parameter? The second argument to

[R] how to use mle with a defined function

2007-07-03 Thread Lin Pan
Hi all, I am trying to use mle() to find a self-defined function. Here is my function: test - function(a=0.1, b=0.1, c=0.001, e=0.2){ # omega is the known covariance matrix, Y is the response vector, X is the explanatory matrix odet = unlist(determinant(omega))[1] # do cholesky

[R] Plotting very skewed data in barplot

2007-07-03 Thread Dr. med. Peter Robinson
Dear R'ers, I would like to use barplot or a similar function to plot data demonstrating the distribution of the length of a kind of conservation in about 25000 DNA sequences. My data look like this: #Total sequences: 23873 0 19936 1 218 2 391 3 477 4 360 5

[R] select row

2007-07-03 Thread Leonardo Lami
Hi all, I have a little problem selecting some rows from a data.frame. I'd like to select the rows where a determinated column take a partivolar value. For example: tab id x y 124-2005 1621814 4834991 224-2005 1621856 4834907 324-2005 1621763 4834956 4 25-2006

Re: [R] Problem installing R packages in OpenBSD

2007-07-03 Thread Butchar, Jon
Hello. It's been quite a while since using OpenBSD (and no OpenBSD here for me to check this out), but I do remember having to reset some of the path entries. Can you check the directory settings in the main R script and see if that's where the fake-... is coming from? This looks like a setting

Re: [R] select row

2007-07-03 Thread ONKELINX, Thierry
Assuming that id is a character. tab[tab$id == 25-2006, ] Cheers, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en

[R] possible bug in ggplot2 v0.5.2???

2007-07-03 Thread Stephane Cruveiller
Dear R-Users, I recently gave a try to the nice package ggplot2. Everything went well until I tried to add a smoother (using lm method for instance). On the graphic device the regression line is displayed but not confidence intervals as it should be (at least on ggplot website). I tried to do

Re: [R] select row

2007-07-03 Thread John Kane
?which Use it to find the rows and then extract the rows selection - mydata[which(mydata$id==25-2006), ] should work. --- Leonardo Lami [EMAIL PROTECTED] wrote: Hi all, I have a little problem selecting some rows from a data.frame. I'd like to select the rows where a determinated

Re: [R] select row

2007-07-03 Thread Leonardo Lami
Thanks all of you for the help! Hi all, I have a little problem selecting some rows from a data.frame. I'd like to select the rows where a determinated column take a partivolar value. For example: tab id x y 124-2005 1621814 4834991 224-2005 1621856

Re: [R] possible bug in ggplot2 v0.5.2???

2007-07-03 Thread hadley wickham
Hi Stephane, The problem is that the windows graphics device doesn't support transparent colours. You can get around this in two ways: * export to a device that does support transparency (eg. pdf) * use a solid fill colour : + stat_smooth(method=lm, fill=grey50) Hadley On 7/3/07, Stephane

[R] Exponentially Weighted Moving Average

2007-07-03 Thread livia
Hi, I have got a series of data x and some parameter a, and I would like to take some Exponentially Weighted Moving Average to the data in the following fomula, and obtain the return series y y1=a^265*x[2]+a^264*x[3]+a^263*x[4]+...+a^0*x[267] y2=a^264*x[4]+a^263*x[5]+a^263*x[6]+...+a^0*x[268]

Re: [R] Plotting very skewed data in barplot

2007-07-03 Thread Jim Lemon
Dr. med. Peter Robinson wrote: Dear R'ers, I would like to use barplot or a similar function to plot data demonstrating the distribution of the length of a kind of conservation in about 25000 DNA sequences. My data look like this: ... Therefore, I would like to show the column

[R] The R Book by M. J. Crawley

2007-07-03 Thread Pietrzykowski, Matthew (GE, Research)
Hello all- I would appreciate any guidance that can be provided. I am new to R and am using it exclusively in a statistics program I am undertaking that mainly references Minitab. My focus is on data modeling and further more multivariate data analysis as much of my work in involves chemical

Re: [R] Problem installing R packages in OpenBSD

2007-07-03 Thread Bruce
Thank you both for your responses. I am now able to install R packages. The front-end R scripts were changed at /usr/local/bin and /usr/local/lib/R/bin as follows: From: R_HOME_DIR=/usr/obj/i386/R-2.4.1/fake-i386/usr/local/lib/R R_SHARE_DIR=/usr/obj/i386/R-2.4.1/fake-i386/usr/local/lib/R/share

Re: [R] The R Book by M. J. Crawley

2007-07-03 Thread Uwe Ligges
Pietrzykowski, Matthew (GE, Research) wrote: Hello all- I would appreciate any guidance that can be provided. I am new to R and am using it exclusively in a statistics program I am undertaking that mainly references Minitab. My focus is on data modeling and further more multivariate

Re: [R] generating correlated Bernoulli random variables

2007-07-03 Thread Bernhard Klingenberg
Hi all, I was wondering how to generate samples for two RVs X1 and X2. X1 ~ Bernoulli (p1) X2 ~ Bernoulli (p2) Also, X1 and X2 are correlated with correlation \rho. You can use the rmvbin() function in the bindata package, e.g., require(bindata) n=10 p1=0.5 p2=0.3 rho=0.2

Re: [R] Exponentially Weighted Moving Average

2007-07-03 Thread davidr
You could use rollFun from fMultivar package. You need to define your EWMA function separately. (Usually the EWMA moves along with a constant window size, though ) David L. Reiner Rho Trading Securities, LLC 550 W. Jackson Blvd #1000 Chicago, IL 60661-5704 312-244-4610 direct 312-244-4500

Re: [R] loop causes syntax error in print()

2007-07-03 Thread Duncan Murdoch
On 7/3/2007 1:59 AM, Ivan Baxter wrote: I am having trouble printing a table out to the GUI display when the table is created and printed within a loop. I get a Error: syntax error message If I comment out the print statement, the loop runs fine and I can print out the last iteration of

Re: [R] regexpr

2007-07-03 Thread runner
using lapply is so great. That help me a lot. thanks. Stephen Tucker wrote: I think you are looking for paste(). And you can replace your for loop with lapply(), which will apply regexpr to every element of 'mylist' (as the first argument, which is 'pattern'). 'text' can be a vector

[R] EWMA procedure to forecast variance

2007-07-03 Thread livia
Hello, I would like to use the Exponential Weighted Moving Average procedure to get the variance. Is there any R function for doing this? Many thanks. -- View this message in context: http://www.nabble.com/EWMA-procedure-to-forecast-variance-tf4018317.html#a11412324 Sent from the R help

Re: [R] MatchIt package on Ubuntu 7.04 (Feisty Fawn)

2007-07-03 Thread Dirk Eddelbuettel
On 2 July 2007 at 23:47, Daniel Nordlund wrote: | I tried to install the MatchIt package on Ubuntu 7.04. How? Via 'sudo apt-get install r-cran-matchit', or using R? | When loading required dependencies I got the following error message: | | Error in dyn.load(x, as.logical(local),

[R] R Icon dulled out

2007-07-03 Thread Wayne_Betws
Hi there, For some strange reason the R icon on my quickstart menu and desktop icon has suddenly dulled out to grey instead of the usual blue colour! I didnt do anything out of the ordinary which might cause this! R seems to be working fine but this problem is still bugging me!! I have tried

[R] how to get the position of an element in a vector ?

2007-07-03 Thread Benoit Chemineau
Hi, dear R developers, I've got a vector of monthly volatilities and i would like to get the position of the highest volatility of the vector without computing a loop. Is there a function that could give me such a result ? a-c(1,2,4,100,3) the highest value is the fourth of the vector. how can

Re: [R] loop causes syntax error in print()

2007-07-03 Thread Ivan Baxter
Duncan Murdoch wrote: On 7/3/2007 1:59 AM, Ivan Baxter wrote: I am having trouble printing a table out to the GUI display when the table is created and printed within a loop. I get a Error: syntax error message If I comment out the print statement, the loop runs fine and I can print

Re: [R] EWMA procedure to forecast variance

2007-07-03 Thread Amir Safari
Hi Have a look on ewmaSmooth function in the qcc package. Also there are some other functions in the spc package, but the qcc should be your meaning. livia [EMAIL PROTECTED] wrote: Hello, I would like to use the Exponential Weighted Moving Average procedure to get the

Re: [R] how to get the position of an element in a vector ?

2007-07-03 Thread ONKELINX, Thierry
?which.max ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance

Re: [R] how to get the position of an element in a vector ?

2007-07-03 Thread Henrique Dallazuanna
which(a==max(a)) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O On 03/07/07, Benoit Chemineau [EMAIL PROTECTED] wrote: Hi, dear R developers, I've got a vector of monthly volatilities and i would like to get the position of the highest volatility of the vector

[R] Fwd: help again

2007-07-03 Thread umarporn charusombat
i try to predict the drought from the precipitation index of each month for 100 year, from 1985 to 2006 here is my code, i have the pdsi-read.csv(pdsi.csv) pdsi-ts(pdsi,start=1985,freq=100) HoltWinters(pdsi) plot(pdsi) lines(HoltWinters(pdsi)$fitted,col=red) pdsi.hw-HoltWinters(pdsi)

Re: [R] Formula syntax question

2007-07-03 Thread Frank E Harrell Jr
Isaac Kohane wrote: Forgive me if this is obvious: I have a frame of data with the variables in each column (e.g. Discrete_Variable1, ContinuousVariable_1, ContinuousVariable_2, ... ContinuousVariable_n) and I want to create a model using lrm i.e. model -

[R] Formula syntax question

2007-07-03 Thread Isaac Kohane
Forgive me if this is obvious: I have a frame of data with the variables in each column (e.g. Discrete_Variable1, ContinuousVariable_1, ContinuousVariable_2, ... ContinuousVariable_n) and I want to create a model using lrm i.e. model - lrm(Discrete_Variable1 ~

[R] Parsimony Analysis of Encemism in R?

2007-07-03 Thread Milton Cezar Ribeiro
Hi R-gurus, Is there a package for Parsimony Analysis of Endemism (Cladist) in R? Kind regards, Miltinho Brazil http://yahoo.com.br/oqueeuganhocomisso [[alternative HTML version deleted]]

[R] EWMA in fMultivar

2007-07-03 Thread livia
Hello, I would like to use the function EWMA() in the fMultivar Package and I have a series of data x, which is the returns series. Basically, I would like to get the variance estimation using EWMA. I am trying something like EWMA(x, lambda) and I have a couple of questions: Should x be the

Re: [R] generating correlated Bernoulli random variables

2007-07-03 Thread Vineet Kumar
Thanks, all for your help! vineet On 7/3/07, Bernhard Klingenberg [EMAIL PROTECTED] wrote: Hi all, I was wondering how to generate samples for two RVs X1 and X2. X1 ~ Bernoulli (p1) X2 ~ Bernoulli (p2) Also, X1 and X2 are correlated with correlation \rho. You can use

Re: [R] how to use mle with a defined function

2007-07-03 Thread Ben Bolker
Lin Pan linpan1975 at yahoo.com writes: Hi all, I am trying to use mle() to find a self-defined function. Here is my function: test - function(a=0.1, b=0.1, c=0.001, e=0.2){ # omega is the known covariance matrix, Y is the response vector, X is the explanatory matrix odet =

Re: [R] Lattice: shifting strips to left of axes

2007-07-03 Thread Michael Hoffman
[EMAIL PROTECTED] wrote: On 7/2/07, Michael Hoffman [EMAIL PROTECTED] wrote: Consider this plot: xyplot(mpg ~ disp | cyl, mtcars, strip=F, strip.left=T, layout=c(1, 3), scales=list(relation=free), par.settings=list(strip.background=list(col=transparent))) I want to have the

[R] Search a function name in a string

2007-07-03 Thread NOEL Yvonnick
Hello, I am trying to find a function name in a string that expresses a functional form : s = blabla...S(var)...blabla I would like to detect the pattern S(*) in s. I am no guru at regular expressions. Just tried : grep(S(.*),c(S(a),CSP)) [1] 1 2 I expected the pattern to be retrieved

[R] Empirical copula in R

2007-07-03 Thread GWeiss
Hi, I would like to implement the empirical copula in R, does anyone know if it is included in a package? I know it is not in the Copula package. This one only includes a gof-test based on the empirical copula process. Thanks for your help! Gregor -- View this message in context:

Re: [R] loop causes syntax error in print()

2007-07-03 Thread Duncan Murdoch
On 7/3/2007 10:23 AM, Ivan Baxter wrote: Duncan Murdoch wrote: On 7/3/2007 1:59 AM, Ivan Baxter wrote: I am having trouble printing a table out to the GUI display when the table is created and printed within a loop. I get a Error: syntax error message If I comment out the print

Re: [R] EWMA in fMultivar

2007-07-03 Thread davidr
To calculate variance (assuming zero mean, as is usual), you would use returns^2. You will have to examine the code by typing EWMA to see what it's doing and how to change it. The code is clear enough that you could make your own version to achieve what you want. HTH, David L. Reiner Rho Trading

Re: [R] EWMA in fMultivar

2007-07-03 Thread Leeds, Mark \(IED\)
there is an ewma example in ?filter I think that might be more useful because then you can see better What's happening in terms of the smoothing. Actually, I just looked and it's not there. It must have been in S+. I include my ewma below but you have to modify it because it assumes a zoo object.

Re: [R] Search a function name in a string

2007-07-03 Thread Uwe Ligges
NOEL Yvonnick wrote: Hello, I am trying to find a function name in a string that expresses a functional form : s = blabla...S(var)...blabla I would like to detect the pattern S(*) in s. I am no guru at regular expressions. Just tried : grep(S(.*),c(S(a),CSP))

Re: [R] MatchIt package on Ubuntu 7.04 (Feisty Fawn)

2007-07-03 Thread Daniel Nordlund
Dirk, Thanks for the assistance. -Original Message- From: Dirk Eddelbuettel [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 03, 2007 6:57 AM To: Daniel Nordlund Cc: r-help@stat.math.ethz.ch Subject: Re: [R] MatchIt package on Ubuntu 7.04 (Feisty Fawn) On 2 July 2007 at 23:47,

Re: [R] Search a function name in a string

2007-07-03 Thread Gabor Grothendieck
Parnetheses have special meaning so they must be escaped or specify a character class of 1: grep(S\\(.*\\),c(S(a),CSP)) [1] 1 grep(S[(].*[)],c(S(a),CSP)) [1] 1 On 7/3/07, NOEL Yvonnick [EMAIL PROTECTED] wrote: Hello, I am trying to find a function name in a string that expresses a

[R] xyplot and autokey, maintaining colors specified via col in key

2007-07-03 Thread Afshartous, David
All, When specifying colors to xyplot w/ a groups argument, using auto.key no longer maintains the colors properly. I've searched the docs and help but haven't found exactly what I need ... I saw a few examples in the archives involving par.settings but that doesn't seem to do it. I also saw

[R] sequences

2007-07-03 Thread livia
Hi, I would like to generate a series in the following form (0.8^1, 0.8^2, ..., 0.8^600) Could anyone tell me how can I achieve that? I am really new to R. -- View this message in context: http://www.nabble.com/sequences-tf4019146.html#a11414836 Sent from the R help mailing list archive at

Re: [R] sequences

2007-07-03 Thread Henrique Dallazuanna
0.8^(1:600) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O On 03/07/07, livia [EMAIL PROTECTED] wrote: Hi, I would like to generate a series in the following form (0.8^1, 0.8^2, ..., 0.8^600) Could anyone tell me how can I achieve that? I am really new to R. --

Re: [R] sequences

2007-07-03 Thread Doran, Harold
Just take advantage of R's vectorized calculations as x - seq(1:600) .8^x Harold -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of livia Sent: Tuesday, July 03, 2007 12:05 PM To: r-help@stat.math.ethz.ch Subject: [R] sequences Hi, I would

Re: [R] sequences

2007-07-03 Thread Chuck Cleland
livia wrote: Hi, I would like to generate a series in the following form (0.8^1, 0.8^2, ..., 0.8^600) Could anyone tell me how can I achieve that? I am really new to R. 8^(1:600) -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th)

Re: [R] xyplot and autokey, maintaining colors specified via col in key

2007-07-03 Thread Gabor Grothendieck
Don't know what you did regarding par.settings to not get the desired result but that is, in fact, the way to go since both the key and the plot lines will get their colors from that: xyplot(outcome ~ time, dat.ex, groups=drug, type=c(g, smooth), auto.key = list(space = top, text =

[R] bug in closing gzfile-opened connections?

2007-07-03 Thread David Reiss
Hi, I am making multiple calls to gzfile() via read.table(), e.g. x - read.table( gzfile( xxx.gz ) ) After i do this many times (I haven't counted, but probably between 50 and 100 times) I get the error message: Error in open.connection(file, r) : unable to open connection In addition: Warning

Re: [R] Lattice: shifting strips to left of axes

2007-07-03 Thread deepayan . sarkar
On 7/3/07, Michael Hoffman [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: On 7/2/07, Michael Hoffman [EMAIL PROTECTED] wrote: Consider this plot: xyplot(mpg ~ disp | cyl, mtcars, strip=F, strip.left=T, layout=c(1, 3), scales=list(relation=free),

[R] vertically concatenating data frames

2007-07-03 Thread Aydemir, Zava \(FID\)
Hi, what is the recommended way to vertically concatenate 2 data frames with the same column names but different number of rows? My problem is something along these lines: df1 - data.frame(var1=var1,var2=var2,var3=var3) # nrow(df1)=1000 df2 - data.frame(var1=var4,var2=var5,var3=var6) #

Re: [R] vertically concatenating data frames

2007-07-03 Thread Greg Snow
Use rbind instead of c: df - rbind(df1,df2) Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Aydemir, Zava

[R] Using odesolve to produce non-negative solutions

2007-07-03 Thread dave fournier
If you didn't get this solved. I have done parameter estimation with models defined by ODE's where negative solutions are a problem and one can only avoid them with great difficulty if the standard explicit methods for solving the ODE are used. I found that using implicit methods could be a great

[R] Convetring a dataframe so that it just has one column

2007-07-03 Thread Leeds, Mark \(IED\)
I have two dataframes, yendog and datasub as below and I want to do the same thing to both of them, namely convert them so that they retain their dataframeness but stack the columns into 1 column. I don't need names on the results. I did try temp1-do.call(rbind,datasub)

Re: [R] Convetring a dataframe so that it just has one column

2007-07-03 Thread Richard M. Heiberger
?stack tmp - data.frame(a=1:10, b=11:20) stack(tmp) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal,

[R] exact AIC

2007-07-03 Thread Selene Zárate
Hi, I am using the stepAIC function on the MASS package that does model selection by exact AIC. I'm not sure what the term 'exact AIC' means, and how it differs from AIC. Thank you, Selene Zarate __ R-help@stat.math.ethz.ch mailing list

[R] how to calculate interaction contrast

2007-07-03 Thread szhan
Hello, R experts, Sorry for asking this question again since I really want a help! I have a two-factor experiment data and like to calculate estimates of interation contrasts say factor A has levels of a1, a2, and B has levels of b1, b2, b3, b4, and b5 with 3 replicates. I am not sure the

Re: [R] Installing packages...

2007-07-03 Thread Weiwei Shi
I have the exact same problem as you had when I customerized some package: the way I go around this is using install.packages(~/Documents/projects/R_customerized_packages/supclust_1.0-5.tar.gz, repos=NULL, type=source) in which supclust_... is built from R CMD build supclust and in your case,

Re: [R] how to solve a min problem

2007-07-03 Thread Spencer Graves
Do you mean minimize mu with 0 b_func(S+mu) 800? For this kind of problem, I'd first want to know the nature of b_func. Without knowing more, I might try to plot b_func(S+mu) vs. mu, then maybe use 'optimize'. If this is not what you mean, please be more specific:

Re: [R] vertically concatenating data frames

2007-07-03 Thread John Kane
?rbind --- Aydemir, Zava (FID) [EMAIL PROTECTED] wrote: Hi, what is the recommended way to vertically concatenate 2 data frames with the same column names but different number of rows? My problem is something along these lines: df1 - data.frame(var1=var1,var2=var2,var3=var3) #

Re: [R] dlda{supclust} 's output

2007-07-03 Thread Weiwei Shi
Hi, I modified dlda{supclust} so that the original example in ?dlda gives the following output: set.seed(342) xlearn - matrix(rnorm(200), nrow = 20, ncol = 10) ## Generating random test data: 8 observations and 10 variables(clusters) xtest - matrix(rnorm(80), nrow = 8, ncol = 10) ##

[R] reinforce library to re-load

2007-07-03 Thread Weiwei Shi
Hi, I am wondering if there is a parameter in library() so that it can reinforce package to be reloaded. It helps when you test your modified package by yourself. Otherwise, my way is to re-start Rgui. (by reading ?library, I understand this option is not implemented) ...Both functions check and

Re: [R] reinforce library to re-load

2007-07-03 Thread Doran, Harold
I think you want to use detach() -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Weiwei Shi Sent: Tuesday, July 03, 2007 3:27 PM To: r-help@stat.math.ethz.ch Cc: [EMAIL PROTECTED] Subject: [R] reinforce library to re-load Hi, I am wondering

[R] Dealing with imported data

2007-07-03 Thread Susie Iredale
Hello all, I am a new R user and am having some difficulty using my imported data. I have finally figured out how to import my data by using the read.delim(Filename, header=TRUE) which took some time because I had to change the directory (a hint for others who might be struggling).

[R] Problems using imported data

2007-07-03 Thread Susie Iredale
(Repeat of previous HTML version) Hello all, I am a new R user and I have finally imported my data using read.delim(Filename.txt, header=TRUE) after some difficulty, by changing file directories (a hint to anyone who might be stuck there). However, I am now stuck trying to use my data.

[R] Non-linear constraints under Markowitz

2007-07-03 Thread Patrick C.
I am hoping to do some portfolio optimization where I want to maximize my possible return subject to the constraint that my variance is below a certain value and no short positions. Is there a way I can use optim to do this ? thanks [[alternative HTML version deleted]]

[R] Fine tunning rgenoud

2007-07-03 Thread Paul Smith
Dear All, I am trying to solve the following maximization problem, but I cannot have rgenoud giving me a reliable solution. Any ideas? Thanks in advance, Paul library(rgenoud) v - 0.90 O1 - 10 O2 - 20 O0 - v*O1+(1-v)*O2 myfunc - function(x) { U0 - x[1] U1 -

Re: [R] Non-linear constraints under Markowitz

2007-07-03 Thread Leeds, Mark \(IED\)
I think that problem has a complicated closed form solution but I'm not sure which text it is in. It might be in Ingersoll, Financial Decision Making. I'm sorry that I can't be less vague. It's also possible to derive it using a Langrange Multiplier. I did it once but that was a long time ago.

[R] Statistics Question not R question: competing risks and non-informative censoring

2007-07-03 Thread sj
All, I am working with Emergency Department (ED) Length of Stay Data. The ED visit can end in one of a variety of ways (Admit, discharge, transfer, etc...) Initially, I have modeled the time to event by fitting a survival model to the time the outcome of interest and treat all other outcomes

[R] (no subject)

2007-07-03 Thread Roy Mendelssohn
Hi: We are having some very strange problems with R on WIndows, both with R 2.4.1 and R 2.5.0. The following command: download.file(url=http://oceanwatch.pfeg.noaa.gov:8081/thredds/wcs/ satellite/AG/ssta/14day? request=GetCoverageversion=1.0.0service=WCSformat=NetCDF3coverage=

[R] Harrell's C

2007-07-03 Thread Madero Jarabo, Rosario
I need to calculate Harrell's C for some survival analyses using Design package with R version 2.4.1. ¿How can I try or do it? Rosario Madero Sección de Bioestadística Hospital Universitario La Paz Pºde la Castellana, 261 28046 Madrid, España Tfno: 917277112 [EMAIL PROTECTED]

[R] Kullback-Leibler divergence

2007-07-03 Thread Terrence Murphy
Dear R users, Is anyone willing to share some sample code using R that calculates the Kullback-Leibler divergence in information contained in the the posterior distribution relative to the prior for some simple continuous distribution such as a normal? We are thinking of an informative prior

Re: [R] Fine tunning rgenoud

2007-07-03 Thread Ravi Varadhan
Paul, You had indicated in your previous email that you are having trouble finding a feasible starting value for constrOptim(). So, you basically need to solve a system of linear inequalities to obtain a starting point. Have you considered using linear programming? Either simplex() in the boot

Re: [R] Fine tunning rgenoud

2007-07-03 Thread Paul Smith
On 7/3/07, Ravi Varadhan [EMAIL PROTECTED] wrote: You had indicated in your previous email that you are having trouble finding a feasible starting value for constrOptim(). So, you basically need to solve a system of linear inequalities to obtain a starting point. Have you considered using

Re: [R] Harrell's C

2007-07-03 Thread Frank E Harrell Jr
Madero Jarabo, Rosario wrote: I need to calculate Harrell's C for some survival analyses using Design package with R version 2.4.1. ¿How can I try or do it? Rosario Madero Sección de Bioestadística Hospital Universitario La Paz Pºde la Castellana, 261 28046 Madrid, España Tfno:

Re: [R] Problems using imported data

2007-07-03 Thread jim holtman
You have to read the data into an object: e.g., mydata - read.delim(Filename.txt, header=TRUE) and then you can access the data with 'mydata'. If you had test as a column header,then mydata$test will access that data. On 7/3/07, Susie Iredale [EMAIL PROTECTED] wrote: (Repeat of previous

Re: [R] Parsimony Analysis of Encemism in R?

2007-07-03 Thread Simon Blomberg
Short answer: No. Longer answer: R currently has some useful but relatively limited functions for phylogenetics. See the Statistical genetics task view on CRAN. The ape package is the most full-featured. Simon. On Tue, 2007-07-03 at 07:59 -0700, Milton Cezar Ribeiro wrote: Hi R-gurus, Is

Re: [R] Fine tunning rgenoud

2007-07-03 Thread Ravi Varadhan
Paul, It should be easy enough to check that your solution is valid (i.e. a local minimum): first, check to see if the solution satisfies all the constraints; secondly, check to see if it is an interior point (i.e. none of the constraints become equality); and finally, if the solution is an

Re: [R] bug in closing gzfile-opened connections?

2007-07-03 Thread Duncan Murdoch
On 03/07/2007 1:37 PM, David Reiss wrote: Hi, I am making multiple calls to gzfile() via read.table(), e.g. x - read.table( gzfile( xxx.gz ) ) After i do this many times (I haven't counted, but probably between 50 and 100 times) I get the error message: Error in open.connection(file,

Re: [R] Fine tunning rgenoud

2007-07-03 Thread Paul Smith
On 7/4/07, Ravi Varadhan [EMAIL PROTECTED] wrote: It should be easy enough to check that your solution is valid (i.e. a local minimum): first, check to see if the solution satisfies all the constraints; secondly, check to see if it is an interior point (i.e. none of the constraints become

Re: [R] Fine tunning rgenoud

2007-07-03 Thread Paul Smith
On 7/4/07, Ravi Varadhan [EMAIL PROTECTED] wrote: It should be easy enough to check that your solution is valid (i.e. a local minimum): first, check to see if the solution satisfies all the constraints; secondly, check to see if it is an interior point (i.e. none of the constraints become

[R] for loop doesn't stop with upper loop value

2007-07-03 Thread Alexander.Herr
Hi list, could anyone please educate me on the following: lst-seq(47, 239, by=12) for(n in lst) { lower=n; upper=lower+10 for(i in lower+2 : upper) { print(paste(n, i: , i, lower: ,lower, upper :, upper)) } } does not stop when i = upper A while loop fixes this but, I

Re: [R] for loop doesn't stop with upper loop value

2007-07-03 Thread Hong Ooi
___ lower+2 : upper parses as lower + (2:upper). The colon operator has fairly high precedence. What you want is (lower + 2):upper -- Hong Ooi Senior Research Analyst, IAG Limited 388 George St, Sydney NSW

Re: [R] Print grid/ggplot to a metafile

2007-07-03 Thread Paul Murrell
Hi Dieter Menne wrote: Dear UseRs called Hadley, or Paul, I am trying to print an edited ggplot2/grid graphics to a metafile. With the commented line below it works, but when I edit the plot by uncommenting the line, it fails, because it's illegal to have 2 graphics in a metafile. It

[R] Sorting the levels of a factor

2007-07-03 Thread Gordon Smyth
Dear Chunxu, I'm cc'ing my reply to the r-help mailing list. As I said in one of my previous replies to you, your questions really have to do with use of factors in R rather than anything specifically to do with the limma package, so they should go to a help list. The levels() function in R,

[R] constraining residual variance to zero in lme or lmer

2007-07-03 Thread toby909
Hi All I havent seen that lme or lmer allows to specify certain constraints (although I heard one could program ones own covariance structure). Specific constraints, including one on the residual variance can be specified in sas proc mixed. In my model I want to fix the residual variance to

Re: [R] for loop doesn't stop with upper loop value

2007-07-03 Thread Rolf Turner
On 4/07/2007, at 12:01 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi list, could anyone please educate me on the following: lst-seq(47, 239, by=12) for(n in lst) { lower=n; upper=lower+10 for(i in lower+2 : upper) { print(paste(n, i: , i, lower: ,lower, upper :,

Re: [R] Problems using imported data

2007-07-03 Thread Stephen Tucker
Actually, I believe attach() and detached() is discouraged nowadays... x - read.delim(Filename.txt, header=TRUE) You can access your data by column: x[,1] x[,c(1,3)] or if your first column is named Col1 and the third Col3, x[,Col1] x[,c(Col1,Col3)] and you can do the same to access by row -

Re: [R] Fine tunning rgenoud

2007-07-03 Thread RAVI VARADHAN
Paul, Here is another approach: I wrote an R function that would generate interior points as starting values for constrOptim. This might work better than the LP approach, since the LP approach gives you a starting value that is on the boundary of the feasible region, i.e a vertex of the

[R] retrieving stats from bwplot

2007-07-03 Thread Héctor Villalobos
Hi all, I want to retrieve the stats from a 'bwplot' with one factor. I have read the help for 'panel' function and I'm aware of the option 'stats' which defaults to 'boxplot.stats' but I didn't understand it well and therefore I am unable to get what I need. Thanks in advance. Héctor

Re: [R] exact AIC

2007-07-03 Thread Prof Brian Ripley
On Tue, 3 Jul 2007, Selene Zárate wrote: I am using the stepAIC function on the MASS package that does model selection by exact AIC. I'm not sure what the term 'exact AIC' means, and how it differs from AIC. It doesn't, but there are approximations to AIC in use. This is explained in the