[R] How to compare two curve model

2012-02-25 Thread
Hi all: I have two curve models: model1<-nls(result ~ exp(b0 + b1*(time)), start = list(b0 = 0, b1 = 5),trace=TRUE,data=data1) model2<-nls(result ~ exp(b0 + b1*(time)), start = list(b0 = 0, b1 = 5),trace=TRUE,data=data2) I wanna compare the two models to find out whether the difference betwe

[R] How to get intersection of multiple vectors?

2012-02-01 Thread
v1<-c("a","b","c","d") v2<-c("a","b","e") v3<-c("a","f","g") I want to get the intersection of v1,v2,v3,ie "a" How can I do then? What I know is only for 2 vectors via "intersect" function,but don't know how to deal with multiple vectors. Many thanks [[alternative HTML versio

Re: [R] subset

2012-01-13 Thread
Thanks£¡ ÔÚ 2012-01-13 10:51:14£¬"Jorge I Velez" дµÀ£º Hi, Use %in% instead of ==. HTH, Jorge.- On Thu, Jan 12, 2012 at 9:36 PM, ÃÏÐÀ <> wrote: Hi all I have a question about "subset" function. > dat id x1 x2 x3 1 a 1 11 111 2 b 2 22 222 3 c 3 33 333 4 d 4 44 444 > subs

Re: [R] subset

2012-01-13 Thread
Many thanks for your elaborated explaina. At 2012-01-13 11:34:51,"R. Michael Weylandt" wrote: >As Jorge noted, the fix is to use "%in%": a fuller explanation of why >`==` didn't work is that it implicitly used vector recycling: look at > >with(data, id == c("a", "c")) > >implicitly, this e

[R] subset

2012-01-12 Thread
Hi all I have a question about "subset" function. > dat id x1 x2 x3 1 a 1 11 111 2 b 2 22 222 3 c 3 33 333 4 d 4 44 444 > subset(dat,id==c("a","c")) id x1 x2 x3 1 a 1 11 111 > subset(dat,id==c("a","d")) id x1 x2 x3 1 a 1 11 111 4 d 4 44 444 >From the above, if I choos

Re: [R] 64bit R under 32bit winxp

2012-01-11 Thread
Thanks At 2012-01-11 16:55:32,"Jeff Newmiller" wrote: >You cannot install 64-bit R on 32-bit OS, but you can install a 32-bit R on a >64-bit OS, and you can later install 64-bit R as well. That is, installing >32-bit R does not interfere with your option to later install a 64-bit R. >--

[R] 64bit R under 32bit winxp

2012-01-10 Thread
Hi all: My OS is 32bit winxp,but I wanna install 64bit R2.14.1. >From the following website,it says "You can also go back and add 64-bit >components to a 32-bit install, or vice versa" http://cran.r-project.org/bin/windows/rw-FAQ.html#Can-both-32_002d-and-64_002dbit-R-be-installed-on-the-same-

Re: [R] question about rev

2012-01-06 Thread
Yes£¬I find out later. rev is only reverse the order. What I use is ! Thanks At 2012-01-06 16:07:11,"Petr PIKAL" wrote: >Hi > >> [R] question about rev >> >> Hi,all: >> I have a vector,and wanna get the opposite value via rev function. >> >> >> > a >> [1] FALSE FALSE TRUE TRUE TRU

[R] question about rev

2012-01-05 Thread
Hi,all: I have a vector,and wanna get the opposite value via rev function. > a [1] FALSE FALSE TRUE TRUE TRUE > > rev(a) [1] TRUE TRUE TRUE FALSE FALSE > I don't know why the 3rd "TRUE" has not been reversed,while all other values are reversed? Thanks My best [[alternati

[R] My finding-resent

2011-12-14 Thread
Sorry for some typo last mail. I corrected it,and resent.Sorry for it. Sir: I find out that for 2 level factor, if I set it to "factor", then I'll get error reply. For the instance last mail, if I use: result1<-glm(y ~ factor(gender),family = binomial);#gender has 2 levels logistic.display

[R] My finding

2011-12-13 Thread
Sir: I find out that for 2 level factor, if I set it to "factor", then I'll get error reply. For the instance last mail, if I use: result1<-glm(y ~ gender,family = binomial);#gender has 2 levels logistic.display(result1) Error in coeff[, 1] : incorrect number of dimensions if I use: res

Re: [R] New question

2011-12-13 Thread
Yes,it works well. Thanks for your help. At 2011-12-14 13:06:14,"Jorge I Velez" wrote: Hi lm_mengxin, If that's the case, just use as.factor(): > fit <- glm(case ~ as.factor(induced) + as.factor(spontaneous), > family=binomial, data=infert) > logistic.display(fit)

Re: [R] Error

2011-12-13 Thread
Yes,I¡¡understand. Thanks for your help. At 2011-12-14 13:53:21,"Virasakdi Chongsuvivatwong" wrote: logistic.display need a rather tidy model ie all independent variables must be the original name not any function of a variable in the dataset of the model. If data1 is your dataset containin

