[R] R on QNX
Hi, Has anyone attempted to compile R on QNX 4.x or 6.x ? It would be particularly cool if there is a precompiled version somewhere on the QNX software archives. Thank you very much !! Suresh ps. Please cc replies to my address if possible... __ 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, self-contained, reproducible code.
[R] Nonlinear fitting - reparametrization help
Hi, I am trying to fit a function of the form: y = A0 + A1 * exp( -0.5* ( (X - Mu1) / Sigma1 )^2 ) - A2 * exp ( -0.5* ( (X-Mu2)/Sigma2 )^2 ) i.e. a mean term (A0) + a difference between two gaussians. The constraints are A1,A2 0, Sigma1,Sigma20, and usually Sigma2Sigma1. The plot looks like a Mexican Hat. I had trouble (poor fits) fitting this function to toy data in Matlab and now I am playing with R's nls and optim functions. I keep running into singular gradient errors with nls, even with very different starting values, and have not yet figured out how to interpret the trace results usefully. Can someone help ? Is there a correct parameterization for this problem ? I have appended some R code with sample data to fit. Thank you !!! Suresh; please cc [EMAIL PROTECTED] if possible. ~~~ x=seq(-10,10,length=1000) a0=0; ae=1; me=0; se=1; ai=0.5; mi=0; si=3; dogy - function(x,a0,ae,me,se,ai,mi,si){ y=a0+ae*exp(-0.5*(((x-me)/se)^2))-ai*exp(-0.5*(((x-mi)/si)^2)) y} y=dogy(x,a0,ae,me,se,ai,mi,si) erval=rnorm(length(y),sd=0.02) y=y+erval #plot(x,y+erval) #fit=nls(y~ae*exp((x/se)^2)-ai*exp((x/si)^2),start=c(ae=.8,se=1.1,ai=.2,si=1),trace=TRUE) #here I tried to unsuccesfully reduce the model by eliminating A0, Mu1, and Mu2 __ 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, self-contained, reproducible code.
Re: [R] The problem with rcom pakage
You need the 2.0 beta package available at: http://sunsite.univie.ac.at/rcom/download/RSrv200beta.exe Also, there is a rcom mailing list at http://mailman.csd.univie.ac.at/mailman/listinfo/rcom-l for more help. Suresh On Tue, 08 Nov 2005 06:42:37 -0500, Julia Ivanova [EMAIL PROTECTED] wrote: I have the problem with rcom 1.2.2 package. It does't work with R 2.2.0. Is there any opportunities to correct the work of this package? Thanks for your help. Yulia __ 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 __ 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
[R] MGARCH estimation
Hi R-users Can the users let me know how to do MGARCH estimate (Bivariate GARCH) and volatility forecast for 2 variables in R. thanks and regards snvk __ 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
[R] minimal hedge variance ratio
Hi all i have two data sets, spot and futures cash market prices. to estimate the minimum variance hedge ratio, i first had a glance on the correlation coefficient of relative price change (ln(St / St-1). surprizingly the value is just 0.2 compared to actual price correlation of 0.9. (i did regress the spot change on future change, co-effi is 0.3, and R2 is only 0.025 a) in such scenario can someone help me in estimating the ratio which are time varying. b) is there a way to define the function as the correlation will work at given level of basis (futures - spot). thank u for the help and co-operation rgds snvk __ 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
Re: [R] significance of spectal peak with spectrum()
I am very much a naive and interested beginner, so I am not at all sure if you will find this reference http://snipurl.com/hq2j interesting S. Uwe Ligges wrote: Sebastian Leuzinger wrote: the null hypothesis would be: one particular frequency peak is not significantly different from the background noise. So you want to know, e.g., whether there is something going on at 1000 Hz? This is difficult: If you are considering the periodogram to be a density, then you do not know the distribution of the value of a single frequency, because it depends on the stuff going on at other frequencies. Second point is (and already asked): Kind of [background] noise? The only really easy test is for the Null signal is white noise, hence H1 is at least one non-white-noisy frequency. [If somebody knows a really good book or papers that cover other cases than the trivial one mentioned above, I am very interested to hear about them, BTW.] If you have another kind of noise (such as blue or pink noise), things become even worse. Uwe Ligges On Friday 16 September 2005 09:28, you wrote: Sebastian Leuzinger wrote: Hello, has anybody got a simple recepie to test the significance level of the peaks after using spectrum() ? What is you null hypothesis? - Kind of noise? - One particular frequency is noisy or all noisy? - ... Uwe Ligges (R-version 2.0.1, linux SuSE9.3) __ 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 __ 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
[R] help required on read.table
Hi all i am facing a peculiar problem for data input using read.table which i never faced previously. i have a data file by name abnew.txt with two coloumns data as depicted below. A B 420 422 314 321 the txt file is created using the excel save as option. i issued the statement as a - read.table(abnew.txt, header=TRUE) a X.þS 1 NA 2 2 3 2 4 NA 5 2 6 2 7 NA 8 2 9 2 10 NA the o/p looks like as copied above. can some one help me on correct data reading. your earliest response will help me a lot. thanks and regards snvk __ 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
[R] problem with read.table
Hi All recently i faced an unknown problem while reading the data. Can someone help me in understanding why this happened. I have .txt file containing X, Y, Z variables. I used the command a - read.table(filename, header=TRUE) after reading the file i am able to view it by tryping a. but i am unable to access the variables in a, by giving the command a$X. a$X NULL this is the output it was showing. However the same i am able to access by giving a[[1]]. i tried changing the mode by issuing command a - as.data.frame(a). But situation remains the same. look forward for experts suggestion on this. rgds snvk __ 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
Re: [R] problem with read.table
Hi Mr. Pedro I tried names(a) and it displayed the names as X, Y and Z. rgds snvk On 8/25/05, Pedro J. Aphalo [EMAIL PROTECTED] wrote: Hi, Did you try names(a) so see what are the names of the columns in the dataframe? Hope this helps a little. Pedro. Krishna wrote: Hi All recently i faced an unknown problem while reading the data. Can someone help me in understanding why this happened. I have .txt file containing X, Y, Z variables. I used the command a - read.table(filename, header=TRUE) after reading the file i am able to view it by tryping a. but i am unable to access the variables in a, by giving the command a$X. a$X NULL this is the output it was showing. However the same i am able to access by giving a[[1]]. i tried changing the mode by issuing command a - as.data.frame(a). But situation remains the same. look forward for experts suggestion on this. rgds snvk __ 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 -- == Pedro J. Aphalo Department of Biological and Environmental Science University of Jyväskylä P.O. Box 35, 40351 JYVÄSKYLÄ, Finland Phone +358 14 260 2339 Mobile +358 50 3721504 Fax+358 14 260 2321 mailto:[EMAIL PROTECTED] http://www.jyu.fi/~aphalo/ ,,,^..^,,, == __ 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
Re: [R] correlation by subset
Hi Mr. Cleland it worked excellently well, and i believe the same logic or function by() can be used even for running regressions on subsets of huge datasets. correct me if iam wrong thank you for the help rgds snvk On 8/24/05, Krishna [EMAIL PROTECTED] wrote: Hi Mr. Cleland Could you please detail the function. Thanks and best regards snvk On 8/24/05, Chuck Cleland [EMAIL PROTECTED] wrote: by(mydata, mydata$GROUPING, function(x) cor(x$x, x$y, use=pair)) ?by Krishna wrote: Hi all Having searched the available documentation on R, I request for help in sorting out the underlying problem. I have a huge dataset containing 2 variables x and y, which is a daily price series. I would like to observe the quarterly correlations among these two variables. Is there anyway where i can calculate cor.coeff by using a grouping variable in R. thanks in advance for the help rgds snvk __ 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 -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 452-1424 (M, W, F) fax: (917) 438-0894 __ 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
[R] help on retrieving output from by( ) for regression
Hi all I used a function qtrregr - by(AB, AB$qtr, function(AB) lm(AB$X~AB$Y)) objective is to run a regression on quartery subsets in the data set AB, having variables X and Y, grouped by variable qtr. Now i retrieved the output using qtrregr, however it only showed the coefficients (intercept and B) with out significant levels and residuals for each qtr. Can some on help me on how can retrieve the detailed regression output. rgds snvk __ 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
[R] correlation by subset
Hi all Having searched the available documentation on R, I request for help in sorting out the underlying problem. I have a huge dataset containing 2 variables x and y, which is a daily price series. I would like to observe the quarterly correlations among these two variables. Is there anyway where i can calculate cor.coeff by using a grouping variable in R. thanks in advance for the help rgds snvk __ 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
Re: [R] correlation by subset
Hi Mr. Cleland Could you please detail the function. Thanks and best regards snvk On 8/24/05, Chuck Cleland [EMAIL PROTECTED] wrote: by(mydata, mydata$GROUPING, function(x) cor(x$x, x$y, use=pair)) ?by Krishna wrote: Hi all Having searched the available documentation on R, I request for help in sorting out the underlying problem. I have a huge dataset containing 2 variables x and y, which is a daily price series. I would like to observe the quarterly correlations among these two variables. Is there anyway where i can calculate cor.coeff by using a grouping variable in R. thanks in advance for the help rgds snvk __ 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 -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 452-1424 (M, W, F) fax: (917) 438-0894 __ 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
[R] optimal hedge variance ratio
Hi All, I am trying to finding out what could be an optimal hedge variance ratio between spot and futures markets, between whose the degree of correlation is highly varying. For some reasons the hedge time period cannot extend for more than 1 month. So just to get an hint, I have calculated monthly correlation coefficients which are highly varying. I am copying the frequency distribution of monthly correlation coefficient values (karl-pearsons') to indicating the degree of volatility. Corre range Frequency -0.70 0.00% -0.52 3.08% -0.33 4.62% 0 7 10.77% 0.3 7 10.77% 0.5 6 9.23% 0.7 16 24.62% 0.9 15 23.08% 1 9 13.85% Can someone throw light on which model to use and how to approach for desiging a hedge model (estimate hedge variance ratio) in such a scenario. Help requested at the earliest. thanks for the attention and best rgds snvk __ 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
[R] help on cross hedge optimal hedge variance ratio
Hi everyone I am trying to estimate the optimal hedge variance ratio for cross hedging two commodities. the price levels are used (compared to price change and % price change) and used the OLS with dummy variable for estimating the co-efficients. the equation looks like this Y = B + B1*D1 + B2*X + B3*(X*D1) Where Y = Daily Cash market price D1 = Dummy variable taking value 1 for period Oct-Mar and 0 for Apr-Sep X = Daily futures market price on which cross hedging is done. B,B1,B2,B3 are the slope co-efficients. The results look like this Regression Statistics Multiple R 0.948702709 R Square0.900036831 Adjusted R Square 0.89981135 Standard Error 25.52050965 Observations1334 CoefficientsStandard Error t Stat P-value Intercept 53.817 4.375 12.300 0.000 X 0.986 0.012 80.283 0.000 D1 27.399 6.106 4.487 0.000 D1 * X -0.100 0.017 -5.820 0.000 It is understood the slope co-efficients for different periods are significant as indicated by t-table value. But I feel suspicious on the reliability of this values. I have used 5 years of daily price data for running the regression, and I feel suscpicious becasue, the monthly correlations (pearson correlation co-efficient) are highly varying between spot and futures and some times even negative. Can someone suggest me a) the tests to judge the reliability of hedge-variance values b) Is there any other better method than described here for estimating the hedge-variance values Thank you for the attention and look forward for an early reply rgds snvk __ 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
[R] error loading nlme package
Hi everyone The suggestion I received from Mr. Dimitris Rizopoulos and Mr. Gabor Grothendieck seems to work well. But unfortunately when I am trying to load nlme package, the following error message is generated. Please help me on this, at the earliest. library(nlme) Error in loadNamespace(i, c(lib.loc, .libPaths()), keep.source) : There is no package called 'lattice' In addition: Warning message: package 'nlme' was built under R version 2.0.1 Error in library(nlme) : package/namespace load failed for 'nlme' Though i am using the version R 2.0.0. A couple of hours back it was loaded, in the new session this problem is generated. regards Krishna __ 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
[R] help on regression by subsets in dataset
Hi Everyone May I request for a small help while performing the regression analysis. I would like to know is there any possibility of conducting the regression for different data subsets (in the same data file), classified on the basis of grouping variable. The alternative for this is running the regression for n number of times which you all know is quite cumbersome. Thank you for your kind attention and help rgds krishna __ 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
Re: [R] [OT] gmail filter for R-help and R-devel lists
i dont use gmail, but this method *may* run into problems if people are replying to a message and r-help is on the cc: line. thunderbird has a to: or cc: option for this... is gmail's to: field a default for to: or cc: ? -s. Deepayan Sarkar wrote: On 6/30/05, Douglas Bates [EMAIL PROTECTED] wrote: This is slightly off-topic but I would be interested in whether anyone has succeeded in creating a filter expression for Google's gmail system that will select messages sent through the R-help and R-devel lists. It seems as if it should be easy to select on '[R]' or '[Rd]' in the subject line but I haven't been able to work out the exact syntax that would do this and not select messages that have an 'R' anywhere in the subject. I filter on the To field, which mostly works: Matches: to:(r-help@stat.math.ethz.ch) Do this: Skip Inbox, Apply label r-help Matches: to:([EMAIL PROTECTED]) Do this: Skip Inbox, Apply label r-help Deepayan __ 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 __ 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
Re: [R] cor vs cor.test
From: ?cor.test Arguments: x, y: numeric vectors of data values. 'x' and 'y' must have the same length. -s. Michael Grant wrote: Using Windows System, R 2.1.0 d is a data frame, 48 rows, 10 columns cor(d) works properly providing all pairwise Pearson correlation coefficients among columns cor.test(d) gives error message Error in cor.test.default(d) : argument y is missing, with no default Why? Thanks, MCG __ 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 __ 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
Re: [R] website reference for building R packages
it is the first link if you type making packages into the google search box here: http://maths.newcastle.edu.au/~rking/R/ -s. Laura Holt wrote: Hi R People: A few weeks ago, someone put a link to a website for how to for building R packages. It was very nice. But of course, I have misplaced the link. Does anyone still have that, please? It was someone from the University of Chicago, I believe. Thanks in advance. Sincerely, Laura Holt mailto: [EMAIL PROTECTED] __ 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 __ 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
Re: [R] hello
http://snipurl.com/f0xh (leads you to packages 'ade4' and 'MASS') -s. Navarre Sabine wrote: I would like to donc an AFC (factoriel correspondance analysis) and I know that on Splus, the function to do that is afc(data). But on R??? is it acm? That a lot! Sabine - ils, photos et vidéos ! [[alternative HTML version deleted]] __ 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 __ 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
Re: [R] R2.1.0: Bug in list.files
Is that the entire story ? I tried this with yesterday's patched version (windows xp) and found: list.files(getwd(),*.txt,full=T) Error in list.files(path, pattern, all.files, full.names, recursive) : invalid 'pattern' regular expression list.files(getwd(),'.txt',full=T) [1] C:/Documents and Settings/suresh/BDE_SysInfo.txt [2] C:/Documents and Settings/suresh/dxva_sig.txt Replacing *.txt with '*.txt' seems to do something. -s. Uwe Ligges wrote: Steve Roberts wrote: R2.0.1 (MS Windows) list.files(myloc,*.zip,full=T) [1] P:/SARsoftware/Rlibraries/gnlm_0.1.zip [2] P:/SARsoftware/Rlibraries/lms2_0.2.zip R2.1.0: list.files(myloc,*.zip,full=T) Error in list.files(path, pattern, all.files, full.names, recursive) : invalid 'pattern' regular expression Bug? or have I missed something You missed to read the NEWS that tells you: o The regular expression code is now based on that in glibc 2.3.3. It has stricter conformance to POSIX, so metachars such as { } + * may need to be escaped where before they did not (but could have been). Probably you want list.files(pattern = \\.zip$, full.names = TRUE) Uwe Ligges Steve. Dr Steve Roberts [EMAIL PROTECTED] Senior Lecturer in Medical Statistics, CMMCH NHS Trust and University of Manchester Biostatistics Group, 0161 275 5192/5764 / 0161 276 5785 __ 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 __ 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 __ 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
Re: [R] R2.1.0: Bug in list.files
oops, my fault. i missed typing the key '*' character in the second version. apologies !!! suresh Suresh Krishna wrote: Is that the entire story ? I tried this with yesterday's patched version (windows xp) and found: list.files(getwd(),*.txt,full=T) Error in list.files(path, pattern, all.files, full.names, recursive) : invalid 'pattern' regular expression list.files(getwd(),'.txt',full=T) [1] C:/Documents and Settings/suresh/BDE_SysInfo.txt [2] C:/Documents and Settings/suresh/dxva_sig.txt Replacing *.txt with '*.txt' seems to do something. -s. Uwe Ligges wrote: Steve Roberts wrote: R2.0.1 (MS Windows) list.files(myloc,*.zip,full=T) [1] P:/SARsoftware/Rlibraries/gnlm_0.1.zip [2] P:/SARsoftware/Rlibraries/lms2_0.2.zip R2.1.0: list.files(myloc,*.zip,full=T) Error in list.files(path, pattern, all.files, full.names, recursive) : invalid 'pattern' regular expression Bug? or have I missed something You missed to read the NEWS that tells you: o The regular expression code is now based on that in glibc 2.3.3. It has stricter conformance to POSIX, so metachars such as { } + * may need to be escaped where before they did not (but could have been). Probably you want list.files(pattern = \\.zip$, full.names = TRUE) Uwe Ligges Steve. Dr Steve Roberts [EMAIL PROTECTED] Senior Lecturer in Medical Statistics, CMMCH NHS Trust and University of Manchester Biostatistics Group, 0161 275 5192/5764 / 0161 276 5785 __ 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 __ 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 __ 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 __ 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
Re: [R] density function
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/20509.html -s. Hui Han wrote: Thank you very much, Professor Ripley. If possible, could you point me to other packages that you think I should look at for estimating a derivative? Best regards, Hui Prof Brian Ripley wrote: On Tue, 10 May 2005, Hui Han wrote: I wonder if the function density outputs the gaussian mixture formula that is estimated from the input data, assuming a gaussian model is used at each data point ? I want to take the derivative of the finally estimated gaussian mixture formula for further analysis. It is a kernel density estimate: a rather trivial mixture, not necessarily Gaussian. Also, it is not set up to optimally estimate a derivative, and you should look at more sophisticated methods in other packages if you want to do that. As to what density outputs: see its help page. __ 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 __ 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
Re: [R] Multiple IF statements - is there a better alternative?
are you looking for something like: InternalMean - mean(data1[,3]) TestValues - c(0,1,2,4,9) #should be in increasing order TestResults - c(.95, .85, .7, NaN,0) if (InternalMean==0) IntResult=1 else IntResult=TestResults[which(TestValues==max(TestValues[TestValuesInternalMean]))] -s. Jones, Glen R wrote: Hello, Rather than rely on a set of IF statements (as there could be many - please see below)), could the following be done in a different/better way? InternalMean - mean(data1[,3]) if (InternalMean == 0) Intresult = 1 if (InternalMean 0 InternalMean 1) Intresult = .95 if (InternalMean = 1 InternalMean 2) Intresult = .85 if (InternalMean = 2 InternalMean 4) Intresult = .70 ... if (InternalMean = 9) Intresult = .0 Thanks in advance Glen Jones Value Analyst Industry Framework Governance Telstra Corporation Limited Tel: (03) 9634 7280 email: [EMAIL PROTECTED] The information contained in this e-mail message may be confidential. If you are not the intended recipient, any use of, interference with, disclosure or copying of this material is unauthorised and prohibited. If you have received this message in error, please notify me by reply e-mail and then delete the message. [[alternative HTML version deleted]] __ 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 __ 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
Re: [R] Multiple IF statements - is there a better alternative?
oops, i meant something more like: TestValues - c(0,1,2,4,9) #should be in increasing order TestResults - c(.95, .85, .7, NaN,0) if (InternalMean==0) IntResult=1 else IntResult=TestResults[TestValues==max(TestValues[TestValues=InternalMean])] -s. Suresh Krishna wrote: are you looking for something like: InternalMean - mean(data1[,3]) TestValues - c(0,1,2,4,9) #should be in increasing order TestResults - c(.95, .85, .7, NaN,0) if (InternalMean==0) IntResult=1 else IntResult=TestResults[which(TestValues==max(TestValues[TestValuesInternalMean]))] -s. Jones, Glen R wrote: Hello, Rather than rely on a set of IF statements (as there could be many - please see below)), could the following be done in a different/better way? InternalMean - mean(data1[,3]) if (InternalMean == 0) Intresult = 1 if (InternalMean 0 InternalMean 1) Intresult = .95 if (InternalMean = 1 InternalMean 2) Intresult = .85 if (InternalMean = 2 InternalMean 4) Intresult = .70 ... if (InternalMean = 9) Intresult = .0 Thanks in advance Glen Jones Value Analyst Industry Framework Governance Telstra Corporation Limited Tel: (03) 9634 7280 email: [EMAIL PROTECTED] The information contained in this e-mail message may be confidential. If you are not the intended recipient, any use of, interference with, disclosure or copying of this material is unauthorised and prohibited. If you have received this message in error, please notify me by reply e-mail and then delete the message. [[alternative HTML version deleted]] __ 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 __ 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 __ 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
Re: [R] R Greenhouse-Geiser correction?
see these threads: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/46512.html http://finzi.psych.upenn.edu/R/Rhelp02a/archive/15653.html -suresh Darren Weber wrote: Is there a function in R for doing Greenhouse-Geiser correction in ANOVA models? Is it already available in the aov function? How do we use it? Best, Darren [[alternative HTML version deleted]] __ 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 __ 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
[R] Contingency table: logistic regression
Hi, I am analyzing a data set with greater than 1000 independent cases (collected in an unrestricted manner), where each case has 3 variables associated with it: one, a factor variable with 0/1 levels (called XX), another factor variable with 8 levels (X) and a third response variable with two levels (Y: 0/1). I am trying to see if X1 has an effect on the relationship between X2 and the proportion of 1-s in Y. I have three questions: a) I have never used glm-s for this or any other sort of analysis before today, so am I interpreting the output correctly ? After setting options(contrasts=c(contr.treatment,contr.poly)) I did: ~~Begin R output~~ Call: glm(formula = Y ~ X * Fac, family = binomial, data = mat, subset = sactype 3 numstim == 16) Deviance Residuals: Min 1Q Median 3Q Max -2.232 -0.901 0.416 0.985 1.656 Coefficients: Estimate Std. Error z value Pr(|z|) (Intercept)2.405 0.209 11.52 2e-16 *** X2-2.511 0.293 -8.57 2e-16 *** X3-3.283 0.286 -11.47 2e-16 *** X4-2.009 0.302 -6.653e-11 *** X5-3.098 0.276 -11.22 2e-16 *** X6-2.580 0.288 -8.97 2e-16 *** X7-3.484 0.288 -12.09 2e-16 *** X8-2.811 0.328 -8.56 2e-16 *** Fac -1.558 0.721 -2.16 0.03071 * X2:Fac 2.133 0.9422.26 0.02351 * X3:Fac 1.848 0.9321.98 0.04748 * X4:Fac 2.836 0.9822.89 0.00386 ** X5:Fac 3.263 0.9453.45 0.00056 *** X6:Fac 3.630 0.9713.74 0.00018 *** X7:Fac 3.256 0.8833.69 0.00023 *** X8:Fac 3.350 1.0003.35 0.00081 *** --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 (Dispersion parameter for binomial family taken to be 1) Null deviance: 1619.4 on 1178 degrees of freedom Residual deviance: 1271.2 on 1163 degrees of freedom AIC: 1303 Number of Fisher Scoring iterations: 5 End R output~~~ I am reading this like this: each of the X2X8 terms tell me whether the proportions associated with those factors at level 0 of Fac, are different from the proportion associated with factor X1 for level 0 of Fac. And each of the terms associated with Fac (X2:Fac,...X8:Fac) is telling me whether the difference between X2...X8 and X1 is different for Fac=0 and Fac=1; and this is the same thing as whether the proportion associated with X2..X8 are different for the two levels of Fac. So these X2...X8:Fac terms are like performing a simple 2x2 analysis of the effect of Fac on Y, given X2 (X8). How much of this is incorrect ? My other two questions are: b) Is this the right way to approach this analysis in R ? Or am I better off reading about multi-way contingency table analyses and using them ? and c) How do I incorporate a correction for multiple-testing into the above analysis ? The effect of Fac on the relationship between X and Y was planned. I would greatly, and respectfully appreciate all pointers, tips and admonitions. Thank you Suresh __ 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
[R] Re: Contingency table: logistic regression
Oops, I corrected some errors in the first paragraph; sorry for the repeated posting. Suresh ~~ Hi, I am analyzing a data set with greater than 1000 independent cases (collected in an unrestricted manner), where each case has 3 variables associated with it: one, a factor variable with 0/1 levels (called Fac), another factor variable with 8 levels (X) and a third response variable with two levels (Y: 0/1). I am trying to see if Fac has an effect on the relationship between X and the proportion of 1-s in Y. I have three questions: a) I have never used glm-s for this or any other sort of analysis before today, so am I interpreting the output correctly ? After setting options(contrasts=c(contr.treatment,contr.poly)) I did: ~~Begin R output~~ Call: glm(formula = Y ~ X * Fac, family = binomial, data = mat, subset = sactype 3 numstim == 16) Deviance Residuals: Min 1Q Median 3Q Max -2.232 -0.901 0.416 0.985 1.656 Coefficients: Estimate Std. Error z value Pr(|z|) (Intercept)2.405 0.209 11.52 2e-16 *** X2-2.511 0.293 -8.57 2e-16 *** X3-3.283 0.286 -11.47 2e-16 *** X4-2.009 0.302 -6.653e-11 *** X5-3.098 0.276 -11.22 2e-16 *** X6-2.580 0.288 -8.97 2e-16 *** X7-3.484 0.288 -12.09 2e-16 *** X8-2.811 0.328 -8.56 2e-16 *** Fac -1.558 0.721 -2.16 0.03071 * X2:Fac 2.133 0.9422.26 0.02351 * X3:Fac 1.848 0.9321.98 0.04748 * X4:Fac 2.836 0.9822.89 0.00386 ** X5:Fac 3.263 0.9453.45 0.00056 *** X6:Fac 3.630 0.9713.74 0.00018 *** X7:Fac 3.256 0.8833.69 0.00023 *** X8:Fac 3.350 1.0003.35 0.00081 *** --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 (Dispersion parameter for binomial family taken to be 1) Null deviance: 1619.4 on 1178 degrees of freedom Residual deviance: 1271.2 on 1163 degrees of freedom AIC: 1303 Number of Fisher Scoring iterations: 5 End R output~~~ I am reading this like this: each of the X2X8 terms tell me whether the proportions associated with those factors at level 0 of Fac, are different from the proportion associated with factor X1 for level 0 of Fac. And each of the terms associated with Fac (X2:Fac,...X8:Fac) is telling me whether the difference between X2...X8 and X1 is different for Fac=0 and Fac=1; and this is the same thing as whether the proportion associated with X2..X8 are different for the two levels of Fac. So these X2...X8:Fac terms are like performing a simple 2x2 analysis of the effect of Fac on Y, given X2 (X8). How much of this is incorrect ? My other two questions are: b) Is this the right way to approach this analysis in R ? Or am I better off reading about multi-way contingency table analyses and using them ? and c) How do I incorporate a correction for multiple-testing into the above analysis ? The effect of Fac on the relationship between X and Y was planned. I would greatly, and respectfully appreciate all pointers, tips and admonitions. Thank you Suresh __ 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
Re: [R] and [ESS] Starting ESS
Hi, Yes, I defined the HOME environment variable as instructed in the installation instructions. Also, I can happily switch buffers in Emacs (C-x C-b or using C-x C-o) to the R-window and back to the .r file I am editing without any problem... If it matters, I am using Windows XP on a Dell Inspiron 9100 laptop, and the latest version of R. Thanks, Suresh On Mon, 28 Feb 2005, Vincent Goulet wrote: Suresh, Did you define a HOME environment variable for Emacs to use (as instructed in the installation instructions)? I observed that when the HOME variable is not defined (or points to a non-existent directory), Emacs will freeze as soon as one toggles from the Emacs window to another application and back to Emacs. And of course, I should have written FSF Emacs in my original post, not FSG. Hope this helps! Le 26 Février 2005 00:06, Suresh Krishna a écrit : Prof. Goulet, I apologize in advance if I shouldnt have been writing to you directly; but I thought that my problem was simple enough that you could very quickly say if you knew of a quick fix for this. Because I am familiar with the Emacs editor, I was happily and gratefully using your packaged version of FSG Emacs after you suggested it here on the list (R-help); but I have run into a problem that occurs when i run: x=1; y=1; par(ask=T) plot(x,y) emacs/ess/r now freezes because it is waiting for me to hit enter to see the next plot, however, when i hit enter, i am not sure R is able to realize that i hit enter. also, the hit enter to see next plot message is not displayed in the window with the r process. If this is a problem that is somehow specific to what I am doing, then please let me know. I have switched back to JGR and the mouse, until then. Thanks !! Suresh Vincent Goulet wrote: To answer your question: I don't think it matters. If you're willing to use FSG Emacs instead of XEmacs, I repackaged Emacs 21.3 for Windows together with recent versions of ESS and AuCTeX for my students (I personally run Linux). The package and installation instructions are at: http://vgoulet.act.ulaval.ca/download/software/emacs/ (Look for files emacs-21.3-ready.zip, emacs_install_en.txt and perhaps ess_s-plus_win_en.txt.) Hope this helps! Le 23 Février 2005 18:16, Laura Holt a écrit : Dear R People: I have finally seen the error of my ways and have decided to use ESS for R and S + stuff. However, I have a question right from the beginning. I'm somewhat confused by the installation instructions. Do I install XEMACS or ESS first, please? Windows XP R Version 2.0.1 (S + 6.2) Thanks so much! Sincerely, Laura Holt mailto: [EMAIL PROTECTED] __ 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 -- Vincent Goulet, Associate Professor École d'actuariat Université Laval, Québec [EMAIL PROTECTED] http://vgoulet.act.ulaval.ca __ 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 __ 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
[R] comparing predicted sequence A'(t) to observed sequence A(t)
Hi, I have a question that I have not been succesful in finding a definitive answer to; and I was hoping someone here could give me some pointers to the right place in the literature. A. We have 4 sets of data, A(t), B(t), C(t), and D(t). Each of these consists of a series of counts obtained in sequential time-intervals: so for example, A(t) would be something like: Count A(t): 25,28,26, 34 .. Time (ms): 0-10, 10-20, 20-30, 30-40 ... Each count in the series A(t) is obtained by summing the total number of observed counts over multiple (say 50), independent repetitions of that time-series. These counts are generally known to be Poisson distributed, and the 4 processes A(t), B(t), C(t) and D(t) are independent of each other. B. It appears on visual observation that the following relationship holds; and such a relationship would also be expected on mechanistic considerations. A(t) = B(t) + C(t) - D(t) We now want to test this hypothesis statistically. Because successive counts in the sequence are likely to be correlated, isnt it true that none of these methods are valid ? Perhaps for other reasons as well ? a)Doing a chi-squared test to see if the predicted curve for A(t) deviates significantly from the observed A(t); this also seems to not take the variability of the predicted curve into account. b)Doing a regression of the predicted values of A(t) against the actual values of A(t) and checking for deviations of slope from 1 and intercept from 0 ? Here, in addition to lack of independence, the fact that X-values are not fixed (i.e. are variable) and the fact that X and Y are Poisson distributed counts should also be taken into account, right ? I would be very grateful if someone could point me to methods to handle this kind of situation, or where to look for them. Is there something in the time-series literature, for instance ? Thanks !! Suresh __ 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
Re: [R] comparing predicted sequence A'(t) to observed sequence A(t)
Hi, Thanks for your quick response ! By predicted A(t), I meant B(t) + C(t) - D(t). In other words, how well does B(t) + C(t) - D(t) approximate A(t) ? And all the counts are non-negative. Regards, Suresh Spencer Graves wrote: What do you mean by the following: A(t) = B(t) + C(t) - D(t)? Since you speak of regressing predicted against actual A(t), I gather this is not what you mean. Another question: Do you have numbers -0 for either predicted or actual A(t)? If yes but only a very few, I might replace the 0's by 0.5 and any negatives by 0.25, take their logarithms, then try acf, pacf, ar, arima(..., xreg=A.pred), etc. There are doubtless better methods. However, if I had to have an answer today, I think I'd try this, then discuss implications and limitations. If I needed a more sophisticated answer and I had a few weeks or months to work on it, I might develop some way to simulate a process that seemed to describe what I thought generated these numbers and compare simulated results with actual, under a variety of hypotheses, obtaining various kinds of p-values, etc. hope this helps. spencer graves Suresh Krishna wrote: Hi, I have a question that I have not been succesful in finding a definitive answer to; and I was hoping someone here could give me some pointers to the right place in the literature. A. We have 4 sets of data, A(t), B(t), C(t), and D(t). Each of these consists of a series of counts obtained in sequential time-intervals: so for example, A(t) would be something like: Count A(t): 25,28,26, 34 .. Time (ms): 0-10, 10-20, 20-30, 30-40 ... Each count in the series A(t) is obtained by summing the total number of observed counts over multiple (say 50), independent repetitions of that time-series. These counts are generally known to be Poisson distributed, and the 4 processes A(t), B(t), C(t) and D(t) are independent of each other. B. It appears on visual observation that the following relationship holds; and such a relationship would also be expected on mechanistic considerations. A(t) = B(t) + C(t) - D(t) We now want to test this hypothesis statistically. Because successive counts in the sequence are likely to be correlated, isnt it true that none of these methods are valid ? Perhaps for other reasons as well ? a)Doing a chi-squared test to see if the predicted curve for A(t) deviates significantly from the observed A(t); this also seems to not take the variability of the predicted curve into account. b)Doing a regression of the predicted values of A(t) against the actual values of A(t) and checking for deviations of slope from 1 and intercept from 0 ? Here, in addition to lack of independence, the fact that X-values are not fixed (i.e. are variable) and the fact that X and Y are Poisson distributed counts should also be taken into account, right ? I would be very grateful if someone could point me to methods to handle this kind of situation, or where to look for them. Is there something in the time-series literature, for instance ? Thanks !! Suresh __ 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 __ 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
[R] locfit confidence intervals
hi, after m=locfit(y~x,..., family=binomial) plot(m,band=local) gives me a plot of locfit's result with a confidence interval around it. i would like to get the actual values that are being used to plot the lines in this figure. i tried using predict, but the standard error it returns when i supply the se=T argument, appears not to be the same as the CI produced by plot (it is much larger...in my one case). i have tried all the different type=.. options, but none of them matches the CI produced by plot. i only recently started using both R and local regression methods and am still feeling my way around, so even though I have gone through the FAQs and the online manuals and the archives of this group and the Loader book, I have been unable to make much progress. any help would be very appreciated !! thanks, suresh __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html