[R] (no subject)
Dear friends I try to install R-project in SUSE 10.0 LINUX. I run the ./configure. The last lines during the run is checking readline/history.h usability... no checking readline/history.h presence... no checking for readline/history.h... no checking readline/readline.h usability... no checking readline/readline.h presence... no checking for readline/readline.h... no checking for rl_callback_read_char in -lreadline... no checking for main in -lncurses... no checking for main in -ltermcap... no checking for main in -ltermlib... no checking for rl_callback_read_char in -lreadline... no checking for history_truncate_file... no configure: error: --with-readline=yes (default) and headers/libs are not available I'm now hoping for some help Thanks in advance. john __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] (installing on SUSE readline failure)
On Mon, 2 Oct 2006, John Kapsomenakis wrote: Dear friends Please include an informative subject! I try to install R-project in SUSE 10.0 LINUX. Did you read the online version of the R Installation and Administration manual at: http://cran.r-project.org/doc/manuals/R-admin.html There you will find information in Appendix A about your problem. Please also check that you have the development RPMs installed as well as those providing readline as such. Appendix A does start with the reminder to: Remember that some package management systems (such as RPM and deb) make a distinction between the user version of a package and the development version. The latter usually has the same name but with the extension `-devel' or `-dev': you need both versions installed. I run the ./configure. The last lines during the run is checking readline/history.h usability... no checking readline/history.h presence... no checking for readline/history.h... no checking readline/readline.h usability... no checking readline/readline.h presence... no checking for readline/readline.h... no checking for rl_callback_read_char in -lreadline... no checking for main in -lncurses... no checking for main in -ltermcap... no checking for main in -ltermlib... no checking for rl_callback_read_char in -lreadline... no checking for history_truncate_file... no configure: error: --with-readline=yes (default) and headers/libs are not available I'm now hoping for some help Thanks in advance. john __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to repeat vectors ?
Hi, Thanks you guys for all the help. I learned a lot from it. It looks using apply() is not an efficient way, since all it does is looping through each row(or col) , which would be slow for large matrix, right ? cheers - Original Message - From: Gabor Grothendieck [EMAIL PROTECTED] Date: Saturday, September 30, 2006 4:54 am Subject: Re: [R] How to repeat vectors ? To: Tong Wang [EMAIL PROTECTED] Cc: r-help@stat.math.ethz.ch Here are 4 approaches in order from most compact to least. #1 only works for numeric matrices, # 2 is a shorter versio of your solution using rep.vec and # 3 is from Alex's post and is likely what I would use in practice. m - matrix(1:4, 2) # test matrix # 1 - m must be numeric for this one to work kronecker(m, rep(1,2)) # 2 apply(m, 2, rep, each = 2) # 2 # 3 - from Alex's post m[rep(1:nrow(m), each = 2),] # 4 matrix(rbind(c(m), c(m)), nc = ncol(m)) On 9/30/06, Tong Wang [EMAIL PROTECTED] wrote: I just figured out a way to do this: rep.vec - function(X,n) return(t(array(rep(X,n),c(length(X),n Then,apply(MyMatrix, 2, rep.vec,2) Is there a better way ? Is there an internal function to repeat a vector or matrix ? Thanks a lot. - Original Message - From: Tong Wang [EMAIL PROTECTED] Date: Friday, September 29, 2006 11:23 pm Subject: How to repeat vectors ? To: r-help@stat.math.ethz.ch Hi, If I have a matrix , say a11 a12 a21 a22 Is there a routine to get: a11 a12 a11 a12 a21 a22 a21 a22 Thanks a lot for any help. best __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] bar chart with several lines
Hi, I have been some problems with producing bar graph with r. Here is my example data (link) and picture but I am not able to do that with r. Please any kind of help is welcome http://www.pasilankaista.com/~ekqvistmt/r/Page001.html Kind Regards, Marko __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] RODBC ERROR on Rcmdr install
Alle 22:55, venerdì 29 settembre 2006, John Fox ha scritto: As I understand it, RODBC isn't useful on non-Windows systems, since the necessary ODBC drivers aren't available. (Someone will correct me, I'm sure, if I don't have that entirely straight.) The RODBC package is used in the Rcmdr to read Excel and some other files under Windows; in the latest version of the Rcmdr, you won't even see this menu item in non-Windows systems. As a matter of fact RODBC can be profitably used under *nix OS together with unixODBC to connect to many DBs. I've been using RODBC with unixODBC on linux, freebsd and win xp to connect smoothly to postgresql, mysql and oracle (somewhat tricky to me under *nix, you need ** to buy ** a driver) and I know that connections are possible to many other *nix DBs under *nix itself. Ciao Vittorio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] [R-pkgs] Stineman interpolation package
The package STINEPACK is now available on CRAN. This package implements the stineman interpolation method, and is coded entirely in R (no Fortan or C libraries). The interpolation method is very robust, and does not yield spurious oscillations near spikes or steps. The original article (Stineman 1980) describes this method as consistently well behaved. The interpolation is done in the stinterp routine, and depending on arguments passed to it, this routine may call other routines to estimate the slope of the interpolating function. If the slope is known it can be explicitly included in stinterp. The interpolation method is described in an article by Russell W. Stineman in the July 1980 issue of Creative Computing with a note from the editor stating that while they were not an academic journal but once in a while something serious and original comes in adding that this was apparently a real solution to a well known problem. According to Stineman, the interpolation procedure has the following properties: 1. If values of the ordinates of the specified points change monotonically, and the slopes of the line segments joining the points change monotonically, then the interpolating curve and its slope will change monotonically. 2. If the slopes of the line segments joining the specified points change monotonically, then the slopes of the interpolating curve will change monotonically. 3. Suppose that the conditions in (1) or (2) are satisfied by a set of points, but a small change in the ordinate or slope at one of the points will result conditions (1) or (2) being not longer satisfied. Then making this small change in the ordinate or slope at a point will cause no more than a small change in the interpolating curve. The method is based on rational interpolation with specially chosen rational functions to satisfy the above three conditions. Slopes computed at the given points with the methods provided by the 'stinterp' function satisfy Stineman's requirements. The original method suggested by Stineman (method=scaledstineman, the default, and stineman) result in lower slopes near abrupt steps or spikes in the point sequence, and therefore a smaller tendency for overshooting. The method based on a second degree polynomial (method=parabola) provides better approximation to smooth functions, but it results in in higher slopes near abrupt steps or spikes and can lead to some overshooting where Stineman's method does not. Both methods lead to much less tendency for 'spurious' oscillations than traditional interplation methods based on polynomials, such as splines (see the example below). Stineman states that The complete assurance that the procedure will never generate 'wild' points makes it attractive as a general purpose procedure. This interpolation method has been implemented in Matlab and Python in addition to R An example follows: library(stinepack) # make a function with a sharp spike x - seq(0,2*pi,by=pi/6) y - sin(x) y[3] - -1.5 # interpolate to a finer axis, try all three methods for estimating the slope. xo - seq(0,2*pi,by=pi/150) y1 - stinterp(x,y,xo,method=sc)$y y2 - stinterp(x,y,xo,method=st)$y y3 - stinterp(x,y,xo,method=pa)$y # compare with standard spline ysp=spline(x,y,n=length(xo)) # plot the results plot(x,y,ylim=c(-1.5,1.5)) points(xo,y1,cex=1/5,col=2) points(xo,y2,cex=1/5,col=3) points(xo,y3,cex=1/5,col=4) points(ysp,cex=1/5,col=5) legend(3, 1, c(Scaled Stineman, Stineman, Parabolic, Spline), col = c(2,3,4,5),lty=1) Sincerely, Halldor -- Halldór Björnsson Deildarstj. Ranns. Þróun Veðursvið Veðurstofu Íslands Halldór Bjornsson Weatherservice R D Icelandic Met. Office [[alternative HTML version deleted]] ___ R-packages mailing list R-packages@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-packages __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] [R-pkgs] New package 'ade4TkGUI', a Tcl/Tk GUI for ade4
Dear R-Users, ade4TkGUI is a new package available on CRAN. It implements a Tcl/Tk graphical user interface (GUI) for the ade4 package. Only the most basic functions of ade4 have a GUI in this first version : classical one-table data analysis methods (PCA, COA, MCA, PCO, etc.), one table with groups of rows (BGA, WGA, DA), and two-tables analysis methods (Coinertia analysis, CCA, PCAIV). http://pbil.univ-lyon1.fr/JTHome/ade4TkGUI.jpg One of the benefits of using ade4TkGUI is the centralized graphical display of the dudi objects created by ade4. A dudi is a list with many components http://pbil.univ-lyon1.fr/ade4html/dudi.html The GUI presents a window in which the user can click on dudi components to get predefined graphical displays : http://pbil.univ-lyon1.fr/JTHome/coa1dudi.jpg Another benefit is for complex functions, and particularly graphical functions that have many parameters. For example, the s.class function has 27 parameters : http://pbil.univ-lyon1.fr/ade4html/s.class.html In this case, the GUI makes it much easier to try various graphical options : http://pbil.univ-lyon1.fr/JTHome/s.class.jpg ade4TkGUI also contains a factor map exploration function, written by Stephane Dray. This function allows dynamic operations like zooming, panning, and identification of points by searching on labels on the factor maps : http://pbil.univ-lyon1.fr/JTHome/explore.jpg Current version (ade4TkGUI_0.1-4) depends on ade4_1.4-2, and the dynamic factor map exploration function depends on tkrplot. Future versions will add GUIs for more advanced ade4 methods, like ktables analysis methods, or spatial methods, and for more graphical functions. All comments are welcome. Please use the adelist mailing list : http://listes.univ-lyon1.fr/wws/info/adelist Jean -- Jean Thioulouse - Labo Biometrie et Biologie Evolutive, UMR CNRS 5558 Universite Lyon 1, 43 Boulevard du 11 Novembre 1918, Bat. G. Mendel 69622 Villeurbanne Cedex, France. Tel/Fax : (33) 4 72 43 27 56 http://pbil.univ-lyon1.fr/JTHome.html ___ R-packages mailing list R-packages@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-packages __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Build error on Windows
From: Duncan Murdoch [EMAIL PROTECTED] Date: Sat, 30 Sep 2006 09:13:36 -0400 On 9/29/2006 5:41 PM, Pankaj Savdekar wrote: Thanks for the quick reply. On 9/29/2006 8:53 AM, Pankaj Savdekar wrote: Hi, I'm trying to build R-2.3.1 on windows, but make gives me following error while building pkg-base: -- Making package base adding build stamp to DESCRIPTION make[4]: *** [frontmatter] Error 1 make[3]: *** [all] Error 2 make[2]: *** [pkg-base] Error 2 make[1]: *** [rpackage] Error 2 make: *** [all] Error 2 Please note that R.exe, Rterm.exe, Rgui.exe, RCmd.exe are build without any errors. I have three questions, can anyone please help me to resolve it? 1. How to solve (or get more details) of the above mentioned error? You need to look through the make files, to see what was happening. Reading the messages in reverse order: make all called make rpackage and so on to make frontmatter. The errors don't tell you which makefiles these are in, but the frontmatter target only occurs in src/gnuwin32/MakePkg. You could try deleting the @ signs from the lines for that target to see exactly what was happening when the error was generated. Yes I could figure out the source of 'frontmatter', but my problem is, there is no error message. I tried 'make -d' too. I tried removing '@', but no change. I'd guess that this is happening because your build is messed up: the base package is used in later build steps. If you start from a clean checkout and just call make, you probably won't see this. Is there any way to check what could have been wrong in building base package? You could look at whatever command in the makefile failed, and try it outside of the makefile, try variations on it, etc. I can't give more specific advice without more specific information on where the error happened. Thanks, I could get the error after 'make distclean'. The error is -- Making package base adding build stamp to DESCRIPTION Error in loadNamespace(name) : there is no package called 'tools' Execution halted make[4]: *** [frontmatter] Error 1 make[3]: *** [all] Error 2 make[2]: *** [pkg-base] Error 2 make[1]: *** [rpackage] Error 2 make: *** [all] Error 2 Surprisingly once this error come, if I do 'make' or 'make pkg-base', this error doesn't get displayed. I tried including R-bin directory to 'PATH', setting R_HOME, R_LIBS environment variable, but it doesn't help. Do I need to set anyother environment variable to find proper tools directory. My library directory contents are as follows: R-2.3.1 library base DESCRIPTION [file] R all.R [file] base [file] Rprofile [file] tools DESCRIPTION [file] NAMESPACE [file] libs tools.dll [file] R all.R [file] tools [file] R.css [file] If you're not used to working in Windows, remember that it is not like Unix in several ways. In particular, you can't delete an open file, because it's considered an error for a file to exist unless it has a valid directory entry. If you try to replace a file that is open, the replacement will fail, and that may lead to other errors later. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Geometric pattern matching with R?
Hi, Is there some package or function for 2- or 3 -dimensional geometric pattern matching with R? It should be measure similarities between patterns in a fuzzy way, so not exact similarities are demanded. Atte Tenkanen University of Turku, Finland __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Simple question on a function
I would like to apply the following function to the rows of the matrix mat, so that freq[1],...,freq[4] are the four elements of each row. min_chi2-function(freq){ obj-function(x){ (freq[1]-(1-x[1])*(1-x[2])-x[3]*sqrt(x[1]*(1-x[1])*x[2]*(1-x[2])))^2/freq[1]+ (freq[2]-(1-x[1])*x[2]+x[3]*sqrt(x[1]*(1-x[1])*x[2]*(1-x[2])))^2/freq[2]+ (freq[3]-x[1]*(1-x[2])+x[3]*sqrt(x[1]*(1-x[1])*x[2]*(1-x[2])))^2/freq[3]+ (freq[4]-x[1]*x[2]-x[3]*sqrt(x[1]*(1-x[1])*x[2]*(1-x[2])))^2/freq[4] } optim(c(0.1,0.1,0.1),obj,NULL,method=BFGS)$par } mat-matrix(c(0.4,0.1,0.1,0.4), byrow=TRUE, nrow=10, ncol=4) Questions: 1. How to do this using the apply function? 2. Can opmit be used directly, i.e. without needing to define the function min_chi2? 3. How to pass the vector of initial conditions (c(0.1,0.1,0.1)) as an argument to apply? The output should be a 10x3 matrix containing 0.5 0.5 0.6 in each row. Thanks a lot, Serguei -- ___ Austrian Institute of Economic Research (WIFO) Name: Serguei Kaniovski P.O.Box 91 Tel.: +43-1-7982601-231 Arsenal Objekt 20 Fax: +43-1-7989386 1103 Vienna, Austria Mail: [EMAIL PROTECTED] http://www.wifo.ac.at/Serguei.Kaniovski __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] bar chart with several lines
This should be enough to show how to do it: dta - read.table(clipboard,dec=,,row.names=NULL) r - barplot(dta$use,ylim=c(-80,60)) lines(r,dta$x1,type=b,col=red,pch=20) lines(r,dta$x2,type=b,col=blue,pch=21) On 01/10/06, Marko Ekqvist [EMAIL PROTECTED] wrote: Hi, I have been some problems with producing bar graph with r. Here is my example data (link) and picture but I am not able to do that with r. Please any kind of help is welcome http://www.pasilankaista.com/~ekqvistmt/r/Page001.html Kind Regards, Marko __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- = David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] finding correlation between two matrices
Dear all, I would like to compare two distance matrices to find the correlation between those and create a XY plot.could you please kindly help me and let me know how I can do that using R.(Mantel test?). Your help is very much appreciated!! Many thanks! Regards, Sima Fakheran ... Sima Fakheran Esfahani PhD Student Institute of Environmental Sciences University of Zurich Winterthurerstrasse 190 8057 Zurich Switzerland Tel: +41 1 635 61 18 Fax:+41 1 635 57 11 email:[EMAIL PROTECTED] http://www.uwinst.unizh.ch www.uwinst.unizh.ch [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] multilevel factor model in lmer
Dan: lmer cannot currently be used for the 2PL. As you note, it is straightforward to estimate the 1PL, but the a-parameters present a current challenge. Doug mentioned to me the other day he is doing some work on this, so I have copied him on this reply. Harold -Original Message- From: [EMAIL PROTECTED] on behalf of Dan Powers Sent: Sun 10/1/2006 10:15 PM To: 'R-Help' Subject: [R] multilevel factor model in lmer Hello -- I am curious if lmer can be used to fit a multilevel factor model such as a two-parameter item response model. The one parameter model is straightforward. A two-factor model requires a set of factor loadings multiplying a single random effect. For example, a logit model for the ith subject responding correctly to the jth item (j=1,..,J) is logit[p(ij)] = a1*item1(i) + ... + aJ * itemJ(i) + lambda1*item1(i)*u(i) + ... + lambdaJ*itemJ(i)*u(i) where the lambdas are factor loadings, with lambda1 fixed to 1.0 and item1-itemJ are dummy variables for the items. Thanks, Dan =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Daniel A. Powers, Ph.D. Department of Sociology University of Texas at Austin 1 University Station A1700 Austin, TX 78712-0118 phone: 512-232-6335 fax: 512-471-1748 [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] finding correlation between two matrices
Have you looked at the function mantel.rtest in the ade4 package? On 02/10/06, sima fakheran [EMAIL PROTECTED] wrote: Dear all, I would like to compare two distance matrices to find the correlation between those and create a XY plot.could you please kindly help me and let me know how I can do that using R.(Mantel test?). Your help is very much appreciated!! Many thanks! Regards, Sima Fakheran ... Sima Fakheran Esfahani PhD Student Institute of Environmental Sciences University of Zurich Winterthurerstrasse 190 8057 Zurich Switzerland Tel: +41 1 635 61 18 Fax:+41 1 635 57 11 email:[EMAIL PROTECTED] http://www.uwinst.unizh.ch www.uwinst.unizh.ch [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- = David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] multilevel factor model in lmer
If you just want to fit the 2PL, without any covariates, then this can be currently handled by function ltm() in package ltm. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: Doran, Harold [EMAIL PROTECTED] To: [EMAIL PROTECTED]; R-Help r-help@stat.math.ethz.ch Cc: [EMAIL PROTECTED] Sent: Monday, October 02, 2006 12:22 PM Subject: Re: [R] multilevel factor model in lmer Dan: lmer cannot currently be used for the 2PL. As you note, it is straightforward to estimate the 1PL, but the a-parameters present a current challenge. Doug mentioned to me the other day he is doing some work on this, so I have copied him on this reply. Harold -Original Message- From: [EMAIL PROTECTED] on behalf of Dan Powers Sent: Sun 10/1/2006 10:15 PM To: 'R-Help' Subject: [R] multilevel factor model in lmer Hello -- I am curious if lmer can be used to fit a multilevel factor model such as a two-parameter item response model. The one parameter model is straightforward. A two-factor model requires a set of factor loadings multiplying a single random effect. For example, a logit model for the ith subject responding correctly to the jth item (j=1,..,J) is logit[p(ij)] = a1*item1(i) + ... + aJ * itemJ(i) + lambda1*item1(i)*u(i) + ... + lambdaJ*itemJ(i)*u(i) where the lambdas are factor loadings, with lambda1 fixed to 1.0 and item1-itemJ are dummy variables for the items. Thanks, Dan =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Daniel A. Powers, Ph.D. Department of Sociology University of Texas at Austin 1 University Station A1700 Austin, TX 78712-0118 phone: 512-232-6335 fax: 512-471-1748 [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] plotting
Dieter Menne dieter.menne at menne-biomed.de writes: Is there something in R that will display both observed values and their influence on calculated statistics? In general : yes. You may give the example in the lm documentation a first try, and then rephrase your question. Thanks for the pointer. I found what I was looking for in lm.influence and influence.measures. I was looking for Cook's Distance some other influence measures. I guess I want to plot the fitted values, observations and influence measures on the same plot. Anupam. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Arrowheads at line-ends
Hi, I'm quite new to R and I'm trying to do a simple plot with two lines, one upper and one lower. The problem is that the lines are reaching limiting values at x=0 for the upper line and x=1 for the lower. Thus, they are undefined at that values. I would like to indicate that with arrowheads. So I want a arrowhead at the left end of the upper line and a one at the right end at the lower line. I've managed to do this manually by drawing them with arrows, but this solution appears too be quite inflexible. So my question to the more experienced R-users out there is if there is a smarter way to do this? Is there, for instance, any graphing property that automaticly insert arrowheads? Here's the code of my manual solution: xA - c(0.,0.0968,0.2340,0.4645,0.6115,0.8890,1.) Va - c(69.016,69.769,70.775,72.456,73.280,73.564,73.921) Vb - c(18.020,17.822,17.480,16.897,16.277,13.833,13.101) plot(c(0,1), c(10,80), type=n, xlab=expression(x[aceton]), ylab=Partielt molart volum, bty=o, xaxs=i, yaxs=i, xaxp=c(0,1,10), yaxp=c(10,80,20), penel.first = grid(20,20,lty=1) ) points(xA[2:7],Va[2:7], type=o, col=blue,pch=5,lend=1) points(xA[1:6],Vb[1:6], type=o, col=darkgreen,pch=5) arrows(xA[2],Va[2],xA[1],Va[1],col=blue) arrows(xA[6],Vb[6],xA[7],Vb[7],col=darkgreen) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] GLS models - bootstrapping
Hello, I am have fitted GLS models to time series data. Now I wish to bootstrap this data to produce confidence intervals for the model. However, because this is time series data, normal bootstrapping is not applicable. Secondly, 'tsboot' appears to only be useful for ar models - and does not seem to be applicable to GLS models. I have written code in R to randomly sample blocks of the data (as in Davison Hinkley's book - bootstrap methods and their application) and use this resampling to re-run the model, but this does not seem to be the correct approach since Confidence Intervals produced do not show the underlying pattern (cycles) in the data [even when block length is increased, it only picks up a little of this variation]. Any help as to how to proceed with this would be greatly appreciated, as I cannot find anything applicable on the R pages. Alternatively, if there is another method to proceed with this (other than bootstrapping), I would also be happy to try it. Thankyou, Lillian. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Simple question on a function
Dear Serguei There might be more efficient ways, but this should work: ## Define function that you want to optimize. In your case I ## copied your code, but included freq as a second argument: fun - function(x, freq) { (freq[1]-(1-x[1])*(1-x[2])-x[3]*sqrt(x[1]*(1-x[1])*x[2]*(1-x[2])))^2/freq[1]+ (freq[2]-(1-x[1])*x[2]+x[3]*sqrt(x[1]*(1-x[1])*x[2]*(1-x[2])))^2/freq[2]+ (freq[3]-x[1]*(1-x[2])+x[3]*sqrt(x[1]*(1-x[1])*x[2]*(1-x[2])))^2/freq[3]+ (freq[4]-x[1]*x[2]-x[3]*sqrt(x[1]*(1-x[1])*x[2]*(1-x[2])))^2/freq[4] } ## Define mat with values for freq (your code) mat-matrix(c(0.4,0.1,0.1,0.4), byrow=TRUE, nrow=10, ncol=4) ## Use apply on mat apply(mat, 1, function(freq, start) optim(start, fun, method=BFGS, freq = freq)$par, start = c(0.1,0.1,0.1)) You still can use t() to transpose the matrix if you want the solutions by row instead of columns. Please remark that in general optim returns a list, including several arguments, e.g. convergence that indicates if optim has converge. Since you wanted a matrix I only returned optim(...)$par. This might be dangerous since the additional information gets lost. Maybe it is better to save the output in a list. You can try: apply(mat, 1, function(freq, start) optim(start, fun, method=BFGS, freq = freq), start = c(0.1,0.1,0.1)) to see the difference. Hope this helps Christoph -- Credit and Surety PML study: visit our web page www.cs-pml.org -- Christoph Buser [EMAIL PROTECTED] Seminar fuer Statistik, LEO C13 ETH Zurich 8092 Zurich SWITZERLAND phone: x-41-44-632-4673 fax: 632-1228 http://stat.ethz.ch/~buser/ -- Serguei Kaniovski writes: I would like to apply the following function to the rows of the matrix mat, so that freq[1],...,freq[4] are the four elements of each row. min_chi2-function(freq){ obj-function(x){ (freq[1]-(1-x[1])*(1-x[2])-x[3]*sqrt(x[1]*(1-x[1])*x[2]*(1-x[2])))^2/freq[1]+ (freq[2]-(1-x[1])*x[2]+x[3]*sqrt(x[1]*(1-x[1])*x[2]*(1-x[2])))^2/freq[2]+ (freq[3]-x[1]*(1-x[2])+x[3]*sqrt(x[1]*(1-x[1])*x[2]*(1-x[2])))^2/freq[3]+ (freq[4]-x[1]*x[2]-x[3]*sqrt(x[1]*(1-x[1])*x[2]*(1-x[2])))^2/freq[4] } optim(c(0.1,0.1,0.1),obj,NULL,method=BFGS)$par } mat-matrix(c(0.4,0.1,0.1,0.4), byrow=TRUE, nrow=10, ncol=4) Questions: 1. How to do this using the apply function? 2. Can opmit be used directly, i.e. without needing to define the function min_chi2? 3. How to pass the vector of initial conditions (c(0.1,0.1,0.1)) as an argument to apply? The output should be a 10x3 matrix containing 0.5 0.5 0.6 in each row. Thanks a lot, Serguei -- ___ Austrian Institute of Economic Research (WIFO) Name: Serguei Kaniovski P.O.Box 91 Tel.: +43-1-7982601-231 Arsenal Objekt 20 Fax: +43-1-7989386 1103 Vienna, Austria Mail: [EMAIL PROTECTED] http://www.wifo.ac.at/Serguei.Kaniovski __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] RODBC ERROR on Rcmdr install
Dear Vittorio, Thanks for the clarification. This raises two questions: (1) If a *nix system has an ODBC driver, can one then read Excel, Access, and dBase data sets via RODBC (which is what the Rcmdr menu item in question provides for)? (2) If so, is there a way for me to detect whether unixODBC is present, or would I have to rely, e.g., on a user-set option? I'm moving this message to the r-devel list. Regards, John John Fox Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of vittorio Sent: Saturday, September 30, 2006 12:40 PM To: r-help@stat.math.ethz.ch Subject: Re: [R] RODBC ERROR on Rcmdr install Alle 22:55, venerdì 29 settembre 2006, John Fox ha scritto: As I understand it, RODBC isn't useful on non-Windows systems, since the necessary ODBC drivers aren't available. (Someone will correct me, I'm sure, if I don't have that entirely straight.) The RODBC package is used in the Rcmdr to read Excel and some other files under Windows; in the latest version of the Rcmdr, you won't even see this menu item in non-Windows systems. As a matter of fact RODBC can be profitably used under *nix OS together with unixODBC to connect to many DBs. I've been using RODBC with unixODBC on linux, freebsd and win xp to connect smoothly to postgresql, mysql and oracle (somewhat tricky to me under *nix, you need ** to buy ** a driver) and I know that connections are possible to many other *nix DBs under *nix itself. Ciao Vittorio __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to dowload mod_R.so
khao_lek wrote: i don't know url address how to dowload mod_R.so for use R and Apache webserver. i'm want to try R on the web. please tell me. Please visit: http://biostat.mc.vanderbilt.edu/RApacheProject to download the latest release, and also read the paper near the end of the page. Jeff -- http://biostat.mc.vanderbilt.edu/JeffreyHorner __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] line plot through NA
Dear R-help list, I hope I did not miss something obvious, because my question seems very simple, but I couln't figure out how to do it. If I have the following data: Day-c(1,2,3,4,5,6,7) V-c(5,NA,10,30,45,NA,10) than the line in plot plot(V~Day, type=b) will start with the 3rd value and stop stop at the 5th value because all NA are omitted. Is there now a parameter which can be added to the plot function so the line will start with with the first value and skip the NA values and can this than applied to xyplots. Many thanks __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] line plot through NA
I assume you mean that you want the first point to be connected by a straight line to the third, etc. because fisrt and sixth points are shown on the plot. If so, you can use the approx function: plot(approx(Day,V,n=length(Day)), type=l) points(Day,V) On 02 Oct 2006 15:31:59 +0100, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Dear R-help list, I hope I did not miss something obvious, because my question seems very simple, but I couln't figure out how to do it. If I have the following data: Day-c(1,2,3,4,5,6,7) V-c(5,NA,10,30,45,NA,10) than the line in plot plot(V~Day, type=b) will start with the 3rd value and stop stop at the 5th value because all NA are omitted. Is there now a parameter which can be added to the plot function so the line will start with with the first value and skip the NA values and can this than applied to xyplots. Many thanks __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- = David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Problems with graphics
Dear all, I am a SAS user, who's trying R. I am a little bit lost for graphics. What is the simplest way for plotting y as a function of x with one symbol (line or dot) for each level of a class variable z (for SAS langage= plot x*y=z). Can I add vertical bars for standard deviation stored in a separate variable (say ystd). Finally, is it possible to do all this with xyplot function arranging plots according to A and B factor: xyplot(y~x|A*B) with as many plots and symbol as there is levels in the z variable for each panel? Thanks for the help. Chris -- ___ Christophe NGUYEN UMR 1220 INRA-ENITAB Transfert sol-plante et cycle des éléments minéraux dans les écosystèmes cultivés Centre INRA de Bordeaux-Aquitaine 71, avenue Edouard Bourlaux, BP 81 33883 Villenave d'Ornon, FRANCE Tel : 00 33 (0)5 57 12 25 07 Fax : 00 33 (0)5 57 12 25 15 email : [EMAIL PROTECTED] page infoservice: http://www.bordeaux.inra.fr/tcem __m°O°m __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] line plot through NA
[EMAIL PROTECTED] writes: Dear R-help list, I hope I did not miss something obvious, because my question seems very simple, but I couln't figure out how to do it. If I have the following data: Day-c(1,2,3,4,5,6,7) V-c(5,NA,10,30,45,NA,10) than the line in plot plot(V~Day, type=b) will start with the 3rd value and stop stop at the 5th value because all NA are omitted. Is there now a parameter which can be added to the plot function so the line will start with with the first value and skip the NA values and can this than applied to xyplots. AFAIK, this is not controlable via options or graphics parameters. So the way forward would be to remove the points with missing data. Here's one way: plot(V~Day, type=b, data=na.omit(data.frame(V,Day))) and another: plot(V~Day, type=b, subset=complete.cases(V,Day)) and another (messes up axis labels, though) s - complete.cases(V,Day) plot(Day[s], V[s], type=b) -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Barplot
Hello, I have used the following data to draw my barplot: BL LRQ 36.351.00 1.92 36.914.00 0.00 25.706.00 0.00 34.383.00 1.92 05.320.50 0.00 BL-c(36.35, 36.91, 25.70, 34.38, 05.32) LR-c(1.00, 4.00, 6.00, 3.00, 0.50) Q-(1.92, 0.00, 0.00, 1.92, 0.00) barplot(dt$LR, main='LR Value', col='orange', border='black', space=0.05, width=(dt$BL), xlab='Length', ylab='LR') axis(1) I would like to do the following things that I don't know how to do it: 1) Writing the value of each 'BL' on my X axis. 2) Writing the value of 'Q' on the bottom of X axis. 3) Draw a line on the bars which connects the 'LR' values. I appreciate your comments. Thanks, Mohsen [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] line plot through NA
Do you mean something like this: plot(approx(Day,V), type='l') -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Monday, October 02, 2006 10:32 AM To: r-help@stat.math.ethz.ch Subject: [R] line plot through NA Dear R-help list, I hope I did not miss something obvious, because my question seems very simple, but I couln't figure out how to do it. If I have the following data: Day-c(1,2,3,4,5,6,7) V-c(5,NA,10,30,45,NA,10) than the line in plot plot(V~Day, type=b) will start with the 3rd value and stop stop at the 5th value because all NA are omitted. Is there now a parameter which can be added to the plot function so the line will start with with the first value and skip the NA values and can this than applied to xyplots. Many thanks __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] separation depending on equal contents in more than one field
Hi, I have a dataframe: (obs - data.frame(a=c(1,2,2,3,3,3), b=c(1,2,3,4,4,5), c=1:2)) attach(obs) In reality its about 1 million rows. Some of the datasets have same contents in col a and! b like row 4 and 5. I want to do some calculations on col c within the duplicated rows and merge them afterwards: layer - function(x) round((1-prod(1-x/100))*100,0) (covnew - aggregate(c, list(a=a, b=b), layer)) This works fine, but not with 1 mill. rows because of memory space limitations. So I thought to split the dataframe into the majority of unique rows on one hand and all duplicated rows on the other: With subset(obs, a %in% a[duplicated(a)]) and !a respectively this works fine for single column comparison. This must be also possible for two column comparison, but I can`t get it. Thanks Florian -- Dr. Florian Jansen Geobotany Nature Conservation Institute for Botany and Landscape Ecology Ernst-Moritz-Arndt-University Grimmer Str. 88 17487 Greifswald - Germany +49 (0)3834 86 4147 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] multilevel factor model in lmer
Harold and Dimitris -- Thanks very much. Cheers, Dan =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Daniel A. Powers, Ph.D. Department of Sociology University of Texas at Austin 1 University Station A1700 Austin, TX 78712-0118 phone: 512-232-6335 fax: 512-471-1748 [EMAIL PROTECTED] -Original Message- From: Dimitris Rizopoulos [mailto:[EMAIL PROTECTED] Sent: Monday, October 02, 2006 6:05 AM To: Doran, Harold; [EMAIL PROTECTED]; R-Help Cc: [EMAIL PROTECTED] Subject: Re: [R] multilevel factor model in lmer If you just want to fit the 2PL, without any covariates, then this can be currently handled by function ltm() in package ltm. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: Doran, Harold [EMAIL PROTECTED] To: [EMAIL PROTECTED]; R-Help r-help@stat.math.ethz.ch Cc: [EMAIL PROTECTED] Sent: Monday, October 02, 2006 12:22 PM Subject: Re: [R] multilevel factor model in lmer Dan: lmer cannot currently be used for the 2PL. As you note, it is straightforward to estimate the 1PL, but the a-parameters present a current challenge. Doug mentioned to me the other day he is doing some work on this, so I have copied him on this reply. Harold -Original Message- From: [EMAIL PROTECTED] on behalf of Dan Powers Sent: Sun 10/1/2006 10:15 PM To: 'R-Help' Subject: [R] multilevel factor model in lmer Hello -- I am curious if lmer can be used to fit a multilevel factor model such as a two-parameter item response model. The one parameter model is straightforward. A two-factor model requires a set of factor loadings multiplying a single random effect. For example, a logit model for the ith subject responding correctly to the jth item (j=1,..,J) is logit[p(ij)] = a1*item1(i) + ... + aJ * itemJ(i) + lambda1*item1(i)*u(i) + ... + lambdaJ*itemJ(i)*u(i) where the lambdas are factor loadings, with lambda1 fixed to 1.0 and item1-itemJ are dummy variables for the items. Thanks, Dan =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Daniel A. Powers, Ph.D. Department of Sociology University of Texas at Austin 1 University Station A1700 Austin, TX 78712-0118 phone: 512-232-6335 fax: 512-471-1748 [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Help with lrm function in package Design
Hi, there, I am having trouble using 'lrm' function in package 'Design'. Basically, the ' . ' after ' ~ ' wouldn't work. Here are some sample codes: temp - data.frame(a=c(rep(0,3),rep(1,3)),b=rnorm(6),c=c('a','b','c','a','b','c')) lrm(a~.,data=temp) Error in terms.formula(formula, specials = strat) : '.' in formula and no 'data' argument This code worked before but I can't remember the exact version number. Is there something being changed in the new version of lrm? If so, how to specify all other variables in the formula then? Thanks in advance, Auston version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 3.1 year 2006 month 06 day01 svn rev38247 language R version.string Version 2.3.1 (2006-06-01) Auston Wei Research Statistical Analyst Division of Quantitative Science The University of Texas MD Anderson Cancer Center Tel: 713-563-4281 Email: [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] qvalue
Dear colleagues, This is not strictly a R question, but I hope it is ok to ask on the list. I fed a vector of p-values from about 20 million anova tests to the package q-value and obtained this output: qsummary(asso_p.qvalue) Call: qvalue(p = asso_p.vec) pi0:1 Cumulative number of significant calls: 1e-04 0.001 0.01 0.025 0.050.1 1 p-value 22711 59067 262103 551316 1013241 1936797 20048103 q-value 3554 5211 9275 12807 16951 24557 20048103 I can see that there are many hits with very small q-values ,say q 0.001, so to use that as cut off I have 5211 significant hits and can expect ~ 5 false postives. But my pi0 is 1. Does it mean that all my tests are true null and there are no significant results? Thanks for your help. Alex Alex Lam PhD student Department of Genetics and Genomics Roslin Institute (Edinburgh) Roslin Midlothian EH25 9PS Phone +44 131 5274471 Web http://www.roslin.ac.uk __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Help with lrm function in package Design
This is a bug in the Design package, please report it to its maintainer. Uwe Ligges [EMAIL PROTECTED] wrote: Hi, there, I am having trouble using 'lrm' function in package 'Design'. Basically, the ' . ' after ' ~ ' wouldn't work. Here are some sample codes: temp - data.frame(a=c(rep(0,3),rep(1,3)),b=rnorm(6),c=c('a','b','c','a','b','c')) lrm(a~.,data=temp) Error in terms.formula(formula, specials = strat) : '.' in formula and no 'data' argument This code worked before but I can't remember the exact version number. Is there something being changed in the new version of lrm? If so, how to specify all other variables in the formula then? Thanks in advance, Auston version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 3.1 year 2006 month 06 day01 svn rev38247 language R version.string Version 2.3.1 (2006-06-01) Auston Wei Research Statistical Analyst Division of Quantitative Science The University of Texas MD Anderson Cancer Center Tel: 713-563-4281 Email: [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] qvalue
alex lam (RI) wrote: Dear colleagues, This is not strictly a R question, but I hope it is ok to ask on the list. I fed a vector of p-values from about 20 million anova tests to the package q-value and obtained this output: qsummary(asso_p.qvalue) Call: qvalue(p = asso_p.vec) pi0:1 Cumulative number of significant calls: 1e-04 0.001 0.01 0.025 0.050.1 1 p-value 22711 59067 262103 551316 1013241 1936797 20048103 q-value 3554 5211 9275 12807 16951 24557 20048103 I can see that there are many hits with very small q-values ,say q 0.001, so to use that as cut off I have 5211 significant hits and can expect ~ 5 false postives. But my pi0 is 1. Does it mean that all my tests are true null and there are no significant results? Well, yes, at least under H0 you would expect the above results in such a case. Concluding without further information that *all* are non-significant is impossible, though. This requires some interpretation depending on where the tests some from... Uwe Ligges Thanks for your help. Alex Alex Lam PhD student Department of Genetics and Genomics Roslin Institute (Edinburgh) Roslin Midlothian EH25 9PS Phone +44 131 5274471 Web http://www.roslin.ac.uk __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Quantitative Position with Constellation
Content listed in R-Help and R-Finance We have a couple of openings in the Risk Management Group of Constellation Commodities and specifically in the Deal Review Team which examines, analyzes and models structured transactions. Brief description follows. If interested, please email me at [EMAIL PROTECTED] with questions and a resume. Regards, Yannis Tzamouranis - Summary of Responsibilities, Essential Duties Expectations: The Quantitative Analyst/Associate, Risk Management is responsible for: * Work within the Structured Deal analysis group to understand, value and place risk metrics around new deals of some complexity, size and risk; examine how they have been modeled by origination, how they will be booked into the trading systems and how they are modified over time. * Help in the valuation of financial and physical trading instruments and derivatives. * Independently create models (usually Monte Carlos) to value deals and confirm risk models created by the front office or Strategists * Develop models in support of various other risk management functions * Develop new risk metrics for management to better understand the risk /return tradeoffs of complex deals. * Study the impact of hedging strategies, stress tests, critical exposures, risks interacting across various regions and commodities. Qualifications (Experience, Competencies, Skills, Education): Ph.D. (in hard sciences or engineering) or Masters degree required in technical field, e.g., computational finance, mathematics, physics, economics, statistics or engineering. Some experience in energy is a plus. A good subset of the following skills and experience (with the capability to eventually learn and cover all the areas below) is desired: * Advanced knowledge of mathematics and statistics, especially the mathematical framework underlying the valuation and risk management of futures, options and other derivatives. * A thorough working knowledge of options valuation as it relates to energy markets, especially North American gas markets. * Advanced modeling and support of system operation, risk management, and valuation systems. * A well developed understanding of the fundamentals of various North American power or gas markets and instruments. * Good knowledge of R (or SPLUS) and Visual Basic are desired. SAS, Matlab and C++ are welcomed as are other programming languages. Extensive experience in Microsoft Excel is also a must. This e-mail and any attachments are confidential, may contain legal, professional or other privileged information, and are intended solely for the addressee. If you are not the intended recipient, do not use the information in this e-mail in any way, delete this e-mail and notify the sender. CEG-IP1 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Help with lrm function in package Design
Thanks a lot. Will do. Auston Auston Wei Research Statistical Analyst Division of Quantitative Science The University of Texas MD Anderson Cancer Center Tel: 713-563-4281 Email: [EMAIL PROTECTED] Uwe Ligges [EMAIL PROTECTED] Sent by: [EMAIL PROTECTED] 10/02/2006 11:47 AM To: [EMAIL PROTECTED] cc: r-help@stat.math.ethz.ch Subject: Re: [R] Help with lrm function in package Design This is a bug in the Design package, please report it to its maintainer. Uwe Ligges [EMAIL PROTECTED] wrote: Hi, there, I am having trouble using 'lrm' function in package 'Design'. Basically, the ' . ' after ' ~ ' wouldn't work. Here are some sample codes: temp - data.frame(a=c(rep(0,3),rep(1,3)),b=rnorm(6),c=c('a','b','c','a','b','c')) lrm(a~.,data=temp) Error in terms.formula(formula, specials = strat) : '.' in formula and no 'data' argument This code worked before but I can't remember the exact version number. Is there something being changed in the new version of lrm? If so, how to specify all other variables in the formula then? Thanks in advance, Auston version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 3.1 year 2006 month 06 day01 svn rev38247 language R version.string Version 2.3.1 (2006-06-01) Auston Wei Research Statistical Analyst Division of Quantitative Science The University of Texas MD Anderson Cancer Center Tel: 713-563-4281 Email: [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] separation depending on equal contents in more than one field
One way is to 'split' the indices of the rows to determine which ones to use. For example from the data give, I got the following: split(seq(nrow(obs)), list(obs$a, obs$b), drop=T) $`1.1` [1] 1 $`2.2` [1] 2 $`2.3` [1] 3 $`3.4` [1] 4 5 $`3.5` [1] 6 You can then use this resulting list and find all entries with more than one value and use this to do your calculations. On 10/2/06, Florian Jansen [EMAIL PROTECTED] wrote: Hi, I have a dataframe: (obs - data.frame(a=c(1,2,2,3,3,3), b=c(1,2,3,4,4,5), c=1:2)) attach(obs) In reality its about 1 million rows. Some of the datasets have same contents in col a and! b like row 4 and 5. I want to do some calculations on col c within the duplicated rows and merge them afterwards: layer - function(x) round((1-prod(1-x/100))*100,0) (covnew - aggregate(c, list(a=a, b=b), layer)) This works fine, but not with 1 mill. rows because of memory space limitations. So I thought to split the dataframe into the majority of unique rows on one hand and all duplicated rows on the other: With subset(obs, a %in% a[duplicated(a)]) and !a respectively this works fine for single column comparison. This must be also possible for two column comparison, but I can`t get it. Thanks Florian -- Dr. Florian Jansen Geobotany Nature Conservation Institute for Botany and Landscape Ecology Ernst-Moritz-Arndt-University Grimmer Str. 88 17487 Greifswald - Germany +49 (0)3834 86 4147 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Barplot
On Mon, 2006-10-02 at 11:14 -0400, Mohsen Jafarikia wrote: Hello, I have used the following data to draw my barplot: BL LRQ 36.351.00 1.92 36.914.00 0.00 25.706.00 0.00 34.383.00 1.92 05.320.50 0.00 BL-c(36.35, 36.91, 25.70, 34.38, 05.32) LR-c(1.00, 4.00, 6.00, 3.00, 0.50) Q-(1.92, 0.00, 0.00, 1.92, 0.00) barplot(dt$LR, main='LR Value', col='orange', border='black', space=0.05, width=(dt$BL), xlab='Length', ylab='LR') axis(1) I would like to do the following things that I don't know how to do it: 1) Writing the value of each 'BL' on my X axis. 2) Writing the value of 'Q' on the bottom of X axis. 3) Draw a line on the bars which connects the 'LR' values. I appreciate your comments. Thanks, Mohsen I'm not sure if I am getting this completely correct, but is this what you want? BL - c(36.35, 36.91, 25.70, 34.38, 5.32) LR - c(1.00, 4.00, 6.00, 3.00, 0.50) Q - c(1.92, 0.00, 0.00, 1.92, 0.00) # Get the bar midpoints in 'mp' mp - barplot(LR, main='LR Value', col='orange', border='black', space=0.05, width=(BL), xlab='Length', ylab='LR') # Write the LR and Q values below the bar midpoints mtext(1, at = mp, text = sprintf(%.1f, LR), line = 1) mtext(1, at = mp, text = sprintf(%.1f, Q), line = 0) # Now connect the LR values across the bars lines(mp, LR) See ?barplot, ?mtext, ?sprintf and ?lines HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How can I generate this numbers
Hi wizards, I need to know how can I generate this numbers I have n numbers N1,N2 , Nn , but Nn = 1- sum(N1+N2+...+Nn-1) and sum(N1+N2+..Nn)=1 and N1,N2,..Nn with 0N1 . Does somebody know how to generate it ? Some distribution or algorithm. Thanks in advance. -- Web Page http://www.geocities.com/ricardo_rios_sv/index.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How can I generate this numbers
This sounds so simple it must be a homework problem, no? cheers, Rolf Turner [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] X-axis labels in histograms drawn by the truehist function
Hi, I had sent this email last week, but received no reply. So, I am resending it - please excuse me for the redundant email. I have a simple problem that I would appreciate getting some tips. I am using the truehist function within an apply call to plot multiple histograms. I can't figure out how to get truehist to use the column names of the matrix as the labels for the x-axis of the histograms. Here is a simple example: library(MASS) # this contains the truehist function X - matrix(runif(4000),ncol=4) colnames(X) - c(X1,X2,X3,X4) par(mfrow=c(2,2)) apply(X, 2, function(x)truehist(x)) In this example, I would like the x-labels of the histograms to be X1, X2, etc. Any help is appreciated. Best, Ravi --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] X-axis labels in histograms drawn by the truehist function
On Mon, 2006-10-02 at 14:58 -0400, Ravi Varadhan wrote: Hi, I had sent this email last week, but received no reply. So, I am resending it - please excuse me for the redundant email. I have a simple problem that I would appreciate getting some tips. I am using the truehist function within an apply call to plot multiple histograms. I can't figure out how to get truehist to use the column names of the matrix as the labels for the x-axis of the histograms. Here is a simple example: library(MASS) # this contains the truehist function X - matrix(runif(4000),ncol=4) colnames(X) - c(X1,X2,X3,X4) par(mfrow=c(2,2)) apply(X, 2, function(x)truehist(x)) In this example, I would like the x-labels of the histograms to be X1, X2, etc. Any help is appreciated. Best, Ravi Ravi, Gabor did reply: https://stat.ethz.ch/pipermail/r-help/2006-September/114019.html HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Barplot
Thanks for your response. I just have two more questions: 1) I don't know how to write the titles of the LR and Q behind their lines of values (at the bottom of the graph). I tried to write like text = sprintf(LR%.1f, LR)... but it writes 'LR' behind all values while I only want it once at the beginning of the line while all the LR and Q values are still in the mid points of bars. 2) I would like a line which connects the mid points of each bar to be like a density function (or regression) line which is not sharp like what I have now. I tried to write density in the code but it tells Error in xy.coords(x, y) : 'x' and 'y' lengths differ I appreciate any comment about these questions Thanks, Mohsen On 10/2/06, Marc Schwartz (via MN) [EMAIL PROTECTED] wrote: On Mon, 2006-10-02 at 11:14 -0400, Mohsen Jafarikia wrote: Hello, I have used the following data to draw my barplot: BL LRQ 36.351.00 1.92 36.914.00 0.00 25.706.00 0.00 34.383.00 1.92 05.320.50 0.00 BL-c(36.35, 36.91, 25.70, 34.38, 05.32) LR-c(1.00, 4.00, 6.00, 3.00, 0.50) Q-(1.92, 0.00, 0.00, 1.92, 0.00) barplot(dt$LR, main='LR Value', col='orange', border='black', space= 0.05, width=(dt$BL), xlab='Length', ylab='LR') axis(1) I would like to do the following things that I don't know how to do it: 1) Writing the value of each 'BL' on my X axis. 2) Writing the value of 'Q' on the bottom of X axis. 3) Draw a line on the bars which connects the 'LR' values. I appreciate your comments. Thanks, Mohsen I'm not sure if I am getting this completely correct, but is this what you want? BL - c(36.35, 36.91, 25.70, 34.38, 5.32) LR - c(1.00, 4.00, 6.00, 3.00, 0.50) Q - c(1.92, 0.00, 0.00, 1.92, 0.00) # Get the bar midpoints in 'mp' mp - barplot(LR, main='LR Value', col='orange', border='black', space=0.05, width=(BL), xlab='Length', ylab='LR') # Write the LR and Q values below the bar midpoints mtext(1, at = mp, text = sprintf(%.1f, LR), line = 1) mtext(1, at = mp, text = sprintf(%.1f, Q), line = 0) # Now connect the LR values across the bars lines(mp, LR) See ?barplot, ?mtext, ?sprintf and ?lines HTH, Marc Schwartz -- Mohsen Jafarikia Department of Animal and Poultry Science University of Guelph Phone: (519) 824-4120 ext.58353 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] sweave2html only for Linux users ?
Dear R-List, I would like to convert my rnw files written with Sweave from LaTeX to html. I discovered on the list the following link : http://biostat.mc.vanderbilt.edu/twiki/bin/view/Main/SweaveConvert Is this document only for linux users or I can use it with windose XP ? Thanks __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] X-axis labels in histograms drawn by the truehist function
Thank you, Marc and Gabor. I apologize for having missed Gabor's reply. Best regards, Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html -Original Message- From: Marc Schwartz (via MN) [mailto:[EMAIL PROTECTED] Sent: Monday, October 02, 2006 3:25 PM To: Ravi Varadhan Cc: r-help@stat.math.ethz.ch Subject: Re: [R] X-axis labels in histograms drawn by the truehist function On Mon, 2006-10-02 at 14:58 -0400, Ravi Varadhan wrote: Hi, I had sent this email last week, but received no reply. So, I am resending it - please excuse me for the redundant email. I have a simple problem that I would appreciate getting some tips. I am using the truehist function within an apply call to plot multiple histograms. I can't figure out how to get truehist to use the column names of the matrix as the labels for the x-axis of the histograms. Here is a simple example: library(MASS) # this contains the truehist function X - matrix(runif(4000),ncol=4) colnames(X) - c(X1,X2,X3,X4) par(mfrow=c(2,2)) apply(X, 2, function(x)truehist(x)) In this example, I would like the x-labels of the histograms to be X1, X2, etc. Any help is appreciated. Best, Ravi Ravi, Gabor did reply: https://stat.ethz.ch/pipermail/r-help/2006-September/114019.html HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R function to compute kappa statistics for two vector
Dear R-user, Did anybody know how to calculate the kappa statistics of two vectors for the agreement? for example: a-c(0,1,0,0,1,0) b-c(0,1,1,0,0,1) I know the percent of agreement is 3/6, but how to get the kappa? [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Problem with rbinom
Hello! I have the following problem: I calculate a variable called pd in Excel, save it as pd.txt, so that it looks like the following: pd 0.070568471 0.011275136 0.006892258 0.028592432 0.028489582 0.01881913 0.035426606 0.011517305 There were 4857 cases in pd.txt. After that I start R and load the data through the following command: daten - read.table(pd.txt, header=T) Then I want to execute the function rbinom: rbinom(4857,1,daten) I get the following error message: Fehler in rbinom(n, size, prob) : ungültige Argumente (error in rbinom(n, size, prob) : bad arguments The problem is daten, because if I excecute rbinom(4857,1,0.5), then it works. So, I have no idea, what the problem could be. Alex -- Alexander Geisler * Moserhofgasse 36/1 * A-8010 Graz StV Technische Mathematik | FakV TMTP email: [EMAIL PROTECTED] | [EMAIL PROTECTED] phone: +43 650 / 811 61 90 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R function to compute kappa statistics for two vector
Kappa() in library vcd kappa2() in library irr ckappa() in library psy cohen.kappa() in library concord.. Bruno - Original Message - From: Philip He [EMAIL PROTECTED] To: R-help@stat.math.ethz.ch Cc: Rebecca Ding [EMAIL PROTECTED] Sent: Monday, October 02, 2006 5:53 PM Subject: [R] R function to compute kappa statistics for two vector Dear R-user, Did anybody know how to calculate the kappa statistics of two vectors for the agreement? for example: a-c(0,1,0,0,1,0) b-c(0,1,1,0,0,1) I know the percent of agreement is 3/6, but how to get the kappa? [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] sweave2html only for Linux users ?
Another approach is to use the Sweave driver in the R2HTML package and work directly with HTML rather than converting. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Laurent Rhelp Sent: Monday, October 02, 2006 3:25 PM To: R-help@stat.math.ethz.ch Subject: [R] sweave2html only for Linux users ? Dear R-List, I would like to convert my rnw files written with Sweave from LaTeX to html. I discovered on the list the following link : http://biostat.mc.vanderbilt.edu/twiki/bin/view/Main/SweaveConvert Is this document only for linux users or I can use it with windose XP ? Thanks __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R function to compute kappa statistics for two vector
Philip He [EMAIL PROTECTED] writes: Dear R-user, Did anybody know how to calculate the kappa statistics of two vectors for the agreement? for example: a-c(0,1,0,0,1,0) b-c(0,1,1,0,0,1) I know the percent of agreement is 3/6, but how to get the kappa? Multiple packages appear to have versions of Cohen's Kappa: irr, concord, psy, vcd, e1071 -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem with rbinom
Using read.table creates a data frame that you store in dataen, rbinom wants a vector not a data frame, so try: rbinom(4857,1,dataen$pd) Or rbinom(4857,1,dataen[[1]]) Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alexander Geisler Sent: Monday, October 02, 2006 4:01 PM To: r-help@stat.math.ethz.ch Subject: [R] Problem with rbinom Hello! I have the following problem: I calculate a variable called pd in Excel, save it as pd.txt, so that it looks like the following: pd 0.070568471 0.011275136 0.006892258 0.028592432 0.028489582 0.01881913 0.035426606 0.011517305 There were 4857 cases in pd.txt. After that I start R and load the data through the following command: daten - read.table(pd.txt, header=T) Then I want to execute the function rbinom: rbinom(4857,1,daten) I get the following error message: Fehler in rbinom(n, size, prob) : ungültige Argumente (error in rbinom(n, size, prob) : bad arguments The problem is daten, because if I excecute rbinom(4857,1,0.5), then it works. So, I have no idea, what the problem could be. Alex -- Alexander Geisler * Moserhofgasse 36/1 * A-8010 Graz StV Technische Mathematik | FakV TMTP email: [EMAIL PROTECTED] | [EMAIL PROTECTED] phone: +43 650 / 811 61 90 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How can I generate this numbers
Hi Rolf Turner, I have a statistical model, it model need this numbers for calculate the probability. This numbers must be random. For example I need that magicfunction(3) [1] 0.3152460 0.5231614 0.1615926 magicfunction(3) [1] 0.6147933 0.3122999 0.0729068 but the argument of the function is arbitrary , does somebody know if exist this function in R? On 10/2/06, Rolf Turner [EMAIL PROTECTED] wrote: This sounds so simple it must be a homework problem, no? cheers, Rolf Turner [EMAIL PROTECTED] -- Web Page http://www.geocities.com/ricardo_rios_sv/index.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] fMultivar rollMax question
Omar Lakkis wrote: I am using fMultivar under R 2.2.1 on a Debian linux box. Could someone, please, explain to me why there are two trailing NAs in the last statement in the code beow? library(fMultivar) x - 1:20 rollMax(x, n=3) [1] 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 rollMax(x, n=2) [1] 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 rollMax(x, n=1) [1] 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 NA NA The rolling functions were build for n 1, which is unfortunately not mentioned in the help page. For n=1 you can just call: apply(x, 1, max) If we want rolling functions which also work for n=1 we have to modify the code in the following way: replace in the function rollFun() the following lines for (i in 2:n) { start = start + 1 end = end + 1 m = cbind(m, x[start:end]) } with if (n 1) { for (i in 2:n) { start = start + 1 end = end + 1 m = cbind(m, x[start:end]) } } else if (n == 1) { m = matrix(m) } Regards DW __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How can I generate this numbers
Ricardo Rios wrote: Hi Rolf Turner, I have a statistical model, it model need this numbers for calculate the probability. This numbers must be random. For example I need that magicfunction(3) [1] 0.3152460 0.5231614 0.1615926 magicfunction(3) [1] 0.6147933 0.3122999 0.0729068 but the argument of the function is arbitrary , does somebody know if exist this function in R? As far as I know, no such function exists in R, but it would be totally trivial to write one, if that's what you really want. However the question you pose makes little sense to me. If you really have a ``statisical model'' then there must be some marginal distribution for each of the probabilities (I *assume* They are probabilities) going into the sequence which you wish to sum to 1. You mention no such distribution. To generate such a sequence with an arbitray marginal distribution is so trivial that it does not bear discussing. If you really can't see how to do this, then you probably shouldn't be messing about with ``statistical models''. You did not explicitly deny that this is a homework problem. I still suspect that it is. cheers, Rolf Turner __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] install packages question
I am at a new job where my sys admin installed R in linux and it does run when I log in as a user. I am on linux 2.1.2 but i'm not sure if it''s redhat etc ( but i doubt this matters for my question ). The alias put in my .envfile ( for the kshell ) is R = /ms/dev/fsf/R/2.0.0/install/.exec/ia32.linux.2.4.lib6/lib/R/bin/exec/R and my R_HOME is /ms/dev/fsf/R/2.0.0/install/.exec/ia32.linux.2.4.lib6/lib/R So now, I am trying to install specific packages ( I can't use install.packages because my linux doesn't have an internet connection ) , I think I found the right documentation ( pg 16 of R installation and administration ) and I set my R_LIBS varaible appropriately but my R CMD INSTALL command is not working. It just drops the CMD and gives ARGUMENT CMD __ignored__ ) and invokes R by itself. I also tried R CMD BATCH testfile and similarly it dropped the CMD and the BATCH and just invoked R also Does anyone know what I need to change ( probably in my .envfile ) so that R knows what these commands mean ? I am familar with installing R ( binary ) and various packages on windows but I am very unfamilar with Linux. I think if I can get this fixed, I might be able to install the specific packages I need because the instructions on pg 16 are clear. Thanks a lot. This is not an offer (or solicitation of an offer) to buy/sell the securities/instruments mentioned or an official confirmation. Morgan Stanley may deal as principal in or own or act as market maker for securities/instruments mentioned or may advise the issuers. This is not research and is not from MS Research but it may refer to a research analyst/research report. Unless indicated, these views are the author's and may differ from those of Morgan Stanley research or others in the Firm. We do not represent this is accurate or complete and we may not update this. Past performance is not indicative of future returns. For additional information, research reports and important disclosures, contact me or see https://secure.ms.com/servlet/cls. You should not use e-mail to request, authorize or effect the purchase or sale of any security or instrument, to send transfer instructions, or to effect any other transactions. We cannot guarantee that any such requests received via ! e-mail will be processed in a timely manner. This communication is solely for the addressee(s) and may contain confidential information. We do not waive confidentiality by mistransmission. Contact me if you do not wish to receive these communications. In the UK, this communication is directed in the UK to those persons who are market counterparties or intermediate customers (as defined in the UK Financial Services Authority's rules). [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How can I generate this numbers
Ricardo Rios alfilnegro.sv at gmail.com writes: Hi Rolf Turner, I have a statistical model, it model need this numbers for calculate the probability. This numbers must be random. For example I need that magicfunction(3) [1] 0.3152460 0.5231614 0.1615926 magicfunction(3) [1] 0.6147933 0.3122999 0.0729068 but the argument of the function is arbitrary , does somebody know if exist this function in R? On 10/2/06, Rolf Turner rolf at erdos.math.unb.ca wrote: This sounds so simple it must be a homework problem, no? cheers, Rolf Turner rolf at math.unb.ca Hmmm. You're basically asking for random probabilities of a composition. There are many possible distributions (and it's hard to imagine that it doesn't matter which one you choose, or what it's parameters are! you may need to think about this some more), e.g. additive log ratio or Dirichlet. Dirichlet (the multivariate analogue of the beta distribution) is most common and simplest, although not very flexible. rdirichlet() exists in several different packages: try RSiteSearch(rdirichlet). (actually, for what you're looking for magicfunction - function(n) { r - runif(n) r/sum(r) } should satisfy your needs -- you can substitute any non-negative probability distribution for runif -- but, again, you may need to think more about what you're doing ...) good luck Ben Bolker __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How can I generate this numbers
Try: rsimplex - function(n){ u - diff(sort(runif(n))) c(u,1-sum(u)) } On Oct 2, 2006, at 5:43 PM, Rolf Turner wrote: Ricardo Rios wrote: Hi Rolf Turner, I have a statistical model, it model need this numbers for calculate the probability. This numbers must be random. For example I need that magicfunction(3) [1] 0.3152460 0.5231614 0.1615926 magicfunction(3) [1] 0.6147933 0.3122999 0.0729068 but the argument of the function is arbitrary , does somebody know if exist this function in R? As far as I know, no such function exists in R, but it would be totally trivial to write one, if that's what you really want. However the question you pose makes little sense to me. If you really have a ``statisical model'' then there must be some marginal distribution for each of the probabilities (I *assume* They are probabilities) going into the sequence which you wish to sum to 1. You mention no such distribution. To generate such a sequence with an arbitray marginal distribution is so trivial that it does not bear discussing. If you really can't see how to do this, then you probably shouldn't be messing about with ``statistical models''. You did not explicitly deny that this is a homework problem. I still suspect that it is. cheers, Rolf Turner __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Kendall for Copula
Somebody know what is the package in which I can find the association measures (like Kendall's Tau and Spearman's Rho) for a copula object (bivariate copulas)?? Thanks a lot. Marta Di Lascio __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] a question regarding 'lrm'
Hi List, I don't understand why 'lrm' doesn't recognize the '~.' formula. I'm pretty sure it was working before. Please see below: I'm using R2.3.0, WinXP, Design 2.0-12 thanks, ...Tao dat - data.frame(y=factor(rep(1:2,each=50)), x1=rnorm(100), x2=rnorm(100), x3=rnorm(100)) lrm(y~., data=dat, x=T, y=T) Error in terms.formula(formula, specials = strat) : '.' in formula and no 'data' argument lrm(y~x1+x2+x3, data=dat, x=T, y=T) Logistic Regression Model lrm(formula = y ~ x1 + x2 + x3, data = dat, x = T, y = T) Frequencies of Responses 1 2 50 50 Obs Max Deriv Model L.R. d.f. P CDxy Gamma 100 1e-08 3.61 3 0.3066 0.594 0.187 0.188 Tau-a R2 Brier 0.095 0.047 0.241 Coef S.E. Wald Z P Intercept -0.05224 0.2071 -0.25 0.8009 x1-0.30699 0.1952 -1.57 0.1159 x2 0.08093 0.2171 0.37 0.7093 x3 0.21450 0.2247 0.95 0.3398 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] RGL 'front' upwards default in rendering image
The documentation for surface3d and rgl.surface in the package RGL states 'surface3d' always draws the surface with the `front' upwards (i.e. towards higher 'z' values). This can be used to render the top and bottom differently; see 'rgl.material' and the example below. Is there a way to override this default? I have search all the related methods help and the documents on RGL's website. Thanx Joe __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] RGL 'front' upwards default in rendering image
Joe Byers wrote: The documentation for surface3d and rgl.surface in the package RGL states 'surface3d' always draws the surface with the `front' upwards (i.e. towards higher 'z' values). This can be used to render the top and bottom differently; see 'rgl.material' and the example below. Is there a way to override this default? I have search all the related methods help and the documents on RGL's website. There are lots of ways to override it: as the docs say, rgl.surface is more flexible than surface3d, and you can draw triangles or quads arbitrarily. What sort of thing do you want to do? Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] help: Error: cannot allocate vector of size 12079 Kb
Dear All, I'm running the latest R on WinXP by using Rgui.exe --max-mem-size=3Mb . After read in a huge data file to a data matrix, I tried to get a subset of the data matrix but failed with: Error: cannot allocate vector of size 12079 Kb Any tips to get out of it? If helps, memory.limit() [1] 3145728000 memory.size() [1] 842735624 Thanks! Best, Cao __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.