Re: [R] exponent confusion
-0.7^1.22 [1] -0.6471718 (-0.7)^1.22 NaN Arithmetically this makes perfect sense, syntactically I'm not sure it does. z-c(-0.7) z == -0.7 [1] TRUE z^1.22 [1] NaN I remember a programming homily: if you are unsure of the operator precedence then you shouldn't assume the person who has to maintain your code has any better knowledge so you should make the order in which you want expressions to be evaluated explicit. Phineas -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of tom wright Sent: Wednesday, February 22, 2006 10:14 AM To: R-Stat Help Subject: [R] exponent confusion please excuse me if this ones a basic error y-c(-0.7,-0.6,-0.5) -0.7^1.22 [1] -0.6471718 y^1.22 [1] NaN NaN NaN am I missing something important in my basic math? __ 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] Unable to configure R 2.2.1 on Solaris 5.10 x86_64
Which compiler are you using? I successfully built R for Solaris on SPARC using GCC, but it took a while to get it working the first time. The first step would be to see if you can build simple Hello World apps for C, C++ and Fortran in the directory in which you are going to install R. If you are unable to do this I would suggest that you build GCC from sources, and rather than use the Sun Software companion disk download the most recent versions of the various libraries and utilities from www.sunfreeware.com. HTH Phineas Campbell Birkbeck College University of London -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Aric Gregson Sent: Monday, February 20, 2006 11:22 PM To: r-help@stat.math.ethz.ch Subject: [R] Unable to configure R 2.2.1 on Solaris 5.10 x86_64 Hello, Apologies for the post here. I have read the R-Admin (learned a lot!) and searched the web for days, but still fail at compiling R on my Ultra 20 running solaris 10 x86 1/06. This is the tail of './configure' output: . checking for dlopen in -ldl... yes checking readline/history.h usability... no checking readline/history.h presence... no checking for readline/history.h... no checking readline/readline.h usability... no checking readline/readline.h presence... no checking for readline/readline.h... no checking for rl_callback_read_char in -lreadline... no checking for main in -lncurses... no checking for main in -ltermcap... yes checking for rl_callback_read_char in -lreadline... no checking for history_truncate_file... no configure: error: --with-readline=yes (default) and headers/libs are not available My R-2.2.1/config.site has the following changes from default: CC=cc -xtarget=opteron -xarch=amd64 CFLAGS=-xO5 -xlibmil -dalign CPPFLAGS=-I/opt/sfw/include -I/opt/sfw/include/readline \ -I/opt/csw/include -I/opt/SUNWspro/include -I/opt/csw/include/readline F77=f95 -xarch=amd64 -xtarget=opteron FFLAGS=-xO5 -xlibmil -dalign LDFLAGS=-L/opt/SUNWspro/lib/amd64/ -L/opt/sfw/lib -L/opt/csw/lib CXX=CC -xarch=amd64 -xtarget=opteron CXXFLAGS=-xO5 -xlibmil -dalign R_BROWSER=mozilla MAKE=gmake My .zshrc file has the following (as I saw that some of the LDFLAGS should match my LD_LIBRARY_PATH and CONFIG_SHELL=/bin/ksh): LD_LIBRARY_PATH=/opt/sfw/include:/opt/sfw/include/readline:/usr/local/lib:/u sr/X/lib:/usr/lib:/usr/ucblib:/lib:/usr/ccs/lib:/etc/lib:/usr/dt/lib:/opt/SU NWspro/lib/amd64/:/opt/sfw/lib:/opt/csw/lib Readline (version 4.2 from the Sun Companion CD) is located in /opt/sfw/include/readline. Both the readline.h and history.h files are there. Version 5.0 is located in /opt/csw/include/readline (from Blastwave). As you can see, I am new at compiling in general and Solaris specifically. Any help would be greatly appreciated. System information: System = SunOS Release = 5.10 KernelID = Generic_118844-26 Machine = i86pc OEM# = 0 Origin# = 1 NumCPU = 1 thanks, aric __ 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] Generating random walks
cumsum(rnorm(100)+c) HTH phineas -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of oliver wee Sent: Wednesday, February 15, 2006 12:41 PM To: r-help@stat.math.ethz.ch Subject: [R] Generating random walks Hello, here is another question, how do I generate random walk models in R? Basically, I need an AR(1) model with the phi^1 value equal to 1: Yt = c + Yt-1 + E where E is random white noise. I tried using the arima.sim command: arima.sim(list(ar=c(1)), n = 1000, rand.gen = rnorm) but got this error since the model I am generating is not stationary: Error in arima.sim(list(ar = c(1)), n = 1000, rand.gen = rnorm) : 'ar' part of model is not stationary I found arima.sim sufficient for generating stationary models, but how about non-stationary models? Thanks again for your help. __ 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] Generating random walks
In retrospect x-cumsum(rnorm(n=100, mean=c)) will probably work quicker Phineas -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Phineas Campbell Sent: Wednesday, February 15, 2006 1:01 PM To: 'R-Help Subject: Re: [R] Generating random walks cumsum(rnorm(100)+c) HTH phineas -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of oliver wee Sent: Wednesday, February 15, 2006 12:41 PM To: r-help@stat.math.ethz.ch Subject: [R] Generating random walks Hello, here is another question, how do I generate random walk models in R? Basically, I need an AR(1) model with the phi^1 value equal to 1: Yt = c + Yt-1 + E where E is random white noise. I tried using the arima.sim command: arima.sim(list(ar=c(1)), n = 1000, rand.gen = rnorm) but got this error since the model I am generating is not stationary: Error in arima.sim(list(ar = c(1)), n = 1000, rand.gen = rnorm) : 'ar' part of model is not stationary I found arima.sim sufficient for generating stationary models, but how about non-stationary models? Thanks again for your help. __ 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] Learning - Example programs
Typing the function name at the prompt prints that body of the function. By working thrugh the steps in the boot function, helped me both understand the way the bootstrap works and write better R code. Phineas -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Martin P. Holt Sent: Saturday, January 28, 2006 3:53 PM To: r-help Subject: [R] Learning - Example programs I'm working my way up the learning curve for R. A method of learning I find very effective is to work through an existing program. Are there any libraries or archives of R programs on the web ? If not, would this be a good idea for the R website ? I hope this is not a FAQ: I have checked as far as I can. Best Wishes, Martin Holt __ 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] Stochastic Volatility
Has anybody implemented or tried to implement a stochastic volatility model using the Kalman filter following a series of papers by Harvey, Ruiz and Shepard? This is a sophisticated approach for estimating an important class of models, so I am surprised that no implementation exists, is this because there are unforeseeable problems? In a related but off topic question, it has been a while since I looked at the non homoskedastic time series literature but back then you couldn't pick up a journal without reading another stochastic volatility paper, does anybody have any ideas why the literature has drifted back toward less satisfactory GARCH and EGARCH models? This question is somewhat moot as if I choose to pursue this I will implement a model myself. Phineas Campbell __ 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] class 'named'
I'm working through the examples in Venables and Ripley in the 'New-style Classes' chapter. On a call to representation, in the lda example, it is unable to find the class named. Is the class named defined anywhere? I've loaded the library methods but this hasn't helped. Phineas Campbell __ 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] STAR models estimation with R
The only STAR model I have come across is Smooth Threshold Autoregressive time series model, see Tong, Non Linear Time Series. I am not aware of any package that has implemented threshold models. Because statistical techniques are used widely across many different disciplines it is inevitable that naming conventions will diverge, so the same technique may have different names in different areas of study. Perhaps it should be added to the posting guide that most general name of a technique should be used, and in the case of more obscure techniques a brief reference to a standard text or paper. Hamilton, see Time Series Analysis, uses the EM algorithm to estimate such models so it should be possible to do in R. HTH Phineas Campbell -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of noomen ajmi Sent: Tuesday, June 28, 2005 8:44 AM To: r-help@stat.math.ethz.ch Subject: [R] STAR models estimation with R Hi, Can you tell me if there are an R package or code for STAR model estimation and test misspecification. If no, how i could do this. Thanks in advance Best regards AJMI Noomen Phd student TUNISIA - [[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] Syntax error with .First.lib
I am trying to build a package which calls some c code. I want to call the dyn.load function when the package is loaded. To do this I create a .First.lib function in MyConv.R file: .First.lib-function(/home/phineas/R_HOME/R-2.0.1/library/, MyConvolve){ ### Intentionally empty body. To be replaced by dyn.load function } R CMD check MyConvolve gives an R syntax error. libname is the directory where the package is saved. The package is being stored in the standard library directory, is possible to pass NULL as this value? pkgname is the string representing the name of the package. To clarify some notation; a package is a set of R data, code and objects to be used when the package is installed, but a library is a compiled c or Fortran binary which can be called by R Should this question be posted to R-devel? version platform sparc-sun-solaris2.9 arch sparc os solaris2.9 system sparc, solaris2.9 status major2 minor0.1 year 2004 month11 day 15 language R Phineas Campbell [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
RE: [R] Solaris 10 on amd and R-2.1.0
This might solve your problem without helping. Having spent I bit of time trying to build R with the pkgadd version of GCC from Sunfreeware and not getting anywhere I downloaded the source for GCC 3.4.2 and built this, then used this to build R. Everything worked fine. HTH Phineas -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Vin Everett Sent: Thursday, May 12, 2005 12:41 PM To: r-help@stat.math.ethz.ch Cc: [EMAIL PROTECTED] Subject: [R] Solaris 10 on amd and R-2.1.0 Hi I am having problems compiling R on a Solaris 10 opteron box we have on trial. checking for Fortran libraries of g77... -L/usr/ccs/lib -L/usr/lib - L/usr/local/lib -L/usr/local/lib/gcc-lib/i386-pc-solaris2.10/3.3.2 - L/usr/ccs/bin -L/usr/local/lib/gcc-lib/i386-pc- solaris2.10/3.3.2/../../.. -lfrtbegin -lg2c -lm -lgcc_s -lfrtbegin: - lg2c: checking how to get verbose linking output from gcc... -v checking for C libraries of gcc... -L/usr/ccs/lib -L/usr/lib - L/usr/local/lib -L/usr/local/lib/gcc-lib/i386-pc-solaris2.10/3.3.2 - L/usr/ccs/bin -L/usr/local/lib/gcc-lib/i386-pc- solaris2.10/3.3.2/../../.. -lgcc_eh checking for dummy main to link with Fortran libraries... unknown configure: error: linking to Fortran libraries from C fails See `config.log' for more details. I have installed gcc from sunfreeware Looks like the following are not found:- configure:26575: gcc -o conftest -g -O2 -I/usr/local/include - L/usr/local/lib conftest.c - ldl -lm -lg2c -lm -lgcc_s -lfrtbegin: -lg2c: 5 ld: fatal: library -lg2c: not found ld: fatal: library -lfrtbegin:: not found ld: fatal: library -lg2c:: not found ld: fatal: File processing errors. No output written to conftest collect2: ld returned 1 exit status configure:26581: $? = 1 configure: failed program was: | /* confdefs.h. */ Any idea where to get them from ? Cheers Vin -- [EMAIL PROTECTED] JDRF/WT Diabetes and Inflammation Laboratory (DIL) Cambridge Institute for Medical Research (CIMR) Wellcome Trust/MRC Building Addenbrooke's Hospital Hills Road Cambridge CB2 2XY +44 1223 763212 +44 7990 966266 __ 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] Re: A somewhat off the line question to a log normal distribution
It has always been my understanding that an arbitrary lognormal distribution has a sufficient quantity of finite moments to ensure a CLT holds, it is not uniquely defined by these moments. Thus although sums of IID lognormal variates will converge to a normal distribution we cannot know, a priori, what the parameters of this distribution will be. If a distribution is strictly positive and has sufficient moments then the sums of logs of the variables will converge to a normal distribution, thus in estimating parameters that are closely related to the mean there would appear to be little to loose by logging the data. Phineas Campbell -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Vito Ricci Sent: Thursday, December 02, 2004 10:08 AM To: [EMAIL PROTECTED] Subject: [R] Re: A somewhat off the line question to a log normal distribution Dear Siegfried, I believe your boss is wrong saying that: He also tried to explain me that the monthly means (based on the daily measurements) must follow a log-normal distribution too then over the course of a year. every statistician know that increasing the sample size the sample distribution of the mean is proxy to a gaussian distribution (Central Limit Theorem) independently from the original distribution of data (in your case log-normal). See this: The Central Limit Theorem is a statement about the characteristics of the sampling distribution of means of random samples from a given population. That is, it describes the characteristics of the distribution of values we would obtain if we were able to draw an infinite number of random samples of a given size from a given population and we calculated the mean of each sample. The Central Limit Theorem consists of three statements: [1] The mean of the sampling distribution of means is equal to the mean of the population from which the samples were drawn. [2] The variance of the sampling distribution of means is equal to the variance of the population from which the samples were drawn divided by the size of the samples. -- [3] If the original population is distributed normally (i.e. it is bell shaped), the sampling distribution of means will also be normal. If the original population is not normally distributed, the sampling distribution of means will increasingly approximate a normal distribution as sample size increases. (i.e. when increasingly large samples are drawn) -- So results you got are just in this way! I think your boss doesn't know well statistics! Regards Vito You wrote: Hello: Oh yes I know it isn't so much related to R, but I gather there are a lot of statisticians reading the mailing list. My boss repeatedly tried to explain me the following. == Lets assume you have got daily measurements of a variable in natural sciences. It turned out that the aformentioned daily measurements follow a log-normal distribution when considered over the course of a year. Okay. He also tried to explain me that the monthly means (based on the daily measurements) must follow a log-normal distribution too then over the course of a year. == I somehow get his explanation. But I have measurements which are log-normal distributed when evaluated on a daily basis over the course of a year but they are close to a Gaussian distribution when considered under the light of monthly means over the course of a year. Is such a latter case feasible. And if not why. Regards, Siegfried Gonzi = Diventare costruttori di soluzioni Became solutions' constructors The business of the statistician is to catalyze the scientific learning process. George E. P. Box Visitate il portale http://www.modugno.it/ e in particolare la sezione su Palese http://www.modugno.it/archivio/palese/ __ [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 __ [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
[R] Empirical P Value
I am trying to return the p value for a stat from the ECDF. That is the index of the first occurrence, on an ordered vector, of a value either greater than or equal to a given value. Ideally I would not have to order the vector beforehand. Currently I use: PValue-function(stat, ECDF){ ###Get the length of the ECFD L-length(ECDF) ###Loop through the ECDF until the p value is found for(i in 1:L){ if(ECDF[i]=stat){ break } } ###Return the 3 values that bracket the p value c((i-1)/L, i/L, (i+1)/L) } Is there a way of doing this that avoids the explicit loop? platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major1 minor9.1 year 2004 month06 day 21 language R Phineas Campbell __ [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
RE: [R] off topic publication question
I had assumed that the use of we in articles was either due to formality, like the distinction between tu and vous in French. The English monarch never refer to themselves in the singular. Or we as in both the author and the reader. However a sample of size 4 of articles to hand suggests that the use of we for single author papers is not universal. HTH Phineas Campbell http://www.phineas.pwp.blueyonder.co.uk/ -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Erin Hodgess Sent: Tuesday, June 08, 2004 6:11 PM To: [EMAIL PROTECTED] Subject: [R] off topic publication question Dear R People: Please excuse the off topic question, but I know that I'll get a good answer here. If a single author is writing a journal article, should she use We performed a test or I performed a test, please? I had learned to use we without regard to the number of authors. Is that true, please? Thanks for the off topic help. Sincerely, Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] applying data generating function
It may be possible to do this without a loop but I haven't found a way ###Generate an array of 100 N(0,1) RVs z-rnorm(100) ###Build the array to store output x-vector(length=100) ###Create initial value x[1]-z[1] ###Loop though building series for(i in 2:100){ x[i]-3.8*x[i-1]*(1-x[i-1])+z[i] } As I understand it you take an overhead hit when using loops, so they are best avoided. HTH Phineas http://www.phineas.pwp.blueyonder.co.uk/ -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Fred J. Sent: Sunday, March 07, 2004 7:55 PM To: r help Subject: [R] applying data generating function Hello Coming from matlab background, I could use some help on this one. I need to generate a data set based on this equation X(t) = 3.8x(t-1) (1-x(t-1)) + e(t), where e(t) is a N(0,0,001) random variable I need say 100 values. How do I do this? Thanks __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html