Re: [R] density vs. mass for discrete probability functions
Stefan--- Under the measure-theoretic approach to probability, discrete & continuous probability densities follow the same underlying mathematical principles. Check any text on measure-theoretic probability theory. ---JFL Stefan Schreiber Sent by: "R-help" 03/14/2019 08:43 PM To r-help@r-project.org, cc Subject [R] density vs. mass for discrete probability functions Dear R users, While experimenting with the dbinom() function and reading its documentation (?dbinom) it reads that "dbinom gives the density" but shouldn't it be called "mass" instead of "density"? I assume that it has something to do with keeping the function for "density" consistent across discrete and continuous probability functions - but I am not sure and was hoping someone could clarify? Furthermore the help file for dbinom() function references a link (http://www.herine.net/stat/software/dbinom.html) but it doesn't seem to land where it should. Maybe this could be updated? Thank you, Stefan __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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 -- To UNSUBSCRIBE and more, see 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] Ghost variables
The script is complete. When I start, the environment is empty. The warnings are issued for these "ghost" variables well before they are created later in the script. Somehow previous incarnations are lingering around and being unhappy even after they were "deleted". Jeff Newmiller has suggested a solution I have yet to try. William Dunlap 02/25/2019 02:30 PM To jlu...@ria.buffalo.edu, cc r-help mailing list Subject Re: [R] Ghost variables Doesn't that mean that your script is incomplete, that it needs to make those variables? Bill Dunlap TIBCO Software wdunlap tibco.com On Mon, Feb 25, 2019 at 10:32 AM wrote: Fellow R-gonauts: I frequently erase/remove all the objects in my current environment so can I re-run scripts to ensure that analyses are complete, error-free, and accurate. However, sometimes when I re-rerun a script I get warning messages (see below for example) regarding some variables (objects) when these variables do not exist in my current environment. These ghost variables had existed at one time, but were subsequently removed by the rm(list=ls()) command or by the broom icon in RStudio. What's happening and how do I exorcise the ghosts? Warning messages: 1: Unknown or uninitialised column: 'K'. 2: Unknown or uninitialised column: 'NDAfit'. 3: Unknown or uninitialised column: 'NDAfit'. 4: Unknown or uninitialised column: 'NDAfit'. 5: Unknown or uninitialised column: 'NDAfit'. 6: Unknown or uninitialised column: 'NDAfit'. 7: Unknown or uninitialised column: 'NDAobs'. Joe Lucke [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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 -- To UNSUBSCRIBE and more, see 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] Ghost variables
Fellow R-gonauts: I frequently erase/remove all the objects in my current environment so can I re-run scripts to ensure that analyses are complete, error-free, and accurate. However, sometimes when I re-rerun a script I get warning messages (see below for example) regarding some variables (objects) when these variables do not exist in my current environment. These ghost variables had existed at one time, but were subsequently removed by the rm(list=ls()) command or by the broom icon in RStudio. What's happening and how do I exorcise the ghosts? Warning messages: 1: Unknown or uninitialised column: 'K'. 2: Unknown or uninitialised column: 'NDAfit'. 3: Unknown or uninitialised column: 'NDAfit'. 4: Unknown or uninitialised column: 'NDAfit'. 5: Unknown or uninitialised column: 'NDAfit'. 6: Unknown or uninitialised column: 'NDAfit'. 7: Unknown or uninitialised column: 'NDAobs'. Joe Lucke [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Unexpected YAML
R Users: Whenever I fire up R, I now get the following message (red) at the end of the prologue. R version 3.5.1 (2018-07-02) -- "Feather Spray" Copyright (C) 2018 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. Error in loadNamespace(name) : there is no package called ‘yaml’ How do I get rid of it? Joe [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Modèle à Equations structurelles
The more general model for estimating structural models is lavaan, contained in the package lavaan. yaya bamba via R-helpSent by: "R-help" 05/10/2018 12:01 PM Please respond to yaya bamba To "r-help@r-project.org" , Michael Dewey , cc Subject Re: [R] Mod�le � Equations structurelles In my previous mail, I was asking help to fit structural equations models by using Partial Least Square (PLS) approch.I have used package plspm. I want to know how to manage moderating and mediating variables. I also want to show simultanously the graph of internal model and measurement model. Thks. Le jeudi 10 mai 2018 � 15:42:46 UTC, Michael Dewey a �crit : Dear Yaya You will get more responses if you can post in English which is the language of the list. If you want advice about package choice you need to tell us what packages you have considered and rejected. You would also benefit from searching the CRAN Task Views - possibly the Psychometrics one might help you. If you want someone to send you code, as appears from your mail, you are out of luck on this list. Michael On 10/05/2018 15:50, yaya bamba via R-help wrote: > Bonjour, > Quelqu'un pourrait m'aider avec le code R pour estimer les mod�les � �quations structurelles via l'approche PLS,int�grer des variables mod�ratrices et m�diatrices et afficher les graphique simultan� des mod�les interne et de mesure? > Cdt. > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. > -- Michael http://www.dewey.myzen.co.uk/home.html [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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 -- To UNSUBSCRIBE and more, see 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] Converting SAS Code
I wish to second this approach to learning R. I tried for several years to translate other stat programs or provide parallel analyses with R. This dabbling-in-R approach did not work . When a transferred to a research unit that could ill afford commercial software, I devoted my entire time to doing everything in R. This was a difficult learning process, but I eventually became proficient in R. The conceptual paradigm for R is only marginally commensurate with that of standard statistical software. You must immerse yourself in R to become proficient. Good luck, Joe Bert GunterSent by: "R-help" 09/29/2017 02:09 PM To "Kevin E. Thorpe" , cc R-help , Andrew Harmon Subject Re: [R] Converting SAS Code I will offer an opinion, with which others may fairly take issue. If you are coming from SAS and wish to learn R, you should forget about SAS entirely; it is ancient and convoluted. But more to the point, as others have already suggested, you will only confuse and hamstring yourself trying to convert the programming paradigms of one language into another. Better to consider the **tasks** you wish to accomplish and learn how to approach them in the new language. I would add that this especially includes learning about R's varied data structures for which there is no cognate in SAS I think (correction requested if I'm wrong about this). If this is a one-off, just finding a local resource to do the job for you might be the best approach. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Fri, Sep 29, 2017 at 10:21 AM, Kevin E. Thorpe wrote: > Regarding point 3, as a moderator I have been helping Andrew get this post > out to the list over the past week. His previous attempts were encoded in > some way that the listserv rejected. He sent me the post via his gmail > account and viewing the source I saw it had at least both plain test and > HTML an I said it was worth a try to post it. Certainly on my mail client > his post displays acceptably with the notice that the HTML alternative was > removed. > > Kevin > > On 09/29/2017 09:51 AM, Michael Dewey wrote: > >> You might get better answers if you >> >> 1 - break this down into separate issues >> 2 - tell us what you want to achieve in words rather than SAS, we all >> read English but few of us speak SAS >> 3 - post in plain text not HTML as HTML mangles your post >> >> On 29/09/2017 13:47, Andrew Harmon wrote: >> >>> Hello all, >>> >>> My statistical analysis training up until this point has been entirely >>> done >>> in SAS. The code I frequently used was: >>> >>> *Yield Champagin; >>> >>> data yield; >>> >>> set stress; >>> >>> if field='YV' then delete; >>> >>> if field='HB' then delete; >>> >>> if barcode='16187DD4015' then delete; >>> >>> if barcode='16187DD6002' then delete; >>> >>> if barcode='16187DD2007' then delete; >>> >>> if barcode='16187DD5016' then delete; >>> >>> if barcode='16187DD8007' then delete; >>> >>> if barcode='16187DD7010' then delete; >>> >>> if barcode='16187DD7007' then delete; >>> >>> if barcode='16187DD8005' then delete; >>> >>> if barcode='16187DD6004' then delete; >>> >>> if barcode='16187DD5008' then delete; >>> >>> if barcode='16187DD7012' then delete; >>> >>> if barcode='16187DD6010' then delete; >>> >>> run; quit; >>> >>> >>> >>> Title'2016 Asilomar Stress Relief champagin yield'; >>> >>> proc mixed method=reml data=yield; >>> >>> class rep Management Foliar_Fungicide Chemical_Treatment; >>> >>> model Grain_Yield__Mg_h_ =Management|Foliar_Fungicide|Chemical_Treatment >>> Final_Stand__Plants_A_ / outpred=resids residual ddfm=kr; >>> >>> random rep rep*Management rep*Management*Foliar_Fungicide; >>> >>> lsmeans Management|Foliar_Fungicide|Chemical_Treatment / pdiff; >>> >>> ods output diffs=ppp lsmeans=means; >>> >>> ods listing exclude diffs lsmeans; >>> >>> run; quit; >>> >>> %include'C:\Users\harmon12\Desktop\pdmix800.sas'; >>> >>> %pdmix800(ppp,means,alpha=0.10,sort=yes); >>> >>> ods graphics off; >>> >>> run; quit; >>> >>> proc univariate data=resids normal plot; id Barcode Grain_Yield__Mg_h_ >>> pearsonresid; var resid; >>> proc print data=resids (obs=3);run; >>> >>> Can someone please help me convert my code to R? Any help would be much >>> appreciated. >>> >>> >>> Thanks, >>> >>> >>> Andrew Harmon >>> >>> [[alternative HTML version deleted]] >>> >>> __ >>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide http://www.R-project.org/posti >>> ng-guide.html >>> and provide commented, minimal, self-contained, reproducible code. >>> >>>
Re: [R] Sampe numbers
N <- 100 C <- 50 x <- numeric(N) for (i in 1:N){ x[i] <- sample(C-sum(x),1) } x sum(x) Frederic NtirenganyaSent by: "R-help" 07/19/2016 01:41 PM To "r-help@r-project.org" , cc Subject [R] Sampe numbers Hi Guys, I am trying to sample 100 numbers from 1:100 i did it like this: sample(1:100,100, replace= TRUE) but i want again include a constraint that their sum must be equal to 50 How could I do it? Cheers Frederic Ntirenganya Maseno University, African Maths Initiative, Kenya. Mobile:(+254)718492836 Email: fr...@aims.ac.za https://sites.google.com/a/aims.ac.za/fredo/ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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 -- To UNSUBSCRIBE and more, see 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] Request for help
There is a video tutorial on the RStudio web site showing how to create R packages within RStudio. Hadley Wickham also has a book on creating R packages. Bert GunterSent by: "R-help" 06/03/2016 02:27 PM To suparna biswas , cc r-help Subject Re: [R] Request for help See the "Writing R Extensions" manual that ships with R. You might also want to consider Hadley Wickham's roxygen2 package, which allows one to include the Help information as specially formatted comments within the code files themselves. The package will then generate the Help files from this info automagically. Finally, google! -- there are many other tutorials on this on the web. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Fri, Jun 3, 2016 at 12:22 AM, suparna biswas wrote: > Dear Sir/Madam >Myself Suparna Biswas, a research scholar from the > department of Mathematical Sciences, Tezpur University, Assam, India. I am > working under the supervision of Dr. Santanu Dutta, Associate Professor, > Department of Mathematical Sciences, Tezpur University, Assam, India. My > research topic is "Estimation and Application of Risk Measure in Finance". > > I mainly use the R software in my research work. I > want to convert all my code into a R package manually. I have gone through > the paper by Friedrich Leisch titled "Creating R Packages: A Tutorial. But > I am facing problem in writing help pages. The things mentioned in the > paper about help pages are not clear to me as I have never written help > pages before. > > I will be obliged if you kindly help me in this > context. Thanking you. > > -- > With warm regards, > Suparna Biswas > Research Scholar > Department of Mathematical Sciences > Tezpur University > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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 -- To UNSUBSCRIBE and more, see 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] promoting scalar arguments to vectors in a function
R users: Suppose I have a function that takes three numeric arguments x, y, and z, any of which may be scalars or vectors. Suppose further that the user takes one of the arguments, say y, as a vector with the other two as scalars. Is there an existing R function that will promote the other two arguments to vectors of the same size? I know in most cases this is not a problem as the promotion is automatic. I need this for a function I am writing and I don't want to write any additional code to do this if I can help it. Joe Joseph F. Lucke, PhD Senior Statistician Research Institute on Addictions University at Buffalo State University of New York 1021 Main Street Buffalo, NY 14203-1016 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Install.package CAIC
You should consider the package "caper", which provides a CAIC. From the caper manual "The caper package implements the methods originally provided in the programs CAIC (Purvis and Rambaut, 1995b) and MacroCAIC (Agapow and Isaac, 2002)." Hope this helps. Gabriela WofkovaSent by: "R-help" 02/03/2016 11:45 AM To r-help@r-project.org, cc Subject [R] Install.package CAIC H ello, I am a begginer in R and I need to incorporate phylogeny into my data. So i tried to instal package CAIC. > install.packages("CAIC") > install.packages("CAIC", repos="http://R-Forge.R-project.org ",type="source") > install.packages("CAIC", repos="http://R-Forge.R-project.org;) But it doesn´t work. Installing package into ‘C:/Users/3.2’ (as ‘lib’ is unspecified)Warning in install.packages : package ‘CAIC’ is not available (for R version 3.2.3) I see on forum one question on it: http://r.789695.n4.nabble.com/Installing-CAIC-tt3693455.html but the advice doesn´t work for me. Have you got any other idea? I have the newest version of R program (R version 3.2.3). Is it possible that the package is available just for older versions? I had also R version 3.1.2, but also it didn´t work. I am sorry, if it is stupid or easy question, but I am at the end with any idea. Thank a lot for every advice. Gabriela W. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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 -- To UNSUBSCRIBE and more, see 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] Correct notation for functions, packages when using LaTex
Erin There is a LaTeX package called listings. It has an R option to prettyprint code. Never used it. Joe "Kevin E. Thorpe"Sent by: "R-help" 12/10/2015 12:14 PM To Erin Hodgess , cc R help Subject Re: [R] Correct notation for functions, packages when using LaTex On 12/10/2015 12:10 PM, Erin Hodgess wrote: > Hello everyone! > > I am writing up something (quickly) using LaTex and periodically refer to R > functions and packages. > > What is the correct way to put those into LaTex, please? I know that R > itself is {\tt R}, but am not sure about the others. > > Thanks for any help, > Sincerely, > Erin > PS Or should I just be doing this in R Studio, even though there is no > code, please? > > When I refer to R function in a LaTeX document I tend to use \texttt{} (same as your {\tt } construct). Historical convention rendered computer code in a monospace font (akin to Courier) so that's what I follow. -- Kevin E. Thorpe Head of Biostatistics, Applied Health Research Centre (AHRC) Li Ka Shing Knowledge Institute of St. Michael's Assistant Professor, Dalla Lana School of Public Health University of Toronto email: kevin.tho...@utoronto.ca Tel: 416.864.5776 Fax: 416.864.3016 __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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 -- To UNSUBSCRIBE and more, see 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] Beta distribution approximate to Normal distribution
Scratch the rchisq (it should have been sqrt(rchisq), but that doesn't help.). Use the truncated normal u <- 3; a <- 2; N <- 100 x <- numeric(N) for (i in 1:N){ repeat{ if( (x[i] <- rnorm(1, u, a)) >= 0 ) break } } or the folded normal abs(rnorm(N, u, a)), They give similar results. The code for the truncated normal allows you to set any truncation point. Joe (Ted Harding)Sent by: "R-help" 09/15/2015 11:12 AM Please respond to ted.hard...@wlandres.net To "r-help@r-project.org" , cc Chien-Pang Chin Subject Re: [R] Beta distribution approximate to Normal distribution Using non-central chi-squared (especially with df=1) is unlikely to generate random numbers anywhere near a Normal distribution (see below). And "rchisq(100, df=1, ncp=u/a)" won't work anyway with u<0, since ncp must be >= 0 (if < 0 then all are NA). Better to shoot straight for the target (truncated Normal), though several shots are likely to be required! For example (code which spells it out), taking u=3 and a=2: n <- 100 u <- 3 ; a <- 2 x <- NULL N <- length(x) while(N < n){ x <- c(x,rnorm(n,mean=u,sd=a)) x <- x[x>0] N <- length(x) } x <- x[1:n] Comparison with non-central chi-squared: y <- rchisq(100, df=1, ncp=u/a) hist(x) hist(y) On 15-Sep-2015 13:26:44 jlu...@ria.buffalo.edu wrote: > Your question makes no sense as stated. However, guessing at what you > want, you should perhaps consider the non-central chi-square density with > 1 df and ncp = u/a, i.e, > > rchisq(100, df=1, ncp=u/a) > > Joe > Joseph F. Lucke, PhD > Senior Statistician > Research Institute on Addictions > University at Buffalo > State University of New York > 1021 Main Street > Buffalo, NY 14203-1016 > > Chien-Pang Chin > Sent by: "R-help" > 09/15/2015 06:58 AM > > To > "r-help@r-project.org" , > > Subject > [R] Beta distribution approximate to Normal distribution > > Hi, > I need to generate 1000 numbers from N(u, a^2), however I don't > want to include 0 and negative values. How can I use beta distribution > approximate to N(u, a^2) in R. > > Thx for help - E-Mail: (Ted Harding) Date: 15-Sep-2015 Time: 16:12:35 This message was sent by XFMail __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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 -- To UNSUBSCRIBE and more, see 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] Beta distribution approximate to Normal distribution
Your question makes no sense as stated. However, guessing at what you want, you should perhaps consider the non-central chi-square density with 1 df and ncp = u/a, i.e, rchisq(100, df=1, ncp=u/a) Joe Joseph F. Lucke, PhD Senior Statistician Research Institute on Addictions University at Buffalo State University of New York 1021 Main Street Buffalo, NY 14203-1016 Chien-Pang ChinSent by: "R-help" 09/15/2015 06:58 AM To "r-help@r-project.org" , cc Subject [R] Beta distribution approximate to Normal distribution Hi, I need to generate 1000 numbers from N(u, a^2), however I don't want to include 0 and negative values. How can I use beta distribution approximate to N(u, a^2) in R. Thx for help __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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 -- To UNSUBSCRIBE and more, see 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] WEIBULL or EXPONENTIAL?
As a start you can use an exploratory approach. Standard survival analysis texts show you how to use a log-log plot to assess whether a distribution is Weibull. Of course, the exponential is a special case of the Weibull. CHIRIBOGA Xavier xavier.chirib...@unine.ch Sent by: R-help r-help-boun...@r-project.org 04/03/2015 10:33 AM To r-help@r-project.org r-help@r-project.org, cc Subject [R] WEIBULL or EXPONENTIAL? Dear members, I am doing a survival analysis wiith the function coxph...however I am wondering how can I know if my data follows a EXPONENTIAL or WEIBULL distribution? I have 3 censored datum. Using R studio. Thanks for the suggestions, Xavier __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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 -- To UNSUBSCRIBE and more, see 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] generating phi using function()
Your function phi has 5 arguments with no defaults. Your call only has 3 arguments. Hence the error message. phi - function(w1, w2, j, k, K){ + zaehler - (k/K)^(w1-1)*(1-k/K)^(w2-1) + nenner - sum( ((1:K)/K)^(w1-1)*(1-(1:K)/K)^(w2-1)) + return( zaehler/nenner ) + } phi(c(1, 1), 44L, 1) Error in phi(c(1, 1), 44L, 1) : argument k is missing, with no default T.Riedle tr...@kent.ac.uk Sent by: R-help r-help-boun...@r-project.org 03/29/2015 08:59 AM To r-help@r-project.org r-help@r-project.org, cc Subject [R] generating phi using function() Hi everybody, I am trying to generate the formula shown in the attachment. My formula so far looks as follows: phi - function(w1, w2, j, k, K){ zaehler - (k/K)^(w1-1)*(1-k/K)^(w2-1) nenner - sum( ((1:K)/K)^(w1-1)*(1-(1:K)/K)^(w2-1)) return( zaehler/nenner ) } Unfortunately something must be wrong here as I get the following message when running a midas regression m22.phi- midas_r(rv~mls(rvh,1:max.lag+h1,1,phi), start = list(rvh=c(1,1))) Error in phi(c(1, 1), 44L, 1) : argument K is missing, with no default Called from: .rs.breakOnError(TRUE) Browse[1] K-125 Browse[1] 125 Could anybody look into my phi formula and tell me what is wrong with it? Thanks in advance. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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] Graph with ggplot2.
ylim(0%,100%) is not valild. It should be ylim(0,100). Jeff Newmiller jdnew...@dcn.davis.ca.us Sent by: R-help r-help-boun...@r-project.org 03/25/2015 11:14 AM To BenedettaB24 . benedetta.brune...@gmail.com, r-help@r-project.org r-help@r-project.org, cc Subject Re: [R] Graph with ggplot2. It is difficult to read your code because the HTML format messes it up, but I think your ggplot function call is missing a parenthesis between fill=Prostate and the + sign. --- 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. On March 25, 2015 7:02:50 AM PDT, BenedettaB24 . benedetta.brune...@gmail.com wrote: Dear all, I want to run ggplot2 in one of my file. I do this: mergefile- read.csv(path of my file/name.csv) library(ggplot2) to import my library ggplot(percent, aes(x=factor(Cell.lines), y=Percentage, vjust=-0.5, fill=Prostate )) + geom_bar(colour=black, stat=identity, position=position_dodge(), size=.3)+ylim(0%,100%)+xlab(Prostate cell lines)+ylab(Percentage of overlapping)+ggtitle(Comparison between cell lines against the prostate cancer lines from DNase esperiment)+theme_bw()+theme(axis.text.x=element_text(angle = 90, vjust = 0.5)) i used this command three times, but now is not working, the error reported is: Error: unexpected ')' in ggplot(percent, aes(x=factor(Cell.lines), y=Percentage, vjust=-0.5, fill=Prostate )) + geom_bar(colour=black, stat=identity, position=position_dodge(), size=.3)+ylim(0%,100%) Can some one help me? any suggestions? Thanks a lot! Best regards, Benedetta [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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 -- To UNSUBSCRIBE and more, see 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] Difference betweeen cor.test() and formula everyone says to use
The distribution of the statistic $ndf * r^2 / (1-r^2)$ with the true value $\rho = zero$ follows an $F(1,ndf)$ distribution. So the t-test is the correct test for $\rho=0$. Fisher's z is an asymptotically normal transformation for any value of $\rho$. Thus Fisher's z is better for testing $\rho= \rho_0 $ or $\rho_1 = \rho_2$. The two statistics will not be equivalent at $\rho=0$ because the statistics are based on different assumptions. Jeremy Miles jeremy.mi...@gmail.com Sent by: r-help-boun...@r-project.org 10/16/2014 07:32 PM To r-help r-help@r-project.org, cc Subject [R] Difference betweeen cor.test() and formula everyone says to use I'm trying to understand how cor.test() is calculating the p-value of a correlation. It gives a p-value based on t, but every text I've ever seen gives the calculation based on z. For example: data(cars) with(cars[1:10, ], cor.test(speed, dist)) Pearson's product-moment correlation data: speed and dist t = 2.3893, df = 8, p-value = 0.04391 alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: 0.02641348 0.90658582 sample estimates: cor 0.6453079 But when I use the regular formula: r - cor(cars[1:10, ])[1, 2] r.z - fisherz(r) se - se - 1/sqrt(10 - 3) z - r.z / se (1 - pnorm(z))*2 [1] 0.04237039 My p-value is different. The help file for cor.test doesn't (seem to) have any reference to this, and I can see in the source code that it is doing something different. I'm just not sure what. Thanks, Jeremy __ 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] Inverse Student t-value
Andre For the last time, there is NO simple rational approximation to the quantiles of the t-distribution. From R help, qt = TINV is based on Hill, G. W. (1970) Algorithm 396: Student's t-quantiles. Communications of the ACM, 13(10), 619–620. And Hill, G. W. (1981) Remark on Algorithm 396, ACM Transactions on Mathematical Software, 7, 250–1. Both of these articles can be googled and the source code obtained from the ACM. (I have done it.) The code uses a rational approximation to the inverse for which you can compute values by hand. Then you can see why we use qt(). :-) Joe Andre geomodel...@gmail.com 10/02/2014 07:27 AM To jlu...@ria.buffalo.edu, cc Duncan Murdoch murdoch.dun...@gmail.com, r-help@r-project.org r-help@r-project.org, r-help-boun...@r-project.org Subject Re: [R] Inverse Student t-value Dear All, The manual formula mean that how to calculate that value by hand for TINV(0.408831, 1221) and the resulted is 4.0891672 Appreciate your help in advance. Cheers! On Wed, Oct 1, 2014 at 9:15 PM, jlu...@ria.buffalo.edu wrote: What do you mean by a manual formula? Andre geomodel...@gmail.com 09/30/2014 11:54 PM To jlu...@ria.buffalo.edu, cc Duncan Murdoch murdoch.dun...@gmail.com, r-help@r-project.org r-help@r-project.org, r-help-boun...@r-project.org Subject Re: [R] Inverse Student t-value Hi JLucke, Maybe the old excel function. TINV and T.INV.2T is same function for T wo-Tailed Inverse of the student`s t-distribution but T.INV use for Left-Tailed inverse of the Student's t-distribution and can be use for Inverse of the student`s t-distribution. I know automatic or functions any software but I just need a manual formula or compute formula (TINV or T.INV.2T) step by step presented by math for calculate until resulted. Thanks in advance. Cheers! On Wed, Oct 1, 2014 at 2:39 AM, jlu...@ria.buffalo.edu wrote: The website has your answer. The t-distribution is a regularized incomplete beta function. The incomplete beta function is given by R's pbeta function. You regularize it with R's beta function. Then you use R's uniroot function to find the inverse. Good homework problem. Andre geomodel...@gmail.com Sent by: r-help-boun...@r-project.org 09/30/2014 02:45 PM To Duncan Murdoch murdoch.dun...@gmail.com, cc r-help@r-project.org r-help@r-project.org Subject Re: [R] Inverse Student t-value Hi Duncan, Let me explain again, I just need a manual expression for inverse student t value. You could go to web page http://www.danielsoper.com/statcalc3/calc.aspx?id=10 That's inverse student t value calculator. Do you know a manual expression use it. Cheers! On Wednesday, October 1, 2014, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 30/09/2014 2:26 PM, Andre wrote: Hi Duncan, Actually, I am trying trace the formula for the Critical value of Z and manual formula is =(I7-1)/SQRT(I7)*SQRT((TINV(0. 05/I7,I7-2))^2/(I7-2+TINV(0.05/I7,I7-2))) So, I got new problem for TINV formula. I just need a manual equation for TINV. Sorry, can't help. I'm not sure I understand what you want, but if it's a simple formula for quantiles of the t distribution, it doesn't exist. Duncan Murdoch Hope solve this problem. Cheers! On Wed, Oct 1, 2014 at 1:20 AM, Duncan Murdoch murdoch.dun...@gmail.com mailto:murdoch.dun...@gmail.com wrote: On 30/09/2014 2:11 PM, Andre wrote: Hi Duncan, No, that's correct. Actually, I have data set below; Then it seems Excel is worse than I would have expected. I confirmed R's value in two other pieces of software, OpenOffice and some software I wrote a long time ago based on an algorithm published in 1977 in Applied Statistics. (They are probably all using the same algorithm. I wonder what Excel is doing?) N= 1223 alpha= 0.05 Then probability= 0.05/1223=0.408831 degree of freedom= 1223-2= 1221 So, TINV(0.408831,1221) returns 4.0891672 Could you show me more detail a manual equation. I really appreciate it if you may give more detail. I already gave you the expression: abs(qt(0.408831/2, df=1221)). For more detail, I suppose you could look at the help page for the qt function, using help(qt). Duncan Murdoch Cheers! On Wed, Oct 1, 2014 at 1:01 AM, Duncan Murdoch murdoch.dun...@gmail.com mailto:murdoch.dun...@gmail.com mailto:murdoch.dun...@gmail.com mailto:murdoch.dun...@gmail.com wrote: On 30/09/2014 1:31 PM, Andre wrote: Dear Sir/Madam, I am trying to use calculation for two-tailed inverse of the student`s t-distribution function presented by Excel functions like =TINV(probability, deg_freedom). For instance: The Excel
Re: [R] Inverse Student t-value
My Excel (2013) returns exactly what R does. I used both T.INV and T.INV.T2There is no TINV. Has Excel been updated? Duncan Murdoch murdoch.dun...@gmail.com Sent by: r-help-boun...@r-project.org 09/30/2014 02:36 PM To Andre geomodel...@gmail.com, cc r-help@r-project.org Subject Re: [R] Inverse Student t-value On 30/09/2014 2:26 PM, Andre wrote: Hi Duncan, Actually, I am trying trace the formula for the Critical value of Z and manual formula is =(I7-1)/SQRT(I7)*SQRT((TINV(0.05/I7,I7-2))^2/(I7-2+TINV(0.05/I7,I7-2))) So, I got new problem for TINV formula. I just need a manual equation for TINV. Sorry, can't help. I'm not sure I understand what you want, but if it's a simple formula for quantiles of the t distribution, it doesn't exist. Duncan Murdoch Hope solve this problem. Cheers! On Wed, Oct 1, 2014 at 1:20 AM, Duncan Murdoch murdoch.dun...@gmail.com mailto:murdoch.dun...@gmail.com wrote: On 30/09/2014 2:11 PM, Andre wrote: Hi Duncan, No, that's correct. Actually, I have data set below; Then it seems Excel is worse than I would have expected. I confirmed R's value in two other pieces of software, OpenOffice and some software I wrote a long time ago based on an algorithm published in 1977 in Applied Statistics. (They are probably all using the same algorithm. I wonder what Excel is doing?) N= 1223 alpha= 0.05 Then probability= 0.05/1223=0.408831 degree of freedom= 1223-2= 1221 So, TINV(0.408831,1221) returns 4.0891672 Could you show me more detail a manual equation. I really appreciate it if you may give more detail. I already gave you the expression: abs(qt(0.408831/2, df=1221)). For more detail, I suppose you could look at the help page for the qt function, using help(qt). Duncan Murdoch Cheers! On Wed, Oct 1, 2014 at 1:01 AM, Duncan Murdoch murdoch.dun...@gmail.com mailto:murdoch.dun...@gmail.com mailto:murdoch.dun...@gmail.com mailto:murdoch.dun...@gmail.com wrote: On 30/09/2014 1:31 PM, Andre wrote: Dear Sir/Madam, I am trying to use calculation for two-tailed inverse of the student`s t-distribution function presented by Excel functions like =TINV(probability, deg_freedom). For instance: The Excel function =TINV(0.408831,1221) = returns 4.0891672. Would you like to show me a manual calculation for this? Appreciate your helps in advance. That number looks pretty far off the true value. Have you got a typo in your example? You can compute the answer to your question as abs(qt(0.408831/2, df=1221)), but you'll get 4.117. Duncan Murdoch __ 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] Inverse Student t-value
The website has your answer. The t-distribution is a regularized incomplete beta function. The incomplete beta function is given by R's pbeta function. You regularize it with R's beta function. Then you use R's uniroot function to find the inverse. Good homework problem. Andre geomodel...@gmail.com Sent by: r-help-boun...@r-project.org 09/30/2014 02:45 PM To Duncan Murdoch murdoch.dun...@gmail.com, cc r-help@r-project.org r-help@r-project.org Subject Re: [R] Inverse Student t-value Hi Duncan, Let me explain again, I just need a manual expression for inverse student t value. You could go to web page http://www.danielsoper.com/statcalc3/calc.aspx?id=10 That's inverse student t value calculator. Do you know a manual expression use it. Cheers! On Wednesday, October 1, 2014, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 30/09/2014 2:26 PM, Andre wrote: Hi Duncan, Actually, I am trying trace the formula for the Critical value of Z and manual formula is =(I7-1)/SQRT(I7)*SQRT((TINV(0. 05/I7,I7-2))^2/(I7-2+TINV(0.05/I7,I7-2))) So, I got new problem for TINV formula. I just need a manual equation for TINV. Sorry, can't help. I'm not sure I understand what you want, but if it's a simple formula for quantiles of the t distribution, it doesn't exist. Duncan Murdoch Hope solve this problem. Cheers! On Wed, Oct 1, 2014 at 1:20 AM, Duncan Murdoch murdoch.dun...@gmail.com mailto:murdoch.dun...@gmail.com wrote: On 30/09/2014 2:11 PM, Andre wrote: Hi Duncan, No, that's correct. Actually, I have data set below; Then it seems Excel is worse than I would have expected. I confirmed R's value in two other pieces of software, OpenOffice and some software I wrote a long time ago based on an algorithm published in 1977 in Applied Statistics. (They are probably all using the same algorithm. I wonder what Excel is doing?) N= 1223 alpha= 0.05 Then probability= 0.05/1223=0.408831 degree of freedom= 1223-2= 1221 So, TINV(0.408831,1221) returns 4.0891672 Could you show me more detail a manual equation. I really appreciate it if you may give more detail. I already gave you the expression: abs(qt(0.408831/2, df=1221)). For more detail, I suppose you could look at the help page for the qt function, using help(qt). Duncan Murdoch Cheers! On Wed, Oct 1, 2014 at 1:01 AM, Duncan Murdoch murdoch.dun...@gmail.com mailto:murdoch.dun...@gmail.com mailto:murdoch.dun...@gmail.com mailto:murdoch.dun...@gmail.com wrote: On 30/09/2014 1:31 PM, Andre wrote: Dear Sir/Madam, I am trying to use calculation for two-tailed inverse of the student`s t-distribution function presented by Excel functions like =TINV(probability, deg_freedom). For instance: The Excel function =TINV(0.408831,1221) = returns 4.0891672. Would you like to show me a manual calculation for this? Appreciate your helps in advance. That number looks pretty far off the true value. Have you got a typo in your example? You can compute the answer to your question as abs(qt(0.408831/2, df=1221)), but you'll get 4.117. Duncan Murdoch [[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] hypergeometric integral
#First, correct your code H - 0.7; t - 1; s - seq(0,t,0.1); x - 1-t/s; library(gsl) Gauss2F1 - function(H,x){ a - H-1/2; b - 1/2-H; c - H+1/2; # if(x=0 x1){ #hyperg_2F1(a,b,c,x) # }else{ hyperg_2F1(c-a,b,c,1-1/(1-x))/(1-x)^b # } } #Here #F - Gauss2F1(a,b,c,x) #and here #integrate(F,lower=0,upper=1,H=0.7) integrate(Gauss2F1,lower=0,upper=1,H=0.7) Error in integrate(Gauss2F1, lower = 0, upper = 1, H = 0.7) : non-finite function value #Then note that Gauss2F1(H,x) [1] Inf 1.143016 1.083553 1.056065 1.039444 1.028055 1.019653 1.013143 1.007920 1.003618 [11] 1.00 #whereupon you find your second problem. #Joe Xuse Chuse chus...@gmail.com Sent by: r-help-boun...@r-project.org 06/17/2014 08:32 AM To r-help r-help@r-project.org, cc Subject [R] hypergeometric integral Dear all, I am trying to make a numerical integral of a Hypergeometrical function 2F1 but it is not working. I dont know how to pass the arguments to my function. Thank you beforehand. Chuse. Here is my code: H - 0.7; t - 1; s - seq(0,t,0.1); x - 1-t/s; library(gsl) Gauss2F1 - function(H,x){ a - H-1/2; b - 1/2-H; c - H+1/2; # if(x=0 x1){ #hyperg_2F1(a,b,c,x) # }else{ hyperg_2F1(c-a,b,c,1-1/(1-x))/(1-x)^b # } } F - Gauss2F1(a,b,c,x) integrate(F,lower=-1,upper=1,H=0.7) [[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] hypergeometric integral
I made a stupid mistake. My note at the end is irrelevant as is the code before the library statement. Instead, the upper bound to your integral must be around .5, not 1. integrate(Gauss2F1,lower=0,upper=.5,H=0.7) 0.4954698 with absolute error 5.5e-15 integrate(Gauss2F1,lower=0,upper=.51,H=0.7) Error in integrate(Gauss2F1, lower = 0, upper = 0.51, H = 0.7) : non-finite function value jlu...@ria.buffalo.edu Sent by: r-help-boun...@r-project.org 06/17/2014 10:24 AM To Xuse Chuse chus...@gmail.com, cc r-help r-help@r-project.org, r-help-boun...@r-project.org Subject Re: [R] hypergeometric integral #First, correct your code H - 0.7; t - 1; s - seq(0,t,0.1); x - 1-t/s; library(gsl) Gauss2F1 - function(H,x){ a - H-1/2; b - 1/2-H; c - H+1/2; # if(x=0 x1){ #hyperg_2F1(a,b,c,x) # }else{ hyperg_2F1(c-a,b,c,1-1/(1-x))/(1-x)^b # } } #Here #F - Gauss2F1(a,b,c,x) #and here #integrate(F,lower=0,upper=1,H=0.7) integrate(Gauss2F1,lower=0,upper=1,H=0.7) Error in integrate(Gauss2F1, lower = 0, upper = 1, H = 0.7) : non-finite function value #Then note that Gauss2F1(H,x) [1] Inf 1.143016 1.083553 1.056065 1.039444 1.028055 1.019653 1.013143 1.007920 1.003618 [11] 1.00 #whereupon you find your second problem. #Joe Xuse Chuse chus...@gmail.com Sent by: r-help-boun...@r-project.org 06/17/2014 08:32 AM To r-help r-help@r-project.org, cc Subject [R] hypergeometric integral Dear all, I am trying to make a numerical integral of a Hypergeometrical function 2F1 but it is not working. I dont know how to pass the arguments to my function. Thank you beforehand. Chuse. Here is my code: H - 0.7; t - 1; s - seq(0,t,0.1); x - 1-t/s; library(gsl) Gauss2F1 - function(H,x){ a - H-1/2; b - 1/2-H; c - H+1/2; # if(x=0 x1){ #hyperg_2F1(a,b,c,x) # }else{ hyperg_2F1(c-a,b,c,1-1/(1-x))/(1-x)^b # } } F - Gauss2F1(a,b,c,x) integrate(F,lower=-1,upper=1,H=0.7) [[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] (no subject)
There's a comma missing after sep=). DBxy-read.csv(paste(C:/users/marta/desktop/DB,filename, sep=) sep=,,header=TRUE) should be DBxy-read.csv(paste(C:/users/marta/desktop/DB,filename, sep=), sep=,,header=TRUE) ^ marta valdes lopez marti_flamenk...@hotmail.com Sent by: r-help-boun...@r-project.org 05/29/2014 01:02 PM To r-help@r-project.org r-help@r-project.org, cc Subject [R] (no subject) Hello, Iam using R 3.1 and i tried to run this script: setwd(C:/users/marta/desktop/DB) library(chron) library(xlsx) filename-univerest_50.csv filename-monicap_50.csv filename-univer1_50.csv filename-univer2_50.csv DBxy-read.csv(paste(C:/users/marta/desktop/DB,filename, sep=) sep=,,header=TRUE) But in the last line I got this error:unexpected symbol in I´ve been trying different things like delete some parts..but it didnt work, if somebody can help me i would aprecciate. Thank you in advance¡ [[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] gumbel distribution
The Weibull and Gumbel distributions are NOT the same. Frede Aakmann Tøgersen fr...@vestas.com Sent by: r-help-boun...@r-project.org 05/14/2014 02:01 AM To eliza botto eliza_bo...@hotmail.com, r-help@r-project.org r-help@r-project.org, cc Subject Re: [R] gumbel distribution Don't know if I understand your last comment but I surely don't think that the Weibull and Gumbel distributions are the same. See their density function on e.g. Wikipedia. Yours sincerely / Med venlig hilsen Frede Aakmann Tøgersen Specialist, M.Sc., Ph.D. Plant Performance Modeling Technology Service Solutions T +45 9730 5135 M +45 2547 6050 fr...@vestas.commailto:fr...@vestas.com http://www.vestas.comhttp://www.vestas.com/ Company reg. name: Vestas Wind Systems A/S This e-mail is subject to our e-mail disclaimer statement. Please refer to www.vestas.com/legal/notice http://www.vestas.com/legal/notice If you have received this e-mail in error please contact the sender. From: eliza botto [mailto:eliza_bo...@hotmail.com] Sent: 13. maj 2014 21:20 To: Frede Aakmann Tøgersen; r-help@r-project.org Subject: RE: [R] gumbel distribution Thankyou very much Frede. It wasn't any home I am just trying to put my grip on distribution. Believe it or not, I came to know for the first time that weibull and gumbel distributions are same. :( Eliza From: fr...@vestas.commailto:fr...@vestas.com To: eliza_bo...@hotmail.commailto:eliza_bo...@hotmail.com; r-help@r-project.orgmailto:r-help@r-project.org Date: Tue, 13 May 2014 20:08:20 +0200 Subject: RE: [R] gumbel distribution Is this a home work problem? See Weibull package:stats R Documentation The Weibull Distribution Description: Density, distribution function, quantile function and random generation for the Weibull distribution with parameters 'shape' and 'scale'. Usage: dweibull(x, shape, scale = 1, log = FALSE) pweibull(q, shape, scale = 1, lower.tail = TRUE, log.p = FALSE) qweibull(p, shape, scale = 1, lower.tail = TRUE, log.p = FALSE) rweibull(n, shape, scale = 1) Yours sincerely / Med venlig hilsen Frede Aakmann Tøgersen Specialist, M.Sc., Ph.D. Plant Performance Modeling Technology Service Solutions T +45 9730 5135 M +45 2547 6050 fr...@vestas.commailto:fr...@vestas.com http://www.vestas.com Company reg. name: Vestas Wind Systems A/S This e-mail is subject to our e-mail disclaimer statement. Please refer to www.vestas.com/legal/notice http://www.vestas.com/legal/notice If you have received this e-mail in error please contact the sender. -Original Message- From: r-help-boun...@r-project.orgmailto:r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of eliza botto Sent: 13. maj 2014 19:57 To: r-help@r-project.orgmailto:r-help@r-project.org Subject: [R] gumbel distribution Dear useRs, I need some examples of gumbel probability plots in R. i'll be extremely grateful if you could share the codes of a working example. Eliza [[alternative HTML version deleted]] __ R-help@r-project.orgmailto: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] R in Excel
Check out http://www.r-bloggers.com/a-million-ways-to-connect-r-and-excel/ for an overview. See section 4. Olga Albutova oda...@gmail.com Sent by: r-help-boun...@r-project.org 04/29/2014 11:05 AM To r-help@r-project.org, cc Subject [R] R in Excel Hello! I need some help. I'd like to make a button in Excel which performes functions wrote in R. Is there is any macros to do this? I don't want to use RExcel. Thank you very much! Sincerely yours, Olga [[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] A vector of normal distributed values with a sum-to-zero constraint
The sum-to-zero constraint imposes a loss of one degree of freedom. Of N samples, only (N-1) can be random. Thus the solution is N - 100 x - rnorm(N-1) x - c(x, -sum(x)) sum(x) [1] -7.199102e-17 Boris Steipe boris.ste...@utoronto.ca Sent by: r-help-boun...@r-project.org 04/01/2014 09:29 AM To Marc Marí Dell'Olmo marceivi...@gmail.com, cc r-help@r-project.org r-help@r-project.org Subject Re: [R] A vector of normal distributed values with a sum-to-zero constraint Make a copy with opposite sign. This is Normal, symmetric, but no longer random. set.seed(112358) x - rnorm(5000, 0, 0.5) x - c(x, -x) sum(x) hist(x) B. On 2014-04-01, at 8:56 AM, Marc Marí Dell'Olmo wrote: Dear all, Anyone knows how to generate a vector of Normal distributed values (for example N(0,0.5)), but with a sum-to-zero constraint?? The sum would be exactly zero, without decimals. I made some attempts: l - 100 aux - rnorm(l,0,0.5) s - sum(aux)/l aux2 - aux-s sum(aux2) [1] -0.0006131392 aux[1]- -sum(aux[2:l]) sum(aux) [1] -0.03530422 but the sum is not exactly zero and not all parameters are N(0,0.5) distributed... Perhaps is obvious but I can't find the way to do it.. Thank you very much! Marc __ 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-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] A vector of normal distributed values with a sum-to-zero constraint
Then what's wrong with centering your initial values around the mean? Marc Marí Dell'Olmo marceivi...@gmail.com 04/01/2014 10:56 AM To Boris Steipe boris.ste...@utoronto.ca, cc jlu...@ria.buffalo.edu, r-help@r-project.org r-help@r-project.org Subject Re: [R] A vector of normal distributed values with a sum-to-zero constraint Boris is right. I need this vector to include as initial values of a MCMC process (with openbugs) and If I use this last approach sum(x) could be a large (or extreme) value and can cause problems. The other approach x - c(x, -x) has the problem that only vectors with even values are obtained. Thank you! 2014-04-01 16:25 GMT+02:00 Boris Steipe boris.ste...@utoronto.ca: But the result is not Normal. Consider: set.seed(112358) N - 100 x - rnorm(N-1) sum(x) [1] 1.759446 !!! i.e. you have an outlier at 1.7 sigma, and for larger N... set.seed(112358) N - 1 x - rnorm(N-1) sum(x) [1] -91.19731 B. On 2014-04-01, at 10:14 AM, jlu...@ria.buffalo.edu wrote: The sum-to-zero constraint imposes a loss of one degree of freedom. Of N samples, only (N-1) can be random. Thus the solution is N - 100 x - rnorm(N-1) x - c(x, -sum(x)) sum(x) [1] -7.199102e-17 Boris Steipe boris.ste...@utoronto.ca Sent by: r-help-boun...@r-project.org 04/01/2014 09:29 AM To Marc Marí Dell'Olmo marceivi...@gmail.com, cc r-help@r-project.org r-help@r-project.org Subject Re: [R] A vector of normal distributed values with a sum-to-zero constraint Make a copy with opposite sign. This is Normal, symmetric, but no longer random. set.seed(112358) x - rnorm(5000, 0, 0.5) x - c(x, -x) sum(x) hist(x) B. On 2014-04-01, at 8:56 AM, Marc Marí Dell'Olmo wrote: Dear all, Anyone knows how to generate a vector of Normal distributed values (for example N(0,0.5)), but with a sum-to-zero constraint?? The sum would be exactly zero, without decimals. I made some attempts: l - 100 aux - rnorm(l,0,0.5) s - sum(aux)/l aux2 - aux-s sum(aux2) [1] -0.0006131392 aux[1]- -sum(aux[2:l]) sum(aux) [1] -0.03530422 but the sum is not exactly zero and not all parameters are N(0,0.5) distributed... Perhaps is obvious but I can't find the way to do it.. Thank you very much! Marc __ 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-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-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] Installing WinBUGS OpenBUGS on OS X 10.8.5
1. To install and run WBugs or Obugs on OSX you must use Parallels or other Windows emulator. 2. Another possibility is to install JAGS ( http://mcmc-jags.sourceforge.net/) via MacPorts (http://www.macports.org/ ) and use R2JAGS. Agony agony_...@yahoo.com Sent by: r-help-boun...@r-project.org 02/24/2014 09:18 AM Please respond to Agony agony_...@yahoo.com To r-help@r-project.org r-help@r-project.org, r-help@r-project.org r-help@r-project.org, cc Subject [R] Installing WinBUGS OpenBUGS on OS X 10.8.5 Dear all, Could any body help me how to install OpenBUGS or WinBUGS on my operating system; OS X 10.8.5? Actually, If there are too many way what is the best way? I will be very grateful to receive your guidance and comments. The installation manual could help me in the best way. Bunch of thanks in advance. Best, Amir [[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] psych package - Cronbach`s Alpha - warning message
I too don't understand the error message. However Coefficient Alpha is easily calculated. To wit: library(psych) tt - cbind(c(1,0.58) , c(0.58,1)) colnames(tt) = rownames(tt) = list(V1 , V2) p - nrow(tt) alpha - p/(p-1) * (1-sum(diag(tt))/sum(tt)) Numerous caveats regarding using C-Alpha apply. And because you have the factor loading you have the reliability of the factor. You don't need C-Alpha. Johannes Moser joh...@web.de Sent by: r-help-boun...@r-project.org 02/14/2014 05:24 PM To r-help@r-project.org, cc Subject [R] psych package - Cronbach`s Alpha - warning message Dear R-help, I try to estimate alpha for a factor that loads onto two items, using the psych-package (newest version). The data is from the boston housing data set. The problem I face can be reproduced by the following approximation of the correlation matrix: library(psych) tt - cbind(c(1,0.58) , c(0.58,1)) colnames(tt) = rownames(tt) = list(V1 , V2) alpha(tt) R Version 3.0.2 (2013-09-25) 64 Bit - Platform: Windows 7 Professional, 64 bit I have tried on two different Windows computers - same warning messages: In matrix(unlist(drop.item), ncol = 6, byrow = TRUE) : data length [10] is not a sub-multiple or multiple of the number of columns [6] What is the reason for the warning? Is it to be taken seriously? How can I avoid this warning? I would be very thankful for any ideas or advice! Thank you a lot in advance!!! [[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] Adjusted R-squared formula in lm()
THE adjusted R^2 is [1-(1-R2)·(n-1)/(n-v-1)], which you call McNemarâs formula. It was actually proposed first by Fisher in 1924. Theil's formula is equal to Fisher's. Wherry's formula, as you give it, is correct but was proposed to estimate the cross-validated R2, which is different from R2. Neither Lord nor Stein actually proposed their respective formulas. They were instead proposed by Darlington to estimate the CVR2 but are based on a mistaken assumption. Neither Wherry's, Lord's, or Stein's formulas estimates what they had hoped to estimate, and most likely are not appropriate to your problem. Browne found the correct estimator of CVR2. R actually uses Fisher's formula but misattributes it to Wherry . The adjusted-R2 is a better estimator of the population coefficient of determination than is R2 itself. It has much less bias and, unlike R2, its expectation is not a function of v, the number of variables. In particular, if the population coefficient of determination is truly zero, R2 can be expected to give the value v/(n-1), whereas the adjR2 will have an expected value of 0. Ista Zahn istaz...@gmail.com Sent by: r-help-boun...@r-project.org 01/28/2013 08:34 AM To Nicole Janz nicolej...@gmail.com, cc r-help@r-project.org Subject Re: [R] Adjusted R-squared formula in lm() Hi Nicole, One nice thing about R is that it is often easy to see the code for many functions. For summary.lm just type the name at the command prompt (no brackets) to see the function definition. There you will find ans$adj.r.squared - 1 - (1 - ans$r.squared) * ((n - df.int)/rdf) Best, Ista On Mon, Jan 28, 2013 at 6:03 AM, Nicole Janz nicolej...@gmail.com wrote: What is the exact formula used in R lm() for the Adjusted R-squared? How can I interpret it? There seem to exist several formula's to calculate Adjusted R-squared. Wherryâs formula [1-(1-R2)·(n-1)/(n-v)] McNemarâs formula [1-(1-R2)·(n-1)/(n-v-1)] Lordâs formula [1-(1-R2)(n+v-1)/(n-v-1)] Stein 1-(n-1/n-k-1)(n-2)/n-k-2) (n+1/n) Theil's formula (found here: http://en.wikipedia.org/wiki/Coefficient_of_determination) According to the textbook Field, Discovering Statistics Using R (2012, p. 273) R uses Wherry's equation which tells us how much variance in Y would be accounted for if the model had been derived from th. population from which the sample was taken. He does not give the formula for Wherry. He recommends using Stein's formula (by hand) to check how well the model cross-validates. Kleiber/Zeileis, Applied Econometrics with R (2008,p. 59) claim it's Theil's adjusted R-squared and don't say exactly how its interpretation varies from the multiple R-squared. Dalgaard, Introductory Statistics with R (2008, p.113) writes that if you multiply [adjusted R-squared] by 100%, it can be interpreted as '% variance reduction'. He does not say to which formula this corresponds. I had previously thought, and read widely, that R-squared penalizes for adding additional variables to the model. Now the use of these different formulas seems to call for different interpretations? My two questions in short: Which formula is used by R lm()? How can I interpret it? Thank you! Nicole Janz, PhD Cand. Lecturer at Social Sciences Research Methods Centre 2012/13 University of Cambridge Department of Politics and International Studies www.nicolejanz.de | nj...@cam.ac.uk | Mobile: +44 (0) 7905 70 1 69 4 Skype: nicole.janz [[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-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] Moore-Penrose Generalized determinant?
If the matrix is singular, the determinant of the matrix and its M-P inverse are both zero. Sean O'Riordain sean...@acm.org Sent by: r-help-boun...@r-project.org 03/14/2012 07:41 AM To r-help@r-project.org cc Subject [R] Moore-Penrose Generalized determinant? Is there a function in R to calculate the generalized determinant of a singular matrix? - similar to the ginv() used to compute the generalized inverse. I can't seem to find any R related posts at all. Thanks in advance, Sean O'Riordain Trinity College Dublin -- View this message in context: http://r.789695.n4.nabble.com/Moore-Penrose-Generalized-determinant-tp4471629p4471629.html Sent from the R help mailing list archive at Nabble.com. __ 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] R versus R Studio output differences
First, be sure your R and the R associated with Rstudio are the same R versions. In Rstudio, check Tools - Options - R version. It looks as if your R-studio is running the 32-bit version of R. Aayush Raman ayushra...@gmail.com Sent by: r-help-boun...@r-project.org 03/09/2012 07:11 AM To r-help@r-project.org cc Subject [R] R versus R Studio output differences Hi Everyone, I ran the same code in R and in R-studio, but got two different results. Does anybody know why this is occurring, and if there is a fix for this? and which is the correct program to use ? Some information about the code I am running: I am running the fisher test and it seems that the p-values are similar but not same for example, for an event A the p-value coming from the R-Studio is around 10^-58 and with R it is 10^-135. Also, I am running the Rstudio on Mac and R through linux server. They both are 64 bit. I am finding it for the first time and I am really surprised by its weirdness. -Best, Aayush Raman [[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] Bayesian functions for mle2 object
I would recommend using the new Bayesian package 'LaplacesDemon' available on CRAN. Ben Bolker bbol...@gmail.com Sent by: r-help-boun...@r-project.org 08/29/2011 02:50 PM To r-h...@stat.math.ethz.ch cc Subject Re: [R] Bayesian functions for mle2 object Billy.Requena billy.requena at gmail.com writes: Hi everybody, I'm interested in evaluating the effect of a continuous variable on the mean and/or the variance of my response variable. I have built functions expliciting these and used the 'mle2' function to estimate the coefficients, as follows: func.1 - function(m=62.9, c0=8.84, c1=-1.6) { s - c0+c1*(x) -sum(dnorm(y, mean=m, sd=s,log=T)) } m1 - mle2(func.1, method=SANN) However, the estimation of the effect of x on the variance of y usually has dealt some troubles, resulting in no convergencies or sd of estimates extremely huge. I tried using different optimizers, but I still faced the some problems. When I had similar troubles in 'GLMM' statistical universe, I used bayesian functions to solve this problem, enjoyning the flexibility of different start points to reach the maximum likelihood estimates. However, I have no idea which package or which function to use to solve the specific problem I'm facing now. Does anyone have a clue? Thanks in advance Unless I'm missing something, you can fit this model (more easily) in gls() from the nlme package, which allows models for heteroscedasticity. See ?nlme::varConstPower gls(y~1,weights=varPower(power=1,form=~x),data) This gives you a standard deviation proportional to (t1+|v|); that is, if the baseline residual standard deviation is S, then the standard deviation is S*(t1+|v|), so S would correspond to your c1 and S*t1 would correspond to your c0. Ben Bolker __ 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] Using Mplus via R
Yes. If you want a program that does some of what Mplus does, use the lavaan package or the sem package. Dimitri Liakhovitski dimitri.liakhovit...@gmail.com Sent by: r-help-boun...@r-project.org 07/18/2011 05:36 PM To r-help r-help@r-project.org cc Subject [R] Using Mplus via R Clarification question: does one need Mplus installed in order to use Mplus Automation package? -- Dimitri Liakhovitski www.ninah.com __ 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] Value of 'pi'
A transcendental number is not the zero of any polynomial with rational, not just integer, coefficients . Ravi Varadhan rvarad...@jhmi.edu Sent by: r-help-boun...@r-project.org 05/31/2011 10:12 AM To 'Bentley Coffey' bentleygcof...@gmail.com, Vincy Pyne vincy_p...@yahoo.ca cc r-help@r-project.org r-help@r-project.org Subject Re: [R] Value of 'pi' `pi' is more than irrational - it is transcendental, which mean it cannot be the zero of a polynomial with integer coefficient. All transcendentals are irrationals, but not vice-versa. I have also heard (courtesy: John Nash) that `pi' is the ratio of actual time it takes to complete your thesis to the anticipated time. I have also heard that March 14 is the official `pi' day in the US (probably not in Indiana!). Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi.edu -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Bentley Coffey Sent: Monday, May 30, 2011 9:01 PM To: Vincy Pyne Cc: r-help@r-project.org Subject: Re: [R] Value of 'pi' Pi is an irRATIOnal number, meaning that it is not equal to the ratio of any integers (whole numbers). Hence, 22/7 is ONLY an approximation. The built-in value for pi in R is also just an approximation (pi has no terminal digit on the right of the decimal point so any finite number of digits will just be an approximation). Yet, the built-in value for pi in R is a more precise approximation, which is usually preferred... On May 30, 2011 2:02 AM, Vincy Pyne vincy_p...@yahoo.ca wrote: Dear R helpers, I have one basic doubt about the value of pi. In school, we have learned that pi = 22/7 (which is = 3.142857). However, if I type pi in R, I get pi = 3.141593. So which value of pi should be considered? Regards Vincy [[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-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] How to regress data into coefficients for a gamma function
Regression for the gamma distribution can be expressed as a generalized linear model. Check Chapter 8 of McCullagh, P. Nelder, J. A. (1989), Generalized linear models, Chapman Hall, London, UK. Walter Anderson wandrso...@gmail.com Sent by: r-help-boun...@r-project.org 03/29/2011 09:57 AM To r-help@r-project.org cc Subject [R] How to regress data into coefficients for a gamma function Hello, I need to regress data like the example below. The data points represent friction factors derived from observed trip length data. The function used to describe this data is a gamma function of the form, f(t) = a * t^b * e^(c*t) and I need to regress the data to obtain the a,b, and c coefficients. The gamma function can also be expressed in the log-linear form, ln[f(t)] = ln[a] + b * ln[t] + c*t, which may be easier to perform a regression on. I have performed a search for information on the subject, and have found a few possibly related sites, I can not figure out how to perform the regression in R. Any help/guidance would be appreciated. Walter tf ln(f) 1 195289313 2 295107713 3 394599113 4 494235813 5 593945213 6 689549413 7 789186113 8 888241613 9 987369713 101086788513 111179777113 121279159513 131377924313 141477306813 151576580213 161663538313 171762848113 181862048813 191961285913 202060959013 212150859713 222250351113 232349842513 242449006913 252548607313 262642286212 272741886612 282841523312 292940833112 303040542412 313126338012 323226120112 333325720412 343425284512 353525066512 363620997812 373720598112 383820343812 393919907912 404019726312 414115475811 424215294211 434314930911 444414858311 454514749311 46469808611 47479772311 48489590611 49499409011 50509336311 51518173811 52528101211 53538064911 54547955911 55557919511 56567047711 57577047711 58587047711 59597047711 60607047711 61614286710 62624214010 63634214010 64644214010 65654177710 66663669110 67673632810 68683596510 69693596510 70703596510 71713196810 72723196810 73733196810 74743196810 75753160510 7676210709 7777207079 7878207079 7979203439 8080199809 8181159849 8282159849 8383159849 8484159849 8585159849 8686141689 8787141689 8888141689 8989141689 9090141689 __ 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] Strange R squared, possible error
lm(y~x+0) yields the regression on x without the constant, i.e., y=bx+e, not y = a +e derek jan.kac...@gmail.com Sent by: r-help-boun...@r-project.org 03/16/2011 03:49 PM To r-help@r-project.org cc Subject [R] Strange R squared, possible error k=lm(y~x) summary(k) returns R^2=0.9994 lm(y~x) is supposed to find coef. a anb b in y=a*x+b l=lm(y~x+0) summary(l) returns R^2=0.9998 lm(y~x+0) is supposed to find coef. a in y=a*x+b while setting b=0 The question is why do I get better R^2, when it should be otherwise? Im sorry to use the word MS exel here, but I verified it in exel and it gives: R^2=0.9994 when y=a*x+b is used R^2=0.99938 when y=a*x+0 is used -- View this message in context: http://r.789695.n4.nabble.com/Strange-R-squared-possible-error-tp3382818p3382818.html Sent from the R help mailing list archive at Nabble.com. __ 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] Bug in lattice auto.key argument
The Lattice auto.key argument has a bug in R.12.2. R version 2.12.2 (2011-02-25) Platform: i386-pc-mingw32/i386 (32-bit) other attached packages: [1] lattice_0.19-17 loaded via a namespace (and not attached): [1] grid_2.12.2 If I set up my plot parameters as require(lattice) superpose.line.settings - trellis.par.get(superpose.line) str(superpose.line.settings) superpose.line.settings$col - 1 superpose.line.settings$lty - c(1,2,5) * superpose.line.settings$lwd - 2 trellis.par.set(superpose.line,superpose.line.settings) and then set up my key list as my.key - list(space=top, points=FALSE, lines=TRUE, columns=3) and then run xyplot with the argument auto.key=my.key, I do NOT get the proper legend at the top of the plot. Instead of the lines in the legend having the characteristics of lty=c(1,2,5), they have the characteristics of lwd=c(1,2,5). The auto.key argument works fine in R.12.1 R version 2.12.1 (2010-12-16) Platform: i386-pc-mingw32/i386 (32-bit) . other attached packages: [1] lattice_0.19-13 loaded via a namespace (and not attached): [1] grid_2.12.1 Joe [[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] A Math question
I just found out that the sum of 1+2+3+... is -1/12. !?! Crazy. Not really. Google on divergent series or Euler summation. The result explains why bosonic string theory must operate only in 26 dimensions! It would then appear that ... -3 - 2 - 1 + 0 +1 +2 +3 + ... is zero. peter dalgaard pda...@gmail.com Sent by: r-help-boun...@r-project.org 02/15/2011 11:53 AM To David Winsemius dwinsem...@comcast.net cc r-help@r-project.org, Kjetil Halvorsen kjetilbrinchmannhalvor...@gmail.com, Maithula Chandrashekhar m.chandrashekhar1...@gmail.com Subject Re: [R] A Math question On Feb 15, 2011, at 15:17 , David Winsemius wrote: On Feb 14, 2011, at 7:33 PM, Kjetil Halvorsen wrote: or even better: http://mathoverflow.net/ I beg to differ. That is designated in its FAQ as expecting research level questions, while the forum I offered is labeled as Welcome to QA for people studying math at any level and professionals in related fields. I don't think the proffered question could be considered research level. Yep. As for the stats contents, we do actually touch upon the question in basic probability. This is the reason that sums over infinite index sets are only defined if the corresponding sum of the absolute value is finite: Otherwise the result depends on the order of summation. (Think 0+1+2+(-1)+3+4+(-2)+5+6+(-3)+) On Sun, Feb 13, 2011 at 8:02 PM, David Winsemius dwinsem...@comcast.net wrote: On Feb 13, 2011, at 4:47 PM, Maithula Chandrashekhar wrote: Dear all, I admit this is not anything to do R and even with Statistics perhaps. Strictly speaking this is a math related question. However I have some reasonable feeling that experts here would come up with some elegant suggestion to my question. Here my question is: What is sum of all Integers? I somewhere heard that it is Zero as positive and negative integers will just cancel each other out. However want to know is it correct? There are more appropriate places to pose such questions: http://math.stackexchange.com/ David Winsemius, MD West Hartford, CT __ 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. -- Peter Dalgaard Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd@cbs.dk Priv: pda...@gmail.com __ 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] A Math question
Kjetil et al, Unlike finite sums, infinite sums are not commutative. To have commutativity, one must have absolute summability, that is, the sum of the absolute values of the terms must be finite. If one has absolute summability, the infinite sum exists and is unique. This sum is not absolutely summable and thus undefined. If one does not require commutativity, then the order of the summation must be specified. The order is often implicitly assumed to be the order of the integers. The sum of the negative integers is negative infinity, the sum of the positive integers is infinity, and the sum of these two sums is undefined. However, Riemann's rearrangement theorem shows that the terms can be re-ordered to yield any sum whatsoever. In particular, if one creates pairs of terms consisting of a positive integer and its negative, then the infinite sum is zero. So the unique sum is undefined; otherwise the sum depends on the order of addition. Joe David Winsemius dwinsem...@comcast.net Sent by: r-help-boun...@r-project.org 02/15/2011 09:17 AM To Kjetil Halvorsen kjetilbrinchmannhalvor...@gmail.com cc r-help@r-project.org, Maithula Chandrashekhar m.chandrashekhar1...@gmail.com Subject Re: [R] A Math question On Feb 14, 2011, at 7:33 PM, Kjetil Halvorsen wrote: or even better: http://mathoverflow.net/ I beg to differ. That is designated in its FAQ as expecting research level questions, while the forum I offered is labeled as Welcome to QA for people studying math at any level and professionals in related fields. I don't think the proffered question could be considered research level. On Sun, Feb 13, 2011 at 8:02 PM, David Winsemius dwinsem...@comcast.net wrote: On Feb 13, 2011, at 4:47 PM, Maithula Chandrashekhar wrote: Dear all, I admit this is not anything to do R and even with Statistics perhaps. Strictly speaking this is a math related question. However I have some reasonable feeling that experts here would come up with some elegant suggestion to my question. Here my question is: What is sum of all Integers? I somewhere heard that it is Zero as positive and negative integers will just cancel each other out. However want to know is it correct? There are more appropriate places to pose such questions: http://math.stackexchange.com/ David Winsemius, MD West Hartford, CT __ 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] OT: Is randomization for targeted cancer therapies ethical?
Clearly inferior treatments are unethical. Donald Berry at MD Anderson in Houston TX and Jay Kadane at Carnegie Mellon have been working on more ethical designs within the Bayesian framework. In particular, response adaptive designs reduce the assignment to and continuation of patients on inferior treatments. Bert Gunter gunter.ber...@gene.com Sent by: r-help-boun...@r-project.org 09/20/2010 01:31 PM To r-help@r-project.org cc Subject [R] OT: Is randomization for targeted cancer therapies ethical? Hi Folks: **Off Topic** Those interested in clinical trials may find the following of interest: http://www.nytimes.com/2010/09/19/health/research/19trial.html It concerns the ethicality of randomizing those with life-threatening disease to relatively ineffective SOC when new biologically targeted therapies appear to be more effective. While the context may be new, the debate, itself, is not: Tukey wrote (or maybe it was talked -- I can't remember for sure) about this about 30 years ago. I'm sure many other also have done so. Cheers, Bert -- Bert Gunter Genentech Nonclinical Biostatistics __ 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] confidence intervals around p-values
A confidence interval around the p-value makes no sense because there is no parameter being estimated, but the sampling distribution of the p-value makes a lot of sense. The pre-observational P-value is a random variable that is a function of the underlying random variable being tested. That is, P_X(t) = Pr(Xt) is itself a random variable with density, distribution, and moments. Thus, one can compute the 95% sampling distribution around the expectation of P. See Hung, H. M. J.; O'Neill, R. T.; Bauer, P. Kohne, K. The behavior of the P-value when the alternative hypothesis is true Biometrics, 1997, 53, 1-22 Donahue, R. M. J. A note on information seldom reported via the p value. The American Statistician, American Statistical Association, 1999, 53, 303-306 Greg Snow greg.s...@imail.org Sent by: r-help-boun...@r-project.org 09/09/2010 12:29 PM To ted.hard...@manchester.ac.uk ted.hard...@manchester.ac.uk, r-help@r-project.org r-help@r-project.org cc Fernando Marmolejo Ramos fernando.marmolejora...@adelaide.edu.au Subject Re: [R] confidence intervals around p-values One other case where a confidence interval on a p-value may make sense is permutation (or other resampling) tests. The population parameter p-value would be the p-value that would be obtained from the distribution of all possible permutations, but in practice we just sample from that population and estimate a p-value. The confidence interval would then be based on the number of sample permutations and could give an idea if that number was big enough. If the full confidence interval is less than alpha then you can be confident that the true p-value would give significance, if it is completely above alpha then it is not significant. The real problem comes when the confidence interval includes alpha, that would indicate that B (the number of resamples/permutations) was not large enough. Be careful, doing a small number of permutations then deciding to do more based on the CI would likely introduce bias (how much is another question). The nice thing is that in this case the p-value is a simple proportion and the confidence interval can be computed using binom.test. But, I fully agree that in most cases the idea of a CI for a p-value is not meaningful, you need to have some case where your p-value is an estimate of a population parameter p-value that has some meaning. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Ted Harding Sent: Thursday, September 09, 2010 8:25 AM To: r-help@r-project.org Cc: Fernando Marmolejo Ramos Subject: Re: [R] confidence intervals around p-values On 09-Sep-10 13:21:07, Duncan Murdoch wrote: On 09/09/2010 6:44 AM, Fernando Marmolejo Ramos wrote: Dear all I wonder if anyone has heard of confidence intervals around p-values... That doesn't really make sense. p-values are statistics, not parameters. You would compute a confidence interval around a population mean because that's a parameter, but you wouldn't compute a confidence interval around the sample mean: you've observed it exactly. Duncan Murdoch Duncan has succinctly stated the essential point in the standard interpretation. The P-value is calculated from the sample in hand, a definite null hypothesis, and the distribution of the test statistic given the null hyptohesis, so (given all of these) there is no scope for any other answer. However, there are circumstances in which the notion of confidence interval for a P-value makes some sense. One such might be the Mann-Whitney test for identity of distribution of two samples of continuous variables, where (because of discretisation of the values when they were recorded) there are ties. Then you know in theory that the underlying values are all different, but because you don't know where these lie in the discretisation intervals you don't know which way a tie may split. So it would make sense to simulate by splitting ties at random (e.g. uniformly distribute each 1.5 value over the interval (1.5,1.6) or (1.45,1.55)). For each such simulated tie-broken sample, calculate the P-value. Then you get a distribution of exact P-values calculated from samples without ties which are consistent with the recorded data. The central 95% of this distribution could be interpreted as a 95% coinfidence interval for the true P-value. To bring this closer to on-topic, here is an example in R (rounding to intervals of 0.2): set.seed(51324) X - sort(2*round(0.5*rnorm(12),1)) Y - sort(2*round(0.5*rnorm(12)+0.25,1)) rbind(X,Y) # [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] # X -1.8 -1.2 -0.8 -0.6 0.00 0.2 0.2 1.2 1.8 2 2.2 # Y -1.2 -0.4 -0.2 0.4 0.41 1.0 1.0 1.2 1.8 2 2.6
Re: [R] path analysis
There are three paths to path analysis in R: the SEM package; the LAVAAN package; and the OpenMx approach. The first two are R programs. The last accesses the program OpenMx. Guy rotem rottem...@gmail.com Sent by: r-help-boun...@r-project.org 09/06/2010 10:37 AM To r-help@r-project.org cc Subject [R] path analysis Hi. which package i need to install to be able to run Path analysis using r? many thanks, Guy -- Guy Rotem Department of Life Sciences The Spatial Ecology Lab Ben Gurion University of the Negev P.O.B. 653 Beer-Sheva 84105 ISRAEL +972-52-3354485 (mobile) +972-8-6461350 (lab) [[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] Brown-Forsythe test of equality of MEANS
The following reference that contains a short Fortran program for the Brown-Forsythe ANOVA Reed, James F., I. Stark, D. B. Robust alternatives to traditional analyses of variance: Welch $W^*$, James $J_I^*$, James $J_II^*$, and Brown-Forsythe $BF^*$ Computer Methods and Programs in Biomedicine, 1988, 26, 233-238 Iasonas Lamprianou lampria...@yahoo.com Sent by: r-help-boun...@r-project.org 08/30/2010 04:05 PM To r-help@r-project.org cc Subject [R] Brown-Forsythe test of equality of MEANS Dear friends, two years ago (as I found on the web) Paul sent the following message but I was not able to find if he got an answer. Today I have the same question and it would be great if I could find out that this test has been implemented (somehow) in R. Please do not confuse it with the Brown-Forsythe test of equality of variances. Thank you: I've been searching around for a function for computing the Brown-Forsythe F* statistic which is a substitute for the normal ANOVA F statistic for when there are unequal variances, and when there is evidence of non-normality. A couple of other people have asked this question, the responses I found have been: ?oneway.test However, that function appears to use the Welch W statistic which, while good at handling unequal variances, is not as good as F* at handling non-normal distributions (or so my textbook tells me). So, two questions: 1. Is there a function ready to use for calculating the Brown-Forsythe F*? 2. If not, what do people use for checking the results of a (one-way) ANOVA when there is non-normality as well as non-constant variances? Thanks, Dr. Iasonas Lamprianou Assistant Professor (Educational Research and Evaluation) Department of Education Sciences European University-Cyprus P.O. Box 22006 1516 Nicosia Cyprus Tel.: +357-22-713178 Fax: +357-22-590539 Honorary Research Fellow Department of Education The University of Manchester Oxford Road, Manchester M13 9PL, UK Tel. 0044 161 275 3485 iasonas.lampria...@manchester.ac.uk __ 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] Brown-Forsythe test of equality of MEANS
Yes. I too remember BMD, BMDP, punch cards, computer printouts, and 24-hour turn-around. However, I am also old enough that when someone asks for an antique method, I will gladly supply it if I can, if only for historical reasons. Bert Gunter gunter.ber...@gene.com 08/31/2010 04:41 PM To jlu...@ria.buffalo.edu cc Iasonas Lamprianou lampria...@yahoo.com, r-help@r-project.org, r-help-boun...@r-project.org Subject Re: [R] Brown-Forsythe test of equality of MEANS Learned Folks: Well, I've already advertised my ignorance about these matters, so I have nothing to lose by plunging ahead with further Questionable advice. From the references cited, Brown-Forsythe originated in the statistical medieval age -- that is, prior to large scale, cheap computing (to be honest, I have dim memories of it in BMD!). Then cameth Brad Efron and the enlightenment: If you are concerned about the distribution of this -- or indeed any reasonably smooth statistic (and some not so smooth: Hinkley - Davison's Bootstrap book has details) -- then bootstrap it. That is, get a confidence interval for the difference in means and see whether 0 falls within (or whatever Null you wish to test). If you are concerned about robustness (whatever that means in this context), well, gosheth! -- we have journeyed a long way since the 1970's. Indeed, there are several packages (e.g. robust, robustbase) with lots of robust alternatives. Most (maybe all?) of which can be bootstrapped, of course. So walketh with thy computers, my brethren, and enter the great age of enlightenment. (Thus endeth the lesson. Caveat Emptor!) Cheers to all, Bert On Tue, Aug 31, 2010 at 12:26 PM, jlu...@ria.buffalo.edu wrote: The following reference that contains a short Fortran program for the Brown-Forsythe ANOVA Reed, James F., I. Stark, D. B. Robust alternatives to traditional analyses of variance: Welch $W^*$, James $J_I^*$, James $J_II^*$, and Brown-Forsythe $BF^*$ Computer Methods and Programs in Biomedicine, 1988, 26, 233-238 Iasonas Lamprianou lampria...@yahoo.com Sent by: r-help-boun...@r-project.org 08/30/2010 04:05 PM To r-help@r-project.org cc Subject [R] Brown-Forsythe test of equality of MEANS Dear friends, two years ago (as I found on the web) Paul sent the following message but I was not able to find if he got an answer. Today I have the same question and it would be great if I could find out that this test has been implemented (somehow) in R. Please do not confuse it with the Brown-Forsythe test of equality of variances. Thank you: I've been searching around for a function for computing the Brown-Forsythe F* statistic which is a substitute for the normal ANOVA F statistic for when there are unequal variances, and when there is evidence of non-normality. A couple of other people have asked this question, the responses I found have been: ?oneway.test However, that function appears to use the Welch W statistic which, while good at handling unequal variances, is not as good as F* at handling non-normal distributions (or so my textbook tells me). So, two questions: 1. Is there a function ready to use for calculating the Brown-Forsythe F*? 2. If not, what do people use for checking the results of a (one-way) ANOVA when there is non-normality as well as non-constant variances? Thanks, Dr. Iasonas Lamprianou Assistant Professor (Educational Research and Evaluation) Department of Education Sciences European University-Cyprus P.O. Box 22006 1516 Nicosia Cyprus Tel.: +357-22-713178 Fax: +357-22-590539 Honorary Research Fellow Department of Education The University of Manchester Oxford Road, Manchester M13 9PL, UK Tel. 0044 161 275 3485 iasonas.lampria...@manchester.ac.uk __ 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] Regression Error: Otherwise good variable causes singularity. Why?
There appears to be a problem in both regressions, as a singularity is also reported in the second regression analysis as well. It appears that the litrate variable is considered a factor in the first analysis and continuous in the second. There also appears to be collinearity between the litrate variable and the Africa variable. Look at the package lm.influence for regression diagnostics. asdir dirkroettg...@gmail.com Sent by: r-help-boun...@r-project.org 08/12/2010 10:35 AM To r-help@r-project.org cc Subject [R] Regression Error: Otherwise good variable causes singularity. Why? This command cdmoutcome- glm(log(value)~factor(year) +log(gdppcpppconst)+log(gdppcpppconstAII) +log(co2eemisspc)+log(co2eemisspcAII) +log(dist) +fdiboth +odapartnertohost +corrupt +log(infraindex) +litrate +africa +imr , data=cdmdata2, subset=zero==1, gaussian(link = identity)) results in this table Coefficients: (1 not defined because of singularities) Estimate Std. Error t value Pr(|t|) (Intercept)1.216e+01 5.771e+01 0.211 0.8332 factor(year)2006 -1.403e+00 5.777e-01 -2.429 0.0157 * factor(year)2007 -2.799e-01 7.901e-01 -0.354 0.7234 log(gdppcpppconst) 2.762e-01 5.517e+00 0.050 0.9601 log(gdppcpppconstAII) -1.344e-01 9.025e-01 -0.149 0.8817 log(co2eemisspc) 5.655e+00 2.903e+00 1.948 0.0523 . log(co2eemisspcAII) -1.411e-01 4.245e-01 -0.332 0.7399 log(dist) -2.938e-01 4.023e-01 -0.730 0.4658 fdiboth1.326e-04 1.133e-04 1.171 0.2425 odapartnertohost 2.319e-03 1.437e-03 1.613 0.1078 corrupt1.875e+00 3.313e+00 0.566 0.5718 log(infraindex)4.783e+00 1.091e+01 0.438 0.6615 litrate0.47 -2.485e+01 3.190e+01 -0.779 0.4365 litrate0.499 -1.657e+01 2.591e+01 -0.639 0.5230 litrate0.523 -2.440e+01 3.427e+01 -0.712 0.4769 litrate0.528 -9.184e+00 1.379e+01 -0.666 0.5060 litrate0.595 -2.309e+01 2.776e+01 -0.832 0.4062 litrate0.66 -1.451e+01 2.734e+01 -0.531 0.5961 litrate0.675 -1.707e+01 2.813e+01 -0.607 0.5444 litrate0.68 -6.346e+00 1.063e+01 -0.597 0.5509 litrate0.699 2.717e+00 3.541e+00 0.768 0.4434 litrate0.706 -1.960e+01 2.933e+01 -0.668 0.5046 litrate0.714 -2.586e+01 4.002e+01 -0.646 0.5186 litrate0.736 5.641e+00 1.561e+01 0.361 0.7181 litrate0.743 -2.692e+01 4.253e+01 -0.633 0.5273 litrate0.762 -2.208e+01 3.100e+01 -0.712 0.4767 litrate0.802 -2.325e+01 3.766e+01 -0.617 0.5375 litrate0.847 -2.620e+01 3.948e+01 -0.664 0.5075 litrate0.86 -3.576e+01 4.950e+01 -0.722 0.4707 litrate0.864 -4.482e+01 6.274e+01 -0.714 0.4755 litrate0.872 -1.946e+01 2.715e+01 -0.717 0.4739 litrate0.877 -2.710e+01 3.702e+01 -0.732 0.4646 litrate0.879 -3.460e+01 5.147e+01 -0.672 0.5020 litrate0.886 -3.276e+01 4.860e+01 -0.674 0.5008 litrate0.889 -4.120e+01 5.755e+01 -0.716 0.4746 litrate0.904 -2.282e+01 2.985e+01 -0.764 0.4453 litrate0.91 -3.478e+01 5.037e+01 -0.691 0.4904 litrate0.923 -1.762e+01 2.551e+01 -0.691 0.4902 litrate0.925 -2.445e+01 3.611e+01 -0.677 0.4990 litrate0.926 -2.995e+01 4.565e+01 -0.656 0.5123 litrate0.928 -2.839e+01 3.933e+01 -0.722 0.4710 litrate0.937 -2.571e+01 3.795e+01 -0.677 0.4986 litrate0.94 -2.109e+01 3.051e+01 -0.691 0.4900 litrate0.959 -2.078e+01 2.895e+01 -0.718 0.4735 litrate0.96 -3.403e+01 4.798e+01 -0.709 0.4787 litrate0.962 -4.084e+01 5.755e+01 -0.710 0.4785 litrate0.971 -3.743e+01 5.247e+01 -0.713 0.4761 litrate0.98 -3.709e+01 5.170e+01 -0.717 0.4737 litrate0.986 -2.663e+01 4.437e+01 -0.600 0.5488 litrate0.991 -3.045e+01 4.166e+01 -0.731 0.4654 litrate1 -2.732e+01 4.459e+01 -0.613 0.5405 africaNA NA NA NA imr2.160e+00 9.357e-01 2.309 0.0216 * although it should result in something similar to this: Coefficients: (1 not defined because of singularities) Estimate Std. Error t value Pr(|t|) (Intercept)1.216e+01 5.771e+01 0.211 0.8332 factor(year)2006 -1.403e+00 5.777e-01 -2.429 0.0157 * factor(year)2007 -2.799e-01 7.901e-01 -0.354 0.7234 log(gdppcpppconst) 2.762e-01 5.517e+00 0.050 0.9601 log(gdppcpppconstAII)
Re: [R] integral in R
help(integrate) Nathalie Gimenes ncgmsanc...@gmail.com Sent by: r-help-boun...@r-project.org 07/19/2010 04:59 PM To r-help@r-project.org cc Subject [R] integral in R Hello All, I have to create a variable that is a function of another one (already created), its cumulative distribution function and the integral of this cumulative distribution, with limits: 0 and the value of the variable. To be clear, I have the variable called âcipâ. And its cdf called âcdfcipâ I need to create the variable: bip = cip + ((1 â cdfcip)^4)*integral((1-cdf(u))^4*du, 0, value of the variable cip) The problem: I donât know how to do this integral. It is like a integral of ((1 â F(u))^4*du with limits 0 and a value c of individual i in case p of the variable cip. Does anybody knows how to do it? Am I clear with the question? Thank you very much! Nathalie [[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] Popularity of R, SAS, SPSS, Stata...
Yes. When my young son told someone that I was a doctor, he had to further explain I was a number doctor, not a people doctor. Barry Rowlingson b.rowling...@lancaster.ac.uk Sent by: r-help-boun...@r-project.org 06/22/2010 09:45 AM To Marc Schwartz marc_schwa...@me.com cc r-help@r-project.org, Patrick Burns pbu...@pburns.seanet.com Subject Re: [R] Popularity of R, SAS, SPSS, Stata... On Tue, Jun 22, 2010 at 2:37 PM, Marc Schwartz marc_schwa...@me.com wrote: Well yes, I've used it myself I think, but I was hoping for something a bit 'sexier'. L'analyse des Données Say it with a deep voice ;-) If you use R in a health or medical context, and are asked what you do, then you can tell people I save lives - with numbers Barry __ 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] What does LOESS stand for?
The closest explanation of the term loess I can find is in Local regression models by Cleveland, W. S.; Grosse, E. Shyu, W. M. (Chapter 8 of Statistical models in S (1992) by Chambers, J. M. Hastie, T. J.) ... local regression models is called loess, which is short for local regression, and was chosen as the name since a loess is a deposit of fine clay or silt ..., and is a surface of sorts. (p. 314). Tal Galili tal.gal...@gmail.com Sent by: r-help-boun...@r-project.org 05/31/2010 12:39 PM To Peter Neuhaus pneuh...@pneuhaus.de cc r-help@r-project.org Subject Re: [R] What does LOESS stand for? Hi Peter, If this article is correct: http://www.r-bloggers.com/abbreviations-of-r-commands-explained-250-r-abbreviations/ Loess stands for: [LO]cally [E]stimated [S]catterplot [S]moothing Best, Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) -- On Mon, May 31, 2010 at 12:33 PM, Peter Neuhaus pneuh...@pneuhaus.dewrote: Dear R-community, maybe someone can help me with this: I've been using the loess() smoother for quite a while now, and for the matter of documentation I'd like to resolve the acronym LOESS. Unfortunately there's no explanation in the help file, and I didn't get anything convincing from google either. I know that the predecessor LOWESS stands for Locally Weighted Scatterplot Smoothing. But what does LOESS stand for, specifically? Locally Weighted Exponential Scatterplot Smoothing? As far as I understand LOESS is still a local polynomial regression, so that would probably make no sense. Any help appreciated! Thanks in advance, Peter __ 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] Expectation of E(x^1/2)
Ben, Ravi, Chuck, and Haneef, Note that the standard normal density can be written (in pseudo-TeX) as 1/sqrt(2*pi) * exp[- ( x/sqrt(2) )^2]. The exponential on the right is a special case of the stretched exponential function exp[- (x/sqrt(tau))^beta]. The stretched exponential function has a nontrivial density and distribution. However, the nth moment of this density is tau^(n)/beta * Gamma[(n)/beta]. The substitution of n=3/2 (not 1/2), tau=sqrt(2), and beta=2, and multiplying by 1/sqrt(2*pi) yields the Mathematica result below. See http://en.wikipedia.org/wiki/Stretched_exponential_function. The use of n=3/2 rather than 1/2 is required because the stretched exponential function is already a function for the first moment. Joe Ben Bolker bol...@ufl.edu Sent by: r-help-boun...@r-project.org 04/11/2010 01:09 AM To Ravi Varadhan rvarad...@jhmi.edu cc r-h...@stat.math.ethz.ch r-h...@stat.math.ethz.ch Subject Re: [R] Expectation of E(x^1/2) And Mathematica says In[2]:= 1/Sqrt[2 Pi] Integrate[Exp[-x^2/2] Sqrt[x],{x,0,Infinity}] 3 Gamma[-] 4 Out[2]= - 3/4 2Sqrt[Pi] (I suppose there's probably a change-of-variables trick to do this ...) in R: gamma(3/4)/(2^(3/4)*sqrt(pi)) [1] 0.4110895 Ravi Varadhan wrote: Chuck showed how to do this: fn - function(x) sqrt(x) * dnorm(x) integrate(fn, 0, Inf) 0.4110895 with absolute error 4.7e-05 So the (almost) exact answer is 0.4110895 + 1i * 0.4110895 __ 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] Cross-validation for parameter selection (glm/logit)
Jay Unless I have misunderstood some statistical subtleties, you can use the AIC in place of actual cross-validation, as the AIC is asymptotically equivalent to leave-out-one cross-validation under MLE. Joe Stone, M. An asymptotic equivalence of choice of model by cross-validation and Akaike's criterion Journal of the Royal Statistical Society. Series B (Methodological), 1977, 39, 44-47 Abstract: A logarithmic assessment of the performance of a predicting density is found to lead to asymptotic equivalence of choice of model by cross-validation and Akaike's criterion, when maximum likelihood estimation is used within each model. Jay josip.2...@gmail.com Sent by: r-help-boun...@r-project.org 04/02/2010 09:14 AM To r-help@r-project.org cc Subject [R] Cross-validation for parameter selection (glm/logit) If my aim is to select a good subset of parameters for my final logit model built using glm(). What is the best way to cross-validate the results so that they are reliable? Let's say that I have a large dataset of 1000's of observations. I split this data into two groups, one that I use for training and another for validation. First I use the training set to build a model, and the the stepAIC() with a Forward-Backward search. BUT, if I base my parameter selection purely on this result, I suppose it will be somewhat skewed due to the 1-time data split (I use only 1 training dataset) What is the correct way to perform this variable selection? And are the readily available packages for this? Similarly, when I have my final parameter set, how should I go about and make the final assessment of the models predictability? CV? What package? Thank you in advance, Jay __ 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] Stacking matrices
What is an easy way to stack a matrix multiple times? E.g. I have a 6x6 matrix that I need to stack vertically 154 times to get a 6*154 by 6 matrix. I would rather not rbind(X,X,...,X) matrices.--Joe [[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] OT Sorta: Odds Are, It's Wrong...
Which in turn reminds me of Box Tiao's line Since small differences in probability cannot be appreciated by the human mind, there seems little point in being excessively precise about uncertainty. Box, G. E. P. Tiao, G. C. (1973), Bayesian inference in statistical analysis, Addison-Wesley, Reading, MA, p. 65. Marc Schwartz marc_schwa...@me.com Sent by: r-help-boun...@r-project.org 03/15/2010 01:46 PM To ted.hard...@manchester.ac.uk cc r-help@r-project.org Subject Re: [R] OT Sorta: Odds Are, It's Wrong... On Mar 15, 2010, at 12:21 PM, Ted Harding wrote: On 15-Mar-10 16:22:13, Marc Schwartz wrote: Hi all, I thought that readers of R-Help might find the following article at ScienceNews of interest: Odds Are, It's Wrong Science fails to face the shortcomings of statistics By Tom Siegfried March 27th, 2010; Vol.177 #7 (p. 26) http://www.sciencenews.org/view/feature/id/57091/title/Odds_are,_its_wro ng Regards, Marc Schwartz If you changed your Subject to Odds R, it's wrong, arc, you might get more on-topic, Marc. Or at least increase people's subjective beliefs that it was OT. Yep, that was just way too obvious, wasn't it...Ar... I plead low serum glucose level this morning, after having some fasting blood work drawn... :-) That's not a bad article, as such things go! I was reminded of reading, many moons ago in a book[1] by John Ziman[2], words to the effect that[3]: If your experiment gives a result significant at the 5 per cent level, then 1 in 20 of your colleagues is entitled to disblieve you. [1] Ziman, John (1968). Public Knowledge: Essay Concerning the Social Dimension of Science. Cambridge University Press. ISBN 0-521-06894-0. [2] http://en.wikipedia.org/wiki/John_Ziman [3] I don't have the book immediately to hand (though I have it somewhere), so cannot vouch that the above is verbatim. However, it's not far off, and the final clause very probably is verbatim. In turn, that reminds me of Stephen Senn's writing in Dicing with Death: Chance, Risk and Health: We can predict nothing with certainty but we can predict how uncertain our predictions will be, on average that is. Regards, Marc __ 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] about IRT simulation
Helen Your program makes no sense. Try the following script I - 10 J - 5 response - matrix(0, 10, 5) #function for probability of response #revised but equivalent version of Helen's formula pij - function(a,b,theta) {1/(1+exp(-a*(theta-b)))} a - rnorm(J, 0.8, 0.04) a b - rnorm(J, 0, 1) b theta - rnorm(I, 0,1) theta for( i in 1:I ) { for( j in 1:J ) { response[i,j]-ifelse(pij(a=a[j], b=b[j], theta[i]) runif(1) , 0 ,1) } } response Helena helenaguchen...@hotmail.com Sent by: r-help-boun...@r-project.org 03/10/2010 11:03 PM To r-h...@stat.math.ethz.ch cc Subject [R] about IRT simulation hello R: we have a two-parameter IRT simulation code. The goal is to generate a response matrix.But the for part doesn't run. we don't know what is wrong with it. Thanks so much~~~ I - 10 J - 5 response - matrix(0, 10, 5) pij - function(a,b,theta) { a - rnorm(J, 0.8, 0.04) a b - rnorm(J, 0, 1) b theta - rnorm(I, 0,1) theta for( i in 1:I ) { for( j in 1:J ) { ptemp - runif(1) pij - exp(a[j]*(theta[i]-b[j]))/(1+exp(a[j]*(theta[i]-b[j]))) response[i,j]-ifelse(pij(b=b[j], a=a[j], theta[i]) ptemp , 0 ,1) } } } response helena __ 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] code
?density ?max Rahim Alhamzawi rahimalhamz...@yahoo.co.uk Sent by: r-help-boun...@r-project.org 12/09/2009 05:23 AM To r-h...@stat.math.ethz.ch cc Subject [R] code Dear support, I want to compute the highest probability density for any data. please do you have any code to help me in this subject. I am looking forward to hearing from you as soon as possible. rahim [[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] lm: RME vs. ML
You need to give your criteria for preferable. For normal-linear models, REML estimates of variances are unbiased, whereas ML estimates are downwardly biased. My intuition is that the ML-induced bias would be worse in small samples. I don't know about other distributions. Likewise I don't know about MSE or other criterion for preference. John Sorkin jsor...@grecc.umaryland.edu Sent by: r-help-boun...@r-project.org 12/07/2009 09:24 PM To r-help@r-project.org cc Subject [R] lm: RME vs. ML windows XP R 2.10 As pointed out by Prof. Venables and Ripley (MASS 4th edition, p275), the results obtained from lme using method=ML and method=REML are often different, especially for small datasets. Is there any way to determine which method is preferable for a given set of data? Thanks, john John David Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please call phone number above prior to faxing) Confidentiality Statement: This email message, including any attachments, is for th...{{dropped:13}} __ 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] The equivalence of t.test and the hypothesis testing of one way ANOVA
Guido wrote However, using a transformation matrix one can transform a model assuming unequal variances into an equivalent model assuming equal variances. On such a transformed model the F test or T test can be applied. This is indeed news to me. I thought such transformations for unequal variances applied only to cases where the variances were known. Unknown, unequal variances leads to the Behrens-Fisher problem and its generalizations, a problem not resolved by mere linear transformation. Correct me and point me to the literature if I've misunderstood. Joe Guido van Steen gvst...@yahoo.com 11/07/2009 09:28 AM To r-help@r-project.org cc jlu...@ria.buffalo.edu, Peng Yu pengyu...@gmail.com Subject Re: [R] The equivalence of t.test and the hypothesis testing of one way ANOVA Hi, Student's T-test is a test that can be used to test ONE SINGLE linear restriction - which serves the as alternative hypothesis - on a linear model - which serves as the null hypothesis - AT THE SAME TIME. Fisher's F test is an extension of the T test. The F test can be used to test ONE OR MORE linear restriction(s) on a linear model AT THE SAME TIME. So, to test a single restriction on a linear model one can use both the F test and the T test. When multiple restrictions are tested at the same time one needs to apply the F test. Both the F and the T test actually require equal variances. However, using a transformation matrix one can transform a model assuming unequal variances into an equivalent model assuming equal variances. On such a transformed model the F test or T test can be applied. The untransformed models are usually called general linear models. In R they can be handled using the glm() function. (See ?glm) A (one-way) Anova model is a specific type of general linear model (glm). So hypotheses on an Anova model are tested in exactly the same way as any other restrictions on a glm should be tested. Best wishes, Guido -- Message: 11 Date: Fri, 6 Nov 2009 09:48:18 -0500 From: jlu...@ria.buffalo.edu Subject: Re: [R] The equivalence of t.test and the hypothesis testing of oneway ANOVA To: Peng Yu pengyu...@gmail.com Cc: r-help-boun...@r-project.org, r-h...@stat.math.ethz.ch Message-ID: ofc71a4670.65d468b9-on85257666.0050ee14-85257666.00517...@ria.buffalo.edu Content-Type: text/plain There extensions to aov for without assuming equal variances. Reed, James F., I. Stark, D. B. (1988), 'Robust alternatives to traditional analyses of variance: Welch $W^*$, James $J_I^*$, James $J_II^*$, and Brown-Forsythe $BF^*$', Computer Methods and Programs in Biomedicine 26, 233--238. I don't know whether they are implemented in R. Peng Yu pengyu...@gmail.com Sent by: r-help-boun...@r-project.org 11/06/2009 07:59 AM To r-h...@stat.math.ethz.ch cc Subject Re: [R] The equivalence of t.test and the hypothesis testing of one way ANOVA Is it possible to use aov() to compute the same p-value that is generated by t.test() with var.equal=F. An assumption of ANOVA is equal variance, I'm wondering how to relax such assumption to allow non equal variance? On Thu, Nov 5, 2009 at 8:31 AM, Benilton Carvalho bcarv...@jhsph.edu wrote: compare t.test(x, y, var.equal=T) with summary(afit) b On Nov 5, 2009, at 12:21 PM, Peng Yu wrote: I read somewhere that t.test is equivalent to a hypothesis testing for one way ANOVA. But I'm wondering how they are equivalent. In the following code, the p-value by t.test() is not the same from the value in the last command. Could somebody let me know where I am wrong? set.seed(0) N1=10 N2=10 x=rnorm(N1) y=rnorm(N2) t.test(x,y) Welch Two Sample t-test data: x and y t = 1.6491, df = 14.188, p-value = 0.1211 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -0.2156863 1.6584968 sample estimates: mean of x mean of y 0.3589240 -0.3624813 A = c(rep('x',N1),rep('y',N2)) Y = c(x,y) fr = data.frame(Y=Y,A=as.factor(A)) afit=aov(Y ~ A,fr) X=model.matrix(afit) B=afit$coefficients V=solve(t(X) %*% X) mse=tail(summary(afit)[[1]]$'Mean Sq',1) df=tail(summary(afit)[[1]]$'Df',1) t_statisitic=(B/(mse * sqrt(diag(V[[2]] 2*(1-pt(abs(t_statisitic),df))#the p-value from aov [1] 0.1090802 __ 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-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
Re: [R] Bayesian regression stepwise function?
The BIC (Raftery) can be used for quasi-Bayesian model selection, but it's not stepwise. Ntzoufras shows how to use WinBUGS to conduct Bayesian model selection, but again it's not stepwise Ntzoufras, I. (2002), 'Gibbs variable selection using BUGS', Journal of Statistical Software 7(7), 1--19. Ntzoufras, I. (2009), Bayesian modeling using WinBUGS, Wiley, Hoboken, NJ. Raftery, A. E. (1995), 'Bayesian model selection in social research', Sociological Methodology 25, 111-163. Allan.Y all...@cmu.edu Sent by: r-help-boun...@r-project.org 10/22/2009 01:09 PM To r-help@r-project.org cc Subject [R] Bayesian regression stepwise function? Hi everyone, I am wondering if there exists a stepwise regression function for the Bayesian regression model. I tried googling, but I couldn't find anything. I know step function exists for regular stepwise regression, but nothing for Bayes. Thanks -- View this message in context: http://www.nabble.com/Bayesian-regression-stepwise-function--tp26013725p26013725.html Sent from the R help mailing list archive at Nabble.com. __ 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] Parameters of Beta distribution
Rescale your data x to (x-A)/(B-A). Maithili Shiva maithili_sh...@yahoo.com Sent by: r-help-boun...@r-project.org 10/07/2009 08:39 AM To r-help@r-project.org cc Subject [R] Parameters of Beta distribution Supose I have a data pertaining to credit loss as amounts - c(46839.50,31177.12,35696.69,21192.57,29200.91,42049.64,42422.19, 44976.18, 32135.36,47936.57,27322.91,37359.09,43179.60, 48381.02, 45872.38, 28057.30,44643.83,36156.33,16037.62, 45432.28) I am trying to fit Beta distribution (two parameters distribution but where lower bound and upper bounds are NOT 0 and 1 respectively). For this I need to estimate the two parameters of Beta distribution. I found some code in VGAM pacakge but it deals with standard Beta distribution i.e. lower bound (say A) = 0 and upper bound (say B) = 1. How do I estimate the parameters of the Beta distribution for above data where A and B are not 0's? Please guide. Thanking you in advance Maithili Add whatever you love to the Yahoo! India homepage. Try now! http://in.yahoo.com/trynew [[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] Unable to load rjags
I am trying to install rjags. Although I can install the library, I cannot load the package. See below. Here is my session sessionInfo() R version 2.9.2 (2009-08-24) i386-pc-mingw32 locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] coda_0.13-4 lattice_0.17-26 loaded via a namespace (and not attached): [1] grid_2.9.2 tools_2.9.2 Here I install the rjags package utils:::menuInstallPkgs() trying URL 'http://lib.stat.cmu.edu/R/CRAN/bin/windows/contrib/2.9/rjags_1.0.3-10.zip' Content type 'application/zip' length 308968 bytes (301 Kb) opened URL downloaded 301 Kb package 'rjags' successfully unpacked and MD5 sums checked The downloaded packages are in C:\Documents and Settings\jlucke\Local Settings\Temp\RtmpRAkMZy\downloaded_packages updating HTML package descriptions BUT, library(rjags) Error in fun(...) : Failed to locate JAGS 1.0.3 installation Error : .onLoad failed in 'loadNamespace' for 'rjags' Error: package/namespace load failed for 'rjags' Any advice? Joe [[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] Logistic Regression for Multinomial Data using R
Use polr from the MASS package Nimal Fernando pnp...@gmail.com Sent by: r-help-boun...@r-project.org 09/25/2009 12:33 PM To r-help@r-project.org cc Subject Re: [R] Logistic Regression for Multinomial Data using R Hi I want to do logistic regression for multinomial data. How can I do it in R? Thanks a lot Nimal Fernando [[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] P-value and R-squared variable selection criteria
Lucas This problem is very old --- older than keypunches. There are several methods for selecting variables (forward, backwards, both, all subsets) using a variety of criteria (p-values, R^2, adjusted R^2, Cp, AIC, BIC, and more). Be sure you understand the methods, especially the tendency to overfit. I use the BIC --- the function is stepAIC with parameter k = log(sample size) from the MASS package. Joe [[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] Contrasts within ANOVA frame (Repost)
Dr Shen Even though you pose 3 contrasts, there are only 2 degrees of freedom as the 3rd contrast is the sum of the first two. Your aov output states this as StdLot has only 2 df. Having used up your df, the aov has nothing to report. Joe Joseph F. Lucke Senior Statistician Research Institute on Addictions State University of New York at Buffalo 1021 Main Street Buffalo, NY 14203-1016 Office: 716-887-6807 Fax: 716-887-2510 http://www.ria.buffalo.edu/profiles/lucke.html Jun Shen jun.shen...@gmail.com Sent by: r-help-boun...@r-project.org 08/19/2009 05:33 PM To r-help@r-project.org cc Subject [R] Contrasts within ANOVA frame (Repost) Would like to try my luck to see if I can catch your eyes. I was trying to do some contrasts within ANOVA. I searched the archive and found a clue posted by Steffen Katzner ( http://tolstoy.newcastle.edu.au/R/help/06/01/19385.html) I have three levels for a factor names StdLot and want to make three comparisons, 1 vs 2, 1 vs 3 and 2 vs 3. First, contrasts(d3$StdLot,3)-matrix(c(1,-1, 0,0,1,-1,1,0,-1),3,3) #d3 is the data set. set up the contrast matrix Second, aov(Bkg~StdLot,na.rm=T,data=d3,contrasts=contrasts(d3$StdLot))-mod.aov #ANOVA, Finally, summary(mod.aov,split=list(StdLot=list('1 vs 2'=1,'2 vs 3'=2,'1 vs 3'=3))) #comparison summary Here is the final result I got, the third comparison is missing. Does anyone have any idea what is wrong here? If I change the order of the comparisons it's always the third one missing. So I guess it's not due to the data. Appreciate any comment. Df Sum Sq Mean Sq F valuePr(F) StdLot 2 1.905 0.953 10.3769 3.710e-05 *** StdLot: 1 vs 2 1 0.223 0.223 2.42390.1200 StdLot: 2 vs 3 1 1.683 1.683 18.3299 2.162e-05 *** StdLot: 1 vs 3 1 Residuals601 55.173 0.092 --- Signif. codes: 0 â***â 0.001 â**â 0.01 â*â 0.05 â.â 0.1 â â 1 2 observations deleted due to missingness -- Jun Shen PhD PK/PD Scientist BioPharma Services Millipore Corporation 15 Research Park Dr. St Charles, MO 63304 Direct: 636-720-1589 [[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] integrate lgamma from 0 to Inf
I am late to this discussion so forgive me if I am being redundant. It appears to me that the integral from 0 to infinity of log-gamma may diverge to infinity. Equation 6.1.50 of Abramowitz Stegun shows that a re-expression of lnGamma(x) and the Stirling approximation involves (x-1/2)*log(x) -x along with other terms. This term appears to dominate the integral and itself diverge. It is worth checking out. integrate(lgamma, lower = 0, upper = 10) 43.24636 with absolute error 1.6e-11 integrate(lgamma, lower = 0, upper = 100) 15438.12 with absolute error 1.4 integrate(lgamma, lower = 0, upper = 1000) 2701843 with absolute error 254 integrate(lgamma, lower = 0, upper = 1) 385485116 with absolute error 18464 gterm - function(x){(x-.5)*log(x)-x} integrate(gterm,lower=0,upper=10) 33.61633 with absolute error 1.1e-05 integrate(gterm,lower=0,upper=100) 15345.59 with absolute error 1.2 integrate(gterm,lower=0,upper=1000) 2700923 with absolute error 252 integrate(gterm,lower=0,upper=1) 385475926 with absolute error 18462 Joseph F. Lucke Senior Statistician Research Institute on Addictions University at Buffalo State University of New York 1021 Main Street Buffalo, NY 14203-1016 Office: 716-887-6807 Fax: 716-887-2510 http://www.ria.buffalo.edu/profiles/lucke.html Andreas Wittmann andreas_wittm...@gmx.de Sent by: r-help-boun...@r-project.org 04/22/2009 03:28 AM To r-help@r-project.org cc Subject [R] integrate lgamma from 0 to Inf Dear R users, i try to integrate lgamma from 0 to Inf. But here i get the message roundoff error is detected in the extrapolation table, if i use 1.0e120 instead of Inf the computation works, but this is against the suggestion of integrates help information to use Inf explicitly. Using stirlings approximation doesnt bring the solution too. ## Stirlings approximation lgammaApprox - function(x) { 0.5*log(2*pi)+(x-(1/2))*log(x)-x } integrate(lgamma, lower = 0, upper = 1.0e120) integrate(lgammaApprox, lower = 0, upper = 1.0e120) integrate(lgamma, lower = 0, upper = 1.0e120) 1.374051e+242 with absolute error 3.2e+235 integrate(lgammaApprox, lower = 0, upper = 1.0e120) 1.374051e+242 with absolute error 3.2e+235 integrate(lgamma, lower = 0, upper = Inf) integrate(lgammaApprox, lower = 0, upper = Inf) integrate(lgamma, lower = 0, upper = Inf) Fehler in integrate(lgamma, lower = 0, upper = Inf) : roundoff error is detected in the extrapolation table integrate(lgammaApprox, lower = 0, upper = Inf) Fehler in integrate(lgammaApprox, lower = 0, upper = Inf) : roundoff error is detected in the extrapolation table Many thanks if you have any advice for me! best regards Andreas -- __ 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] large factorials
I am late to this discussion so I apologize if what I say has already been noted. The function below does NOT require large factorials, but very small reciprocal of factorials. Thus if v2 would be replaced with something like exp(-lgamma(i-n+m+1)-lgamma(m+1)) and checked for underflow (ie .Machine$double.xmin), then the problem MAY be solved. E.g., sum1 - function(l,u,t,i,n,w,tol=.Machine$double.xmin) { v - 0 v2 - 1 for (m in 0 :w v2 tol) { v1 - ((u^(1/2))*(l^(1/2))*t)^(i-n+2*m) v2 - exp(-lgamma(i-n+m+1)-lgamma(m+1)) v3 - v1/v2 v - v+v3 } return(v) } sum1(1,2,10,80,3,80) [1] 7.043456e+207 sum1(1,2,10,80,3,100) [1] 8.804319e+207 sum1(1,2,10,80,3,200) [1] 1.760863e+208 sum1(1,2,10,80,3,1000) [1] 8.804314e+208 Joseph F. Lucke Senior Statistician Research Institute on Addictions University at Buffalo State University of New York 1021 Main Street Buffalo, NY 14203-1016 Office: 716-887-6807 Fax: 716-887-2510 http://www.ria.buffalo.edu/profiles/lucke.html molinar sky...@hotmail.com Sent by: r-help-boun...@r-project.org 04/23/2009 10:00 AM To r-help@r-project.org cc Subject Re: [R] large factorials Here is what I did: library(rSymPy) factorial.sympy - function(n) sympy(paste(factorial(, n, ))) factorial.sympy(171) [1] 124101807021766782342484052410310399261660557750169318538895180361199607522169175299275197812048758557646495950167038705280988985869071076733124203221848436431047357788996854827829075454156196485215346831804429323959817369689965723590394761615227855818006117636510842880 Which work perfectly. Here is one of my summation functions: sum1 - function(l,u,t,i,n,w) { + v - 0 + for (m in 0 :w) { + v1 - ((u^(1/2))*(l^(1/2))*t)^(i-n+2*m) + v2 - (factorial.sympy(i-n+m))*(factorial.sympy(m)) + v3 - v1/v2 + v - v+v3 + } + return(v) + } sum1(1,2,10,80,3,80) Error in (factorial.sympy(i - n + m)) * (factorial.sympy(m)) : non-numeric argument to binary operator I'm not sure why it works when I do the factorial normally but when I call my function it doesn't work? molinar wrote: Thank you everyone all of your posts were very helpful. I tried each one and I think I have about 10 new packages installed. The formula I need to calculate did not involve any logarithms but infinite summations of factorials, I'm sorry for not specifying. I read some things about using logarithms but I thought in my case I would have to do an e to the log and by doing that R still gave me the same problems with numbers over 170. But I was able to get it to work by using the last post about the rsympy packages. I tried downloading bc but I didn't know how to connect it to R, so R said could not find function bc. Thanks again for all of your help. Samantha Gabor Grothendieck wrote: Also the R sympy package can handle this: library(rSymPy) Loading required package: rJava factorial.sympy - function(n) sympy(paste(factorial(, n, ))) # note that first time sympy is called it loads java, jython and sympy # but on subsequent calls its faster. So make a dummy call first. factorial.sympy(10) [1] 3628800 # code from earlier post defining factorial.bc to be inserted here benchmark(replications=10, columns=c('test', 'elapsed'), + bc=factorial.bc(500), + sympy = factorial.sympy(500)) test elapsed 1bc2.17 2 sympy0.09 See the rSymPy, r-bc and rbenchmark home pages: http://rsympy.googlecode.com http://r-bc.googlecode.com http://rbenchmark.googlecode.com On Wed, Apr 22, 2009 at 3:21 PM, molinar sky...@hotmail.com wrote: I am working on a project that requires me to do very large factorial evaluations. On R the built in factorial function and the one I created both are not able to do factorials over 170. The first gives an error and mine return Inf. Is there a way to have R do these larger calculations (the calculator in accessories can do 1 factorial and Maple can do even larger) -- View this message in context: http://www.nabble.com/large-factorials-tp23175816p23175816.html Sent from the R help mailing list archive at Nabble.com. __ 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-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. -- View this message in context: http://www.nabble.com/large-factorials-tp23175816p23197344.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list
Re: [R] large factorials
The modified function I presented contains a stupid error, which is corrected below. sum1 - function(l,u,t,i,n,w,tol=.Machine$double.xmin) { v - 0 v2 - 1 for (m in 0 :w v2 tol) { v1 - ((u^(1/2))*(l^(1/2))*t)^(i-n+2*m) v2 - exp(-lgamma(i-n+m+1)-lgamma(m+1)) v3 - v1*v2 v - v+v3 } return(v) } sum1(1,2,10,80,3,80) [1] 5.519201e-23 sum1(1,2,10,80,3,100) [1] 6.892307e-23 sum1(1,2,10,80,3,200) [1] 1.375784e-22 sum1(1,2,10,80,3,1000) [1] 6.86821e-22 Need more coffee... Joseph F. Lucke Senior Statistician Research Institute on Addictions University at Buffalo State University of New York 1021 Main Street Buffalo, NY 14203-1016 Office: 716-887-6807 Fax: 716-887-2510 http://www.ria.buffalo.edu/profiles/lucke.html [[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] integrate lgamma from 0 to Inf
IMHO, you should consult an advanced text on calculus with integration over infinite intervals, so that you understand what you are trying to do. Joseph F. Lucke Senior Statistician Research Institute on Addictions University at Buffalo State University of New York 1021 Main Street Buffalo, NY 14203-1016 Office: 716-887-6807 Fax: 716-887-2510 http://www.ria.buffalo.edu/profiles/lucke.html Stavros Macrakis macra...@alum.mit.edu Sent by: r-help-boun...@r-project.org 04/27/2009 10:30 AM To Andreas Wittmann andreas_wittm...@gmx.de cc r-help@r-project.org Subject Re: [R] integrate lgamma from 0 to Inf On Wed, Apr 22, 2009 at 3:28 AM, Andreas Wittmann andreas_wittm...@gmx.de wrote: i try to integrate lgamma from 0 to Inf. Both gamma and log are positive and monotonically increasing for large arguments. What can you conclude about the integrability of log(gamma(x))? -s __ 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] Maple and R
You can export the Maple code to C or Fortran. I actually found it easier to export it to Fortran and then use a text editor to change Fortran's assignment ='s to R's -. After additional tweaks for R, you can convert the script into an R function. Joseph F. Lucke Senior Statistician Research Institute on Addictions University at Buffalo State University of New York 1021 Main Street Buffalo, NY 14203-1016 Office: 716-887-6807 Fax: 716-887-2510 http://www.ria.buffalo.edu/profiles/lucke.html Roslina Zakaria zrosl...@yahoo.com Sent by: r-help-boun...@r-project.org 04/07/2009 02:29 AM To r-help@r-project.org cc Subject [R] Maple and R Hi R-users, Can Maple function be exported to R? I have a jacobian matrix (4X4) from maple in algebraic form which involve modified Bessel function of the first kind. I just wonder whether we can use algebraic form into R before the value of the parameters can be estimated. Thank you so much for your attention and help. __ 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] Maple and R
I forgot. You can get the Bessel functions from Robin Hankin's GSL package. R. K. S. Hankin 2006. Introducing gsl, a wrapper for the Gnu Scientific Library. Rnews 6(4):24-26 Joseph F. Lucke Senior Statistician Research Institute on Addictions University at Buffalo State University of New York 1021 Main Street Buffalo, NY 14203-1016 Office: 716-887-6807 Fax: 716-887-2510 http://www.ria.buffalo.edu/profiles/lucke.html Roslina Zakaria zrosl...@yahoo.com Sent by: r-help-boun...@r-project.org 04/07/2009 02:29 AM To r-help@r-project.org cc Subject [R] Maple and R Hi R-users, Can Maple function be exported to R? I have a jacobian matrix (4X4) from maple in algebraic form which involve modified Bessel function of the first kind. I just wonder whether we can use algebraic form into R before the value of the parameters can be estimated. Thank you so much for your attention and help. __ 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] Distinguishing variables from functions with the same name
guRus: I have a variable beta as an argument to R's beta function. So essentially I have a case of beta(alpha, beta). What surprises me is that R doesn't barf on this stupid programming practice. R gets the right answer. How does R know beta the variable from beta the function? Joseph F. Lucke Senior Statistician Research Institute on Addictions University at Buffalo SUNY [[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] get top 50 correlated item from a correlation matrix for each item
A solution using a toy example r - cor(mvrnorm(1000,mu=rep(0,10),Sigma=diag(10))) #assume a 10 x 10 matrix j - i-1:dim(r)[1] #generate matrix indices lt - outer(i,j,'') #get boolean lower triangle sort(r[lt],decreasing=TRUE)[1:5] #extract top 5 correlations Joseph F. Lucke Senior Statistician Research Institute on Addictions University at Buffalo SUNY Tan, Richard r...@panagora.com Sent by: r-help-boun...@r-project.org 02/12/2009 11:19 AM To r-help@r-project.org cc Subject [R] get top 50 correlated item from a correlation matrix for each item Hi, I have a correlation matrix of about 3000 items, i.e., a 3000*3000 matrix. For each of the 3000 items, I want to get the top 50 items that have the highest correlation with it (excluding itself) and generate a data frame with 3 columns like (ID, ID2, cor), where ID is those 3000 items each repeat 50 times, and ID2 is the top 50 correlated items with ID, and cor is the correlation of ID and ID2. I know I can use two for loops to do it but it is very time consuming considering the correlation matrix is generated for each month of the past 20 years. Is there a better way to do it? Regards, Richard [[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] Can't install rggobi package
I am unable to install the rggobi package. I do not have trouble installing other packages. Any advice or suggestions? sessionInfo() R version 2.8.1 (2008-12-22) i386-pc-mingw32 locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] tools_2.8.1 Joseph F. Lucke Senior Statistician Research Institute on Addictions University at Buffalo SUNY [[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] OT: Reference for SIC/BIC
Generally smart people, I need a recent reference for using the Schwarz/Bayesian information criterion for model fitting in a frequentist stepwise regression. Joe [[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] OT: Adding verbatim R code text into LaTeX documents: texttt; verb or url?
LaTeX offers a verbatim environment. \begin{verbatim} This is maintained verbatim, Latex commands and environments are typeset as written without any processing. \end{verbatim} Be sure to use the package verbatim. ---Joe Peter Dunn pdu...@usc.edu.au Sent by: r-help-boun...@r-project.org 01/28/2009 01:41 AM To R Help r-help@r-project.org cc Subject [R] OT: Adding verbatim R code text into LaTeX documents: texttt; verb or url? Hi all I use Sweave extensively to mix R and LaTeX, and often have R code appearing in my LaTeX document. Just a quick question then: What is the best way to add example of R commands into LaTeX in-line? (That is, not using Sweave.) For example, suppose I wish to place in my document this instruction: ...is done in R using the command \verb|lm( y ~ var.one + var.two )| as follows: I used \verb above, but I see three options: \verb, \url (package url), or \texttt; there are probably others. Here are my comments on these three: - Using \texttt is OK, but it disappears my tildes and can hyphenate - Using \verb is good, but it can hyphenate. - Using \url is very good, but it: * disappears my spaces; so for the above example, the spaces added for clarity are gone. * Minor: I like my verbatim text a little smaller (\small size), and change the font size for verbatim using \def\verba...@font{\small\ttfamily} but \url seems to ignore this and appears larger than if I used \text or \verb. Also, using \url often adds line-breaks mid-variable at the dots (for example, splitting var.one to have var. on one line, and one on the next). I'm not sure this is a problem or not; here it is just an observation. Ideally, one would want a LaTeX function, say \rcode{}, that displayed in-text using non-proportional font, kept tildes, kept spacing, uses my verb-font changes, and broke at sensible places for R. (I don't want much, do I?) So two questions: * What do other people do? Maybe there is a solution I have over-looked. * Is there an easy solution? I suppose writing such a command in LaTeX is possible, but there is strong evidence to reject the hypothesis that I would be able to write one. Maybe one of the above choices are easily adopted. If no easy solutions exist or emerge, I'm happy to run with \url. Thanks again. P. Peter Dunn Biostatistician School of Health and Sport Science Faculty of Science, Health and Education University of the Sunshine Coast Tel: +61 7 5456 5085 Fax: +61 7 5430 2896 Email: pdu...@usc.edu.au www.usc.edu.au CRICOS Provider Number: 01595D This communication is intended for the recipient only and should not be forwarded, distributed or otherwise read by others without express permission. The views expressed in this email are not necessarily those of the University of the Sunshine Coast. -- This message has been scanned for viruses and\ dangerous...{{dropped:15}} __ 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] using Sweave with a master file that has several iputted .tex files
Use the include function in LaTeX. Christopher W. Ryan cr...@binghamton.edu Sent by: r-help-boun...@r-project.org 01/27/2009 12:48 PM To r-h...@stat.math.ethz.ch cc Subject [R] using Sweave with a master file that has several iputted .tex files Suppose I have a Master.Rnw file that looks something like this: \documentclass[12pt]{mypaper} \usepackage[margin=1in]{geometry} \usepackage{setspace} \usepackage{url} \usepackage{indentfirst} \usepackage{fancyhdr} \usepackage{Sweave} \pagestyle{fancy} \lhead{sonographic rectal diameter and ADHD} \rhead{ } \usepackage{abbrevs} %\usepackage{natbib} %\usepackage{apacite} \bibliographystyle{StandardMedicalJournal} %\bibpunct{}{}{,}{}{}{} \usepackage{multirow} \usepackage{outlines} \begin{document} \input{C:/DATA/SCHOLAR/ADHDConstipation/SonographicStudy/PAR06180/SpecificAims} \input{C:/DATA/SCHOLAR/ADHDConstipation/SonographicStudy/PAR06180/BackgroundAndSignificance} \input{C:/DATA/SCHOLAR/ADHDConstipation/SonographicStudy/PAR06180/PreliminaryStudies} \input{C:/DATA/SCHOLAR/ADHDConstipation/SonographicStudy/PAR06180/ResearchDesignAndMethods} ...abbrevieated... \end{document} Some of the inputted files contain R code, enclosed in chunkname= and @. Several of them don't contain any R code. Can I compile the whole document with Sweave(Master.Rnw) ? Thanks. --Chris -- Christopher W. Ryan, MD SUNY Upstate Medical University Clinical Campus at Binghamton 40 Arch Street, Johnson City, NY 13790 cryanatbinghamtondotedu PGP public keys available at http://home.stny.rr.com/ryancw/ If you want to build a ship, don't drum up the men to gather wood, divide the work and give orders. Instead, teach them to yearn for the vast and endless sea. [Antoine de St. Exupery] __ 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] Cannot access packages
Although I have installed R many times on many machines without problems, I have recently encountered a problem with accessing packages. R has been installed successfully with the --internet2 option. The session info is below. sessionInfo() R version 2.8.1 (2008-12-22) i386-pc-mingw32 locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] tools_2.8.1 When I try to load a package (chron in this example) from the CMU mirror, I get the following error message: utils:::menuInstallPkgs() --- Please select a CRAN mirror for use in this session --- trying URL 'http://lib.stat.cmu.edu/R/CRAN/bin/windows/contrib/2.8/chron_2.3-28.zip' Error in download.file(url, destfile, method, mode = wb, ...) : cannot open URL 'http://lib.stat.cmu.edu/R/CRAN/bin/windows/contrib/2.8/chron_2.3-28.zip' In addition: Warning message: In download.file(url, destfile, method, mode = wb, ...) : cannot open: HTTP status was '403 Forbidden (Blocked by NG)' Warning in download.packages(p0, destdir = tmpd, available = available, : download of package 'chron' failed This error applies to ANY package. The option --internet2 must be used. If not, then I cannot even access the mirror. Can anyone help me out? Could this be a firewall problem? Joe [[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.