[R] How to compare two curve model
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 between them is significant or not. How can I do then? Many thanks! My best [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How to get intersection of multiple vectors?
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 version deleted]] __ R-help@r-project.org 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] subset
Many thanks for your elaborated explaina. At 2012-01-13 11:34:51,R. Michael Weylandt michael.weyla...@gmail.com 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 expands to id == c(a,c, a, c) to get the lengths to match. Obviously only the first elements work here. But when you had c(a, d) it expanded to c(a,d, a, d) and you get TRUE for the 1st and 4th slot. This, however, was just a lucky coincidence. Had you used c(d, a) there would have been no matches. Anyways, definitely use %in% but hopefully this clarifies things. Michael On Thu, Jan 12, 2012 at 9:50 PM, Jorge I Velez jorgeivanve...@gmail.com wrote: 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 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 choose id=a,c, the result is wrong,but if I choose id=a,d, the result is right. What's the reason for it? Many thanks! My best [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] subset
Thanks£¡ ÔÚ 2012-01-13 10:51:14£¬Jorge I Velez jorgeivanve...@gmail.com дµÀ£º 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 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 choose id=a,c, the result is wrong,but if I choose id=a,d, the result is right. What's the reason for it? Many thanks! My best [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] subset
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 choose id=a,c, the result is wrong,but if I choose id=a,d, the result is right. What's the reason for it? Many thanks! My best [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] 64bit R under 32bit winxp
Thanks At 2012-01-11 16:55:32,Jeff Newmiller jdnew...@dcn.davis.ca.us 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. --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. ÃÏÐÀ lm_meng...@163.com wrote: 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-machine_003f Does it mean that I can install and run 64bit R2.14.1 under 32bit winxp?If so,how can I add 64-bit components to a 32-bit install? Many thanks for your help. My best [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] 64bit R under 32bit winxp
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-machine_003f Does it mean that I can install and run 64bit R2.14.1 under 32bit winxp?If so,how can I add 64-bit components to a 32-bit install? Many thanks for your help. My best [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] question about rev
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 petr.pi...@precheza.cz 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 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? Misunderstanding what rev function does. see letters rev(letters) !a Regards Petr Thanks My best [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[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 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 [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] My finding-resent
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(result1) Error in coeff[, 1] : incorrect number of dimensions if I use: result1-glm(y ~ factor(age),family = binomial); #age has 3 levels logistic.display(result1) It works well. So,I conclude that for 2level variable,I must NOT set it to factor.The following command can work well for instance: result1-glm(y ~ gender,family = binomial);#gender has 2 levels logistic.display(result1) It works well. So I have a suggestion that no matter the number of levels, if I set it to factor, logistic.disply can all works well. At 2011-12-14 13:53:21,Virasakdi Chongsuvivatwong cvira...@gmail.com 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 containing y, 'gender' and 'age', what you need to do is data1$age1 - factor(data1$age) result1-glm(y ~ age1 + gender + CD4,family = binomial, data=data1) logistic.display(result1) Note that 'gender', like 'y', is already dichotomized (0,1). There is no need to 'factor' Virasakdi C 2011/12/14 ÃÏÐÀ lm_meng...@163.com 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 jorgeivanve...@gmail.com wrote: Hi there, Try require(epicalc) logistic.display(result) HTH, Jorge On Tue, Dec 13, 2011 at 7:16 AM, ÃÏÐÀ wrote: 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) From the result,I can get OR(Odds Ratio) of gender via exp(Estimate of Female, since Male is regarded as reference group and has no result).But how can I compute the 95%CI of OR of gender? Thanks a lot for your help. My best! [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- -- NOTE: Prince of Songkla University will NEVER ask for your PSU Passport/Email Username or password by e-mail. If you receive such a message, please report it to report-ph...@psu.ac.th. NEVER reply to any e-mail asking for your PSU Passport/Email or other personal details. For more information, contact the PSU E-Mail Service by dialing 2121 [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How to compute 95%CI for OR from logistic regression?
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) From the result,I can get OR(Odds Ratio) of gender via exp(Estimate of Female, since Male is regarded as reference group and has no result).But how can I compute the 95%CI of OR of gender? Thanks a lot for your help. My best! [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Error
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 jorgeivanve...@gmail.com wrote: Hi there, Try require(epicalc) logistic.display(result) HTH, Jorge On Tue, Dec 13, 2011 at 7:16 AM, ÃÏÐÀ wrote: 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) From the result,I can get OR(Odds Ratio) of gender via exp(Estimate of Female, since Male is regarded as reference group and has no result).But how can I compute the 95%CI of OR of gender? Thanks a lot for your help. My best! [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] New question
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, spontaneous1, spontaneous2 But the acturally OR is as the following,which is not what I expected: crude OR(95%CI) adj. OR(95%CI)P(Wald's test) P(LR-test) induced (cont. var.) 1.05 (0.74,1.5) 1.52 (1.02,2.27) 0.042 0.042 spontaneous (cont. var.) 2.9 (1.97,4.26) 3.31 (2.19,5.01) 0.001 0.001 Can anyone give me some suggestions? Many thanks! 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 jorgeivanve...@gmail.com wrote: Hi there, Try require(epicalc) logistic.display(result) HTH, Jorge On Tue, Dec 13, 2011 at 7:16 AM, ÃÏÐÀ wrote: 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) From the result,I can get OR(Odds Ratio) of gender via exp(Estimate of Female, since Male is regarded as reference group and has no result).But how can I compute the 95%CI of OR of gender? Thanks a lot for your help. My best! [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Error
Yes,I¡¡understand. Thanks for your help. At 2011-12-14 13:53:21,Virasakdi Chongsuvivatwong cvira...@gmail.com 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 containing y, 'gender' and 'age', what you need to do is data1$age1 - factor(data1$age) result1-glm(y ~ age1 + gender + CD4,family = binomial, data=data1) logistic.display(result1) Note that 'gender', like 'y', is already dichotomized (0,1). There is no need to 'factor' Virasakdi C 2011/12/14 ÃÏÐÀ lm_meng...@163.com 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 jorgeivanve...@gmail.com wrote: Hi there, Try require(epicalc) logistic.display(result) HTH, Jorge On Tue, Dec 13, 2011 at 7:16 AM, ÃÏÐÀ wrote: 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) From the result,I can get OR(Odds Ratio) of gender via exp(Estimate of Female, since Male is regarded as reference group and has no result).But how can I compute the 95%CI of OR of gender? Thanks a lot for your help. My best! [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- -- NOTE: Prince of Songkla University will NEVER ask for your PSU Passport/Email Username or password by e-mail. If you receive such a message, please report it to report-ph...@psu.ac.th. NEVER reply to any e-mail asking for your PSU Passport/Email or other personal details. For more information, contact the PSU E-Mail Service by dialing 2121 [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] New question
Yes,it works well. Thanks for your help. At 2011-12-14 13:06:14,Jorge I Velez jorgeivanve...@gmail.com 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) OR lower95ci upper95ci Pr(|Z|) as.factor(induced)1 1.585398 0.7972313 3.152769 1.69e-01 as.factor(induced)2 2.281856 0.9784062 5.321787 5.620567e-02 as.factor(spontaneous)1 3.630192 1.8855353 6.989152 1.145482e-04 as.factor(spontaneous)2 10.525317 4.045 24.926241 8.745128e-08 Also, take a look at ?factor and ?glm. HTH, Jorge.- 2011/12/13 ÃÏÐÀ Yes,you are right. But if I wanna treat induced and spontaneous as factors, how can I get the corresponding OR? At 2011-12-14 12:54:30,Jorge I Velez wrote: I forgot to mention (sorry for double posting) that str(infert) shows that induced and spontaneous are not factors: 'data.frame':248 obs. of 8 variables: $ education : Factor w/ 3 levels 0-5yrs,6-11yrs,..: 1 1 1 1 2 2 2 2 2 2 ... $ age : num 26 42 39 34 35 36 23 32 21 28 ... $ parity: num 6 1 6 4 3 4 1 2 1 2 ... $ induced : num 1 1 2 2 1 2 0 0 0 0 ... $ case : num 1 1 1 1 1 1 1 1 1 1 ... $ spontaneous : num 2 0 0 0 1 1 0 0 1 0 ... $ stratum : int 1 2 3 4 5 6 7 8 9 10 ... $ pooled.stratum: num 3 1 4 2 32 36 6 22 5 19 ... This explains why you did not see reference levels in those variables. HTH, Jorge.- On Tue, Dec 13, 2011 at 11:48 PM, Jorge I Velez wrote: Hi, Are you sure? That's not what I got: require(epicalc) ?logistic.display model0 - glm(case ~ induced + spontaneous, family=binomial, data=infert) logistic.display(model0) Logistic regression predicting case crude OR(95%CI) adj. OR(95%CI)P(Wald's test) induced (cont. var.) 1.05 (0.74,1.5) 1.52 (1.02,2.27) 0.042 spontaneous (cont. var.) 2.9 (1.97,4.26) 3.31 (2.19,5.01) 0.001 P(LR-test) induced (cont. var.) 0.042 spontaneous (cont. var.) 0.001 Log-likelihood = -139.806 No. of observations = 248 AIC value = 285.612 My impression is that you did something else and you are not telling us the full story. Here is my sessionInfo(): R version 2.14.0 Patched (2011-11-12 r57642) Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) locale: [1] US.UTF-8 attached base packages: [1] grid splines stats graphics grDevices utils datasets methods [9] base other attached packages: [1] ggplot2_0.8.9proto_0.3-9.2reshape_0.8.4plyr_1.6 [5] epicalc_2.14.0.0 nnet_7.3-1 MASS_7.3-16 survival_2.36-10 [9] maptools_0.8-10 lattice_0.20-0 foreign_0.8-47 sp_0.9-91 [13] maps_2.2-2 loaded via a namespace (and not attached): [1] tools_2.14.0 Could you please share your sessionInfo() as well as your OS, i.e., see http://www.r-project.org/posting-guide.html? HTH, Jorge.- 2011/12/13 ÃÏÐÀ 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, spontaneous1, spontaneous2 But the acturally OR is as the following,which is not what I expected: crude OR(95%CI) adj. OR(95%CI)P(Wald's test) P(LR-test) induced (cont. var.) 1.05 (0.74,1.5) 1.52 (1.02,2.27) 0.042 0.042 spontaneous (cont. var.) 2.9 (1.97,4.26) 3.31 (2.19,5.01) 0.001 0.001 Can anyone give me some suggestions? Many thanks! 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(result) HTH, Jorge On Tue, Dec 13, 2011 at 7:16 AM, ÃÏÐÀ wrote: 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) From the result,I can get OR(Odds Ratio) of gender via exp(Estimate of Female, since Male is regarded as reference group and has no result).But how can I compute the 95%CI of OR of gender? Thanks a lot for your help. My best! [[alternative HTML version deleted]]
[R] My finding
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: result1-glm(y ~ factor(age),family = binomial); #age has 3 levels logistic.display(result1) It works well. So I have a suggestion that no matter the number of levels, if I set it to factor, logistic.disply can all works well. logistic.display At 2011-12-14 13:53:21,Virasakdi Chongsuvivatwong cvira...@gmail.com 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 containing y, 'gender' and 'age', what you need to do is data1$age1 - factor(data1$age) result1-glm(y ~ age1 + gender + CD4,family = binomial, data=data1) logistic.display(result1) Note that 'gender', like 'y', is already dichotomized (0,1). There is no need to 'factor' Virasakdi C 2011/12/14 ÃÏÐÀ lm_meng...@163.com 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 jorgeivanve...@gmail.com wrote: Hi there, Try require(epicalc) logistic.display(result) HTH, Jorge On Tue, Dec 13, 2011 at 7:16 AM, ÃÏÐÀ wrote: 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) From the result,I can get OR(Odds Ratio) of gender via exp(Estimate of Female, since Male is regarded as reference group and has no result).But how can I compute the 95%CI of OR of gender? Thanks a lot for your help. My best! [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- -- NOTE: Prince of Songkla University will NEVER ask for your PSU Passport/Email Username or password by e-mail. If you receive such a message, please report it to report-ph...@psu.ac.th. NEVER reply to any e-mail asking for your PSU Passport/Email or other personal details. For more information, contact the PSU E-Mail Service by dialing 2121 [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] The test of randomized slopes(intercepts)
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) differs from zero at 0.05 significant level,I should randomize the slope(or intercept), and if not,I should fix the slope(or intercept). But I can't find out which statistical test should be used to test whether the variance of 300 slopes(or intercepts) differs from zero,which need your help. Thanks a lot! My best. [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] question about the axis label
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,x.ticklabs=1:13,y.ticklabs=1:11) The axis labs are overlap, still can't get what I want. I'm in difficulty in how to set the axis labels,which need your suggestion very much. Thanks for your help. My best. way nation fre 1 1 0 1 2 1 1 3 1317 1 4 0 1 5 0 1 6 0 1 7 1 1 8 1 1 9 1 1 10 16 1 11 2 2 1 0 2 2 0 2 3 35 2 4 0 2 5 0 2 6 0 2 7 0 2 8 0 2 9 3 2 10 0 2 11 0 3 1 12 3 2 8 3 3 539 3 4 38 3 5 7 3 6 0 3 7 6 3 8 7 3 9 325 3 10 36 3 11 15 4 1 0 4 2 0 4 3 2 4 4 0 4 5 0 4 6 0 4 7 0 4 8 0 4 9 1 4 10 0 4 11 0 5 1 0 5 2 0 5 3 4 5 4 1 5 5 0 5 6 0 5 7 0 5 8 0 5 9 4 5 10 0 5 11 2 6 1 0 6 2 0 6 3 0 6 4 0 6 5 0 6 6 0 6 7 0 6 8 0 6 9 1 6 10 0 6 11 0 7 1 0 7 2 0 7 3 1 7 4 0 7 5 0 7 6 0 7 7 0 7 8 0 7 9 0 7 10 0 7 11 0 8 1 0 8 2 0 8 3 128 8 4 2 8 5 0 8 6 0 8 7 0 8 8 0 8 9 0 8 10 0 8 11 1 9 1 0 9 2 0 9 3 22 9 4 0 9 5 0 9 6 0 9 7 0 9 8 0 9 9 3 9 10 0 9 11 0 10 1 0 10 2 0 10 3 8 10 4 0 10 5 0 10 6 0 10 7 0 10 8 0 10 9 2 10 10 0 10 11 0 11 1 0 11 2 0 11 3 6 11 4 0 11 5 0 11 6 0 11 7 0 11 8 1 11 9 0 11 10 0 11 11 0 12 1 0 12 2 0 12 3 124 12 4 1 12 5 0 12 6 10 12 7 0 12 8 0 12 9 5 12 10 1 12 11 0 13 1 5 13 2 3 13 3 561 13 4 7 13 5 3 13 6 0 13 7 7 13 8 9 13 9 50 13 10 7 13 11 45 __ R-help@r-project.org 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] about the trend comparison by R
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 under R environment. Thanks a lot. My best [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How to draw multi group plot?
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 plot directly? Thanks My best. __ R-help@r-project.org 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] about heatmap
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 deleted]] __ R-help@r-project.org 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] the problem about sample size
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,I use the same data set(data_JM) without any missing value. fitLME - lme(CD4 ~ time + time:Group_DR, random = ~time | id,data = data_JM); fitSURV_death - coxph(Surv(time_fail, death) ~ (Group_DR), data = data_JM, x = TRUE); summary(fitLME); Linear mixed-effects model fit by REML Data: data_JM AIC BIClogLik 9102.502 9134.538 -4544.251 ... ... Number of Observations: 721 summary(fitSURV_death) Call: coxph(formula = Surv(time_fail_min, death) ~ (Group_DR), data = data_JM, x = TRUE) n= 721 coef exp(coef) se(coef) z Pr(|z|) Group_DR -0.16854 0.84490 0.04213 -4 6.33e-05 *** --- Signif. codes: 0 ¡®***¡¯ 0.001 ¡®**¡¯ 0.01 ¡®*¡¯ 0.05 ¡®.¡¯ 0.1 ¡® ¡¯ 1 The sample size of lme and coxph is the same as marked blue above,and I'm sure that data_JM contains no missing value. So, what's reason about the warning Error in jointModel(fitLME, fitSURV_death, timeVar = time, method = piecewise-PH-GH) : sample sizes in the longitudinal and event processes differ. Thanks a lot . My best. [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] a question about Joint Model(JM)
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 notaids as follow: fitSURV - coxph(Surv(start, stop, event) ~ drug, data = aids); Thanks a lot for your help! My best. [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] a question about the command followup.plot of epicale package
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(get(search()[2]), names) == as.character(substitute(ylab)) : Longer object length is not an integer multiples of the shorter object. If anyone can give me some guidance,I'll appreciate your help deeply. Thanks a lot. My best regards [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] a question about the variance of growth model
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 question is: if variance's change is not in a unique trend(for instance: varance increase at first, and then decrease...) How to do with this situation? Thanks a lot! My best [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] what ~1stands for?
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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] a question about multilevelmodel
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 please?)?And what's the usage of this new variable in the following analysis? Thanks a lot! My best. [[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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] about the cox result
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(coef)zp data_ori$drugddI 0.216 1.240.146 1.47 0.14 Likelihood ratio test=2.17 on 1 df, p=0.140 n= 467 I wanna extract the result: 0.216 1.240.146 1.47 0.14 and the corresponding name coef exp(coef) se(coef)zp from fit_cox. I use the command: str(fit_cox),but I can only find 0.216 of the result,but the other four results( 1.240.146 1.47 0.14) can't be found. Anyone can help me? 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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.