Re: [R] goodness of fit test

2008-10-01 Thread ctu
Hi Edna, You could use lapply or sapply to perform the multiple goodness of fit tests at the same time. Chunhao Quoting Edna Bell [EMAIL PROTECTED]: Dear R Gurus; Is there an automated process for goodness of fit tests, please? I know there is prop.test for one at a time, but I was

Re: [R] Bug in is ?

2008-09-24 Thread ctu
Thank you for all of you. Intuitively, 7 is an integer for people who live in this planet. It is just very difficult for me to believe that R does not think 7 is an integer but 7L is. is.integer(7) # R 2.7.2 [1] FALSE Thus, based on Martin's comments, I try it again on the S-PLUS 8.0 and

Re: [R] Bug in is ?

2008-09-24 Thread ctu
Hi Keith, No doubt, 7.0 is integer in math. But if people can write 7 why people need to write 7.0 (I do not see any reason to do this). My point is that R maybe can do something like S-plus. No point to argue. don't you think so? Thanks Chunhao Quoting Keith Jewell [EMAIL PROTECTED]:

[R] Bug in is ?

2008-09-23 Thread ctu
Hi R users Is there anything wrong in is function? (R 2.7.2) I believe that everyone will agree that 7 is an integer, right? but why R shows 7 is not an integer is.integer(7) [1] FALSE is(7,integer) [1] FALSE is(as.integer(7), integer) [1] TRUE Thank you very much in advance Chunhao

Re: [R] Bug in is ?

2008-09-23 Thread ctu
This is really bothering me! In the Dr. Venables and Dr. Ripley's book S Programming Page 105 shows that c(is(10,integer),is(10.5,integer)) [1] T F But I try this in R 2.7.2 it shows c(is(10,integer),is(10.5,integer)) [1] FALSE FALSE Does anyone know what is going on here? Appreciate,

[R] S.O.S try doesnot work in boot?

2008-09-09 Thread ctu
First thanks for Jinsong's suggestions I would like to do a bootstrap in a nonlinear model. But it fails to converge in most of time. (it did converge if I just use nls without boot). Thus, I use try function to resolve my problem. This following code is from Jinsong's suggestion.

[R] Help parametric boot

