Re: [R] how to fit GJR-GARCH model in R
Hi,All, I am trying to fit a GJR-GARCH model in R: r_t = mu + e_t h_t = alp_0 + alp_1 * e_(t-1)^2 + alp_2 * s_(t-1) * e_(t-1)^2 + beta * h_(t-1) where r_t = return (on day t), h_t = conditional volatility on day t, and s_(t-1) = 1 if e_(t-1) 0 (zero otherwise). I have downloaded the packages tseries and fSeries but can not see how to fit this model. Any help would be very much appreciated. Thanks, Steven _ 享用世界上最大的电子邮件系统― MSN Hotmail。 http://www.hotmail.com __ 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] Calculate of data frame
Hello, I have a dataframe which I read from a file: df - readtable(myFile); The dataframe has 4 columns: model, count, value and date where model and date are made of charactors and count and value are numbers. An example is like: modelcountvaluedate A420.87/1/2005 A310.27/2/2005 B714.27/1/2005 B16.2 7/2/2005 A2117/1/2005 B965.2 7/2/2005 Now I want to get the total count and value for each model/date pair, like modelcountvaluedate A631.87/1/2005 A310.27/2/2005 B714.27/1/2005 B1067.4 7/2/2005 Anyone can tell me how to do this? Thanks. Fan [[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
Re: [R] Calculate of data frame
Thanks for your answer, Peter. Now I have a new data frame which is sorted by (model,date) pair. Since the sorting is done to charactors, I have 7/1/2005 followed by 7/10/2005 instead of 7/2/2005. How can I do the aggregation and at the same time, make the result sorted the way I want (i.e, 7/1/2005 followd by 7/2/2005)? Thanks, Fan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Dalgaard Sent: Thursday, July 14, 2005 1:29 PM To: Zhang, Fan Cc: r-help@stat.math.ethz.ch Subject: Re: [R] Calculate of data frame Zhang, Fan [EMAIL PROTECTED] writes: Now I want to get the total count and value for each model/date pair, like modelcountvaluedate A631.87/1/2005 A310.27/2/2005 B714.27/1/2005 B1067.4 7/2/2005 Anyone can tell me how to do this? aggregate(df[,c(count,value)],df[,c(date,model)],sum) date model count value 1 7/1/2005 A 6 31.8 2 7/2/2005 A 3 10.2 3 7/1/2005 B 7 14.2 4 7/2/2005 B10 71.4 -- 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
Re: [R] R 2.0.0 is not suffisantly reliable to be used
WHAT CAN I DO FOR YOU, SIR ? Perhaps you're expecting some sort of congratulations for that new release ? I've taken time to download it, test it, and I've said what I've got to say. You're helping nobody with that sort of process of intention. -- Fan Liaw, Andy wrote: From: Fan After wasting one whole day, I've finally decided to stay with 1.9.1, some problems have been reported to R-Bugs. For occasional users, I would say, there's no worst thing than that: you installed the new release, and soem of your existing codes no longer work ! Given the attitude that you've taken, I'd guess you do not deserve the improvements introduced in R-2.0.0. If you are at all serious about having your code working with R-2.0.0, you would have tested it in the alpha/beta cycle, and try to resolve it before the official release, rather than ranting about it after the fact. Most people know better, and will not appreciate how you denigrate R-core's effort. Andy ps: If it's too hard for you to learn to spell, at least learn to use a spell checker. -- Fan __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp Dohme or MSD and in Japan, as Banyu) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system. -- __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] e1071, R1.9.0, Solaris 2.9, should I be worried?
On Tue, May 25, 2004 at 04:38:44PM +1200, Richard A. O'Keefe wrote: In R 1.9.0 running under Solaris 2.9 on a SunBlade 100, with Sun WorkShop 6 update 2 C++ 5.3 2001/05/15 as the C++ compiler, I just did How worried should I be? I guess the Warning: x hides Solver::x warnings related to a deliberate style choice, but what about the String literal converted to char* ones? as the message says, things like info(Exceeds max_iter in multiclass_prob\n); and the info() accepts char * as parameter __ [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] New version of benchmark comparing R with other software
Merci, Philippe. Just a complement regarding Matlab 6.5 (R13). R 1.9.0 is globally faster than Matlab 6.5 (tested on an AthlonXP): Matlab R Total time for all 15 tests (sec) 14.29 10.81 Overall mean (sec) 0.860.45 Matlab 6.5 has optimized the loops performance (sth called Just In Time), with spectacular results, codes with loops could be faster then vectorized codes. Here's the result for the loops test: Matlab R Creation of a 220x220 Toeplitz matrix (loops) 0.01 0.50 Bravo to the R dev team, nice job ! Cheers -- Fan Philippe Grosjean wrote: Hello, Thanks to Douglas Bates, there is now a new benchmark suite (version 2.3) which is compatible with R 1.9.0 and the recent Matrix library (0.8-1 or above). You find it at http://www.sciviews.org/other/benchmark.htm. It compares R 1.9.0 under Windows with: S-PLUS 6.5, Matlab 6.0, O-Matrix 5.6, Octave 2.1.42, Scilab 2.7 and Ox 3.30. In short, R in its version 1.9.0 and with the new Matrix library, is now one of the fastest matrix calculation package among those tested on the computer and system used (P IV, 1 Gb RAM and Windows XP pro). Keeping its limitations in mind (only a few functions tested, and relatively artificial situations that may or may not compare with real-world cases), this benchmark suite could be useful for deciding which software to chose for computing intensive matrix calculations, and also to compare the same software (R) on different platforms, with one or several processors, and/or with various optimized BLAS libraries. Best, Philippe Grosjean ...°})) ) ) ) ) ) ( ( ( ( ( Prof. Philippe Grosjean \ ___ ) \/ECO\ ( Numerical Ecology of Aquatic Systems /\___/ ) Mons-Hainaut University, Pentagone / ___ /( 8, Av. du Champ de Mars, 7000 Mons, Belgium /NUM\/ ) \___/\ ( phone: + 32.65.37.34.97, fax: + 32.65.37.33.12 \ ) email: [EMAIL PROTECTED] ) ) ) ) ) SciViews project coordinator (http://www.sciviews.org) ( ( ( ( ( ... __ [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] Error with 1.9.0 - winMenuAdd not usable in .Rprofile
With the R 1.9.0 version (Windows patched binary), I've got a strange behaviour: the function winMenuAdd is no longer usable in the start up file .Rprofile, the following error message was given: Error in try(winMenuAdd(test)) : couldn't find function winMenuAdd but the function works fine in interactive, once R loaded. Any idea ? Thanks -- Fan Duncan Murdoch wrote: On Wed, 21 Apr 2004 18:40:05 +0100 (BST), Prof Brian Ripley [EMAIL PROTECTED] wrote : On Wed, 21 Apr 2004, Duncan Murdoch wrote: I think it would be more useful for debugging purposes to do them one at a time. Do we still get an error message about HOMEDRIVE if we do the above? What if we set only HOMEPATH? Unfortunately you get the same message unless both are set correctly, so setting just one on the command line will tell you nothing. I've changed the message for R-patched so we can tell them apart. I've just uploaded builds of r-patched and r-devel to CRAN that incorporate this change. They should be visible tomorrow at http://cran.r-project.org/bin/windows/base Follow the links near the top of the page; the ones in the main part are for the unpatched 1.9.0 release. Duncan Murdoch __ [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] Error with 1.9.0 - winMenuAdd not usable in .Rprofile
Brian, thanks for the hint, it works. The old 1.8 version works very well without the need of such manual loading, I guess, there'd be some internal changes in the order of libraries loading at the startup in the 1.9.0 version ? -- Fan [EMAIL PROTECTED] wrote: I had this problem too. The documentation for the winMenus says that these functions are part of the utils package. R must be loading this library after it sources in Rprofile. If you add library(utils) to the beginning of your .First function, it should take care of the problem. Brian Gregor, P.E. Transportation Planning Analysis Unit Oregon Department of Transportation [EMAIL PROTECTED] (503) 986-4120 -Original Message- From: Fan [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 21, 2004 3:06 PM To: Duncan Murdoch Cc: [EMAIL PROTECTED] Subject: [R] Error with 1.9.0 - winMenuAdd not usable in .Rprofile With the R 1.9.0 version (Windows patched binary), I've got a strange behaviour: the function winMenuAdd is no longer usable in the start up file .Rprofile, the following error message was given: Error in try(winMenuAdd(test)) : couldn't find function winMenuAdd but the function works fine in interactive, once R loaded. Any idea ? Thanks -- Fan Duncan Murdoch wrote: On Wed, 21 Apr 2004 18:40:05 +0100 (BST), Prof Brian Ripley [EMAIL PROTECTED] wrote : On Wed, 21 Apr 2004, Duncan Murdoch wrote: I think it would be more useful for debugging purposes to do them one at a time. Do we still get an error message about HOMEDRIVE if we do the above? What if we set only HOMEPATH? Unfortunately you get the same message unless both are set correctly, so setting just one on the command line will tell you nothing. I've changed the message for R-patched so we can tell them apart. I've just uploaded builds of r-patched and r-devel to CRAN that incorporate this change. They should be visible tomorrow at http://cran.r-project.org/bin/windows/base Follow the links near the top of the page; the ones in the main part are for the unpatched 1.9.0 release. Duncan Murdoch __ [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 __ [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] classification and association rules in R
hello, I am looking for a classification or/and association rules in R. However, after searching in CRAN, nothing found. Is anyone know if they are available in R? By the way, I heard that there are some people developing a better search interface for R (or CRAN?). Where are the related information I can get? Thanks. Regards, Rong-En Fan __ [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] socket clusters on snow dies easily
On Thu, Apr 08, 2004 at 11:18:43AM -0500, Luke Tierney wrote: If you absolutely have to use the socket approach you will probably have to track down the particular reason for this failure in your environment by looking at what is going on under the hood and checking the pieces. The master sets up a server socket, the slave noted connect to that socket, and for some reason the first read on that connection seems to be failing. It could be a timing issues--you may need to adjust socket timeouts, it could be a permission or firewall issue; hard to tell without experimenting. You are probably better off using the PVM version if at all possible. Overall it more solid than the socket version and likely to have fewer issues. er, due to some historical reason, we want to use socket instead of MPI or PVM. My friend and I will trace the socket code and see how to solve this problem. If there is anything new, i'll post here. Regards, Rong-En Fan __ [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] socket clusters on snow dies easily
hello, I'm using R 1.8.1 with the lastest snow package on FreeBSD 4.9. However, when I try to using socket clusters, it's very unstable. Sometimes it dies half way when I run parSapply(), sometimes it dies when cluster connection is idle. I create a socket cluster by following cmd cl = makeCluster(foo, type = SOCK, outfile=/tmp/rafanlog); Then, I just idle in R, and tail -f outfile, I got following: [... some R msgs ...] Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for a HTML browser interface to help. Type 'q()' to quit R. #library(serialize) library(snow) slaveLoop(makeSOCKmaster()) Error in unserialize(node$con) : error reading from connection Execution halted after makeCluster() returns, the outfile hangs around the empty lines above, about 1 minute later, all msg shows up, also it dies. This is reproducible on my machine. Also, one of my friends also got this result on Linux machines w/ R 1.8.x. Is there any one also encounter this problem? Any comments or suggestion are welcome :) Regards, Rong-En Fan __ [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] Compiling/using R on IBM AIX
Hi, I plan to use R on IBM AIX machines (4.x.x), and hoping some feedbacks from R users on this OS. I've looked at the R search site, my impression is that there would be very few peoples who are currently using R on AIX, correct me if I'm wrong. To compile R on AIX, I have two little questions: 1. which compiles would be recommanded (IBM C Fortran compilers vs GNU compiles), and are there any restrictions on the version to be used ? 2. is Perl 5.0.0 usable instead of the version 5.6.1 recommanded ? Many thanks in advance for your help -- Fan __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Excel can do what R can't?????
Dear Professor Ripley, I'm little confused of your reply: do you mean that GRG would not be a standard optimization algorithm, so it couldn't be better than what exist in R ? I'm not a specialist of numerical optimization algorithms, but it seems that GRG is actually implemented in several specialized optimisation toolbox (sure generally commercial), not only the limited one in Excel. And with google, search GRG generalized reduced gradient is giving 424 links. -- Fan I've found that the discussions are interesting, generally speaking, peoples seem equally confident on R's optim/nlm and Excel's solver. The authors of the algorithm GRG2 (Generalized Reduced Gradient) are not cited in the documentation of optim(), so I'm wondering if the optimization algorithm implemented in Excel is fondamentally the same than that in R ? I don't suppose Excel cites the method*s* used in optim() either, but GRG2 is not in the index of my copies of any of the standard texts on numerical optimization. ** L'ADSL A 20 EUR/MOIS** Tiscali propose l'ADSL le moins cher du marché : 20 EUR/mois et le modem ADSL offert ! Pour profiter de cette offre exceptionnelle, cliquez ici : http://register.tiscali.fr/adsl/ Offre soumise à conditions. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Excel can do what R can't?????
I've found that the discussions are interesting, generally speaking, peoples seem equally confident on R's optim/nlm and Excel's solver. The authors of the algorithm GRG2 (Generalized Reduced Gradient) are not cited in the documentation of optim(), so I'm wondering if the optimization algorithm implemented in Excel is fondamentally the same than that in R ? Thanks in advance -- Fan Damon Wischik wrote: Michael Rennie wrote: Last, it's not even that I'm getting error messages anymore- I just can't get the solution that I get from Excel. If I try to let R find the solution, and give it starting values of c(1,2), it gives me an optimization solution, but an extremely poor one. However, if I give it the answer I got from excel, it comes right back with the same answer and solutions I get from excel. Using the 'trace' function, I can see that R gets stuck in a specific region of parameter space in looking for the optimization and just appears to give up. Even when it re-set itself, it keeps going back to this region, and thus doesn't even try a full range of the parameter space I've defined before it stops and gives me the wrong answer. 1. Either your function or the Excel solver is wrong. I executed your source code (which defines f), then ran it over a grid of points, and plotted the answer, using this code: xvals - seq(.2,2,by=.2) yvals - seq(1,3,by=.2) z - matrix(NA,nrow=length(xvals),ncol=length(yvals)) for (i in 1:length(xvals)) for (j in 1:length(yvals)) { x - xvals[i] y - yvals[j] z[i,j] - f(c(x,y)) } filled.contour(x=xvals,y=yvals,z=log(z)) Your solution from Excel evaluates to f(c(.558626306252032,1.66764519286918)) == 0.3866079 while I easily found a point which was much better, f(c(.4,1)) = 7.83029e-05 You should have tried executing your function over a grid of points, and plotting the results in a contour plot, to see if optim was working sensibly. You could do the same grid in Excel and R to verify that the function you've defined does the same thing in each. Since your optimization is only over a 2D parameter space, it is easy for you to plot the results, to see at a glance what the optimum is, and to work out what is going wrong. 2. Your code executes very slowly because it is programmed inefficiently. You need to iterate a function to get your final solution, but you don't need to keep track of all the states you visit on the way. The way R works, whenever you assign a value to a certain index in a vector, as in A[i] - 10, the system actually copies the entire vector. So, in every iteration, you are copying very many vectors, and this is needlessly slowing down the program. Also, at the end of each iteration, you define bio - cbind(W, C, ASMR, SMR, A, F, U, SDA, Gr, Ed, GHg, EGK, Hg) which creates a matrix. But you only ever use this matrix right at the end, and so there is no need to create this 365*14 matrix at every single iteration. It looks to me as if you took some Excel code and translated it directly into R. This will not produce efficient R code. Your iterative loop would be more naturally expressed in R as f - function(q) { p - q[[1]] ACT - q[[2]] # cat(paste(Trying p=,p, ACT=,ACT,\n,sep=)) state - c(W=Wo,Hg=Hgo) numdays - length(temps) for (i in 1:numdays) state - updateState(state, jday=temps$jday[i],temp=temps$Temp[i],M=numdays, p=p,ACT=ACT) Wtmod - state[[W]] Hgtmod - state[[Hg]] (Wt-Wtmod)^2/Wt + (Hgt-Hgtmod)^2/Hgt } updateState - function(state,jday,temp,M,p,ACT) { # Given W[i-1] and Hg[i-1], want to compute W[i] and Hg[i] W - state[[W]] Hg - state[[Hg]] # First compute certain parameters: Vc[i-1] ... Expegk[i-1] Vc - (CTM-temp)/(CTM-CTO) Vr - (RTM-temp)/(RTM-RTO) C - p * CA * W^CB * Vc^Xc * exp(Xc*(1-Vc)) * Pc ASMR - ACT * RA * W^RB * Vr^Xa * exp(Xa*(1-Vr)) ... # Now find W[i] and Hg[i] Wnew - if (!(jday==121 Mat==1)) W+Gr/Ef elseW * (1-GSI*1.2) Hgnew - a*Hgp*C*(1-Expegk)/(Pc*W*EGK) + Hg*Expegk c(W=Wnew,Hg=Hgnew) } In this code, I do not attempt to keep the entire array in memory. All I need to know at each iteration is the value of state=(W,Hg) at time i-1, and from this I compute the new value at time i. 3. You use some thoroughly weird code to read in a table. You should add a row to the top of your table with variable names, then just use temps - read.table(TEMP.DAT, header=TRUE) temps$Vc - (CTM-temps$temp)/(CTM-CTO) This would also avoid leaving global variables (like Day) hanging around the place. Global variables cause confusion: see the next point. 4. Here are some lines taken from your code. p - NULL ACT - NULL #starting values for p, ACT p - 1 ACT - 2 f - function (q) { F[i]- (FA*((comp[i,3])^FB)*(exp(FG*p))*C[i]) # (and ACT is never referred to) } Why did you define p-NULL and ACT-NULL at the top? Those definitions are irrelevant, because they are overridden by p-1 and ACT-2
Re: [R] excel files and R
For loading Excel data and many others file formats, one possibility is to use the free conversion utility: DataLoad. See: http://www.vsn-intl.com/genstat/downloads/datald.htm (there're probably also other links) It should be easy to create R wrappers to use that utility. Cheers -- Fan Marc Schwartz wrote: On Wed, 2003-06-25 at 09:20, Thomas Lumley wrote: On Wed, 25 Jun 2003, Simon Fear wrote: I guess all that I and apparently others really want is that foreign might include read.excel, like it has read.sas and read.spss. Which is essentially what Bernhard Pfaff's recent post offers - thanks again Bernhard - but using RODBC instead of foreign. It would be nice, but it's quite hard to read Excel off Windows. The formats in foreign are either documented by the vendor (accurately in the case of Stata and Epi Info, with some omissions for SAS XPORT) or that have been reverse-engineered by someone else (read.spss is based on PSPP, an attempt at an SPSS clone by Ben Pfaaf, and I think Duncan Murdoch did read.S). While it isn't usual to say nice things about commercial vendors on these lists I would like to note that Stata not only documents its file format in its manuals (with some helpful C snippets for the trickier parts), but made available the file format for their `large data set' version 7/SE, which I didn't buy. -thomas Simon, To add to Thomas' comments and respond to your thoughts, if one were so inclined, given that R is a volunteer effort, I suspect that an addition to 'foreign' for Excel would indeed be appreciated by many users. One resource, with appropriate attribution given, would be the source code for OpenOffice.org's (OOo) Calc. Since Calc can read and write Excel formats without using Windows/Office DLL's, it seems reasonable to presume that OOo has reverse engineered the native Excel file structure. Since OOo's source is available under the GPL, this could provide the basis for a read.excel function. Yet another would be Gnumeric, which like Calc is GPL'd and can read and write native Excel file formats. More information is available at: http://www.openoffice.org/dev_docs/source/1.0.3/source.html http://www.gnome.org/projects/gnumeric/ Food for thought... :-) Regards, Marc Schwartz __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] overlapping pattern match
Hi, all, I have a string like aaacdf, I want to find how many aa in the string. Obviously, It is 2 in this case. it is easy to do in Perl, but how to do such overlapping match in R or Splus. Thanks! Y.Fan __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] search engine dose not work for Morzilla
Hello, I am running R1.6.2 on Redhat8.0. I use Morzilla to display the html file. However,the search engine does not work. eg. I type plot and press search, it does not return the result but show the same page. Any idea? Thanks! Y.Fan __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Type of multi-valued variable
Thanks to Frank for pointing out that. There're so many misc in the package hmisc, I haven't yet explored all the functionalities ! The implementation of mChoice / summary() is very interesting, and it could be a good starting point for adding more functionalities on the class mChoice. I'm having a little question on the usage of the function summary.formula() in hmisc: how to get the cross tabluations result like an array, as what xtabs does ? For example, suppose titanic is a dataset as the following: str(titanic) `data.frame': 1313 obs. of 11 variables: $ pclass : Factor w/ 3 levels 1st,2nd,3rd: 1 1 1 1 1 1 1 1 1 1 ... $ survived : int 1 0 0 0 1 1 1 0 1 0 ... $ sex : Factor w/ 2 levels female,male: 1 1 2 1 2 2 1 2 1 2 ... $ age : num 29.000 2.000 30.000 25.000 0.917 ... ... ftable(xtabs( ~ sex + pclass + survived, data=titanic)) survived 0 1 sexpclass female 1st 9 134 2nd 13 94 3rd 134 79 male 1st 120 59 2nd 148 25 3rd 440 58 My question is how to get that with hmisc::summary() ? (survived could be a mChoice variable) Thanks in advance -- Fan Frank E Harrell Jr a écrit : On Mon, 10 Feb 2003 21:51:50 +0100 Fan [EMAIL PROTECTED] wrote: Hi, I've read in the past a thead in the R discussion list about the multi-valued type variable (what was called checklist). At the moment Gregory had intention to add some general code in his gregmisc package. I'm wondering if there's some general code / packages available ? A general class for taking account this type of variable would be very useful in the domain of survey processings, as multi-responses questions are often used. The simple operations applied to these variables are holecount, cross tabulations with others variables, transformation to single coded variables like number of responses, etc. Thanks in advance for any help -- Fan Fan, Take a look at p. 38-44 of http://hesweb1.med.virginia.edu/biostat/s/doc/summary.pdf where examples of the mChoice (multiple choice) function in Hmisc are given. -- Frank E Harrell Jr Prof. of Biostatistics Statistics Div. of Biostatistics Epidem. Dept. of Health Evaluation Sciences U. Virginia School of Medicine http://hesweb1.med.virginia.edu/biostat __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Type of multi-valued variable
Hi, I've read in the past a thead in the R discussion list about the multi-valued type variable (what was called checklist). At the moment Gregory had intention to add some general code in his gregmisc package. I'm wondering if there's some general code / packages available ? A general class for taking account this type of variable would be very useful in the domain of survey processings, as multi-responses questions are often used. The simple operations applied to these variables are holecount, cross tabulations with others variables, transformation to single coded variables like number of responses, etc. Thanks in advance for any help -- Fan __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help