[R] double integral calculation

2011-06-18 Thread Moohwan Kim
a=[0.1,0.2,0.1,0.3,0.4] b=[0.2,0.3,0.1,0.2,0.5] c=[1,1,1,1,1] log(c+a-x*b) where x=unknown scale variable. int=$$log(c+a-x*b)dadb, where $ denotes integral sign. Actually, how could I calculate the integral's approximation? double summation? best, moohwan

Re: [R] Bartlett's Test of Sphericity

2011-06-18 Thread Jeremy Miles
cortest.bartlett() in the psych package. I've never seen a non-significant Bartlett's test. Jeremy On 17 June 2011 12:43, thibault grava thibault.gr...@gmail.com wrote: Hello Dear R user, I want to conduct a Principal components analysis and I need to run two tests to check whether I can

Re: [R] Non-linear Regression best-fit line

2011-06-18 Thread Dennis Murphy
Hi: Perhaps the self-starting functions may be helpful. See ?selfStart. There are self-starting functions for both the logistic and Gompertz models (SSlogis and SSgompertz, respectively). Go through the examples to see how they work. HTH, Dennis On Fri, Jun 17, 2011 at 2:14 PM, Sean Bignami

[R] Applying function to all elements of a formula

2011-06-18 Thread Scott Fortmann-Roe
Hi, I would like to do a regression like: reg - lm(y~log(.), data) where the log function is applied to . in the form: log(x1)+ log(x2)+ log(x3)... instead of in the form log(x1+x2+x3+...) Is this possible? Thank you, Scott [[alternative HTML version

Re: [R] Applying function to all elements of a formula

2011-06-18 Thread Dennis Murphy
Yes, it's possible, but if you want to do prediction on future x-values, you will likely have a problem. One way to do it would be something like (assuming y is the first column of dat) reg - lm(y ~ log(as.matrix(dat[, -1])), dat) but the output would be pretty ugly (see summary(reg)). Another

Re: [R] Bartlett's Test of Sphericity

2011-06-18 Thread Ted Harding
To add to Jeremy's comment below: The Bartlett test is very sensitive to non-normality in the data, so can readily give significant results even for non-correlated data. Ted. On 18-Jun-11 06:47:52, Jeremy Miles wrote: cortest.bartlett() in the psych package. I've never seen a non-significant

Re: [R] Applying function to all elements of a formula

2011-06-18 Thread Dimitris Rizopoulos
maybe another way is by reconstructing the formula using paste(), e.g., data - data.frame(y = rnorm(5), x1 = runif(5), z = runif(5), age = runif(5)) nameRsp - y nams - names(data) namsX - nams[!nams %in% nameRsp] form - as.formula(paste(nameRsp, ~ , paste(log(, namsX, ), sep = ,

Re: [R] Non-linear Regression best-fit line

2011-06-18 Thread peter dalgaard
On Jun 17, 2011, at 23:14 , Sean Bignami wrote: I am trying to fit a curve to a cumulative mortality curve (logistic) where y is the cumulative proportion of mortalities, and t is the time in hours (see below). Asym. at 0 and 1 y [1] 0. 0.04853859 0.08303777 0.15201970 0.40995074

Re: [R] Bartlett's Test of Sphericity

2011-06-18 Thread peter dalgaard
On Jun 18, 2011, at 10:48 , (Ted Harding) wrote: To add to Jeremy's comment below: The Bartlett test is very sensitive to non-normality in the data, so can readily give significant results even for non-correlated data. Hmm, I wouldn't bet on that. Correlation tests are usually fairly robust.

Re: [R] is this a bug?

2011-06-18 Thread Albert-Jan Roskam
Thanks a lot to all who responded. This is a little less confusing now, although it's hard for me to fathom the (practical) use of a dataframe within a dataframe. If one mixes different notations, or, put in a different way, different underlying classes (data.frame vs. numeric), these rather

Re: [R] rle on large data . . . without a for loop!

2011-06-18 Thread Dennis Murphy
Hi Justin: I'm not dead certain this is what you were after, but try this: dat-data.frame(id = rep(1:5, each = 200), state=sample(1:3, 1000, replace=TRUE, prob=c(0.7,0.05,0.25)), V1=runif(1000, 1, 10), V2=rnorm(1000)) ## input a data

[R] how to subtract one string from another in R

2011-06-18 Thread Vijayan Padmanabhan
Dear R Group Here is what i am trying to do.. but couldnt figure out how.. string-ABC DEFG HIJKLM NOPQ RSTUV WXY string1-substr(string,1,4) I want to create an R object string 2 ( following the logic shown).. R does not allow string subtraction.. any suggestions how to achieve this?

Re: [R] Applying function to all elements of a formula

2011-06-18 Thread Dennis Murphy
Much better..nice! Dennis On Sat, Jun 18, 2011 at 1:53 AM, Dimitris Rizopoulos d.rizopou...@erasmusmc.nl wrote: maybe another way is by reconstructing the formula using paste(), e.g., data - data.frame(y = rnorm(5), x1 = runif(5),    z = runif(5), age = runif(5)) nameRsp - y nams -

Re: [R] is this a bug?

2011-06-18 Thread Dennis Murphy
Hi: It's also simpler to use transform() or within(), especially if you want to create and/or modify multiple variables in a data frame. For example, df- data.frame(weight=round(runif(10, 10, 100)), sex=round(runif(100, 0, 1))) df - transform(df, pct = 100 * weight/ave(weight,

[R] Hidden Markov Chains - mhsmm

2011-06-18 Thread Lui ##
Dear R-Users, I am currently trying my luck with Hidden Markov Chains and use the package mhsmm. I was very shocked to see how the initial values for the transition matrix and probability distributions affected the outcomes. The results were extremely different even for small changes in the

Re: [R] how to subtract one string from another in R

2011-06-18 Thread Santosh Srinivas
Hello Vijayan, Depending on your end goal the following could possibly help substr(string,nchar(string1)+1, nchar(string)) or strsplit(string, ) HTH, Santosh On Sat, Jun 18, 2011 at 2:06 PM, Vijayan Padmanabhan padmanabhan.vija...@gmail.com wrote: Dear R Group Here is what i am trying to

[R] Unexpected result with lag() et diff() in plm package.

2011-06-18 Thread Michael Ash
I have an unexpected result with the functions lag() and diff() in the plm (panel data) package when used with transform(). These plm-specific functions are supposed to generate lags and first differences within each panel. lag() does not work properly the first time (it reproduces the same

Re: [R] how to subtract one string from another in R

2011-06-18 Thread Dennis Murphy
Is this what you're looking for? string - ABC DEFG HIJKLM NOPQ RSTUV WXY unlist(strsplit(string, )) [1] ABCDEFG HIJKLM NOPQ RSTUV WXY HTH, Dennis On Sat, Jun 18, 2011 at 1:36 AM, Vijayan Padmanabhan padmanabhan.vija...@gmail.com wrote: Dear R Group Here is what i am trying to do..

Re: [R] how to subtract one string from another in R

2011-06-18 Thread Dennis Murphy
Hi: I think I misread your intentions the first time. Is this more in line with what you want? f - function(s) { ssp - unlist(strsplit(string, )) n - length(ssp) splits - grep(' ', ssp) sapply(splits, function(x) paste(ssp[-(1:x)], collapse = )) } f(string) [1] DEFG

Re: [R] Bartlett's Test of Sphericity

2011-06-18 Thread David Cross
Yes, Bartlett's is not a good way to justify a PCA. David Cross d.cr...@tcu.edu www.davidcross.us On Jun 18, 2011, at 1:47 AM, Jeremy Miles wrote: cortest.bartlett() in the psych package. I've never seen a non-significant Bartlett's test. Jeremy On 17 June 2011 12:43, thibault

[R] Required libraries

2011-06-18 Thread Trying To learn again
Hi all, I´m trying to recuperate old files I wrotte and I´m trying to execute on R version 2.13.0 (2011-04-13), the thing is I execute my old file and nothing happens...I suposse I need to install some library but there no appears no message, no text telling required grafics library or something

Re: [R] Server question

2011-06-18 Thread Duncan Murdoch
On 11-06-17 10:35 AM, Oliver Jones wrote: Hi A client of mine has asked me to investigate the installation of R-software. Could anyone tell me whether the software works only on a client machine or whether it sits on a server with clients attaching to it? Not immediately clear from the

Re: [R] profile plot in R

2011-06-18 Thread Duncan Murdoch
On 11-06-17 3:43 PM, Vickie S wrote: Hi friends, I have a matrix with following format. group var1 var2 ...varN c1 group1 1.2399 1.4990-1.4829 c2 group4 0.8989 0.7849.1.8933 ... ... c100 group10 . I want to draw a profile plot of each condition c1 to c100, which

Re: [R] Will R CMD build delete the .Rnw file?

2011-06-18 Thread Duncan Murdoch
On 11-06-17 9:07 AM, Yang Lu wrote: Hi, I used R CMD build to build a package but realized that the .Rnw file was deleted after the .tar.gz file was generated. Is it supposed to be the case? If not, any idea as to why it happened? No, R should not delete .Rnw files. No idea why it

Re: [R] NonParametric Anova

2011-06-18 Thread Tal Galili
Hi Loo, This topic has been asked a lot. I've complied a bunch of tutorials and relevant functions here: http://www.r-statistics.com/2010/04/repeated-measures-anova-with-r-tutorials/ If you find resources which I haven't listed, please let me know... Best, Tal Contact

Re: [R] Bartlett's Test of Sphericity

2011-06-18 Thread Tal Galili
Hi Thibault, Not that I think you'll use this after the above responses, but for the record, have a look at: ?bartlett.test Cheers, Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me:

[R] Justify PCA? -- was: Bartlett's Test of Sphericity

2011-06-18 Thread Bert Gunter
Apologies for the obvious, but just to clarify: there is no reason to justify a PCA -- it's just an eigen decomposition of a matrix and is therefore justified by linear algebra. If one wants to determine whether some subset of the eigenvectors = principal components suffice to represent the data

[R] Array

2011-06-18 Thread Muhammad Rahiz
Hi, Can someone advise why the followind did not produce the array, given the condition specified? s - 1 a1 - array(dim=c(1,4)) a2 - array(dim=c(2,4)) arr - ifelse(s==0,a1,a2) Thanks. Muhammad __ R-help@r-project.org mailing list

Re: [R] Array

2011-06-18 Thread Duncan Murdoch
On 11-06-18 10:45 AM, Muhammad Rahiz wrote: Hi, Can someone advise why the followind did not produce the array, given the condition specified? s- 1 a1- array(dim=c(1,4)) a2- array(dim=c(2,4)) arr- ifelse(s==0,a1,a2) See the Value section of ?ifelse. Duncan Murdoch

Re: [R] Array

2011-06-18 Thread jim holtman
Try using 'if': s - 1 a1 - array(dim=c(1,4)) a2 - array(dim=c(2,4)) arr - if (s == 1) a1 else a2 str(arr) logi [1, 1:4] NA NA NA NA On Sat, Jun 18, 2011 at 10:45 AM, Muhammad Rahiz muhammad.ra...@ouce.ox.ac.uk wrote: Hi, Can someone advise why the followind did not produce the array,

Re: [R] Array

2011-06-18 Thread Muhammad Rahiz
Understood now. Thanks Duncan. Muhammad On Sat, 18 Jun 2011, Duncan Murdoch wrote: On 11-06-18 10:45 AM, Muhammad Rahiz wrote: Hi, Can someone advise why the followind did not produce the array, given the condition specified? s- 1 a1- array(dim=c(1,4)) a2- array(dim=c(2,4)) arr-

Re: [R] profile plot in R

2011-06-18 Thread Joshua Wiley
Hi, Another easy option would be to convert your data to long format and then use ggplot2 or lattice. Something like (though not exact without a reproducible example): require(ggplot2) long.dat - melt(your_data, arguments) ggplot(long.dat, aes(x = variable, y = value)) +

Re: [R] Server question

2011-06-18 Thread Mike Marchywka
From: oliver.jo...@digred.com To: r-help@r-project.org Date: Fri, 17 Jun 2011 15:35:38 +0100 CC: rebeccahard...@deltaeconomics.com Subject: [R] Server question Hi A client of mine has asked me to investigate the installation of R-software. Could anyone tell me

Re: [R] how to subtract one string from another in R

2011-06-18 Thread Vijayan Padmanabhan
Dear Dennis/Santosh Got some ideas from both your suggestions.. Here is what finally i derived as a solution to my problem.. The final R object string2 holds what i want now as a vector of substrings of the desired length derived from the main string. string-ABC DEFG HIJKLM NOPQ RSTUV WXY

[R] different results from nls in 2.10.1 and 2.11.1

2011-06-18 Thread Philip Bett
Hi, I've noticed I get different results fitting a function to some data on my laptop to when I do it on my computer at work. Here's a code snippet of what I do: ##-- require(circular) ## for Bessel function I.0 ## Data: dd -

Re: [R] is this a bug?

2011-06-18 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Albert-Jan Roskam Sent: Saturday, June 18, 2011 2:44 AM To: Brian Diggs; R-help@r-project.org Subject: Re: [R] is this a bug? Thanks a lot to all who responded. This is a

Re: [R] Server question

2011-06-18 Thread Steve Lianoglou
Hi, On Fri, Jun 17, 2011 at 10:35 AM, Oliver Jones oliver.jo...@digred.com wrote: Hi A client of mine has asked me to investigate the installation of R-software. Could anyone tell me whether the software works only on a client machine or whether it sits on a server with clients attaching to

Re: [R] Bartlett's Test of Sphericity

2011-06-18 Thread Daniel Malter
I do not understand why that would be the case as the only input involving the relationship of the data is the determinant of the correlation matrix. For what you suggest to be true, the non-normality of the data would have to introduce correlation. If what you are saying is true, we would

Re: [R] Bartlett's Test of Sphericity

2011-06-18 Thread peter dalgaard
On Jun 18, 2011, at 15:48 , Tal Galili wrote: Hi Thibault, Not that I think you'll use this after the above responses, but for the record, have a look at: ?bartlett.test That's the other Bartlett's test, namely the one for comparison of variances. That test is well known to rely on higher

Re: [R] Justify PCA? -- was: Bartlett's Test of Sphericity

2011-06-18 Thread peter dalgaard
On Jun 18, 2011, at 16:26 , Bert Gunter wrote: Apologies for the obvious, but just to clarify: there is no reason to justify a PCA -- it's just an eigen decomposition of a matrix and is therefore justified by linear algebra. If one wants to determine whether some subset of the eigenvectors

[R] Pass Vector from R to C

2011-06-18 Thread Jaimin Dave
Hi , I have a function which passes a vector from R to C. However the size of the vector is decided inside the c program. But as I have to pass the size while calling the function from R lot of my space is getting wasted. Is there any other alternative? I call c function as :

Re: [R] Bartlett's Test of Sphericity

2011-06-18 Thread Daniel Malter
Thanks for the clarification. That makes sense. To summarize, bartlett.test() in the base distribution of R is not the sphericity test, and it relies on the higher moments of the normal distribution. The sphericity test can be computed with the formula provided or the one implemented in the psych

[R] Trouble with Paste and Quotes and List Objects

2011-06-18 Thread Sparks, John James
Dear R Helpers, I have a list that contains a number of objects, each of them financial statement data from quantmod (although I don't think that knowledge of quantmod is necessary to help with this problem). str(listfinobj) chr [1:4815] A.f AA.f AACC.f AAME.f AAN.f AAON.f AAP.f AAPL.f AAT.f

Re: [R] Trouble with Paste and Quotes and List Objects

2011-06-18 Thread peter dalgaard
On Jun 18, 2011, at 23:05 , Sparks, John James wrote: Dear R Helpers, I have a list that contains a number of objects, each of them financial statement data from quantmod (although I don't think that knowledge of quantmod is necessary to help with this problem). str(listfinobj) chr

Re: [R] Hidden Markov Chains - mhsmm

2011-06-18 Thread Rolf Turner
(1) Repeatedly sending the same message to this list is not a good idea. (2) It would probably be most efficacious for you to contact the maintainer of the mhsmm package. Type maintainer(mhsmm) to find out who this is! cheers, Rolf Turner

Re: [R] Errorbars

2011-06-18 Thread Peter Ehlers
On 2011-06-17 06:24, anna Harris wrote: Hi, Does anyone know how i get rid of the marker point in my error bars? The bars default function (it seems) is to have a dot in the middle of the bar, however i don't want it there. I am using Hmis to draw my errorbars and code is

Re: [R] Pass Vector from R to C

2011-06-18 Thread Barry Rowlingson
On Sat, Jun 18, 2011 at 7:08 PM, Jaimin Dave davejaim...@gmail.com wrote: Hi , I have a function which passes a vector from R to C. However the size of the vector is decided inside the c program. But as I have to pass the size while calling the function from R lot of my space is getting