[R] Rmetrics New Built
*www.Rmetrics.org Rmetrics - new Built 190.10053 *The new built has now implemented my 'timeDate' and 'timeSeries' classes which became part of the fBasics package. Furthermore, MS Windows specifics were removed from the packages, so we can try to build Rmetrics on Linux and on Mac OSX. Please send me your experiences. There is now a small new package named winRmetrics which holds the MS Windows specific part for those who prefer the Windows Rmetrics Port. The user guides and reference guides are not yet updated. What are the next steps? Maybe somebody is around and can try to build the packages for (Debian) Linux and Mac OSX. This would be a great help for me! The *.tar.gz files are availalble on http://www.itp.phys.ethz.ch/econophysics/R/bin/windows/contrib/1.9/Sources/ If the Linux and Mac OSX builds are successfully done, I will submit the packages to the CRAN server. Best Regards Diethelm Wuertz [[alternative HTML version deleted]] __ [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] Getting the same values of adjusted mean and standard errors as SAS
Thanks for the help. Both the "Design" package and the "effects" package look as though they are what I need although it will probably take me a while to get on top of both. I have had a brief go at the Design package and the contrast function is particularly useful. A question on the Design package: There are 5 types for factor "group", one is the reference - call it "a". f <- ols(y ~ age + sex + group, data=dd) contrast(f, list(group='a'), list(group='b')) I can use this to contrast pairs but can I use this to contrast b against c,d, and e as a group. Also "a" against the rest? Thanks, David Frank E Harrell Jr wrote: On Thu, 27 May 2004 16:34:58 +0930 "David J. Netherway" <[EMAIL PROTECTED]> wrote: Hello, I am trying to get the same values for the adjusted means and standard errors using R that are given in SAS for the following data. The model is Measurement ~ Age + Gender + Group. I can get the adusted means at the mean age by using predict. I do not know how to get the appropriate standard errors at the adjusted means for Gender using values from predict. So I attempted to get them directly from the residuals as follows. The data is at the end of the email. While there is a match for the males there is a large difference for the females indicating that what I am doing is wrong. # meanAge <- mean(dd$Age) meanAgeM <- mean(dd$Age[d$Gender=="M"]) meanAgeF <- mean(dd$Age[d$Gender=="F"]) . . . . By using sex-specific means of age you are not getting adjusted estimates in the usual sense. I prefer to think of effects as differences in predicted values rather than as complex SAS-like contrasts. The Design package's contrast function makes this easy (including SEs and confidence limits): library(Design) # also requires Hmisc d <- datadist(dd); options(datadist='d') f <- ols(y ~ age + sex + group, data=dd) contrast(f, list(sex='M'), list(sex='F')) # usual adjusted difference M vs F contrast(f, list(sex='M',age=mean(dd$age[dd$sex=='M']), list(sex='F',age=mean(dd$age[dd$sex=='F')) # M vs F not holding age constant You can also experiment with specifying age=tapply(age, sex, mean, na.rm=TRUE) using some of the contrast.Design options. --- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ [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] bar plot patterns
__ [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] Getting the same values of adjusted mean and standard errors as SAS
David J. Netherway wrote: Thanks for the help. Both the "Design" package and the "effects" package look as though they are what I need although it will probably take me a while to get on top of both. I have had a brief go at the Design package and the contrast function is particularly useful. A question on the Design package: There are 5 types for factor "group", one is the reference - call it "a". f <- ols(y ~ age + sex + group, data=dd) contrast(f, list(group='a'), list(group='b')) I can use this to contrast pairs but can I use this to contrast b against c,d, and e as a group. Also "a" against the rest? Type ?contrast.Design. You'll see examples of 'vector' contrasts with and without weighted/unweighted averaging of effects. E.g. contrast(f, list(group='b'), list(group=c('c','d','e'))) will give 3 contrasts. There is an option to average these. Frank Thanks, David Frank E Harrell Jr wrote: On Thu, 27 May 2004 16:34:58 +0930 "David J. Netherway" <[EMAIL PROTECTED]> wrote: Hello, I am trying to get the same values for the adjusted means and standard errors using R that are given in SAS for the following data. The model is Measurement ~ Age + Gender + Group. I can get the adusted means at the mean age by using predict. I do not know how to get the appropriate standard errors at the adjusted means for Gender using values from predict. So I attempted to get them directly from the residuals as follows. The data is at the end of the email. While there is a match for the males there is a large difference for the females indicating that what I am doing is wrong. # meanAge <- mean(dd$Age) meanAgeM <- mean(dd$Age[d$Gender=="M"]) meanAgeF <- mean(dd$Age[d$Gender=="F"]) . . . . By using sex-specific means of age you are not getting adjusted estimates in the usual sense. I prefer to think of effects as differences in predicted values rather than as complex SAS-like contrasts. The Design package's contrast function makes this easy (including SEs and confidence limits): library(Design) # also requires Hmisc d <- datadist(dd); options(datadist='d') f <- ols(y ~ age + sex + group, data=dd) contrast(f, list(sex='M'), list(sex='F')) # usual adjusted difference M vs F contrast(f, list(sex='M',age=mean(dd$age[dd$sex=='M']), list(sex='F',age=mean(dd$age[dd$sex=='F')) # M vs F not holding age constant You can also experiment with specifying age=tapply(age, sex, mean, na.rm=TRUE) using some of the contrast.Design options. --- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ [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 -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ [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] glmm?
Spencer Graves <[EMAIL PROTECTED]> writes: > Is there an easy way to get confidence intervals from "glmm" in > Jim Lindsey's library(repeated)? Consider the following slight > modification of an example from the help page: > df <- > data.frame(r=rbinom(10,10,0.5), n=rep(10,10), x=c(rep(0,5), > > + rep(1,5)), nest=1:10) > > fit <- glmm(cbind(r,n-r)~x, family=binomial, nest=nest, data=df) > > summary(fit) > Error in print.summary.glmm(structure(list(call = glmm(cbind(r, n - r) ~ : > couldn't find function "print.summary.glm" It's a namespace problem. The S3 method, which is being called directly, is now in a namespace. > getAnywhere("print.summary.glm") A single object matching 'print.summary.glm' was found It was found in the following places registered S3 method for print from namespace stats namespace:stats Check the form of the call in question to see if the object being printed does have class summary.glm, in which case the generic function print should be used instead of print.summary.glm. __ [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] bar plot patterns
Thank you for your answer. I have about 7 stacks it is not very appealing to have just stripes with changing angles. I was wondering if there is a way to have varying patters in black and white. Osman - Original Message - From: Petr Pikal To: Osman Cc: [EMAIL PROTECTED] Sent: Monday, May 31, 2004 5:01 AM Subject: Re: [R] bar plot patterns On 29 May 2004 at 16:54, Osman wrote: > Dear R users, > > Is there a package or function that can produce multiple fill patterns > to be used instead of colors in barplots or pie charts? Shades of grey > are difficult to differentiate if more than 3 to 5.. Hi This is what help page says about colours and shading lines density: a vector giving the density of shading lines, in lines per inch, for the bars or bar components. The default value of 'NULL' means that no shading lines are drawn. Non-positive values of 'density' also inhibit the drawing of shading lines. angle: the slope of shading lines, given as an angle in degrees (counter-clockwise), for the bars or bar components. col: a vector of colors for the bars or bar components. Do you want something else than barplot(1:3, col=c(2,3,3),density=c(2,4,6), angle=c(30,60,90)) Cheers Petr > > Osman > [[alternative HTML version deleted]] > > __ > [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 Petr Pikal [EMAIL PROTECTED] [[alternative HTML version deleted]] __ [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] Rmetrics New Built
> What are the next steps? > > Maybe somebody is around and can try to build the packages for (Debian) > Linux and Mac OSX. This would be a great help for me! The *.tar.gz files > are availalble on > If the Linux and Mac OSX builds are successfully done, I will submit the > packages to the CRAN server. all four of the packages successfully build on Debian unstable - no errors, nor warnings. this is a Good Thing. I would guesstimate that they should build trivially on OSX as well, but i'm at home today [in the US, today is Memorial day - a sort of low-key holiday when people tend to have picnics and things] and have no intention of driving to campus... maybe you can sucker Dirk into packaging them for Debian and getting them into the system there? :) --elijah __ [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
[R] Calculating distances between points in a data frame?
Dear list, I would like to calculate the distance between consecutive points in a data frame. Of course the first point in the data frame does not have a point of origin, and should get a value NA. I have tried two different loops, which both result in error: > num <- seq(0,10,1) > X <- seq(0,30,3) > Y <- seq(0,40,4) > XY <- data.frame(num, X, Y) > attach(XY) > summary(XY) num X Y Min. : 0.0 Min. : 0.0 Min. : 0 1st Qu.: 2.5 1st Qu.: 7.5 1st Qu.:10 Median : 5.0 Median :15.0 Median :20 Mean : 5.0 Mean :15.0 Mean :20 3rd Qu.: 7.5 3rd Qu.:22.5 3rd Qu.:30 Max. :10.0 Max. :30.0 Max. :40 > plot(X,Y) > rngNum <- range(num) > for (i in rngNum){ + XY$DistXY[i] <- sqrt( ((X[i]-X[i-1])^2) + ((Y[i]-Y[i-1])^2) ) + } Error in "$<-.data.frame"(`*tmp*`, "DistXY", value = sqrt(((X[i] - X[i - : replacement has 10 rows, data has 11 > for (i in rngNum){ + XY$DistXY2[i] <- ifelse(i=min(rngNum), NA, sqrt(((X[i]-X[i-1])^2) + ((Y[i]-Y[i-1])^2)) ) + } Error in ifelse(i = min(rngNum), NA, sqrt(((X[i] - X[i - 1])^2) + ((Y[i] - : unused argument(s) (i ...) > detach(XY) > Any suggestions much appreciated, Sander Oom. -- Dr. Sander P. Oom Animal, Plant and Environmental Sciences University of the Witwatersrand Private Bag 3 Wits 2050 South Africa Tel (work) +27 (0)11 717 64 04 Tel (home) +27 (0)18 297 44 51 Fax +27 (0)18 299 24 64 Email [EMAIL PROTECTED] Web www.oomvanlieshout.net/sander __ [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
[R] [OT] "plot y against x"
Hi Folks, I'd be grateful for some views on the following. When I say "plot y against x" I mean that y is on the vertical axis and x is on the horizontal axis. I acquired this usage so long ago that I can no longer remember how I acquired it, and therefore can not cite my "authority" for my usage. There can also be an implication that y is a function of x (or y is a "dependent" variable and x an "independent" variable). To the best of my knowledge, this is the standard usage. However, I have had a query which suggests that the "transposed" meaning may be quite frequently adopted, i.e. "plot x [horizontal axis] against y [vertical axis]" Google tells me that "plot y against x" throws up about 147 hits, while "plot x against y" throws up about 54 hits. One of the latter is unequivocal and comes from a respected department of mathematics: http://www.maths.lancs.ac.uk/dept/coursenotes/lab100/pdffiles/a12.pdf Q 12.1 A simple plot. Invoke Matlab in an Xterm window and position the Figure window so that you can see it properly. x = -3:5% plotting values (range) y = 2*x + 3 % a linear function of x plot(x,y) % plot x against y and at least two refer to "Statistical analysis with R" (so maybe I'm not so off-topic after all), also unequivocal, e.g.: http://www.nbn.ac.za/Education/11-stats-2004/R1.8/r_workshop.pdf Example: Plotting functions Assume that you were to plot a function by hand. One possibility of doing it is to 1. Select some xvalues from the range to be plotted 2. Compute the corresponding y = f(x) values 3. Plot x against y 4. Add a (more or less) smooth line connecting the (x; y)points ... plot(x, y)# plots x against y (However, in R itself, "?plot" is discretely silent about what is "against" what!) I'd value commments on whether the above "transposed" usage is in fact sufficiently common (perhaps mainly in certain subject areas) as to constitute a "linguistic enclave" with a valid dialectal usage which is the opposite of the standard. Or maybe there isn't really a standard. This would help to respond to the query, which whether in writing something which uses "plot y against x" it would be worth while including an explicit explanation of which way round it is meant, so that it's clear to any reader, whichever dialectal group they belong to. There was also a related query on whether "regression of Y on X" could be understood the "wrong way round" and about usage of the phrase "a model for Y against X". Where regression is concerned, I don't think there is room for doubt and anyone who interpreted it on the lines of "X~Y" is simply wrong. "Model for Y against X", however, is not a standard phrase, I think (though clear enough if you make the analogy with "plot"), and would need the same disambiguation as "plot y against x" (if any is needed). With thanks! Best wishes to all, Ted. E-Mail: (Ted Harding) <[EMAIL PROTECTED]> Fax-to-email: +44 (0)870 167 1972 Date: 31-May-04 Time: 15:51:53 -- XFMail -- __ [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] Calculating distances between points in a data frame?
Hi! It may bee that the function dist can be of some use to you? ?diff I have something like this in mind. (you do not need a loop.) XY$DistXY <- sqrt(diff(X)^2+diff(Y)^2) Have fun trying. Sincerely Eryk *** REPLY SEPARATOR *** On 5/31/2004 at 5:25 PM Sander Oom wrote: >Dear list, > >I would like to calculate the distance between consecutive points in a >data >frame. Of course the first point in the data frame does not have a point >of >origin, and should get a value NA. I have tried two different loops, which >both result in error: > > > num <- seq(0,10,1) > > X <- seq(0,30,3) > > Y <- seq(0,40,4) > > XY <- data.frame(num, X, Y) > > attach(XY) > > summary(XY) > num X Y > Min. : 0.0 Min. : 0.0 Min. : 0 > 1st Qu.: 2.5 1st Qu.: 7.5 1st Qu.:10 > Median : 5.0 Median :15.0 Median :20 > Mean : 5.0 Mean :15.0 Mean :20 > 3rd Qu.: 7.5 3rd Qu.:22.5 3rd Qu.:30 > Max. :10.0 Max. :30.0 Max. :40 > > plot(X,Y) > > rngNum <- range(num) > > for (i in rngNum){ >+ XY$DistXY[i] <- sqrt( ((X[i]-X[i-1])^2) + ((Y[i]-Y[i-1])^2) ) >+ } >Error in "$<-.data.frame"(`*tmp*`, "DistXY", value = sqrt(((X[i] - X[i - : > replacement has 10 rows, data has 11 > > for (i in rngNum){ >+ XY$DistXY2[i] <- ifelse(i=min(rngNum), NA, sqrt(((X[i]-X[i-1])^2) + >((Y[i]-Y[i-1])^2)) ) >+ } >Error in ifelse(i = min(rngNum), NA, sqrt(((X[i] - X[i - 1])^2) + ((Y[i] - > : > unused argument(s) (i ...) > > detach(XY) > > > >Any suggestions much appreciated, > >Sander Oom. > > >-- >Dr. Sander P. Oom >Animal, Plant and Environmental Sciences >University of the Witwatersrand >Private Bag 3 >Wits 2050 >South Africa > >Tel (work) +27 (0)11 717 64 04 >Tel (home) +27 (0)18 297 44 51 >Fax +27 (0)18 299 24 64 > >Email [EMAIL PROTECTED] >Web www.oomvanlieshout.net/sander > >__ >[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 Dipl. bio-chem. Eryk Witold Wolski@MPI-Moleculare Genetic Ihnestrasse 63-73 14195 Berlin 'v' tel: 0049-30-83875219 / \ mail: [EMAIL PROTECTED]---W-Whttp://www.molgen.mpg.de/~wolski __ [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] [OT] "plot y against x"
Engineers have been plotting stress (or strain, or log of either) as y against log(fatigue lifetime) as x for 100 years or more. Thus it appears that allowable stress is a function of required cycles, and that is how the plot is interpreted. The underlying regression, however, correctly treats observed lifetime as the dependent variable (even though it's plotted as x) and testing stress (or strain, in a strain-controlled test) as the independent variable (plotted as y). Errors are in the horizontal direction. The curve is just "plotted wrong." However, the convention of plotting stress (or strain) vertically and lifetime horizontally is so universal among engineers, that a statistician risks loss of credibility to present a curve with the axes exchanged, even though both plots have the identical underlying regression. Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 503-217-5849 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ted Harding Sent: Monday, May 31, 2004 10:52 AM To: [EMAIL PROTECTED] Subject: [R] [OT] "plot y against x" Hi Folks, I'd be grateful for some views on the following. When I say "plot y against x" I mean that y is on the vertical axis and x is on the horizontal axis. I acquired this usage so long ago that I can no longer remember how I acquired it, and therefore can not cite my "authority" for my usage. There can also be an implication that y is a function of x (or y is a "dependent" variable and x an "independent" variable). To the best of my knowledge, this is the standard usage. However, I have had a query which suggests that the "transposed" meaning may be quite frequently adopted, i.e. "plot x [horizontal axis] against y [vertical axis]" Google tells me that "plot y against x" throws up about 147 hits, while "plot x against y" throws up about 54 hits. One of the latter is unequivocal and comes from a respected department of mathematics: http://www.maths.lancs.ac.uk/dept/coursenotes/lab100/pdffiles/a12.pdf Q 12.1 A simple plot. Invoke Matlab in an Xterm window and position the Figure window so that you can see it properly. x = -3:5% plotting values (range) y = 2*x + 3 % a linear function of x plot(x,y) % plot x against y and at least two refer to "Statistical analysis with R" (so maybe I'm not so off-topic after all), also unequivocal, e.g.: http://www.nbn.ac.za/Education/11-stats-2004/R1.8/r_workshop.pdf Example: Plotting functions Assume that you were to plot a function by hand. One possibility of doing it is to 1. Select some xvalues from the range to be plotted 2. Compute the corresponding y = f(x) values 3. Plot x against y 4. Add a (more or less) smooth line connecting the (x; y)points ... plot(x, y)# plots x against y (However, in R itself, "?plot" is discretely silent about what is "against" what!) I'd value commments on whether the above "transposed" usage is in fact sufficiently common (perhaps mainly in certain subject areas) as to constitute a "linguistic enclave" with a valid dialectal usage which is the opposite of the standard. Or maybe there isn't really a standard. This would help to respond to the query, which whether in writing something which uses "plot y against x" it would be worth while including an explicit explanation of which way round it is meant, so that it's clear to any reader, whichever dialectal group they belong to. There was also a related query on whether "regression of Y on X" could be understood the "wrong way round" and about usage of the phrase "a model for Y against X". Where regression is concerned, I don't think there is room for doubt and anyone who interpreted it on the lines of "X~Y" is simply wrong. "Model for Y against X", however, is not a standard phrase, I think (though clear enough if you make the analogy with "plot"), and would need the same disambiguation as "plot y against x" (if any is needed). With thanks! Best wishes to all, Ted. E-Mail: (Ted Harding) <[EMAIL PROTECTED]> Fax-to-email: +44 (0)870 167 1972 Date: 31-May-04 Time: 15:51:53 -- XFMail -- __ [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
[R] Question about building library and BLAS
Dear helpers, I am trying to create a library which uses some Fortran source files and Lapack and Blas subroutines. The Fortran source files from the original author contain subroutines isamax.f, sgefa.f and sgesl.f, which are part of BLAS subroutines on my Linux computer, but maybe different (old) versions. So in addition to these subroutines, there are other Lapack and Blas subroutines involved. There is no problem to compile and run these files using g77, such as the following to create car: g77 -mieee-fp -fPIC -O2 -g -pipe -march=i386 -mcpu=i686 car isamax.f, sgefa.f sgesl.f foo1.f ... foo20.f -llapack -lblas By doing this, the procedure does not use subroutines isamax.f, sgefa.f sgesl.f in BLAS, as expected. In fact, there are problems to use these subroutines in BLAS, for some reason. Now what I want is to build an R library. The Makefile is the following: LIBNAME=car PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) OBJS=isamax.o saxpy.o sscal.o foo1.o ... foo20.o -llapack -lblas $(LIBNAME)$(SHLIB_EXT): $(OBJS) $(SHLIB_LD) $(SHLIB_LDFLAGS) -o $@ $(OBJS) $(FLIBS) clean: @rm -f *.o *.$(SHLIB_EXT) realclean: clean Some compiling outputs are the following: g77 -mieee-fp -fPIC -O2 -g -pipe -march=i386 -mcpu=i686 -c isamax.f -o isamax.o ... g77 -mieee-fp -fPIC -O2 -g -pipe -march=i386 -mcpu=i686 -c foo1.f -o foo1.o .. gcc -shared -o car.so isamax.o .. foo20.o -llapack -lblas -L/usr/local/lib -L/usr/lib/gcc-lib/i386-redhat-linux/3.3.2 -L/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/../../.. -lfrtbegin -lg2c -lm -lgcc_s However, it turns out that this process did not take into account these three files isamax, sgefa.f and sgesl.f. Instead, it used subroutines in Blas, but again for some reason, it provided error. My question is how do I set up my Makefile, or maybe other files, such that I have the same result as I did to compile and run these Fortran files directly. Thanks in advance. -- Zhu Wang Statistical Science Department Southern Methodist University Dallas, TX 75275-0332 Phone:(214)768-2453 Fax:(214)768-4035 [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
Re: [R] Rmetrics New Built
On Mon, May 31, 2004 at 09:54:21AM -0500, elijah wright wrote: > > If the Linux and Mac OSX builds are successfully done, I will submit the > > packages to the CRAN server. > > all four of the packages successfully build on Debian unstable - no > errors, nor warnings. this is a Good Thing. I would guesstimate that Ah, thanks, good to know. Did you try 'R CMD check' too, for good measure? > they should build trivially on OSX as well, but i'm at home today [in the > US, today is Memorial day - a sort of low-key holiday when people tend to > have picnics and things] and have no intention of driving to campus... > > maybe you can sucker Dirk into packaging them for Debian and getting them > into the system there? :) That has of course been the plan all along, for both Debian and Quantian. I'm a little behind on a few other things, but knowing that these build out of the box may well move them up the priority queue :) Thanks, Dirk -- FEATURE: VW Beetle license plate in California __ [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] Question about building library and BLAS
Zhu Wang <[EMAIL PROTECTED]> writes: > I am trying to create a library which uses some Fortran source files Someone named Martin Maechler will shortly be sending you email regarding the distinction between 'library' and 'package' :-) (You are creating a package, not a library, despite the fact that you will later attach it using a function called 'library'.) > and Lapack and Blas subroutines. The Fortran source files from the > original author contain subroutines isamax.f, sgefa.f and sgesl.f, > which are part of BLAS subroutines on my Linux computer, but maybe > different (old) versions. So in addition to these subroutines, there > are other Lapack and Blas subroutines involved. There is no problem > to compile and run these files using g77, such as the following to > create car: > > g77 -mieee-fp -fPIC -O2 -g -pipe -march=i386 -mcpu=i686 car > isamax.f, sgefa.f sgesl.f foo1.f ... foo20.f -llapack -lblas > > By doing this, the procedure does not use subroutines isamax.f, sgefa.f sgesl.f in > BLAS, > as expected. In fact, there are problems to use these subroutines in BLAS, for some > reason. > > Now what I want is to build an R library. The Makefile is the following: > > LIBNAME=car > > PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) > > OBJS=isamax.o saxpy.o sscal.o foo1.o ... foo20.o -llapack -lblas > > $(LIBNAME)$(SHLIB_EXT): $(OBJS) > $(SHLIB_LD) $(SHLIB_LDFLAGS) -o $@ $(OBJS) $(FLIBS) > > clean: > @rm -f *.o *.$(SHLIB_EXT) > > realclean: clean > > Some compiling outputs are the following: > > g77 -mieee-fp -fPIC -O2 -g -pipe -march=i386 -mcpu=i686 -c isamax.f > -o isamax.o > ... > g77 -mieee-fp -fPIC -O2 -g -pipe -march=i386 -mcpu=i686 -c foo1.f -o > foo1.o > .. > gcc -shared -o car.so isamax.o .. foo20.o -llapack -lblas > -L/usr/local/lib -L/usr/lib/gcc-lib/i386-redhat-linux/3.3.2 > -L/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/../../.. -lfrtbegin -lg2c > -lm -lgcc_s > > However, it turns out that this process did not take into account these > three files isamax, sgefa.f and sgesl.f. > Instead, it used subroutines in Blas, but again for some reason, it provided > error. I think you are working too hard. Temporarily move the source files for the BLAS and Lapack routines to backup names, such as isamax.f.old, then do the same to the Makefile (i.e. move it to Makefile.old) then create a file called Makevars containing PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) __ [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] Question about building library and BLAS
Douglas Bates <[EMAIL PROTECTED]> writes: > Zhu Wang <[EMAIL PROTECTED]> writes: > > > I am trying to create a library which uses some Fortran source files > > Someone named Martin Maechler will shortly be sending you email > regarding the distinction between 'library' and 'package' :-) > > (You are creating a package, not a library, despite the fact that >you will later attach it using a function called 'library'.) > > > and Lapack and Blas subroutines. The Fortran source files from the > > original author contain subroutines isamax.f, sgefa.f and sgesl.f, > > which are part of BLAS subroutines on my Linux computer, but maybe > > different (old) versions. So in addition to these subroutines, there > > are other Lapack and Blas subroutines involved. There is no problem > > to compile and run these files using g77, such as the following to > > create car: > > > > g77 -mieee-fp -fPIC -O2 -g -pipe -march=i386 -mcpu=i686 car > > isamax.f, sgefa.f sgesl.f foo1.f ... foo20.f -llapack -lblas > > > > By doing this, the procedure does not use subroutines isamax.f, sgefa.f sgesl.f in > > BLAS, > > as expected. In fact, there are problems to use these subroutines in BLAS, for > > some reason. > > > > Now what I want is to build an R library. The Makefile is the following: > > > > LIBNAME=car > > > > PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) > > > > OBJS=isamax.o saxpy.o sscal.o foo1.o ... foo20.o -llapack -lblas > > > > $(LIBNAME)$(SHLIB_EXT): $(OBJS) > > $(SHLIB_LD) $(SHLIB_LDFLAGS) -o $@ $(OBJS) $(FLIBS) > > > > clean: > > @rm -f *.o *.$(SHLIB_EXT) > > > > realclean: clean > > > > Some compiling outputs are the following: > > > > g77 -mieee-fp -fPIC -O2 -g -pipe -march=i386 -mcpu=i686 -c isamax.f > > -o isamax.o > > ... > > g77 -mieee-fp -fPIC -O2 -g -pipe -march=i386 -mcpu=i686 -c foo1.f -o > > foo1.o > > .. > > gcc -shared -o car.so isamax.o .. foo20.o -llapack -lblas > > -L/usr/local/lib -L/usr/lib/gcc-lib/i386-redhat-linux/3.3.2 > > -L/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/../../.. -lfrtbegin -lg2c > > -lm -lgcc_s > > > > However, it turns out that this process did not take into account these > > three files isamax, sgefa.f and sgesl.f. > > Instead, it used subroutines in Blas, but again for some reason, it provided > > error. > > I think you are working too hard. Temporarily move the source files > for the BLAS and Lapack routines to backup names, such as > isamax.f.old, then do the same to the Makefile (i.e. move it to > Makefile.old) then create a file called Makevars containing > > PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) I should have read your message more carefully. Those three Fortran routines that you mention are single precision and it would be silly to use them on modern computers. R only provides single precision floating point for compatibility. All numerical linear algebra is doing in double precision. Check where sgefa and sgesl are being called and see if they really need to be in single precision. I'm sure if you replace them by calls to dgefa and dgesl (and suitably change the precision of the arguments) they will run as fast as before. In fact you can probably use the Lapack routines dgetrf and dgetrs instead and get a performance boost. __ [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] Calculating distances between points in a data frame?
Try using running from the gregmisc package with pad = TRUE: require(gregmisc) XY <- data.frame(num = seq(0,10), X = seq(0,30,3), Y = seq(0, 40, 4) ) DistXY <- function(idx) { i <- idx[2] with(XY, sqrt( (X[i]-X[i-1])^2 + (Y[i]-Y[i-1])^2 ) ) } XY$Dist <- running( 1:nrow(XY), width=2, fun = DistXY, pad = TRUE ) Sander Oom oomvanlieshout.net> writes: : : Dear list, : : I would like to calculate the distance between consecutive points in a data : frame. Of course the first point in the data frame does not have a point of : origin, and should get a value NA. I have tried two different loops, which : both result in error: : : > num <- seq(0,10,1) : > X <- seq(0,30,3) : > Y <- seq(0,40,4) : > XY <- data.frame(num, X, Y) : > attach(XY) : > summary(XY) :num X Y : Min. : 0.0 Min. : 0.0 Min. : 0 : 1st Qu.: 2.5 1st Qu.: 7.5 1st Qu.:10 : Median : 5.0 Median :15.0 Median :20 : Mean : 5.0 Mean :15.0 Mean :20 : 3rd Qu.: 7.5 3rd Qu.:22.5 3rd Qu.:30 : Max. :10.0 Max. :30.0 Max. :40 : > plot(X,Y) : > rngNum <- range(num) : > for (i in rngNum){ : + XY$DistXY[i] <- sqrt( ((X[i]-X[i-1])^2) + ((Y[i]-Y[i-1])^2) ) : + } : Error in "$<-.data.frame"(`*tmp*`, "DistXY", value = sqrt(((X[i] - X[i - : : replacement has 10 rows, data has 11 : > for (i in rngNum){ : + XY$DistXY2[i] <- ifelse(i=min(rngNum), NA, sqrt(((X[i]-X[i-1])^2) + : ((Y[i]-Y[i-1])^2)) ) : + } : Error in ifelse(i = min(rngNum), NA, sqrt(((X[i] - X[i - 1])^2) + ((Y[i] - : : unused argument(s) (i ...) : > detach(XY) : > : : Any suggestions much appreciated, : : Sander Oom. : : -- : Dr. Sander P. Oom : Animal, Plant and Environmental Sciences : University of the Witwatersrand : Private Bag 3 : Wits 2050 : South Africa : : Tel (work) +27 (0)11 717 64 04 : Tel (home) +27 (0)18 297 44 51 : Fax +27 (0)18 299 24 64 : : Email sander oomvanlieshout.net : Web www.oomvanlieshout.net/sander : : __ : R-help stat.math.ethz.ch 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
[R] Putting referenced titles on plots
I have a data frame "ctx" and an array "names", where names[i] is the column name for ctx[i], and am making histograms for each column of ctx: for (i in 2:ncol(ctx)){hist(ctx[,i], br=100, main=names[i])} The titles don't come out like I expect. Each names[i] is something like "1098_s_at" and R doesn't seem to like printing these. Instead, it prints "1" or "2" or "3" etc. I have also tried binding ctx and names into a single data frame and referencing the first row of each [i] as the title, but I get the same result. Can someone tell me how to get these titles attached? Thanks, Graham __ [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
[R] Contrasts
Hello, I am trying to figure out how to conduct a t-test on a specific contrast for my data. I have four factors in my data and would like to conduct a t-test on the average of the data from the first two factors against the average of the data on the second two factor (i.e. is the average of the first two different from the average of the second two). Is there a quick way to do this? I found the contrast function, but wasn't sure how to apply it. Thank you, Kim __ [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] Regression model type II
Hi Benjamin, Maybe this link is useful to you: http://eeb37.biosci.arizona.edu/~brian/splus.html It has a function 'slope' that calculates different type II regressions and a link to a paper comparing them. Although it was written for S-plus it works in R too. If you get any better solutions, let me know. Best regards, Angel Benjamin PLANQUE wrote: I am trying to fit regression models type II with R, but it seems to me that most (all) of the linear model functions are for type I regressions. Does anyone knows whether type II regressions functions exist in R. Benjamin __ [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] Putting referenced titles on plots
[EMAIL PROTECTED] wrote: I have a data frame "ctx" and an array "names", where names[i] is the column name for ctx[i], and am making histograms for each column of ctx: for (i in 2:ncol(ctx)){hist(ctx[,i], br=100, main=names[i])} Works for me. Are you sure "names" is a vector containing the stuff you expect to be printed? Uwe Ligges The titles don't come out like I expect. Each names[i] is something like "1098_s_at" and R doesn't seem to like printing these. Instead, it prints "1" or "2" or "3" etc. I have also tried binding ctx and names into a single data frame and referencing the first row of each [i] as the title, but I get the same result. Can someone tell me how to get these titles attached? Thanks, Graham __ [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] Putting referenced titles on plots
1. That seems strange. The following simplification of your function produced sensible results for me: hist(1:4, main= "1098_s_at") I got similar results from your exact statement after first defining names and ctx as follows: names <- letters[1:3] ctx <- data.frame(x=1:4, y=1:4, a=1:4) In each case, I got a histogram with a standard text title at the top. What version of R are you running? If it's NOT R 1.9.0pat, you might try upgrading -- and then running "update.packages()". 2. "names" is that name of a function, and it is generally considered bad practice to mask function names with names of other objects, even though R can often (though not always) determine which object you want from the context. What do you get from "conflicts()"? hope this helps. spencer graves [EMAIL PROTECTED] wrote: I have a data frame "ctx" and an array "names", where names[i] is the column name for ctx[i], and am making histograms for each column of ctx: for (i in 2:ncol(ctx)){hist(ctx[,i], br=100, main=names[i])} The titles don't come out like I expect. Each names[i] is something like "1098_s_at" and R doesn't seem to like printing these. Instead, it prints "1" or "2" or "3" etc. I have also tried binding ctx and names into a single data frame and referencing the first row of each [i] as the title, but I get the same result. Can someone tell me how to get these titles attached? Thanks, Graham __ [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] Question about building library and BLAS
On Mon, 2004-05-31 at 11:39, Douglas Bates wrote: > I should have read your message more carefully. Those three Fortran > routines that you mention are single precision and it would be silly > to use them on modern computers. R only provides single precision > floating point for compatibility. All numerical linear algebra is > doing in double precision. Check where sgefa and sgesl are being > called and see if they really need to be in single precision. I'm > sure if you replace them by calls to dgefa and dgesl (and suitably > change the precision of the arguments) they will run as fast as > before. Thanks. I have replaced sgefa and sgesl with dgefa and dgesl. The results are confirmed by running the compiled Fortran code. I will convey this to the original author. > In fact you can probably use the Lapack routines dgetrf and > dgetrs instead and get a performance boost. I will try to improve later. -- Zhu Wang __ [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] Calculating distances between points in a data frame?
Hi Gabor, Thanks for your suggestion. However when installing the package gregmisc, I get the following error: > local({a <- CRAN.packages() + install.packages(select.list(a[,1],,TRUE), .libPaths()[1], available=a)}) trying URL `http://cran.r-project.org/bin/windows/contrib/1.9/PACKAGES' Content type `text/plain; charset=iso-8859-1' length 17940 bytes opened URL downloaded 17Kb trying URL `http://cran.r-project.org/bin/windows/contrib/1.9/gregmisc_1.11.0.zip' Error in download.file(url, destfile, method, mode = "wb") : cannot open URL `http://cran.r-project.org/bin/windows/contrib/1.9/gregmisc_1.11.0.zip' In addition: Warning message: cannot open: HTTP status was `404 Not Found' > I was quite surprised as well! I tried different mirrors, but to no avail. Maybe tomorrow, Sander. At 18:44 2004/05/31, you wrote: Try using running from the gregmisc package with pad = TRUE: require(gregmisc) XY <- data.frame(num = seq(0,10), X = seq(0,30,3), Y = seq(0, 40, 4) ) DistXY <- function(idx) { i <- idx[2] with(XY, sqrt( (X[i]-X[i-1])^2 + (Y[i]-Y[i-1])^2 ) ) } XY$Dist <- running( 1:nrow(XY), width=2, fun = DistXY, pad = TRUE ) Sander Oom oomvanlieshout.net> writes: : : Dear list, : : I would like to calculate the distance between consecutive points in a data : frame. Of course the first point in the data frame does not have a point of : origin, and should get a value NA. I have tried two different loops, which : both result in error: : : > num <- seq(0,10,1) : > X <- seq(0,30,3) : > Y <- seq(0,40,4) : > XY <- data.frame(num, X, Y) : > attach(XY) : > summary(XY) :num X Y : Min. : 0.0 Min. : 0.0 Min. : 0 : 1st Qu.: 2.5 1st Qu.: 7.5 1st Qu.:10 : Median : 5.0 Median :15.0 Median :20 : Mean : 5.0 Mean :15.0 Mean :20 : 3rd Qu.: 7.5 3rd Qu.:22.5 3rd Qu.:30 : Max. :10.0 Max. :30.0 Max. :40 : > plot(X,Y) : > rngNum <- range(num) : > for (i in rngNum){ : + XY$DistXY[i] <- sqrt( ((X[i]-X[i-1])^2) + ((Y[i]-Y[i-1])^2) ) : + } : Error in "$<-.data.frame"(`*tmp*`, "DistXY", value = sqrt(((X[i] - X[i - : : replacement has 10 rows, data has 11 : > for (i in rngNum){ : + XY$DistXY2[i] <- ifelse(i=min(rngNum), NA, sqrt(((X[i]-X[i-1])^2) + : ((Y[i]-Y[i-1])^2)) ) : + } : Error in ifelse(i = min(rngNum), NA, sqrt(((X[i] - X[i - 1])^2) + ((Y[i] - : : unused argument(s) (i ...) : > detach(XY) : > : : Any suggestions much appreciated, : : Sander Oom. : : -- : Dr. Sander P. Oom : Animal, Plant and Environmental Sciences : University of the Witwatersrand : Private Bag 3 : Wits 2050 : South Africa : : Tel (work) +27 (0)11 717 64 04 : Tel (home) +27 (0)18 297 44 51 : Fax +27 (0)18 299 24 64 : : Email sander oomvanlieshout.net : Web www.oomvanlieshout.net/sander : : __ : R-help stat.math.ethz.ch 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 __ [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] Contrasts
I hope you get a reply from someone who knows more about this than I. However, in the spirit that a quick hack is sometimes better than an elegant answer later, consider the following: DF <- data.frame(a=rep(letters[1:4], 2), y=1:8) > DF$b <- ((DF$a %in% letters[1:2])-(DF$a%in% letters[3:4])) > fit <- lm(y~b+a, DF, singular.ok=T) > summary(fit) Call: lm(formula = y ~ b + a, data = DF, singular.ok = T) Residuals: 1 2 3 4 5 6 7 8 -2 -2 -2 -2 2 2 2 2 Coefficients: (1 not defined because of singularities) Estimate Std. Error t value Pr(>|t|) (Intercept)4.500 1.414 3.182 0.0335 * b -1.500 1.414 -1.061 0.3486 ab 1.000 2.828 0.354 0.7415 ac-1.000 2.828 -0.354 0.7415 adNA NA NA NA --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 Residual standard error: 2.828 on 4 degrees of freedom Multiple R-Squared: 0.2381, Adjusted R-squared: -0. F-statistic: 0.4167 on 3 and 4 DF, p-value: 0.751 This will give you what you want ONLY if you have the same number of observations in the two subsets to be compared. If not, then you can redefine DF$b to produce what you want. hope this helps. spencer graves Kimberly Ann Fernandes wrote: Hello, I am trying to figure out how to conduct a t-test on a specific contrast for my data. I have four factors in my data and would like to conduct a t-test on the average of the data from the first two factors against the average of the data on the second two factor (i.e. is the average of the first two different from the average of the second two). Is there a quick way to do this? I found the contrast function, but wasn't sure how to apply it. Thank you, Kim __ [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] [OT] "plot y against x"
It would not matter if the relationship you are trying to plot is monotonic and therefore invertible. If the relationship is non-monotonic and therefore not invertible, then it does matter which variable you call dependent, since in this latter case you have a multi-valued relationship. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Ted Harding Sent: Monday, May 31, 2004 10:52 To: [EMAIL PROTECTED] Subject: [R] [OT] "plot y against x" Hi Folks, I'd be grateful for some views on the following. When I say "plot y against x" I mean that y is on the vertical axis and x is on the horizontal axis. I acquired this usage so long ago that I can no longer remember how I acquired it, and therefore can not cite my "authority" for my usage. There can also be an implication that y is a function of x (or y is a "dependent" variable and x an "independent" variable). To the best of my knowledge, this is the standard usage. However, I have had a query which suggests that the "transposed" meaning may be quite frequently adopted, i.e. "plot x [horizontal axis] against y [vertical axis]" Google tells me that "plot y against x" throws up about 147 hits, while "plot x against y" throws up about 54 hits. One of the latter is unequivocal and comes from a respected department of mathematics: http://www.maths.lancs.ac.uk/dept/coursenotes/lab100/pdffiles/a12.pdf Q 12.1 A simple plot. Invoke Matlab in an Xterm window and position the Figure window so that you can see it properly. x = -3:5% plotting values (range) y = 2*x + 3 % a linear function of x plot(x,y) % plot x against y and at least two refer to "Statistical analysis with R" (so maybe I'm not so off-topic after all), also unequivocal, e.g.: http://www.nbn.ac.za/Education/11-stats-2004/R1.8/r_workshop.pdf Example: Plotting functions Assume that you were to plot a function by hand. One possibility of doing it is to 1. Select some xvalues from the range to be plotted 2. Compute the corresponding y = f(x) values 3. Plot x against y 4. Add a (more or less) smooth line connecting the (x; y)points ... plot(x, y)# plots x against y (However, in R itself, "?plot" is discretely silent about what is "against" what!) I'd value commments on whether the above "transposed" usage is in fact sufficiently common (perhaps mainly in certain subject areas) as to constitute a "linguistic enclave" with a valid dialectal usage which is the opposite of the standard. Or maybe there isn't really a standard. This would help to respond to the query, which whether in writing something which uses "plot y against x" it would be worth while including an explicit explanation of which way round it is meant, so that it's clear to any reader, whichever dialectal group they belong to. There was also a related query on whether "regression of Y on X" could be understood the "wrong way round" and about usage of the phrase "a model for Y against X". Where regression is concerned, I don't think there is room for doubt and anyone who interpreted it on the lines of "X~Y" is simply wrong. "Model for Y against X", however, is not a standard phrase, I think (though clear enough if you make the analogy with "plot"), and would need the same disambiguation as "plot y against x" (if any is needed). With thanks! Best wishes to all, Ted. E-Mail: (Ted Harding) <[EMAIL PROTECTED]> Fax-to-email: +44 (0)870 167 1972 Date: 31-May-04 Time: 15:51:53 -- XFMail -- __ [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] Calculating distances between points in a data frame?
Sander Oom wrote: Hi Gabor, Thanks for your suggestion. However when installing the package gregmisc, I get the following error: > local({a <- CRAN.packages() + install.packages(select.list(a[,1],,TRUE), .libPaths()[1], available=a)}) trying URL `http://cran.r-project.org/bin/windows/contrib/1.9/PACKAGES' Content type `text/plain; charset=iso-8859-1' length 17940 bytes opened URL downloaded 17Kb trying URL `http://cran.r-project.org/bin/windows/contrib/1.9/gregmisc_1.11.0.zip' Error in download.file(url, destfile, method, mode = "wb") : cannot open URL `http://cran.r-project.org/bin/windows/contrib/1.9/gregmisc_1.11.0.zip' In addition: Warning message: cannot open: HTTP status was `404 Not Found' > I was quite surprised as well! I tried different mirrors, but to no avail. Maybe tomorrow, Sander. There is a bug in the script that uploads binary packages to CRAN. The PACKAGES file for R-1.9.x/R-2.0.x for Windows erroneously indicates that gregmisc_1.11.0.zip is available, but it isn't (at least the PACKAGES file will be fixed tomorrow). gregmisc does not pass the checks (well, it even does not install) on Windows, see: CRAN/bin/windows/contrib/checkSummaryWin.html There is a note on that page which points you to an outdated but still available Windows version: CRAN/bin/windows/contrib/1.9/last/gregmisc_0.10.2.zip Uwe Ligges At 18:44 2004/05/31, you wrote: Try using running from the gregmisc package with pad = TRUE: require(gregmisc) XY <- data.frame(num = seq(0,10), X = seq(0,30,3), Y = seq(0, 40, 4) ) DistXY <- function(idx) { i <- idx[2] with(XY, sqrt( (X[i]-X[i-1])^2 + (Y[i]-Y[i-1])^2 ) ) } XY$Dist <- running( 1:nrow(XY), width=2, fun = DistXY, pad = TRUE ) Sander Oom oomvanlieshout.net> writes: : : Dear list, : : I would like to calculate the distance between consecutive points in a data : frame. Of course the first point in the data frame does not have a point of : origin, and should get a value NA. I have tried two different loops, which : both result in error: : : > num <- seq(0,10,1) : > X <- seq(0,30,3) : > Y <- seq(0,40,4) : > XY <- data.frame(num, X, Y) : > attach(XY) : > summary(XY) :num X Y : Min. : 0.0 Min. : 0.0 Min. : 0 : 1st Qu.: 2.5 1st Qu.: 7.5 1st Qu.:10 : Median : 5.0 Median :15.0 Median :20 : Mean : 5.0 Mean :15.0 Mean :20 : 3rd Qu.: 7.5 3rd Qu.:22.5 3rd Qu.:30 : Max. :10.0 Max. :30.0 Max. :40 : > plot(X,Y) : > rngNum <- range(num) : > for (i in rngNum){ : + XY$DistXY[i] <- sqrt( ((X[i]-X[i-1])^2) + ((Y[i]-Y[i-1])^2) ) : + } : Error in "$<-.data.frame"(`*tmp*`, "DistXY", value = sqrt(((X[i] - X[i - : : replacement has 10 rows, data has 11 : > for (i in rngNum){ : + XY$DistXY2[i] <- ifelse(i=min(rngNum), NA, sqrt(((X[i]-X[i-1])^2) + : ((Y[i]-Y[i-1])^2)) ) : + } : Error in ifelse(i = min(rngNum), NA, sqrt(((X[i] - X[i - 1])^2) + ((Y[i] - : : unused argument(s) (i ...) : > detach(XY) : > : : Any suggestions much appreciated, : : Sander Oom. : : -- : Dr. Sander P. Oom : Animal, Plant and Environmental Sciences : University of the Witwatersrand : Private Bag 3 : Wits 2050 : South Africa : : Tel (work) +27 (0)11 717 64 04 : Tel (home) +27 (0)18 297 44 51 : Fax +27 (0)18 299 24 64 : : Email sander oomvanlieshout.net : Web www.oomvanlieshout.net/sander : : __ : R-help stat.math.ethz.ch 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 __ [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] Rmetrics New Built
> > > If the Linux and Mac OSX builds are successfully done, I will submit > > > the packages to the CRAN server. > > > > all four of the packages successfully build on Debian unstable - no > > errors, nor warnings. this is a Good Thing. I would guesstimate that > > Ah, thanks, good to know. Did you try 'R CMD check' too, for good > measure? good idea. doing that reveals the following. dirk, most of this is for your reference as a repackager, so that you know what dependencies will have to be met for useful debian packages. :) there are also some problems that become evident with the packages... 1) fBasics requires package "date" after i fixed the date package dependency, i get this error from R check: Running examples in fBasics-Ex.R failed. The error most likely occurred in: > ### * B1-ghypDistribution > > flush(stderr()); flush(stdout()) 2) fExtremes requires packages "evd" and "ismev" after fixing those two dependencies, R CMD check produces the following output: * checking S3 generic/method consistency ... WARNING Error in .tryQuietly({ : Error in library(package, lib.loc = lib.loc, character.only = TRUE, verbose = FALSE) : .First.lib failed Execution halted * checking for replacement functions with final arg not named 'value' ... WARNING Error in .tryQuietly({ : Error in library(package, lib.loc = lib.loc, character.only = TRUE, verbose = FALSE) : .First.lib failed Execution halted * checking foreign function calls ... WARNING Error in .tryQuietly({ : Error in library(package, lib.loc = lib.loc, character.only = TRUE, verbose = FALSE) : .First.lib failed Execution halted * checking Rd files ... WARNING Rd files with non-standard keywords: 'man/C3-gpdglmFit.Rd': fExtremes 'man/C1-gpdFamily.Rd': fExtremes 'man/C6-rlargFit.Rd': fExtremes 'man/C5-ppFit.Rd': fExtremes 'man/B1-gevFamily.Rd': fExtremes 'man/Z1-fExtremesTools.Rd': fExtremes 'man/B4-mdaPlots.Rd': fExtremes 'man/B2-gevFit.Rd': fExtremes 'man/D1-exindexPlots.Rd': fExtremes 'man/C4-potFit.Rd': fExtremes 'man/A2-getExtremes.Rd': fExtremes 'man/B3-gevglmFit.Rd': fExtremes 'man/A1-evPlots.Rd': fExtremes 'man/C2-gpdFit.Rd': fExtremes Each '\keyword' entry should specify one of the standard keywords (as listed in file 'KEYWORDS.db' in the 'doc' subdirectory of the R home directory). See chapter 'Writing R documentation files' in manual 'Writing R Extensions'. * checking for missing documentation entries ... ERROR Error in .tryQuietly({ : Error in library(package, lib.loc = lib.loc, character.only = TRUE, verbose = FALSE) : 3) fOptions documentation needs work? * checking Rd files ... WARNING Rd files with non-standard keywords: 'man/D2-MonteCarloOptions.Rd': fOptions 'man/C2-HestonNandiOptions.Rd': fOptions 'man/B2-MultAssetsOptions.Rd': fOptions 'man/B5-BinaryOptions.Rd': fOptions 'man/C1-hngarchFit.Rd': fOptions 'man/A2-BasicAmericanOptions.Rd': fOptions 'man/Z1-fOptionsTools.Rd': fOptions 'man/B1-MultExercisesOptions.Rd': fOptions 'man/D1-LowDiscrepancy.Rd': fOptions 'man/B3-LookbackOptions.Rd': fOptions 'man/A3-BinomialTreeOptions.Rd': fOptions 'man/B6-AsianOptions.Rd': fOptions 'man/B4-BarrierOptions.Rd': fOptions 'man/A1-PlainVanillaOptions.Rd': fOptions 'man/B7-FXTransOptions.Rd': fOptions Each '\keyword' entry should specify one of the standard keywords (as listed in file 'KEYWORDS.db' in the 'doc' subdirectory of the R home directory). 4) fSeries: Packages required but not available: mda polspline fixed these dependencies on my local system - no biggie - then from R CMD check got: * checking S3 generic/method consistency ... WARNING Error in .tryQuietly({ : Error in library(package, lib.loc = lib.loc, character.only = TRUE, verbose = FALSE) : .First.lib failed Execution halted * checking for replacement functions with final arg not named 'value' ... WARNING Error in .tryQuietly({ : Error in library(package, lib.loc = lib.loc, character.only = TRUE, verbose = FALSE) : .First.lib failed Execution halted * checking foreign function calls ... WARNING Error in .tryQuietly({ : Error in library(package, lib.loc = lib.loc, character.only = TRUE, verbose = FALSE) : .First.lib failed Execution halted * checking Rd files ... WARNING Rd files with non-standard keywords: 'man/D1-fSeriesData.Rd': fSeries 'man/Z1-fSeriesTools.Rd': fSeries 'man/B2-lmTests.Rd': fSeries 'man/B1-regressionModelling.Rd': fSeries 'man/C3-rollingAnalysis.Rd': fSeries 'man/A4-randomInnovations.Rd': fSeries 'man/A3-garchModelling.Rd': fSeries 'man/C2-benchmarkAnalysis.Rd': fSeries 'man/A2-armaStatistics.Rd': fSeries 'man/A1-armaModelling.Rd': fSeries 'man/A5-tseriesTests.Rd': fSeries 'man/C1-technicalAnalysis.Rd': fSeries Each '\keyword' entry should specify one of the standard keywords (as listed in file 'KEYWORDS.db' in the 'doc' subdirectory of the R home directory). See chapter 'Writing R documentation files' in manual
Re: [R] Putting referenced titles on plots
Thank you both for the help. The below 1. works for me, too, both cases. I am not actually using "names" as an object name. I am writing: for (i in 2:nrow(ctxheadlogtrans)){hist(ctxheadlogtrans[,i], br=100, main=gene.names.head[i])} which gives me histograms titled "1", "2", "3", etc. But: gene.names.head[1] gives me "1007_s_at", and gene.names.head[2] gives me "1053_at" and for (i in 2:5){print(gene.names.head[i])} gives me a list of the titles I want. I am using RAqua 1.8.1 on Mac OS X. Is there something I am missing? Thanks, Graham On May 31, 2004, at 10:37 AM, Spencer Graves wrote: 1. That seems strange. The following simplification of your function produced sensible results for me: hist(1:4, main= "1098_s_at") I got similar results from your exact statement after first defining names and ctx as follows: names <- letters[1:3] ctx <- data.frame(x=1:4, y=1:4, a=1:4) In each case, I got a histogram with a standard text title at the top. What version of R are you running? If it's NOT R 1.9.0pat, you might try upgrading -- and then running "update.packages()". 2. "names" is that name of a function, and it is generally considered bad practice to mask function names with names of other objects, even though R can often (though not always) determine which object you want from the context. What do you get from "conflicts()"? hope this helps. spencer graves [EMAIL PROTECTED] wrote: I have a data frame "ctx" and an array "names", where names[i] is the column name for ctx[i], and am making histograms for each column of ctx: for (i in 2:ncol(ctx)){hist(ctx[,i], br=100, main=names[i])} The titles don't come out like I expect. Each names[i] is something like "1098_s_at" and R doesn't seem to like printing these. Instead, it prints "1" or "2" or "3" etc. I have also tried binding ctx and names into a single data frame and referencing the first row of each [i] as the title, but I get the same result. Can someone tell me how to get these titles attached? Thanks, Graham __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://rd.mailshell.com/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] Putting referenced titles on plots
Is `names' by any chance a factor? What is class(names)? If `names' is a factor, then you're getting the underlying numeric representation rather than the factor levels. -roger [EMAIL PROTECTED] wrote: I have a data frame "ctx" and an array "names", where names[i] is the column name for ctx[i], and am making histograms for each column of ctx: for (i in 2:ncol(ctx)){hist(ctx[,i], br=100, main=names[i])} The titles don't come out like I expect. Each names[i] is something like "1098_s_at" and R doesn't seem to like printing these. Instead, it prints "1" or "2" or "3" etc. I have also tried binding ctx and names into a single data frame and referencing the first row of each [i] as the title, but I get the same result. Can someone tell me how to get these titles attached? Thanks, Graham __ [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] Putting referenced titles on plots
Yes! Thank you. It is a factor (I don't know how it became a factor). I created an array based on the 'names' factor, and can get the titles by referencing the new array. Thanks so much, Graham On May 31, 2004, at 11:44 AM, Roger D. Peng wrote: Is `names' by any chance a factor? What is class(names)? If `names' is a factor, then you're getting the underlying numeric representation rather than the factor levels. -roger [EMAIL PROTECTED] wrote: I have a data frame "ctx" and an array "names", where names[i] is the column name for ctx[i], and am making histograms for each column of ctx: for (i in 2:ncol(ctx)){hist(ctx[,i], br=100, main=names[i])} The titles don't come out like I expect. Each names[i] is something like "1098_s_at" and R doesn't seem to like printing these. Instead, it prints "1" or "2" or "3" etc. I have also tried binding ctx and names into a single data frame and referencing the first row of each [i] as the title, but I get the same result. Can someone tell me how to get these titles attached? Thanks, Graham __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://rd.mailshell.com/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] Converting data frame to array?
Dear John, Thank you for your helpful answer. I was obviously being stupid, as I have, as you point out, more predictors than observations. What I was hoping to get was some sort of an "explaining linear combination" of my predictors: which predictors are important for the results I see (if any) and which are irrelevant. Any hints on how to achieve that? Cheers Thomas -Original Message- From: John Fox [mailto:[EMAIL PROTECTED] Sent: 29. maj 2004 01:24 To: TAPO (Thomas Agersten Poulsen) Cc: [EMAIL PROTECTED] Subject: RE: [R] Converting data frame to array? Dear Thomas, In fact, the more common way to fit a linear regression in R is to use variables in a data frame (or list) along with a model formula specifying the model. All of this is explained in the Introduction to R manual that is distributed with R: see, in particular, Sec. 6.3 on data frames, Sec. 7 on reading data from files, and Sec. 11 on statistical models. Given two data frames, say d1 and d2, the first containing, e.g., observations on variables x1 and x2 and the second on y, one could do lm(y ~ x1 + x2, data=c(x1, x2)) or lm(y ~ x1 + x2, data=data.frame(x1, x2)). That said, it's not altogether clear to me what it is that you're trying to do. Are there 10 observations on 300 variables in the first data frame, constituting the predictors, and 10 observations on 1 variable in the second data frame, constituting the response? If so, you have many more predictors than observations, and it's not reasonable to perform a regression. Of course, I may not have this straight. I hope this helps, John > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of TAPO > (Thomas Agersten Poulsen) > Sent: Friday, May 28, 2004 2:11 PM > To: [EMAIL PROTECTED] > Subject: [R] Converting data frame to array? > > Dear List, > > Please bear with a poor newbee, who might be doing > everything backwards (I was brought up in pure math). > > I want to make a simple multi-linear regression on a > set of data. I did some expreiments, and if X is a 4 by 2 > array and Y is a 4 by > 1 array, I can do a linear regression by lm(y~x). > > Now I have a tab-delimited text file with 10 rows of > 300 measurements and an other file with 10 rows of one value > each. When I read in those files using read.delim(), I get > data frames, and apparently I can no longer do the > multi-linear regression. > > Is there a way to convert the data frames into arrays, > or am I going the wrong way about this? > > Sincerely > Thomas Poulsen > > __ > [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
[R] ffnet problem
Context:Linux debian testing, compiled R 1.9.0 from source. I've just installed the contributed ffnet package wit no problem at all. But when loading the library the following error message is popping up and no ffnet command seems to work: >library("ffnet") Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load shared library "/usr/local/lib/R/library/ffnet/libs/ffnet.so": libstdc++.so.2.8: cannot open shared object file: No such file or directory Error in library("ffnet") : .First.lib failed .. What should I do? Ciao Vittorio __ [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] ffnet problem
On Mon, May 31, 2004 at 09:38:54PM +0200, [EMAIL PROTECTED] wrote: > Context:Linux debian testing, compiled R 1.9.0 from source. > > I've just installed the contributed ffnet package wit no problem at all. "No problem at all" seems unlikely in light of ... > But when loading the library the following error message is popping up and > no ffnet command seems to work: > > >library("ffnet") > Error in dyn.load(x, as.logical(local), as.logical(now)) : > unable to load shared library "/usr/local/lib/R/library/ffnet/libs/ffnet.so": > libstdc++.so.2.8: cannot open shared object file: No such file or directory > Error in library("ffnet") : .First.lib failed ... this. Are you sure ffnet really built? Dirk -- FEATURE: VW Beetle license plate in California __ [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
[R] Doubts on anova and use of contrasts in multcomp package
Dear list, I have been studying R and I would like the aid of more experienced to solve the problems of the analysis below: r = gl(3, 8, label = c('r1', 'r2', 'r3')) e = rep(gl(2, 4, label = c('e1', 'e2')), 3) y = c(26.2, 26.0, 25.0, 25.4, 24.8, 24.6, 26.7, 25.2, 25.7, 26.3, 25.1, 26.4, 19.6, 21.1, 19.0, 18.6, 22.8, 19.4, 18.8, 19.2, 19.8, 21.4, 22.8, 21.3) df = data.frame(r, e, y) aux = sort(rep(letters[1:6], 4)) #auxiliary variable df = data.frame(df, aux) attach(df) par(mfrow = c(2, 1)) interaction.plot(r, e, y, col = 'blue', ylab = 'y', xlab = 'r') interaction.plot(e, r, y, col = 'blue', ylab = 'y', xlab = 'r') av1 = aov(y ~ r*e) av2 = aov(y ~ r/e) efR_E = summary(av2, split = list('r:e' = list( 'e1 vs e2/r1' = 1, 'e1 vs e2/r2' = 2, 'e1 vs e2/r3' = 3))) av3 = aov(y ~ e/r) efE_R = summary(av3, split = list('e:r' = list( 'r/e1' = c(1,3), 'r/e2' = c(2,4 mds = model.tables(av1, ty = 'means') detach(df) cat('\nData:'); cat('\n') print(df) cat('\nMeans:'); cat('\n') print(mds) cat('\nANOVA:'); cat('\n') print(summary(av1)); cat('\n') cat('\nANOVA - E effect in R levels:'); cat('\n') print(efR_E); cat('\n') cat('\nANOVA - R effect in E levels:'); cat('\n') print(efE_R); cat('\n') #===Below: my original intention (post in this list and still not answered...) # ANOVA - R effect in E levels: #-- # Df # e 1 # e:r 4 #e:r: r/e1 2 # r1 vs (r2,r3)/e1 1?... # r2 vs r3/e11?... #e:r: r/e2 2 # r1 vs (r2,r3)/e1 1?... # r2 vs r3/e21?... #-- #Residuals 18 #-- #===Below: alternative using multcomp # (with auxiliary variable - aux) to study R effect in E levels: # a: r1/e1 # c: r2/e1 # e: r3/e1 # b: r1/e2 # d: r2/e2 # f: r3/e2 #a b c de f C1 = c(2, 0, -1, 0, -1, 0)# r1 vs (r2,r3)/e1 C2 = c(0, 0, 1, 0, -1, 0)# r2 vs r3/e1 C3 = c(0, 2, 0, -1, 0, -1)# r1 vs (r2,r3)/e2 C4 = c(0, 0, 0, 1, 0, -1)# r2 vs r3/e2 C = rbind(C1, C2, C3, C4) row.names(C) = c('r1 vs (r2,r3)/e1', 'r2 vs r3/e1', 'r1 vs (r2,r3)/e2', 'r2 vs r3/e2') lim1 = lm(y ~ aux, data = df) print(anova(lim1)) tc1 = simtest(y ~ aux, data = df, conf.level = 0.9, alternative = 'less', eps = 1e-04, cmatrix = C) print(summary(tc1)) #===Below: verifying E effect in R levels (already analized in av2) # (with auxiliary variable - aux) # a: e1/r1 # c: e1/r2 # e: e1/r3 # b: e2/r1 # d: e2/r2 # f: e2/r3 #a b c d ef C1 = c(1, -1, 0, 0, 0, 0)# e1 vs e2/r1 C2 = c(0, 0, 1, -1, 0, 0)# e1 vs e2/r2 C3 = c(0, 0, 0, 0, 1, -1)# e1 vs e2/r3 C = rbind(C1, C2, C3) row.names(C) = c('e1 vs e2/r1', 'e1 vs e2/r2', 'e1 vs e2/r3') lim2 = lm(y ~ aux, data = df) print(anova(lim2)) tc2 = simtest(y ~ aux, data = df, conf.level = 0.9, alternative = 'less', eps = 1e-04, cmatrix = C) print(summary(tc2)) #===My Questions: # a) Is possible the resolution of the original intention? How? # b) Why p-values of soluctions av2 and lim2 dont agree? # c) Are there another better way to lead of this analysis? #=== Best regards, José Cláudio Faria UESC/DCET Brasil 73-634.2779 [EMAIL PROTECTED] [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
[R] Help on parameters
Hi, I have a follow analysis Trat1 = quantitative variable Trat2 = qualitative variable with 3 levels (A, B, C) Trat3 = qualitative variable with 3 levels (D, E, F) Resp = Response I try to get the parameters to compare with zero, so I make this model: glm(Resp~Trat1*Trat2+Trat1*Trat3-Trat1-1) The -Trat1 is to make comparison of slope with zero. The -1 is to make comparison os intercept with zero. The results that I want are: Coefficients: Estimate Std. Error t value Pr(>|t|) Trat2A Trat2B Trat2C Trat3D Trat3E Trat3F Trat1:Trat2A Trat1:Trat2B Trat1:Trat2C Trat1:Trat3D Trat1:Trat3E Trat1:Trat3F But I get this: Coefficients: Estimate Std. Error t value Pr(>|t|) Trat2A1.353331.00307 1.349 0.18108 Trat2B1.353331.00307 1.349 0.18108 Trat2C4.293331.00307 4.280 5.14e-05 *** Trat3E0.866671.09881 0.789 0.43260 Trat3F0.920001.09881 0.837 0.40493 Trat1:Trat2A 0.536570.16166 3.319 0.00136 ** Trat1:Trat2B 0.536570.16166 3.319 0.00136 ** Trat1:Trat2C -0.093130.16166 -0.576 0.56617 Trat1:Trat3E 0.036360.17709 0.205 0.83783 Trat1:Trat3F 0.340000.17709 1.920 0.05843 . Look that the intercept and slope of Trat3D dont appear What is the problem? Thanks Ronaldo -- How can you think and hit at the same time? -- Yogi Berra -- |> // | \\ [***] | ( õ õ ) [Ronaldo Reis Júnior] |> V [UFV/DBA-Entomologia] |/ \ [36571-000 Viçosa - MG ] |> /(.''`.)\ [Fone: 31-3899-2532 ] | /(: :' :)\ [EMAIL PROTECTED]] |>/ (`. `'` ) \[ICQ#: 5692561 | LinuxUser#: 205366 ] |( `- ) [***] |>> _/ \_Powered by GNU/Debian Woody/Sarge __ [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] Converting data frame to array?
stepAIC in library(MASS) or "step"? hope this helps. spencer graves TAPO (Thomas Agersten Poulsen) wrote: Dear John, Thank you for your helpful answer. I was obviously being stupid, as I have, as you point out, more predictors than observations. What I was hoping to get was some sort of an "explaining linear combination" of my predictors: which predictors are important for the results I see (if any) and which are irrelevant. Any hints on how to achieve that? Cheers Thomas -Original Message- From: John Fox [mailto:[EMAIL PROTECTED] Sent: 29. maj 2004 01:24 To: TAPO (Thomas Agersten Poulsen) Cc: [EMAIL PROTECTED] Subject: RE: [R] Converting data frame to array? Dear Thomas, In fact, the more common way to fit a linear regression in R is to use variables in a data frame (or list) along with a model formula specifying the model. All of this is explained in the Introduction to R manual that is distributed with R: see, in particular, Sec. 6.3 on data frames, Sec. 7 on reading data from files, and Sec. 11 on statistical models. Given two data frames, say d1 and d2, the first containing, e.g., observations on variables x1 and x2 and the second on y, one could do lm(y ~ x1 + x2, data=c(x1, x2)) or lm(y ~ x1 + x2, data=data.frame(x1, x2)). That said, it's not altogether clear to me what it is that you're trying to do. Are there 10 observations on 300 variables in the first data frame, constituting the predictors, and 10 observations on 1 variable in the second data frame, constituting the response? If so, you have many more predictors than observations, and it's not reasonable to perform a regression. Of course, I may not have this straight. I hope this helps, John -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of TAPO (Thomas Agersten Poulsen) Sent: Friday, May 28, 2004 2:11 PM To: [EMAIL PROTECTED] Subject: [R] Converting data frame to array? Dear List, Please bear with a poor newbee, who might be doing everything backwards (I was brought up in pure math). I want to make a simple multi-linear regression on a set of data. I did some expreiments, and if X is a 4 by 2 array and Y is a 4 by 1 array, I can do a linear regression by lm(y~x). Now I have a tab-delimited text file with 10 rows of 300 measurements and an other file with 10 rows of one value each. When I read in those files using read.delim(), I get data frames, and apparently I can no longer do the multi-linear regression. Is there a way to convert the data frames into arrays, or am I going the wrong way about this? Sincerely Thomas Poulsen __ [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 __ [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] Converting data frame to array?
Dear Thomas, I doubt whether there's anything useful that you can do with 300 predictors and only 10 observations. A naïve application of variable selection will likely allow you to account perfectly for the variation in the response variable just by capitalizing on chance. John > -Original Message- > From: TAPO (Thomas Agersten Poulsen) [mailto:[EMAIL PROTECTED] > Sent: Monday, May 31, 2004 2:26 PM > To: John Fox > Cc: [EMAIL PROTECTED] > Subject: RE: [R] Converting data frame to array? > > Dear John, > > Thank you for your helpful answer. I was obviously > being stupid, as I have, as you point out, more predictors > than observations. > > What I was hoping to get was some sort of an > "explaining linear combination" of my predictors: which > predictors are important for the results I see (if any) and > which are irrelevant. > > Any hints on how to achieve that? > > Cheers > Thomas > > -Original Message- > From: John Fox [mailto:[EMAIL PROTECTED] > Sent: 29. maj 2004 01:24 > To: TAPO (Thomas Agersten Poulsen) > Cc: [EMAIL PROTECTED] > Subject: RE: [R] Converting data frame to array? > > > Dear Thomas, > > In fact, the more common way to fit a linear regression in R is to use > variables in a data frame (or list) along with a model formula > specifying the model. All of this is explained in the > Introduction to R > manual that is distributed with R: see, in particular, Sec. > 6.3 on data > frames, Sec. 7 on reading data from files, and Sec. 11 on statistical > models. > > Given two data frames, say d1 and d2, the first containing, e.g., > observations on variables x1 and x2 and the second on y, one could do > lm(y ~ x1 + x2, data=c(x1, x2)) or lm(y ~ x1 + x2, data=data.frame(x1, > x2)). > > That said, it's not altogether clear to me what it is that > you're trying > to do. Are there 10 observations on 300 variables in the first data > frame, constituting the predictors, and 10 observations on 1 > variable in > the second data frame, constituting the response? If so, you have many > more predictors than observations, and it's not reasonable to > perform a > regression. Of course, I may not have this straight. > > I hope this helps, > John > > > -Original Message- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] On Behalf Of TAPO > > (Thomas Agersten Poulsen) > > Sent: Friday, May 28, 2004 2:11 PM > > To: [EMAIL PROTECTED] > > Subject: [R] Converting data frame to array? > > > > Dear List, > > > > Please bear with a poor newbee, who might be doing > > everything backwards (I was brought up in pure math). > > > > I want to make a simple multi-linear regression on a > > set of data. I did some expreiments, and if X is a 4 by 2 > > array and Y is a 4 by > > 1 array, I can do a linear regression by lm(y~x). > > > > Now I have a tab-delimited text file with 10 rows of > > 300 measurements and an other file with 10 rows of one value > > each. When I read in those files using read.delim(), I get > > data frames, and apparently I can no longer do the > > multi-linear regression. > > > > Is there a way to convert the data frames into arrays, > > or am I going the wrong way about this? > > > > Sincerely > > Thomas Poulsen > > > > __ > > [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] ffnet problem
>> >> I've just installed the contributed ffnet package wit no problem at all. > >"No problem at all" seems unlikely in light of ... Dirk, You're right! Here you are what happened: desktop:/tmp# R INSTALL -l /usr/local/lib/R/library ffnet/ * Installing *source* package 'ffnet' ... ** libs make: Nothing to be done for `all'. ** R ** help >>> Building/Updating help pages for package 'ffnet' Formats: text html latex example .. .. And the compilation of ffnet commands kept going on as though there had been no problems This was somewhat misleading to a newbye!! Anyway, what steps should I take now? Ciao Vittorio __ [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] Rmetrics New Built
Hello Elijah, Hello Dirk First of all many thanks for your help and support. 1) Sorry, I used non-standard kyewords and thus I added to my doc/KEYWORDS.db database the following lines: Rmetrics: Rmetrics Rmetrics|winRmetrics: winRmetrics Rmetrics|fBasics: Basics Rmetrics|fSeries: Series Rmetrics|fExtremes: Extremes Rmetrics|fOptions: Options Then you don't get the warnings. Maybe it is not a good idea to have non-standard keywords. [This should only produce a WARNING ...] 2) fExtremes depends also on evir, sorry that I forgot this. Now I have corrected the DESCRIPTION file as: Depends: R (>= 1.9.0), evd, evir, ismev 3) I have not yet found the error: <>Running examples in fBasics-Ex.R failed. The error most likely occurred in: ### * B1-ghypDistribution This runs fine under MS Windows ... [Hint: The hyperbolic Distribution uses calls to a Fortran program ? - does this work properly for Fortran under Linux?] 4+5) Currently I have no idea what the following means: Error in .tryQuietly( I still try to find it out Thanks again Diethelm elijah wright wrote: If the Linux and Mac OSX builds are successfully done, I will submit the packages to the CRAN server. >>>all four of the packages successfully build on Debian unstable - no >>>errors, nor warnings. this is a Good Thing. I would guesstimate that >>> >>> >>Ah, thanks, good to know. Did you try 'R CMD check' too, for good >>measure? >> >> > > >good idea. doing that reveals the following. dirk, most of this is for >your reference as a repackager, so that you know what dependencies will >have to be met for useful debian packages. :) there are also some >problems that become evident with the packages... > >1) fBasics requires package "date" > >after i fixed the date package dependency, i get this error from R check: > >Running examples in fBasics-Ex.R failed. >The error most likely occurred in: > > > >>### * B1-ghypDistribution >> >>flush(stderr()); flush(stdout()) >> >> > > > >2) fExtremes requires packages "evd" and "ismev" > >after fixing those two dependencies, R CMD check produces the following >output: > >* checking S3 generic/method consistency ... WARNING >Error in .tryQuietly({ : Error in library(package, lib.loc = lib.loc, >character.only = TRUE, verbose = FALSE) : >.First.lib failed >Execution halted >* checking for replacement functions with final arg not named 'value' ... >WARNING >Error in .tryQuietly({ : Error in library(package, lib.loc = lib.loc, >character.only = TRUE, verbose = FALSE) : >.First.lib failed >Execution halted >* checking foreign function calls ... WARNING >Error in .tryQuietly({ : Error in library(package, lib.loc = lib.loc, >character.only = TRUE, verbose = FALSE) : >.First.lib failed >Execution halted >* checking Rd files ... WARNING >Rd files with non-standard keywords: > 'man/C3-gpdglmFit.Rd': fExtremes > 'man/C1-gpdFamily.Rd': fExtremes > 'man/C6-rlargFit.Rd': fExtremes > 'man/C5-ppFit.Rd': fExtremes > 'man/B1-gevFamily.Rd': fExtremes > 'man/Z1-fExtremesTools.Rd': fExtremes > 'man/B4-mdaPlots.Rd': fExtremes > 'man/B2-gevFit.Rd': fExtremes > 'man/D1-exindexPlots.Rd': fExtremes > 'man/C4-potFit.Rd': fExtremes > 'man/A2-getExtremes.Rd': fExtremes > 'man/B3-gevglmFit.Rd': fExtremes > 'man/A1-evPlots.Rd': fExtremes > 'man/C2-gpdFit.Rd': fExtremes >Each '\keyword' entry should specify one of the standard keywords (as >listed in file 'KEYWORDS.db' in the 'doc' subdirectory of the R home >directory). >See chapter 'Writing R documentation files' in manual 'Writing R >Extensions'. >* checking for missing documentation entries ... ERROR >Error in .tryQuietly({ : Error in library(package, lib.loc = lib.loc, >character.only = TRUE, verbose = FALSE) : > > > > >3) fOptions documentation needs work? > >* checking Rd files ... WARNING >Rd files with non-standard keywords: > 'man/D2-MonteCarloOptions.Rd': fOptions > 'man/C2-HestonNandiOptions.Rd': fOptions > 'man/B2-MultAssetsOptions.Rd': fOptions > 'man/B5-BinaryOptions.Rd': fOptions > 'man/C1-hngarchFit.Rd': fOptions > 'man/A2-BasicAmericanOptions.Rd': fOptions > 'man/Z1-fOptionsTools.Rd': fOptions > 'man/B1-MultExercisesOptions.Rd': fOptions > 'man/D1-LowDiscrepancy.Rd': fOptions > 'man/B3-LookbackOptions.Rd': fOptions > 'man/A3-BinomialTreeOptions.Rd': fOptions > 'man/B6-AsianOptions.Rd': fOptions > 'man/B4-BarrierOptions.Rd': fOptions > 'man/A1-PlainVanillaOptions.Rd': fOptions > 'man/B7-FXTransOptions.Rd': fOptions >Each '\keyword' entry should specify one of the standard keywords (as >listed in file 'KEYWORDS.db' in the 'doc' subdirectory of the R home >directory). > > >4) fSeries: > >Packages required but not available: > mda polspline > > >fixed these dependencies on my local system - no biggie - then from R >CMD check got: > >* checking S3 generic/method consistency ... WARNING >Error in .tryQuietly({ : Error in library(package
Re: [R] ffnet problem
On Mon, May 31, 2004 at 10:38:37PM +0200, [EMAIL PROTECTED] wrote: > > >> > >> I've just installed the contributed ffnet package wit no problem at all. > > > >"No problem at all" seems unlikely in light of ... > > Dirk, > > You're right! > Here you are what happened: > > desktop:/tmp# R INSTALL -l /usr/local/lib/R/library ffnet/ > * Installing *source* package 'ffnet' ... > ** libs > make: Nothing to be done for `all'. > ** R > ** help > >>> Building/Updating help pages for package 'ffnet' > Formats: text html latex example > .. > .. > > And the compilation of ffnet commands kept going on as though there had > been no problems This was somewhat misleading to a newbye!! > > Anyway, what steps should I take now? Don't know, sorry. But looking at the comment in http://cran.r-project.org/contrib/extra/ffnet/ReadMe it would appear that one needs additional sources to build ffnet. Also, if the package built reliably, it would probably reside in the main part of CRAN rather than in the contrib/extra directory. Dirk -- FEATURE: VW Beetle license plate in California __ [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] ffnet problem
Given that those files are dated 27/06/2000, they are unlikely to work with the current version of R. (R has changed quite a bit since 2000!!) Don't know why/how the code depends on NR codes, as one can find better quality code in many instances. It might not be too difficult to get rid of the dependency on NR codes. BTW, why not use nnet in the VR bundle? (Obviously I have not looked at ffnet at all...) Best, Andy > From: Dirk Eddelbuettel > > On Mon, May 31, 2004 at 10:38:37PM +0200, > [EMAIL PROTECTED] wrote: > > > > >> > > >> I've just installed the contributed ffnet package wit no > problem at all. > > > > > >"No problem at all" seems unlikely in light of ... > > > > Dirk, > > > > You're right! > > Here you are what happened: > > > > desktop:/tmp# R INSTALL -l /usr/local/lib/R/library ffnet/ > > * Installing *source* package 'ffnet' ... > > ** libs > > make: Nothing to be done for `all'. > > ** R > > ** help > > >>> Building/Updating help pages for package 'ffnet' > > Formats: text html latex example > > .. > > .. > > > > And the compilation of ffnet commands kept going on as > though there had > > been no problems This was somewhat misleading to a newbye!! > > > > Anyway, what steps should I take now? > > Don't know, sorry. But looking at the comment in > http://cran.r-project.org/contrib/extra/ffnet/ReadMe it would appear that one needs additional sources to build ffnet. Also, if the package built reliably, it would probably reside in the main part of CRAN rather than in the contrib/extra directory. Dirk -- FEATURE: VW Beetle license plate in California __ [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
[R] LAPACK and ScaLAPACK new functionality survey
Apologies for the off-topic post, and apologies for those already seen this elsewhere... >From NA-digest last week: --- From: Jack Dongarra <[EMAIL PROTECTED]> Date: Fri, 28 May 2004 16:17:17 -0400 Subject: LAPACK and ScaLAPACK New Functionality Survey LAPACK and ScaLAPACK new functionality survey We plan to update the LAPACK and ScaLAPACK libraries and would like to have feedback from users on what functionalities they think are missing and would be needed in order to make these libraries more useful for the community. We invite you to enter your suggestions in the form below. It would be most useful to have input by June 16th, although we would welcome your input at any time. Both LAPACK and ScaLAPACK provide well-tested, open source, reviewed code implementing trusted algorithms that guarantee reliability, efficiency and accuracy. Any new functionality must adhere to these standards and should have a significant impact in order to justify the development costs. We are also interested in suggestions regarding user interfaces, documentation, language interfaces, target (parallel) architectures and other issues, again provided the impact is large enough. We already plan to include a variety of improved algorithms discovered over the years by a number of researchers (e.g. faster or more accurate eigenvalue and SVD algorithms, extra precise iterative refinement, recursive blocking for some linear solvers, etc.). We also know of a variety of other possible functions we could add (e.g. updating and downdating factorizations), but are uncertain of their impact. Please see http://icl.cs.utk.edu/lapack-survey.html for the survey. We would like to have your input by June 16th, 2004. Regards, Jack, Jim, and Sven __ [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
[R] Tree() and confidence intervals
Hello I'm currently using Monte Carlo techniques to estimate prices (variable not static) from the following type of data: 1,22,40,22,33,5,2000 3,45,33,6,7,0,3000 22,22,33,44,55,66,7 Each row is a record from group A and the cells in all but the last column are the volumes of 'widgets' in the record. The last column is the cost of all the widgets in the record. Any widget can have a different prices in each record but the price is assumed to be normally distributed with a starting price and deviation. The aim is to apply the estimated prices to eg an average record (in terms of volumes of widgets per record) from group B and compare the cost of this average record against the cost of an average record from group A. I've used a Monte Carlo approach to estimate confidence intervals but thought another view could be obtained by using tree() to split the records into two disparate groups and run these two groups separately through the Monte Carlo model. Is this feasible? 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
[R] rcmd with a libgsl.a
Dear all, I'm new to R and am trying to create a dll in order to be able to use the "dyn.load". I work with some examples and its works fine. Now, I would like to create a dll that use a lib (libgsl.a). I have linked its in a main c program and its works fine too. How can I instruct rcm ... to include this lib??? The .h file is in mingw\include\gsl and I put #include in the C code. The libgsl.a is in mingw\lib. Best regards. __ [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] ffnet problem
> Anyway, what steps should I take now? "should" isn't quite what I'm telling you; just free advice. :) I use nnet from the nnet package (VR bundle), and find it very good. And it doesn't require any additional libraries. If you've got a binary installation, you've probably got it already... library(nnet) ?nnet I found nnet isn't as "quick and dirty" out of the box as ffnet, but gives you much more control over the fit and diagnostics (less "black-box"-ish). Cheers Jason __ [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