[R] New question

2011-12-13 Thread
According to the example of logistic.display: model0 <- glm(case ~ induced + spontaneous, family=binomial, data=infert) summary(model0) logistic.display(model0) induced: 3levels 0,1,2 spontaneous: 3levels 0,1,2 So if 0 is reference, we should get 2 OR for " induced1"," induced2"," spontane

[R] Error

2011-12-13 Thread
Hi sir: I follow your suggestion: result<-glm(y ~ factor(age) + factor(gender) + CD4,family = binomial) logistic.display(result) Error in coeff[, 1] : incorrect number of dimensions At 2011-12-14 01:59:36,"Jorge I Velez" wrote: Hi there, Try require(epicalc) logistic.display(re

[R] How to compute 95%CI for OR from logistic regression?

2011-12-13 Thread
Hi all: My data has 3 variables: age(3levels : <30y=1 30-50y=2, >50y=3) gender(Male=0, Female=1) CD4 cell count(raw lab measurement) y(1:death 0:alive) I perform logistic regression to find out the factors that influence y. result<-glm(y ~ factor(age) + factor(gender) + CD4,family = binomial

[R] The test of randomized slopes(intercepts)

2011-07-02 Thread
Hi all: I perform the linear mixed model for 300 persons, y is CD4 count,x is time. I randomized slope and intercept,so I can get 300 slopes and 300 intercepts.Now I wanna test wheter the variance of 300 slopes and 300 intercepts differs from zero. If the variance of 300 slopes(or intercepts) d

[R] question about the axis label

2011-01-25 Thread
Hello sir: I have a question about the axis label of scatterplot3d function. The data is in the attachment. If I use the command: scatterplot3d(x,y,z,type="h") I want the plot's x-axis lab to be 1,2,3,...,13, y-axis lab to be 1,2,3,...11 But if I use the command: scatterplot3d(x,y,z,type="h"

[R] about the trend comparison by R

2010-08-02 Thread
Hi all: I've 2 groups of data,which are measured at: 1990,1991,1992,...2000. I wanna know whether the trend of 2 groups are same or not. Maybe time series analysis is suitable,but I don't know which index is fit for my purpose,and how to get the index from function of time series analysis unde

[R] How to draw multi group plot?

2010-06-28 Thread
As the attachement,I wanna draw multi group plot. But I can only use : plot(x,y...) points(...) It's a heavy work to use these command if there're too many groups to be drawn because I have to use point() for many times. I wanna know wheter there's command which can draw the multigroup pl

[R] about heatmap

2010-05-31 Thread
Hi all: As to the "heatmap" function, the default style is "red and yellow",and red refers to low level and yellow refers to high level. How can I change the style to the contrary: red refers to high level and yellow refers to low level? Thanks a lot! My best [[alternative HTML version d

[R] the problem about sample size

2010-03-14 Thread
Hi all: I am a user of "JM" package. Here's the problem of "sample size". The warning is: Error in jointModel(fitLME, fitSURV_death, timeVar = "time", method = "piecewise-PH-GH") : sample sizes in the longitudinal and event processes differ. According to the suggestion of "missing data",

[R] a question about Joint Model(JM)

2010-03-01 Thread
Hell sir: I'm a user of JM and have a quesion. As to "JM: An R Package for the Joint Modelling of Longitudinal and Time-to-Event Data", on page14: fitSURV <- coxph(Surv(Time, death) ~ drug, data = aids.id, x = TRUE) I don't understand why use the dataset "aids.id", but not"aids" as follow: fitSU

[R] a question about the command "followup.plot" of epicale package

2010-02-20 Thread
Hi all: I have a question about the command "followup.plot" of epicale package. As to the demo data "Orthodont", the command "followup.plot" works well.But if I delete some rows of data(delete Male data,and keep Female data only, for instance),the command can't work,and the warning is "In attr(

[R] a question about the variance of growth model

2010-01-25 Thread
Hi all: In the growth model (Ref.Multilevel Modeling in R (2.3)),I have a question about the variance: On p.73, it says:"To model decreasing variance one can use the varExp option. In cases where variance increases can use the varFixed option (see Pinheiro & Bates, 2000 for details)." My que

[R] what "~1"stands for?

2010-01-21 Thread
Hi all: In the expression: lme(y~1,random=~1|time) What "~1" stands for? Thanks a lot! [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] a question about "multilevel"model

2010-01-17 Thread
Hello all: I've read the document named "A Brief Introduction to R, the multilevel package and the nlme package". At p68, one can transform the dataset to the required format by using "make.univ". I wanna know,how the new variable "MULTDV" is calculated(can you show me the formula if possible pl

[R] about the cox result

2009-11-02 Thread
Hi all: I finished cox analysis like this: fit_cox<-coxph(Surv(dat$Time, dat$death) ~ dat$CD4 + strata(dat$gender),data=dat); > fit_cox Call: coxph(formula = Surv(data_ori$Time, data_ori$death) ~ data_ori$drug + strata(data_ori$gender), data = data_ori) coef exp(coef) se(co