gmane.comp.lang.r.general.mbox
来自「R-Project是一个开源的统计软件,专门有一个R语言,类似S语言,这个包里面」· MBOX 代码 · 共 1,572 行 · 第 1/5 页
MBOX
1,572 行
>> myCurve <-function(x, log) {> f <- ... # calculate curve here> if (log==T) f <- log10(f)> return(f)> }>> logY=T> xyplot(Conc ~ Time | Subj,> groups=Dose,> data = mydata,> scales=list(x=list(at=seq(0,96,24)), y=list(log=logY)),> panel = function(...) {> panel.abline(h=c(0, 50, 100, 150, 200, 250) ,> v=c(0,24,48,72,96), col.line="gray")> panel.xyplot(...)> panel.curve(myCurve, from=0, to=96, n=300, ..., log=logY)> },> logY> )You need to learn more about (1) R functions and (2) R's scopingrules. Your last argument (logY) is not doing what you think it'sdoing (which doesn't really matter because of the scoping rules).Your error is caused because inpanel.curve(myCurve, from=0, to=96, n=300, ..., log=logY)the 'log' argument is not being passed to myCurve (nor is it supposedto). However, you should be able to replace it bypanel.curve(myCurve(x, log = logY), from=0, to=96, n=300, ...)-Deepayan______________________________________________R-help@stat.math.ethz.ch mailing listhttps://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.From news@gmane.org Tue Mar 04 03:33:20 2003From: Don MacQueen <macq@llnl.gov>Subject: Re: Better way to change the name of a column in a dataframe?Date: Fri, 15 Dec 2006 16:49:25 -0800Lines: 88Message-ID: <p06230913c1a8f2cbae1c@[128.115.153.6]>References: <CA612484A337C6479EA341DF9EEE14AC05B7CDB5@hercules.ssainfo>Mime-Version: 1.0Content-Type: text/plain; charset="us-ascii"Content-Transfer-Encoding: 7bitX-From: r-help-bounces@stat.math.ethz.ch Sat Dec 16 01:50:43 2006Return-path: <r-help-bounces@stat.math.ethz.ch>Envelope-to: gclrg-r-help@gmane.orgReceived: from hypatia.math.ethz.ch ([129.132.145.15]) by dough.gmane.org with esmtp (Exim 4.50) id 1GvNl8-0000om-P1 for gclrg-r-help@gmane.org; Sat, 16 Dec 2006 01:50:38 +0100Received: from hypatia.math.ethz.ch (hypatia [129.132.145.15]) by hypatia.math.ethz.ch (8.13.6/8.13.6) with ESMTP id kBG0ncC7010329; Sat, 16 Dec 2006 01:50:09 +0100X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on hypatia.math.ethz.chX-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=AWL, BAYES_50 autolearn=no version=3.1.7Received: from nspiron-2.llnl.gov (nspiron-2.llnl.gov [128.115.41.82]) by hypatia.math.ethz.ch (8.13.6/8.13.6) with ESMTP id kBG0nRvT010279 for <r-help@stat.math.ethz.ch>; Sat, 16 Dec 2006 01:49:28 +0100Received: from macqmac.llnl.gov (HELO [128.115.153.6]) ([128.115.153.6]) by nspiron-2.llnl.gov with ESMTP; 15 Dec 2006 16:49:27 -0800X-Attachments: X-IronPort-AV: i="4.12,178,1165219200"; d="scan'208"; a="14945408:sNHT29379632"In-Reply-To: <CA612484A337C6479EA341DF9EEE14AC05B7CDB5@hercules.ssainfo>To: "Ben Fairbank" <BEN@ssanet.com>, <r-help@stat.math.ethz.ch>X-Virus-Scanned: by amavisd-new at stat.math.ethz.chX-BeenThere: r-help@stat.math.ethz.chX-Mailman-Version: 2.1.9Precedence: listList-Id: "Main R Mailing List: Primary help" <r-help.stat.math.ethz.ch>List-Unsubscribe: <https://stat.ethz.ch/mailman/listinfo/r-help>, <mailto:r-help-request@stat.math.ethz.ch?subject=unsubscribe>List-Archive: <https://stat.ethz.ch/pipermail/r-help>List-Post: <mailto:r-help@stat.math.ethz.ch>List-Help: <mailto:r-help-request@stat.math.ethz.ch?subject=help>List-Subscribe: <https://stat.ethz.ch/mailman/listinfo/r-help>, <mailto:r-help-request@stat.math.ethz.ch?subject=subscribe>Sender: r-help-bounces@stat.math.ethz.chErrors-To: r-help-bounces@stat.math.ethz.chArchived-At: <http://permalink.gmane.org/gmane.comp.lang.r.general/75853>And there is the rename.vars() function in the gdata package.-DonAt 11:39 AM -0600 12/14/06, Ben Fairbank wrote:>Hello R users -->>>>If I have a dataframe such as the following, named "frame" with the>columns intended to be named col1 through col6,>>>>> frame>> col1 col2 cmlo3 col4 col5 col6>>[1,] 3 10 2 6 5 7>>[2,] 6 8 4 10 7 1>>[3,] 7 5 1 3 1 8>>[4,] 10 6 5 4 9 2>>>>and I want to correct or otherwise change the name of one of the>columns, I can do so with>>>>> dimnames(frame)[[2]][which(dimnames(frame)[[2]]=="cmlo3")] <- "col3">>>>which renames the offending column:>>>>> frame>> col1 col2 col3 col4 col5 col6>>[1,] 3 10 2 6 5 7>>[2,] 6 8 4 10 7 1>>[3,] 7 5 1 3 1 8>>[4,] 10 6 5 4 9 2>>>>This seems cumbersome and not very intuitive. How can one accomplish>this more simply?>>>>With thanks for any suggestions,>>>>Ben Fairbank>>> [[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.-- --------------------------------------Don MacQueenEnvironmental Protection DepartmentLawrence Livermore National LaboratoryLivermore, CA, USA______________________________________________R-help@stat.math.ethz.ch mailing listhttps://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.From news@gmane.org Tue Mar 04 03:33:20 2003From: baud-bovy.gabriel@hsr.itSubject: how to adjust link function in logistic regression to predict the proportion of correct responses in 2AFC task?Date: Sat, 16 Dec 2006 01:57:25 +0100Lines: 102Message-ID: <6.2.3.4.0.20061216001441.03746570@mail.hsr.it>Mime-Version: 1.0Content-Type: text/plain; charset="us-ascii"Content-Transfer-Encoding: 7bitX-From: r-help-bounces@stat.math.ethz.ch Sat Dec 16 01:58:12 2006Return-path: <r-help-bounces@stat.math.ethz.ch>Envelope-to: gclrg-r-help@gmane.orgReceived: from hypatia.math.ethz.ch ([129.132.145.15]) by dough.gmane.org with esmtp (Exim 4.50) id 1GvNsQ-0001P0-86 for gclrg-r-help@gmane.org; Sat, 16 Dec 2006 01:58:10 +0100Received: from hypatia.math.ethz.ch (hypatia [129.132.145.15]) by hypatia.math.ethz.ch (8.13.6/8.13.6) with ESMTP id kBG0vcNT012156; Sat, 16 Dec 2006 01:57:48 +0100X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on hypatia.math.ethz.chX-Spam-Level: *X-Spam-Status: No, score=1.4 required=5.0 tests=BAYES_50, FORGED_RCVD_HELO, NO_REAL_NAME autolearn=no version=3.1.7Received: from swip.net (mailfe05.tele2.it [212.247.154.141]) by hypatia.math.ethz.ch (8.13.6/8.13.6) with ESMTP id kBG0vWYH012136 for <r-help@stat.math.ethz.ch>; Sat, 16 Dec 2006 01:57:33 +0100X-Cloudmark-Score: 0.000000 []Received: from [83.184.42.19] (HELO GABRIEL.hsr.it) by mailfe05.swip.net (CommuniGate Pro SMTP 5.0.12) with ESMTP id 257743746 for r-help@stat.math.ethz.ch; Sat, 16 Dec 2006 01:57:32 +0100X-Mailer: QUALCOMM Windows Eudora Version 6.2.3.4To: r-help@stat.math.ethz.chX-Virus-Scanned: by amavisd-new at stat.math.ethz.chX-BeenThere: r-help@stat.math.ethz.chX-Mailman-Version: 2.1.9Precedence: listList-Id: "Main R Mailing List: Primary help" <r-help.stat.math.ethz.ch>List-Unsubscribe: <https://stat.ethz.ch/mailman/listinfo/r-help>, <mailto:r-help-request@stat.math.ethz.ch?subject=unsubscribe>List-Archive: <https://stat.ethz.ch/pipermail/r-help>List-Post: <mailto:r-help@stat.math.ethz.ch>List-Help: <mailto:r-help-request@stat.math.ethz.ch?subject=help>List-Subscribe: <https://stat.ethz.ch/mailman/listinfo/r-help>, <mailto:r-help-request@stat.math.ethz.ch?subject=subscribe>Sender: r-help-bounces@stat.math.ethz.chErrors-To: r-help-bounces@stat.math.ethz.chArchived-At: <http://permalink.gmane.org/gmane.comp.lang.r.general/75854>I have would like to use logistic regression to analyze thepercentage of correct responses in a 2 alternative forcedchoice task. The question is whether one needs to take intoaccount the fact expected probabilities for the percentage ofcorrect responses ranges between 0.5 and 1 in this case andhow to adjust the link function accordingly in R (see details below).GabrielSubjects were asked to match a tactile stimulus(shape A or B) with a visual template (response a or b).The exact stimulus properties depended on theexperimental factors ecc (3 levels: 0.4, 0.7 and 1.0)and kappa (also 3 levels: 0.75, 1, 1.25), which yieldednine experimental conditions. Five subjects participatedto the experiment and each stimulus was presented 10 timesin each experimental condition.The following table reports the pooled responses of the5 subjects. | | kappa | | | 0.75 1.0 1.25 |ecc | shape +--------+--------+--------+ | | resp | resp | resp | | | a b | a b | a b |----+-------+--------+--------+--------+0.4 | A | 41 9 | 38 12 | 35 15 | | B | 3 47 | 7 43 | 11 39 |----+-------+--------+--------+--------+0.7 | A | 22 28 | 33 17 | 39 11 | | B | 10 40 | 21 29 | 24 26 |----+-------+--------+--------+--------+1.0 | A | 26 24 | 26 24 | 28 22 | | B | 20 30 | 18 32 | 25 25 |----+-------+--------+--------+--------+For this analysis, I define "correct response" asthe resp=a for shape=A and resp=b for shape=B.The proportions of correct responses are therefore: | | kappa |ecc | shape | 0.75 1.0 1.25 |----+-------+--------+--------+--------+0.4 | A | 0.82 | 0.76 | 0.70 | | B | 0.94 | 0.86 | 0.78 |----+-------+--------+--------+--------+0.7 | A | 0.44 | 0.66 | 0.78 | | B | 0.80 | 0.58 | 0.52 |----+-------+--------+--------+--------+1.0 | A | 0.52 | 0.52 | 0.56 | | B | 0.60 | 0.62 | 0.50 |----+-------+--------+--------+--------+The proportion of correct response is thelargest for ecc=0.4 and, in general, smallestfor ecc=1 as expected. It was expected thatproportions of correct response would beclose to 0.5 when ecc=1 because shapesA and B were the same in this condition.I would like to use the logistic regressionto assess the effect of the shape, ecc and kappaon the proportion of correct responses. For example,glm(resp~shape*ecc*kappa,data=data,link=binomial)or, better,gee(resp~shape*ecc*kappa,id=subject,data=data,family=binomial, corstr = "exchangeable")given the fact that data that are correlated becausethe 50 responses come from five subjects.My first question is rather statistical: do I need totake into account the fact that the values of these proportionsare expected to range in the inter
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?