2008-09-07 Thread ctu
Hi R users Is there any example for nonlinear parametric boot? I google it but I can't find it. I am interested in the parameter estimators of a nonlinear model. But I really don't know how to code it in the ran.gen statement (data set from ?nls) fm1 - nls(weight ~

[R] Help use try function with boot

2008-09-06 Thread ctu
Hi R users, Is is possible for me to use the try function with boot? I would to do the bootstraping with a nonlinear model(it works well when R 1000). But it does not work very well (when R is large) thus I try to use try to resolve. I put the try function in two cases: case1: put the

Re: [R] Help use try function with boot

2008-09-06 Thread ctu
Hi Jinsong, I try to put the try in the c1.fun but it still does not work. Do you mean this? c1.fun-try(function(data,i){ + d-data + d$density-d$fitted+d$res[i] + coef(update(c1.nmf,data=d)) + } ,silent=T) c1.try-boot(c1data, statistic = c1.fun, R=5000) Error in nls(formula = density

[R] Help for par(mfrow)

2008-09-03 Thread ctu
Hi, R users I have a question with par(mfrow). I try to histograms and qqplots form boot output for 5 statistics but par(mfrow=c(5,2)) or par(mfrow=c(5,1)) does not work. R still display each figure separately. What did I do wrong? (I check ?par) c1.boot-boot(c1data,c1.fun,R=999) c1.boot

[R] correlation with boot

2008-09-01 Thread ctu
Hi R users, I have one simple question but I really don't know why I can't get it work. The data was adopted from Efron's An introduction to the bootstrap book. nlaw LSAT GPA [1,] 576 3.39 [2,] 635 3.30 [3,] 558 2.81 [4,] 578 3.03 [5,] 666 3.44 [6,] 580 3.07 [7,] 555 3.00

Re: [R] correlation with boot

2008-09-01 Thread ctu
Hi Professor Ripley, (Thank you very much)^infinite for your response. I still have few questions 1. R shows that I have two column in nlaw data. ncol(nlaw) [1] 2 corr(nlaw) [1] 0.7763745 2. Why can't I use boot::corr? I check corr in boot package and it seems to be used for computing

Re: [R] How can I create a vector of vector?

2008-08-08 Thread ctu
Hi Jim, x-as.vector(list(c(31,2,3), c(1,2,5,34,5656),c(211,3243,5,343,3))) x[1] [[1]] [1] 31 2 3 x[2] [[1]] [1]125 34 5656 x[3] [[1]] [1] 211 32435 3433 Hope this helps Chunhao Quoting Jim [EMAIL PROTECTED]: Dear All, How can I create a vector of vector in

Re: [R] Re peated Measure ANOVA-Old question

2008-07-30 Thread ctu
Tank you (Anna Mark) very much for this super information Let me confirm that IF I want to perform the RM-ANOVA I should use lmer and perform the post-hoc test by using glht, right? Because I am not so familiar with lmer so I have two more questions. Let me use that following example again, 1.

Re: [R] Mixed effects model where nested factor is not the repeated across treatments lme???

2008-07-30 Thread ctu
Hi Miki, I just got the same problem with you couple hours ago. Rusers (Anna, and Mark {thank you guys}) provide me a vary valuable information. link to following address. http://www.nabble.com/Tukey-HSD-(or-other-post-hoc-tests)-following-repeated-measures-ANOVA-td17508294.html#a17559307 for

Re: [R] About clustering techniques

2008-07-29 Thread ctu
Hi Paco, I got the same problem with you before. Thus, I just impute the missing values For example: newdata-as.matrix(impute(olddata, fun=random)) then I believe that you could analyze your data. Hopefully it helps. Chunhao Quoting pacomet [EMAIL PROTECTED]: Hello R users It's some time I

[R] Repeated Measure ANOVA-Old question

2008-07-29 Thread ctu
Hi R users, I google the website and I found that there are three ways to perform repeated measure ANOVA: aov, lme and lmer. http://www.mail-archive.com/[EMAIL PROTECTED]/msg58502.html But the questions are which one is good to use and how to do post-hoc test? I use the example that is

Re: [R] create multi windows plot at the same time

2008-07-25 Thread ctu
Hi, you only need to add x11() in front of plot(); such as x11() Plot(v1) x11() Plot(v2) .. then R will open multi windows for you Chunhao Quoting Alessandro [EMAIL PROTECTED]: Ciao All I'd like to generate 4 windows plot to compare different relationship at the same time in R. Each

Re: [R] R: create multi windows plot at the same time

2008-07-25 Thread ctu
par(mfrow=c(2,2)) is trying to open a 2*2 figures in one window, so you could see your v1,..v4 in one windows at the same time if you want they plot separately then you could use x11() for each plot() Chunhao Quoting Alessandro [EMAIL PROTECTED]: Hi I have a problem with par(mfrow=c(2,2))

Re: [R] What's the T-Value in fisher.test

2008-07-10 Thread ctu
Hi Dave, As I know there is no T value for Fisher's exact test (no matter you use SAS, R or other packages) Fisher's exact test is for the categorical data analysis. Fisher's exact test for testing the null of independence of rows and columns in a contingency table with fixed marginals so

Re: [R] rounding

2008-07-10 Thread ctu
I got round(0.55,1) [1] 0.6 round(2.55,1) [1] 2.5 Your answers are also correct. Please check ?round Quoting Korn, Ed (NIH/NCI) [E] [EMAIL PROTECTED]: Hi, Round(0.55,1)=0.5 Round(2.55,1)=2.6 Can this be right? Thanks, Ed [[alternative HTML version deleted]]

Re: [R] How to output 0.405852702657738 as 0.405853 ?

2008-07-10 Thread ctu
round(0.405852702657738,6) [1] 0.405853 Super Chunhao Tu Quoting Daren Tan [EMAIL PROTECTED]: I am confused by options(digits) and options(scipen), which should be used to output 0.405852702657738 as 0.405853 in write.table ?

[R] Fwd: Re: extracting index list when using tapply()

2008-07-08 Thread ctu
The following message is provided by Erik Please provide the reproducible code to do this. Generate a sample data set using the random data generating functions and show us what you'd like, we can then more easily help. [EMAIL PROTECTED] wrote: Hi, How about using subset?

[R] Loglikelihood for x factorial?

2008-07-08 Thread ctu
Hi Rers, I have a silly question. I don't know how to express the loglikelihood function of 1/(x!) where x=x1,x2,xn in R. Could anyone give me a hint? Thank you in advance. Chunhao Tu __ R-help@r-project.org mailing list

Re: [R] GLM, LMER, GEE interpretation

2008-07-07 Thread ctu
I agree with Ben. Theoretically, Laplace (lmer) provides a better approximation. Chunhao Quoting Ben Bolker [EMAIL PROTECTED]: Daniel Malter daniel at umd.edu writes: Hi, my dependent variable is a proportion (prob.bind), and the independent variables are factors for group membership

Re: [R] looking for alternative of 'if-else'

2008-07-06 Thread ctu
Why don't you try switch Let me assume that you want to calculate a=3 and b =5 by using one of MEAN, SUM,MIN, and MAX functions. Then you could write your code: (If you want to calculate MEAN) example-function(fun=c(MEAN, SUM, MIN, MAX)){ + fun-match.arg(fun);a=3;b=5 + switch( fun, +

Re: [R] looking for alternative of 'if-else'

2008-07-06 Thread ctu
Hi, I write the code for you. Hope this helps SD - 1 date1 - seq(as.Date(2001-01-01), as.Date(2002-12-1), by = day) len1 - length(date1) set.seed(1) # to make it reproducible data1 - zoo(rnorm(len1), date1) plot(data1) # calculation for monthly or quarterly mean calc = function(frequ = c(M.S,

Re: [R] Method for checking automatically which distribtions fits a data

2008-07-06 Thread ctu
Hi, In my experience, I just plot the data set then figure it out. Maybe you could try this? I really wonder that there is such a R function exists. If yes, please let me know. Thanks Chunhao Tu Quoting Gundala Viswanath [EMAIL PROTECTED]: Hi, Suppose I have a vector of data. Is there a

Re: [R] Matrix set value problem

2008-07-03 Thread ctu
Hi, when you do the trunc the mx is not a real integer 1 so you must round up m-matrix(data=NA, nrow=10,ncol=10) i-1001 mx-round(trunc(i/1000)) my-round((i/1000-mx)*1000) m[mx,my]-1 m [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,]1 NA NA NA NA NA NA NA NA

Re: [R] NLME questions -- interpretation of results

2008-07-02 Thread ctu
Hi Jenny, I try your code but I did not get in converge in fm3 (see the below). For the first question, you could use fm1 to interpret the result without bothering fm2 and fm3. It means that R0 and lrc can be treated as pure fixed effects (Pinherir and Bates, 2000 Book). For the second

Re: [R] NLME questions -- interpretation of results

2008-07-02 Thread ctu
Hi Jenny, (I use the data you provide in the previous e-mail) For the 1st question, let me assume you only want to compare loc: A vs. B So you could specified your code like this: fmAB - nlme(Y ~ SSlogis(X, Asym, R0, lrc),data = LAST, random = Asym ~1, fixed = Asym+R0+lrc

Re: [R] For loop

2008-06-28 Thread ctu
Hi, I guess this what your need. I assume your output is 10 by 11 matrix. However, you still need to define your geneset function(?) result- list() output-matrix(NA, nrow=10, ncol=11) for(i in 1:length(ncol(output))) { result[[i]] - geneset(which(geneset %n% output[1,])) } Chunhao

Re: [R] ubuntu repository for R

2008-06-21 Thread ctu
Hi All R+Linux users, I am very new to Linux and I also have the (dis)similar problem. I try to install R 2.7.0 on Ubuntu. But I only got the R 2.6.2 version. Could anyone tell me how to uninstall R 2.6.2 and install R2.7.0 on Ubuntu. many thanks in advance. Chunhao Quoting Graham

[R] How/When to use :: and :::?

2008-06-20 Thread ctu
Hi Dear R users, I check help(Syntax) but I still don't know how to use :: and ::: and when I should use it. Can anyone give me a answer? Thanks in advance Chunhao Tu __ R-help@r-project.org mailing list

[R] Question about nlmer

2008-06-20 Thread ctu
Hi R user, I have a question about nlmer. Can I specify the multilevel random effects in the the nlmer? For example, level 1 is hospital and level 2 is patient, so nlmer(response~SSfol(Dose,Time,lke,lka,lcl)~(lke+lka+lcl|hospital)~(lke+lka+lcl|patient%in%hospital), data=health,

Re: [R] mean

2008-06-06 Thread ctu
TABLE-matrix(data=c(12,13,14,15,24,10),byrow=T,nrow=2,ncol=3) TABLE [,1] [,2] [,3] [1,] 12 13 14 [2,] 15 24 10 apply(TABLE,1,mean) [1] 13.0 16.3 Chunhao Quoting Marco Chiapello [EMAIL PROTECTED]: Hi, I have a simple question. If I have a table and I want to have

Re: [R] sorting the data~

2008-06-04 Thread ctu
id-c(1,1,1,1,3,3,3,7,7,7,7,11,11,11,2,2,2,4,4,4,4,8,8,8) sort(id) [1] 1 1 1 1 2 2 2 3 3 3 4 4 4 4 7 7 7 7 8 8 8 11 11 11 Quoting Manli Yan [EMAIL PROTECTED]: no,the id is variable of a table,such as: treatment id age response low 1 50 20 low

Re: [R] How to solve a non-linear system of equations using R

2008-06-03 Thread ctu
Hi Jorge, Have you tried to use systemfit package. In this package, this is a function call nlsystemfit . This might help. Chunhao Quoting Jorge Ivan Velez [EMAIL PROTECTED]: Dear R-list members, I've had a hard time trying to solve a non-linear system (nls) of equations which

Re: [R] splitting data frame based on a criteria

2008-06-03 Thread ctu
Or ?gsummary Quoting Moshe Olshansky [EMAIL PROTECTED]: Also check ?aggregate --- On Wed, 4/6/08, Ingmar Visser [EMAIL PROTECTED] wrote: From: Ingmar Visser [EMAIL PROTECTED] Subject: Re: [R] splitting data frame based on a criteria To: Marvin Lists [EMAIL PROTECTED] Cc:

Re: [R] function

2008-06-01 Thread ctu
I wrote a function and I hope this helps b-c(1,2,3,4);lambda-c(0.3,0.4,0.5,0.6) m-c(0.10,0.11,0.12,0.13);t-c(7,8,9,10) N=4 Y-matrix(data=NA,nrow=4, ncol=1) for (i in 1:N){ y=b*(1-exp(lambda*(t^m))) Y-matrix(data=y, nrow=4, ncol=1) Y-as.numeric(Y) sim-data.frame(t,

Re: [R] optimization setup

2008-05-30 Thread ctu
I just wonder that if you know theta and x. Why can't you specify these in your functions. such as f1-function(theta1){1+2+theta1[1]} (Let me assume theta[1]=1, theta[2]=2) f2-function(theta1){f1(theta1)*exp(3)*theta1[2]} (again, I assume x=3) f3-function(theta1){f1(theta1)-f2(theta1)}

Re: [R] test for multivariate normality?

2008-05-29 Thread ctu
Yes. You could install mvnormtest Package and perform the multivariate normality test. By using mshapiro.test I wish this is helpful! Chunhao Tu Quoting HongSheng Liao [EMAIL PROTECTED]: My stat textbook tells me that using Shapiro-Wilk test for each variable one by one is not equal to

Re: [R] How do you exit a function in R?

2008-05-29 Thread ctu
You might try to use on.exit or stop? # on.exit if (nAssetPositions != nAssetPrices) { on.exit(cat(Different number of assets! \n)) } # stop if (nAssetPositions != nAssetPrices) { stop(Different number of assets!) } You could find these in S programming

Re: [R] Thank you

2008-05-29 Thread ctu
I totally agree both of you. This is a super place to mature the R. I learn a lot from this R heaven! Chunhao Quoting Esmail Bonakdarian [EMAIL PROTECTED]: Tubin wrote: In the past few weeks I have had to give myself a crash course in R, in order to accomplish some necessary tasks for my

Re: [R] optimization setup

2008-05-29 Thread ctu
Hi, I think Ray has answered this question in the previous e-mail. Because optim can only use one single parameter thus you can not have the parameters: theta, theta1 and x at the same time. such as: f1-function(theta) {theta[1]+theta[2]} f2-function(theta) {f1(theta)*3} f3-function(theta)

[R] How to make R running faster

2008-05-28 Thread ctu
Hi everyone, I run the R loops on window XP and vista. Both are Intel core 2 Duo 2.2 GHz with 2 GB ram and XP is significantly faster than vista. Dose anyone know how speed up R loops in vista? Thank you in advance. Chunhao Tu __

[R] How to write a package based on nlme

2008-05-25 Thread ctu
Dear R Helpers, I try to write a small package that based on nlme however my code does not work. R always appears this message: Error in eval(expr, envir, enclos) : object y not found where y is the response variable. Please help me out! This is my code: require(nlme) AMPmixed-function(y, x,

[R] Need help for nlme

2008-05-25 Thread ctu
Hi everyone, I try to write a module based on nlme however R always shows me the error message Error in eval(expr, envir, enclos) : object y not found. Does anyone know how to solve this? There is no problem in nls at all. require(nlme) AMPmixed-function(y, x, S1=c(asymptotic,logistic),