Re: [R] Comparison of demographics between 2 study samples

2008-08-14 Thread C.H.
Use a smaller alpha value rather than 0.05.

C

On Thu, Aug 14, 2008 at 10:14 AM, Mark Home <[EMAIL PROTECTED]> wrote:
> Dear All:
>
> I have a clinical study where I would like to compare the demographic 
> information for 2 samples in a study.  The demographics include both 
> categorical and continuous variables.  I would like to be able to say whether 
> the demographics are significantly different or not.
>
> The majority of papers that I have read use multiple techniques to achieve 
> this (e.g., t-test for the continuous variables and either Fischer exact or 
> Chi-square for categorical).  I wonder whether this might lead to spurious 
> differences due to multiple significance tests.  Is there a better way to do 
> this?
>
> Thanks in advance for your advice,
>
> Mark
>
>[[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.
>



-- 
CH Chan
Research Assistant - KWH
http://www.macgrass.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] R and Wordpress

2010-02-24 Thread C.H.
Dear R helpers,

I have a question regarding wordpress and R. I have asked this
question in Wordpress support (
http://wordpress.org/support/topic/368312 ) but there is no answer so
far, maybe the R community can have a better answer.

I followed the excellent tutorial on r-statistics-blog (
http://www.r-statistics.com/2010/02/r-syntax-highlight-on-your-blog-a-wordpress-plugin/
) to enable syntax hightlighting but Wordpress keeps breaking "<-"
into "< -" and I have to use "=" instead. (I think "=" is confusing.)
And I think it is not related to the theme as well.

Is there any clue to solve this? I am using Wordpress 2.9.2.

Regards,

CH

-- 
CH Chan
Research Assistant - KWH
http://www.macgrass.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.


Re: [R] R and Wordpress

2010-02-25 Thread C.H.
I have found a partial solution to this. Wordpress will only chew the
first <- on a given post. Therefore, I add a comment with a <-.

e.g.

# <-
hello <- c(1,2,3)

WP will only break the first <-.


On Thu, Feb 25, 2010 at 9:33 PM, Steve Lianoglou
 wrote:
> Hi,
>
> On Wed, Feb 24, 2010 at 11:40 PM, C.H.  wrote:
>> Dear R helpers,
>>
>> I have a question regarding wordpress and R. I have asked this
>> question in Wordpress support (
>> http://wordpress.org/support/topic/368312 ) but there is no answer so
>> far, maybe the R community can have a better answer.
>>
>> I followed the excellent tutorial on r-statistics-blog (
>> http://www.r-statistics.com/2010/02/r-syntax-highlight-on-your-blog-a-wordpress-plugin/
>> ) to enable syntax hightlighting but Wordpress keeps breaking "<-"
>> into "< -" and I have to use "=" instead. (I think "=" is confusing.)
>> And I think it is not related to the theme as well.
>>
>> Is there any clue to solve this? I am using Wordpress 2.9.2.
>
> I'm guessing that your best bet is to ask the author of the blog that
> you linked to in your post ... just post a comment on that post there.
>
> -steve
> --
> Steve Lianoglou
> Graduate Student: Computational Systems Biology
>  | Memorial Sloan-Kettering Cancer Center
>  | Weill Medical College of Cornell University
> Contact Info: http://cbio.mskcc.org/~lianos/contact
>



-- 
CH Chan
Research Assistant - KWH
http://www.macgrass.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.


Re: [R] Effect Size Formaula and Calulations in R

2010-03-16 Thread C.H.
pwr package:

ES.h and ES.w1, ES.w2, cohen.ES



On Wed, Mar 17, 2010 at 1:28 PM, Jim Silverton  wrote:
> Hello,
> I would like to find out how to use R to compute the effect size of two
> samples for a two sample t test. Is there a formula for the fisher's exact
> test? Any R code and/or formula would be greatly appreciated.
>
> Thanks,
> Jim
>
>        [[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.
>



-- 
CH Chan
Research Assistant - KWH
http://www.macgrass.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.


Re: [R] Coding of categorical variables for logistic regression?

2010-03-28 Thread C.H.
?polr of the MASS package.


On Mon, Mar 29, 2010 at 10:39 AM, Ravi Kulkarni  wrote:
>
> How do I use the "extra" information that two of my predictors are ordinal?
> (I did not know I could do that.)
>
> Thanks,
>  Ravi
> --
> View this message in context: 
> http://n4.nabble.com/Coding-of-categorical-variables-for-logistic-regression-tp1694250p1694644.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.
>



-- 
CH Chan
Research Assistant - KWH
http://www.macgrass.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.


Re: [R] help: forest plots

2009-12-13 Thread C.H.
This one does required the metafor package.

http://tables2graphs.com/doku.php?id=04_regression_coefficients



On Mon, Dec 14, 2009 at 8:13 AM, Kim Jung Hwa  wrote:
> Hi All,
>
> I'm fitting a Poisson regression. And I want to plot 95% Confidence Interval
> of Regression Estimates.
>
> After coming back to original scale (using following formula):
>
> exponential(estimate +/- 1.96*SE),
>
> at best I can get the output in the form of estimates, lower_limit,
> upper_limit values.
>
> As far I know forest() in metafor package needs input in the form of
> estimates and their variances. In the above case can I still use forest()?
> OR if there exists some other function which takes such input and gives
> forest plots?
>
> Any help would be highly appreciated,
> Thanks,
> Kim
>
>        [[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.
>



-- 
CH Chan
Research Assistant - KWH
http://www.macgrass.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.


Re: [R] how to specify xlim in forestplot

2009-05-11 Thread C.H.
The plot function in meta (not rmeta) can specify xlim.

http://cran.r-project.org/web/packages/meta/index.html

Regards,

CH


On Tue, May 12, 2009 at 9:08 AM, Waverley  wrote:
> Hi,
>
> I am using rmeta forestplot function.  The values to plot and their
> 95% upper and lower are of both positive and negative values such that
> I need to specify the x axis range.
>
> Looks like forestplot can only allow positive values for x.  Is that true?
>
> Can someone help me? in plot you can just specify xlim to define the x
> axis range.
>
> --
> Waverley @ Palo Alto
>
> __
> 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.
>



-- 
CH Chan
Research Assistant - KWH
http://www.macgrass.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.


Re: [R] Quality control and possible QC in R book?

2009-04-21 Thread C.H.
You may refer to the R News article on qcc package by Scrucca.

http://cran.r-project.org/doc/Rnews/Rnews_2004-1.pdf



On Wed, Apr 22, 2009 at 4:00 AM, Erin Hodgess  wrote:
> Dear R People:
>
> Is there a Quality Control in R book that would be accessible for
> undergraduates, please?
>
> I'm teaching a QC course in the fall semester and would be happy to
> have a Use R book or something like that, please.
>
> Thanks in advance,
> Erin
>
>
> --
> Erin Hodgess
> Associate Professor
> Department of Computer and Mathematical Sciences
> University of Houston - Downtown
> mailto: erinm.hodg...@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.
>



-- 
CH Chan
Research Assistant - KWH
http://www.macgrass.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.


Re: [R] Do you use R for data manipulation?

2009-05-06 Thread C.H.
There is a book on data manipulation using R.

Data manipulation with R.

http://www.springer.com/statistics/computational/book/978-0-387-74730-9

It highlighted how comprehensive the data manipulation capabilities of R can be.

Regards,

CH


On Wed, May 6, 2009 at 10:01 PM, Simon Pickett  wrote:
> My institute uses SAS religiously, I am the only R "heathen".
>
> I have resisted learning to use SAS because I dont see the point after years
> of using R and I like being able to do everything using one program.
> However, my colleagues maintain that SAS is "better" for programming without
> really ever giving me a good reason why other than memory issues.
>
> dont want to hi-jack the thread but would be interested in hearing some
> other views, especially since my organisation spends (wastes?) alot of money
> every year on SAS licences...
>
> Simon.
>
> - Original Message - From: "Laura Arsanto" 
> To: ; ; 
> Cc: ; ;
> 
> Sent: Wednesday, May 06, 2009 2:53 PM
> Subject: Re: [R] Do you use R for data manipulation?
>
>
>
>
> I used R for my master thesis (with big effort, anyway) and now I find
> difficult to use R in my daily work, becasue it has really serious problems
> with datasets of big dimension, both in the data manipulation step and in
> the analysis step.
>
> But I really would love to use it, as I like its transparence, compared to
> other software.
>
> Laura
>
> ***
>
>> Date: Wed, 6 May 2009 06:42:45 -0700
>> From: jrkrid...@yahoo.ca
>> To: r-h...@stat.math.ethz.ch; fjb...@gmail.com
>> CC: ross.laza...@gmail.com; gregory_war...@urmc.rochester.edu;
>> g...@warnes.net
>> Subject: Re: [R] Do you use R for data manipulation?
>>
>>
>>
>>
>> --- On Wed, 5/6/09, Farrel Buchinsky  wrote:
>>
>> > Is R an appropriate tool for data
>> > manipulation and data reshaping and data
>> > organizing? I think so but someone who recently joined our
>> > group thinks not.
>>
>> I only do small scale projects and am by no means a programmer. Isn't Perl
>> something for earings?
>>
>> That said, I find R to be extremely useful at data manipulation and have
>> used it exclusively in my last three projects.  The different data
>> structures alone are worth their weight in gold, if for nothing else than
>> making it harder to make stupid mistakes in coding.
>>
>> > The new recruit believes that python or another language is
>> > a far better tool for developing data manipulation scripts that can be
>> > then used by> several members of our research group. Her assessment is
>> > that R is useful> only when it comes to data analysis and working with
>> > statistical models.
>>
>> Any reason that she thinks this?  How well does she know R?  It is not
>> exactly a language that one picks up in a week, especially if one is coming
>> from using a stats package like SAS or SPSS. As an ex-SAS and SYSTAT user it
>> took me weeks to just get comfortable with the power of subscripting and the
>> ability to do all kinds of calculations "in-line".
>>
>> > So what do you think:
>> > 1)R is a phenomenally powerful and flexible tool and since you are going
>> > >  > to do analyses in R you might as well use it to read data in and merge
>> > it and reshape it to whatever you need.
>>
>> Definately. I am not a computer scientist or a statistician. I usually am
>> working as a single contractor and normally with small datasets as part of a
>> larger project.  R does what I want, usually very elegantly (albeit perhaps
>> after a lot of headbanging and calls for help to the R-list) and it would be
>> stupid for me to use more than one language when it is not needed.
>>
>> Another plus is that I can  easily leave my data analysis work and a
>> working copy of R with the client.  He/she may have a problem seeing what I
>> did but it is clearly readable & replicable by either the client or another
>> consultant.
>>
>> > OR
>> > 2) Are you crazy? Nobody in their right mind uses R to pipe
>> > the data around their lab and assemble it for analysis.
>>
>> Well I don't work in a lab but why complicate things? If everyone is using
>> the same tools then you have a good situation.  Others who do work in labs
>> can address this point more cogently
>>
>> >From a personnel point of view do you expect everyone in the lab to be
>> >proficient with R and, for example, Perl? What happens when/if you lose
>> >your Perl expert(s)?  I've had occasions where I waited a week for data
>> >simply because the division's MS Access "expert" was on holiday and the
>> >only other "Access" person there only knew how to enter data and run the
>> >monthly reports.  Anything more complicated required the "expert".
>>
>>
>>
>>
>>
>>      __
>> Make your browsing faster, safer, and easier with the new Internet
>> Explorer® 8. Optimized for Yahoo! Get it Now for Free! at
>> http://downloads.yahoo.com/ca/internetexplorer/
>>
>> __
>> R-help@r-project.org 

Re: [R] Learning to speak R: simple data processing

2013-01-10 Thread C.H.
?which.max


On Fri, Jan 11, 2013 at 7:59 AM, ej  wrote:
> apply(m, 1, max)

__
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 for Card Game Modeling

2013-03-10 Thread C.H.
One approach is to build an agent to play the game repeatably and then
calculate the winning odds if a particular card is played.
The logical first step is to implement a playable version of the game using R.

http://www.personeel.unimaas.nl/g-chaslot/papers/ACGSzitaChaslotSpronck.pdf


On Mon, Mar 11, 2013 at 2:02 AM, Peter Ehlers  wrote:
> On 2013-03-10 10:49, Lorenzo Isella wrote:
>>
>> Dear All,
>> Unfortunately, I cannot come up with a script or a concrete example at
>> this stage.
>> I am trying to investigate statistically a card game (not a game like
>> poker, but something more like Magic).
>> There are various kinds of cards (agents, missions, victory points) each
>> obeying a given set of rules.
>> The purpose of the statistical analysis is to come up with a measure of
>> the strength of each card.
>> Any idea if "out there" there is any R package/script which can help me?
>> Any suggestion is welcome
>>
>> Lorenzo
>
>
> Why not simulate?
>
> Peter Ehlers
>
>
> __
> 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.


Re: [R] Feature selection package for text mining

2013-03-13 Thread C.H.
FSelector

Maybe chi-sq is a good starting point.

On Wed, Mar 13, 2013 at 2:02 PM, Venkata Satish Basva
 wrote:
> Hi,
> I am doing a project on authorship attribution, where my term document
> matrix has around 10450 features.
> Can you please suggest me a package where I can find the feature selection
> function to reduce the dimensions.
>
> Regards,
> Venkata Satish Basva
>
> [[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.


Re: [R] Text to Speech In R

2012-10-04 Thread C.H.
Pizza can be ordered from R (fortune 66), why not tts?

Under Debian, I can tts by apt-get install the tts engine espeak and
then use the simple system call under R

> system("espeak", input="hello world, howdy")


On Thu, Oct 4, 2012 at 8:31 PM, Alex Zhang  wrote:
> Dear all,
>
> Excuse me for my searching skills: I just couldn't figure out how to do any 
> simple text to speech in R console.
>
> What I want to do is, out put simple English words or sentences to speaker as 
> voice. No fanciness. For example, I want the R console to speak "Hello world" 
> or "Howdy".
>
> Do you know of any related function/package? Thanks,
>
> - Alex
> [[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.


Re: [R] How to handle Chinese character in R plot?

2012-10-17 Thread C.H.
I guess you are using Arch.

I think it might be related to the fonts. Try to install good Chinese
font such as ttf-wqy-zenhei. In my (debian) system, I have only
installed this font and it plots in R without hiccups.



On Wed, Oct 17, 2012 at 9:45 AM, Manish Gupta  wrote:
> Hi,
>
>
> I also did the same what u suggested.
>
>
>> sessionInfo()
> R version 2.14.1 (2011-12-22)
> Platform: x86_64-unknown-linux-gnu (64-bit)
>
> locale:
>  [1] LC_CTYPE=zh_CN.UTF-8   LC_NUMERIC=C
>  [3] LC_TIME=zh_CN.UTF-8LC_COLLATE=zh_CN.UTF-8
>  [5] LC_MONETARY=zh_CN.UTF-8LC_MESSAGES=zh_SG.UTF-8
>  [7] LC_PAPER=C LC_NAME=C
>  [9] LC_ADDRESS=C   LC_TELEPHONE=C
> [11] LC_MEASUREMENT=zh_SG.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods   base
>
> loaded via a namespace (and not attached):
> [1] XML_3.9-4
>> source("a.txt",encoding="UTF-8")
>
> But still same pblm is there.
>
> 
>
>
>
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/How-to-handle-Chinese-character-in-R-plot-tp4645950p4646421.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.


Re: [R] Command line r

2013-10-02 Thread C.H.
Have a look at the littler.

http://dirk.eddelbuettel.com/code/littler.html

On Sun, Sep 29, 2013 at 3:36 AM, Tomek R  wrote:
> Hi,
> I have found myself often doing simple statistical analysis using Linux 
> command line on a single dataset. Therefore, I put a perl script together, 
> which makes it 
> easier:https://github.com/religa/statshttps://github.com/religa/stats/blob/master/r
> The idea behind simpleR is that it becomes a standard part of any Linux pipe.
> For example, to get a summary of your data, one would have to type: 'r 
> summary file.txt'; to plot it: 'r -p file.txt'; to calculate sum of numbers 
> from 1 to 100: 'seq 1 100 | r sum -';
> I tried to test it under Linux / Mac, including various types of pipes and 
> redirects. I am looking forward to your comments on how to improve it.
> Tomek
>
>
> [[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.


[R] Hong Kong R users' group

2010-06-23 Thread C.H.
Dear R users in Hong Kong,

Hello. Any HK R users in HK would like to organize a regular users'
group meeting like LA, NY, London, Osaka... etc ? Maybe some
demonstrations, lightning talks, beginner tutorials. Thanks.

Regards,

CH

-- 
CH Chan

__
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] Simple question, name of the variable as string.

2010-09-16 Thread C.H.
Dear R users,

I have a very simple question and I've tried to search for the answer.
(But failed.)

there should be a function (func) that work like

> abc <- c(1,2,3,4)
> func(abc)
"abc"

I would like to know the name of that function. Thank you very much
for your help.

Regards,

CH

-- 
CH Chan

__
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] Composing Music - R Package

2010-09-19 Thread C.H.
http://r-forge.r-project.org/projects/tuner/



On Mon, Sep 20, 2010 at 8:35 AM, Deb Midya  wrote:
> Hi R Users,
>
> Thanks in advance.
>
> I am using R-2.11.1 on Windows XP.
>
> May I request you to assist me for the following please.
>
> 1.   Is there any R-package or if any to compose music?
>
> 2.   Is there any R-package or if any to analyse music?
>
> Once again, thank you very much for the time you have given.
>
> Regards,
>
> Deb
>
>
>
>
>        [[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.
>
>



-- 
CH Chan

__
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] check for item in vector

2010-12-13 Thread C.H.
Dear R users,

Suppose I have an vector like this:

animal <- c("Tiger","Panda")

I would like to know is there any function that check for the
existence of certain item in a vector.

e.g.

> func("Tiger",animal) # check for the existence of "Tiger"
TRUE
> func("Acacia",animal)  #Acacia is not an item of the animal vector
FALSE

I know that it can be done by for loop. But I would like to know is
there any built-in function for that.

Thank you very much.

CH

-- 
CH Chan

__
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] forest plot

2010-08-23 Thread C.H.
The correct command for forest plot should be "plot" (instead of
"forest") if you are using metagen from meta package.

For help:

?plot.meta

On Tue, Aug 24, 2010 at 11:03 AM, zhangweiwei  wrote:
>
> Dear Sir or Madam,
>
>
>
> I am trying to plot forest plot. I extracted odds ratio and their 
> corresponding 95% confidence interval from papers, then I calculated the 
> log(OR) and standard error using the following command
>
>  OR<-metagen(logOR,selogOR,sm="OR")
>
> forest(OR,comb.fixed=TRUE,comb.random=TRUE,digits=2)
>
>
>
> However, it does not produce a forest plot.  Can someone kindly help? Thank 
> you in advance.
>
>
>
> Best wishes
>
> weiwei
>
>
>        [[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.
>



-- 
CH Chan

__
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] OdfWeave and Locale

2010-08-31 Thread C.H.
Dear all,

I have a question regarding the odfweave. I created an odt file
(test_input.odt) using OO.o for WIndows XP. The code is generic.

 Code for odt ---

 \Sexpr{dim(iris)[1]}

<>=
odfItemize(levels(iris$Species))
@

Table 1:

<>=
data.frame(N =tapply(iris$Petal.Length, iris$Species, length) ,mean =
tapply(iris$Petal.Length, iris$Species, mean), sd=
tapply(iris$Petal.Length, iris$Species, sd))
@

one way anova, p= \Sexpr{summary(aov(iris$Petal.Length~iris$Species))[[1]][1,5]}

 Code for odt ---

When I try to use the odfWeave command to process the input file, the
following error is encountered.

-- R output 

odfWeave("test_input.odt","output.odt")
  Copying  test_input.odt
  Setting wd to
C:\DOCUME~1\kwhuser\LOCALS~1\Temp\Rtmpnblj4D/odfWeave01132749455
  Unzipping ODF file using unzip -o "test_input.odt"
Archive:  test_input.odt
 extracting: mimetype
   creating: Configurations2/statusbar/
  inflating: Configurations2/accelerator/current.xml
   creating: Configurations2/floater/
   creating: Configurations2/popupmenu/
   creating: Configurations2/progressbar/
   creating: Configurations2/menubar/
   creating: Configurations2/toolbar/
   creating: Configurations2/images/Bitmaps/
  inflating: content.xml
  inflating: manifest.rdf
  inflating: styles.xml
 extracting: meta.xml
  inflating: Thumbnails/thumbnail.png
  inflating: settings.xml
  inflating: META-INF/manifest.xml

  Removing  test_input.odt
  Creating a Pictures directory

  Pre-processing the contents
Error in gsub("\xe2\u0080\x93", "-", x) :
  'pattern' is invalid in this locale

-- R output 

I would like to know how to fix that. Thank you.

The following are the session info and the locale information.

 Session info -

sessionInfo()
R version 2.10.1 (2009-12-14)
i386-pc-mingw32

locale:
[1] LC_COLLATE=Chinese_Hong Kong S.A.R..950  LC_CTYPE=Chinese_Hong
Kong S.A.R..950
[3] LC_MONETARY=Chinese_Hong Kong S.A.R..950 LC_NUMERIC=C
[5] LC_TIME=Chinese_Hong Kong S.A.R..950

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

other attached packages:
[1] odfWeave_0.7.11 XML_3.1-1   lattice_0.17-26

loaded via a namespace (and not attached):
[1] grid_2.10.1

 Session info -

Thank you.

CH

-- 
CH Chan

__
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] Query regarding Windows based statistical software development using R as programming language

2010-09-04 Thread C.H.
Have a look at deducer.

http://www.deducer.org/manual.html



On Sat, Sep 4, 2010 at 12:20 PM, Soumen Pal  wrote:
> Hi,
>
> I am a beginner in R. I have a query as below:
>
> Is it possible to develop a Windows based statistical software
> (user-friendly) like SPSS using R as a programming language?
>
> Otherwise, is it possible to use R code directly (no command-line
> execution) in Windows based programming language such as Visual Basic?
> Please help me, if possible, with some link to study materials related to
> such topic.
>
> --
> Thanks & Regards,
>
> Soumen Pal
>
>        [[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.
>



-- 
CH Chan

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] A plot similar to violin plot

2011-03-08 Thread C.H.
Dear R Users,

I would like to know is there any package to create a plot like this?

http://dl.dropbox.com/u/5409929/cs1160521f01.gif

X axis is categorical. And the positions of the points are
corresponding to the frequency. (similar to violinplot)

Thank you.

Regards,

CH

-- 
CH Chan

__
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 plot similar to violin plot

2011-03-08 Thread C.H.
Sorry for being ambiguous.

The data are some continuous variable (Y-axis) categorized into 3
groups (Controls, Depressed EF and Preserved EF, X-asis).

The band of dots on the plot is the data point. The density of dots
and the "fatness" of the band present the frequency of a particular
value in Y-axis. This property is similar to the violin plot: showing
the probability density of the data at different values. Instead of
showing a shape in violin plot, this plot shows the actual
distribution of the data points.

Thank you.

Regards,

CH


On Tue, Mar 8, 2011 at 11:14 PM, Ista Zahn  wrote:
> Hi,
> I don't understand what is being plotted here. Can you describe what
> you want in more detail?
>
> Best,
> Ista
>
> On Tue, Mar 8, 2011 at 7:27 AM, C.H.  wrote:
>> Dear R Users,
>>
>> I would like to know is there any package to create a plot like this?
>>
>> http://dl.dropbox.com/u/5409929/cs1160521f01.gif
>>
>> X axis is categorical. And the positions of the points are
>> corresponding to the frequency. (similar to violinplot)
>>
>> Thank you.
>>
>> Regards,
>>
>> CH
>>
>> --
>> CH Chan
>>
>> __
>> 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.
>>
>
>
>
> --
> Ista Zahn
> Graduate student
> University of Rochester
> Department of Clinical and Social Psychology
> http://yourpsyche.org
>



-- 
CH Chan

__
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] Dump the "source code" of data frame

2011-04-13 Thread C.H.
Dear R experts,

I remember a similar function existed and have been mentioned in
R-help before. I tried my best to search but I really can't find it
out.

suppose I have an data frame like this:

> somedata <- data.frame(age.min = 1, age.max = 1.5, male = TRUE, l = -1.013, 
> m=16.133, s=0.07656)

In order to back up the data and I don't want to use write.table(), I
would like to back up the "source code" of the data frame. When I
apply that function (let's call it dumpdf() ), the function will
reproduce the "source code" that creates the data.frame. For example:

> dumpdf(somedata)
somedata <- data.frame(age.min = 1, age.max = 1.5, male = TRUE, l =
-1.013, m=16.133, s=0.07656)

Is there any function similar to the dumpdf() above?

Thank you so much!

Regards,

CH

-- 
CH Chan

__
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] Recoding observations in all columns of a data frame.

2011-08-31 Thread C.H.
Dear all,

Suppose I have a data frame like this:

[code]
var1 <- c(1,999,2)
var2 <- c(999,1,2)
var3 <- c(1,2,999)
example <- data.frame(var1,var2,var3)
[/code]

I want to replace all 999 to NA in all observations in all columns. I
know how to do it in each individual column.

[code]
example$var1[example$var1==999] <- NA
[/code]

I think it can be done with a for loop.

[code]
for (i in 1:length(example))
  {
example[,i][example[,i] == 999] <- NA
  }
[/code]

Is there any R-esque way to do this without using a for loop?

Thanks.

Regards,

CH
-- 
CH Chan

__
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] Multiple t.test

2011-09-12 Thread C.H.
Dear R experts,

Suppose I have an data frame likes this:

> example <- data.frame(age=c(1,2,3, 4,5,6), height=c(100,110,120,130,140,150), 
> disease=c(TRUE, TRUE, TRUE, FALSE, FALSE, FALSE))

> example
  age height disease
1   1100TRUE
2   2110TRUE
3   3120TRUE
4   4130   FALSE
5   5140   FALSE
6   6150   FALSE

Is there anyway to compare the age and height between those with
disease=TRUE and disease=FALSE using t.test and extract the p-values
quickly?

I can do this individually

t.test(example$age~example$disease)[3]

But when the number of variable grow to something like 200 it is not
easy any more.

Thanks!

Regards,

CH

-- 
CH Chan

__
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 learning

2012-05-31 Thread C.H.
Learn by solving your own problem.

Break down your [real or toy] problem into solvable subtasks. Find out
how to solve these subtasks using R.

Quick-R is a good reference for task specific information.

http://www.statmethods.net/

On Thu, May 31, 2012 at 5:57 AM, arun.gurubaramurugeshan
 wrote:
> If you haven't already look at Introduction to R, please follow this link
> "http://cran.r-project.org/doc/manuals/R-intro.pdf";. There are several books
> which will teach you R, please look at online retailers like Amazon, Ebay
> etc.,
> Online search for specific task will also to help you to gather knowledge,
> what I mean is, search online for "summarize a data table in R" it will
> produce a lot of results and you will find different people saying different
> ways to get the task done which will help to learn more R coding. Hope this
> helps.
>
>
> Thanks
> Arun
>
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/R-learning-tp4631814p4631871.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.


Re: [R] Analyzing Poor Performance Using naiveBayes()

2012-08-09 Thread C.H.
I think you have been hit by the problem of high variance. (overfitting)

Maybe you should consider doing a feature selection perhaps using the
chisq ranking from FSelector.

And then training the Naive Bayes using the top n features (n=1 to
200) as ranked by chisq, plot the AUCs or F1 score from both training
set and cross training set against n. From the graph, you can select
the optimal number of n.


On Fri, Aug 10, 2012 at 6:40 AM, Kirk Fleming  wrote:
> My data is 50,000 instances of about 200 predictor values, and for all 50,000
> examples I have the actual class labels (binary). The data is quite
> unbalanced with about 10% or less of the examples having a positive outcome
> and the remainder, of course, negative. Nothing suggests the data has any
> order, and it doesn't appear to have any, so I've pulled the first 30,000
> examples to use as training data, reserving the remainder for test data.
>
> There are actually 3 distinct sets of class labels associated with the
> predictor data, and I've built 3 distinct models. When each model is used in
> predict() with the training data and true class labels, I get AUC values of
> 0.95, 0.98 and 0.98 for the 3 classifier problems.
>
> When I run these models against the 'unknown' inputs that I held out--the
> 20,000 instances--I get AUC values of about 0.55 or so for each of the three
> problems, give or take.  I reran the entire experiment, but instead using
> 40,000 instances for the model building, and the remaining 10,000 for
> testing. The AUC values showed a modest improvement, but still under 0.60.
>
> I've looked at a) the number of unique values that each predictor takes on,
> and b) the number of values, for a given predictor, that appear in the test
> data that do not appear in the training data.  I can eliminate variables
> that have very few non-null values, and those that have very few unique
> values (the two are largely the same), but I wouldn't expect this to have
> any influence on the model.
>
> I've already eliminated variables that are null in every instance, and
> duplicate variables having identical values for all instances. I have not
> done anything to check further for dependant variables, and don't know how
> to.
>
> Besides getting a clue, what might be my next best step?
>
>
>
>
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/Analyzing-Poor-Performance-Using-naiveBayes-tp4639825.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.


Re: [R] Perform 20 x one-way anova in 1 go

2011-10-13 Thread C.H.
This is one solution

?sapply

sapply(data.frame(iris$Sepal.Length, iris$Sepal.Width,
iris$Petal.Length, iris$Petal.Width), function(x)
(summary(aov(x~iris$Species



On Tue, Oct 11, 2011 at 5:10 PM, Joshua Wong  wrote:
> Hi Guys,
>
> I have about 20 continous predictors and I want to do one-way anova to check 
> the significance of each variable against the dependent variable.
> Apart from doing running the anova 20 times, is there a faster way?
>
> Thanks,
> Joshua
>        [[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.
>



-- 
CH Chan

__
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] Hong Kong R user group

2012-04-19 Thread C.H.
Dear R users in Hong Kong,

Please join the HKRUG and we are organizing our 1st meeting.

https://groups.google.com/d/forum/hkrug

Thank you.

CH

__
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] tm package: problem of TermDocumentMatrix and minWordLength

2012-05-16 Thread C.H.
Dear All,

The following code illustrate the problem.

[R code]
require(tm)
exampledoc <- c("R is good", "R is really good")
examplecorpus <- Corpus(VectorSource(exampledoc), encoding = "UTF-8")
dtm <- DocumentTermMatrix(examplecorpus, control = list(minWordLength = 1))
as.matrix(dtm)
[/R code]

The term "R" and "is" were not included in the dtm even the control
parameter minWordLength was set to 1.

Terms
Docs good really
   11  0
   21  1

Would you reproduce this problem?

The following is my sessionInfo

> sessionInfo()
R version 2.15.0 (2012-03-30)
Platform: i686-pc-linux-gnu (32-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=C LC_NAME=C
 [9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

other attached packages:
[1] tm_0.5-7.1

loaded via a namespace (and not attached):
[1] compiler_2.15.0 slam_0.1-23 tools_2.15.0

Regards,

CH

__
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] shapiro wilk normality test

2008-07-12 Thread C.H.
You may consider the nortest package.

http://cran.r-project.org/web/packages/nortest/index.html

Regards,

CH

On Sat, Jul 12, 2008 at 11:30 PM, Bunny, lautloscrew.com
<[EMAIL PROTECTED]> wrote:
> Hi everybody,
>
> somehow i dont get the shapiro wilk test for normality. i just can´t find
> what the H0 is .
>
> i tried :
>
>  shapiro.test(rnorm(5000))
>
>Shapiro-Wilk normality test
>
> data:  rnorm(5000)
> W = 0.9997, p-value = 0.6205
>
>
> If normality is the H0, the test says it´s probably not normal, doesn´t it ?
>
> 5000 is the biggest n allowed by the test...
>
> are there any other test ? ( i know qqnorm already ;)
>
> thanks in advance
>
> matthias
> __
> 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.
>



-- 
CH Chan
Research Assistant - KWH
http://www.macgrass.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.


Re: [R] eee pc

2007-12-16 Thread C.H.
You can using the default Linux (Xandros, Debian Based) and enable
Debian Etch Repo in eeepc to install R via apt-get.

http://lnxg.ca/?Hardware:Asus_Eeepc_701:EeePC_Tips

I can install R, LaTeX.

Regards,
C


On Dec 17, 2007 4:37 AM, Gabor Csardi <[EMAIL PROTECTED]> wrote:
> You can easily install ubuntu on it (although it might require
> an external drive):
> http://hup.hu/node/48116
> So running R should not be problem.
>
> G.
>
>
> On Sun, Dec 16, 2007 at 12:56:39PM -0500, Burton Rothberg wrote:
> > I'm thinking of getting one of these lightweight linux laptops for
> > traveling. Does anyone know if / how R runs on it?
> >
> >   [[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.
>
> --
> Csardi Gabor <[EMAIL PROTECTED]>MTA RMKI, ELTE TTK
>
>
> __
> 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.
>



-- 
CH Chan
Research Assistant - KWH
http://www.macgrass.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.


Re: [R] I need arguments pro-S-PLUS and against SAS...

2008-01-04 Thread C.H.
One simple reason: graphic.


On Jan 5, 2008 5:23 AM, Liviu Andronic <[EMAIL PROTECTED]> wrote:
> On 1/4/08, Alberto Monteiro <[EMAIL PROTECTED]> wrote:
> > I need arguments pro-S-PLUS and against SAS for a meeting I will
> > have next week. S-Plus is (90 - 99)% compatible with R, so using
> > S-Plus will make things much easier for everyone. But I can't use
> > this argument. What other arguments could I use?
>
> There was a recent discussion "who uses r". Maybe some arguments there
> are useful in your case.
>
> Liviu
>
>
> __
> 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.
>



-- 
CH Chan
Research Assistant - KWH
http://www.macgrass.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.


Re: [R] Critical values of r

2008-01-13 Thread C.H.
Not particularly R related, but r related.

For pearson correlation, the test statistics is based on t distribution.

ts = r * sqrt ((n-2)/(1-r^2))
with n-2 degree of freedom.

I think you can solve this question, maybe a little bit of googling.



On Jan 14, 2008 1:39 PM, Sanglamt <[EMAIL PROTECTED]> wrote:
>
> I've spent several hours trying to track the answer down myself and failed
> miserably so a simple question for everyone that will no doubt have a
> painfully obvious answer.
>
> What's the command to calculate the critical value of r using a two tailed
> test with a given alpha and degrees of freedom? I.e., alpha=0.05, df=18,
> two-tailed test, with the result being 0.4438
> --
> View this message in context: 
> http://www.nabble.com/Critical-values-of-r-tp14795700p14795700.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.
>



-- 
CH Chan
Research Assistant - KWH
http://www.macgrass.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] Trend graph

2008-09-26 Thread C.H.
Dear R Gurus,

I have a problem related to plot.
For example, I have two variables, pre and post.

pre <- c(1,2,3,4,5)
post <- c(2,5,7,2,3)

How can I plot a line graph similar to this one?

http://www.pubmedcentral.nih.gov/articlerender.fcgi?artid=1847566&rendertype=figure&id=F1

Would you please provide me a keyword so that I can search. I don't
know what is the name of this type of graph.

Regards,
H

-- 
CH Chan
Research Assistant - KWH
http://www.macgrass.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] log-minus-log plot

2009-02-19 Thread C.H.
Dear experts,

I would like to know how to plot the log-minus-log plot for survival
analysis (to check the proportional assumption) in R.

Using the AML example.

fit <- survfit(Surv(time, status) ~ x, data=aml)
length(fit$surv) #20

as the length of fit$surv is shorter than aml$x and aml$time. I don't
know how to plot.

Thank you.

Regards,

CH


-- 
CH Chan
Research Assistant - KWH
http://www.macgrass.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.


Re: [R] Fisher test problem

2009-03-21 Thread C.H.
I tried the OpenEpi, the p-value of 1.25 is due to the fact that the
one tailed p-value is 0.62. The two tailed p-value then is 0.62 * 2 =
1.25. OpenEpi is not clever enough to ceiling the p-value to 1.

CH

On Sun, Mar 22, 2009 at 3:43 AM, David Winsemius  wrote:
> Let me ask you: What degree of credibility should be accorded a WWW
> application that delivers a p-value of 1.25?
>
> If the answer is not immediately and glaringly obvious, then tell us, what
> sort of axioms of probability are you working with?
>
> --
> David Winsemius
> On Mar 21, 2009, at 3:17 PM, Viju Moses wrote:
>
>> Hi, I noted a discrepancy between R and openepi when I ran a fisher test
>> with the same matrix. In R:
>>
>> > a=matrix(c(1,2,6,17), nrow=2)
>> > a
>>   [,1] [,2]
>> [1,]    1    6
>> [2,]    2   17
>> > fisher.test(a, conf.int=T)
>>
>>      Fisher's Exact Test for Count Data
>>
>> data:  a
>> p-value = 1
>> alternative hypothesis: true odds ratio is not equal to 1
>> 95 percent confidence interval:
>> 0.02061498 31.73691924
>> sample estimates:
>> odds ratio
>> 1.396646
>>
>> But in openepi the P value is 1.25. (In another instance too for other
>> sets of data, I had got a p value of 1 in 3 instances for a prop.test when I
>> got 3 other answers on a friend's stata software with the same data. )
>>
>> I'm using R on Ubuntu Intrepid. Is there anything I'm doing wrong? Any
>> other packages I have to install?
>>
>> Thanks in advance
>>
>> Viju Moses
>>
>> __
>> 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.
>
> David Winsemius, MD
> Heritage Laboratories
> 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.
>



-- 
CH Chan
Research Assistant - KWH
http://www.macgrass.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.


Re: [R] How to get the P-values from GLM results?

2008-03-19 Thread C.H.
abc <- glm(x~y)
summary(abc)


On Wed, Mar 19, 2008 at 11:51 AM, Alex Wang <[EMAIL PROTECTED]> wrote:
> Hello all,
>
>   I have a question concerning how to get the P-value for a explanatory
>  variables based on GLM.
>
>   I'll run multiple regressions with GLM, and I'll need the P-value for the
>  same explanatory variable from these multiple GLM results.
>
>   I check the help and there are quite a few Value options but I just  can
>  not find anyone  about the p-value.
>
>   Could anyone help me with that?
>
>  Thanks a lot!
>
>  Alex
>
> [[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.
>



-- 
CH Chan
Research Assistant - KWH
http://www.macgrass.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.


Re: [R] p-value=0 running coxph

2008-10-30 Thread C.H.
Because your test statistics (z=-9.16) is too small. (well, z> 1.96 or
Z < -1.96 is p=0.05)
If you really want the exact p, you can try
pnorm(-9.16)

if I were you I will quote p<0.001 as well as the test statistics. (if
you are going to submit it to medical journals)

C


On Thu, Oct 30, 2008 at 10:36 PM, GSt <[EMAIL PROTECTED]> wrote:
>
> Dear all,
>
> I have a question concerning the p-value. When running coxph I get a p-value
> = 0. :confused:
> Can this be true? Why aren´t there decimal points? Is there a way to find
> out the exact p-value?
>
> Here is the output:
> 
> Call:
> coxph(formula = Surv(start, stop, status) ~ Albumin_gproL, data = dial,
> na.action = na.omit, method = "breslow")
>
> n=22449 (31 observations deleted due to missingness)
>   coef   exp(coef)   se(coef) zp
> Albumin_gproL -0.157 0.855 0.0172   -9.160
>
>   exp(coef)exp(-coef)lower .95upper .95
> Albumin_gproL 0.855 1.17 0.826 0.884
>
> Rsquare= 0.003   (max possible= 0.033 )
> Likelihood ratio test = 73.6  on 1 df,   p=0
> Wald test   = 83.8  on 1 df,   p=0
> Score (logrank) test = 86.1  on 1 df,   p=0
>
>> cox.zph(cox_)
>  rhochisq  p
> Albumin_gproL -0.05090.1970.657
> 
>
> Thank you in advance...
> GSt
> --
> View this message in context: 
> http://www.nabble.com/p-value%3D0-running-coxph-tp20248274p20248274.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.
>



-- 
CH Chan
Research Assistant - KWH
http://www.macgrass.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.


Re: [R] Likelihood ratio test using R

2008-11-04 Thread C.H.
For the third one:

?anova.glm

test=Chisq will be LRT.

For the first two, you can have the answer from ordinary stat book.


On Wed, Nov 5, 2008 at 1:11 PM, Maithili Shiva <[EMAIL PROTECTED]> wrote:
> Hi!
>
> I am working on the Logistic Regression using R. My R script is as follows
>
>
> ONS <- read.csv("ONS.csv",header = TRUE)
>
> ONS.glm <- glm(Y ~ Age1+Age2+Sex+Education+Profession+TimeInJob+ 
> TimeInCurrentJob+OwnResidence+Dependents+ApplIncome+FamilyInco+IIR+FOIR+YearsAtBank+SavingsAccount+CurrentAccount,
>  family = binomial(link = logit), data=ONS)
>
> summary(ONS.glm)
>
>
> OUTPUT (RESULT) is as follows -
>
> Deviance Residuals:
>Min   1Q   Median   3Q  Max
> -1.7888  -0.6910  -0.3220  -0.2179   3.1608
>
> Coefficients:
>   Estimate Std. Error z value Pr(>|z|)
> (Intercept)  -1.454e+00  1.380e-01 -10.532  < 2e-16 ***
> Age1  2.313e-01  9.902e-02   2.336   0.0195 *
> Age2 -6.648e-01  5.209e-02 -12.761  < 2e-16 ***
> Sex  -7.012e-01  7.325e-02  -9.572  < 2e-16 ***
> Education-5.271e-01  7.963e-02  -6.619 3.61e-11 ***
> Profession   -3.512e-01  4.908e-02  -7.155 8.38e-13 ***
> TimeInJob-3.107e-01  1.980e-01  -1.569   0.1166
> TimeInCurrentJob  2.752e+00  1.895e-01  14.521  < 2e-16 ***
> OwnResidence  1.608e+00  1.858e-01   8.654  < 2e-16 ***
> Dependents   -4.066e-01  1.867e-01  -2.178   0.0294 *
> ApplIncome   -6.401e-02  4.319e-03 -14.820  < 2e-16 ***
> FamilyInco7.148e-02  7.389e-03   9.674  < 2e-16 ***
> IIR   5.765e-02  1.353e-02   4.262 2.03e-05 ***
> FOIR  7.383e-07  1.056e-07   6.990 2.74e-12 ***
> YearsAtBank  -1.926e-07  3.519e-08  -5.473 4.42e-08 ***
> SavingsAccount   -2.083e-07  1.785e-07  -1.167   0.2432
> CurrentAccount   -1.550e+00  1.107e-01 -14.008  < 2e-16 ***
> ---
> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
>
> (Dispersion parameter for binomial family taken to be 1)
>
>Null deviance: 39300  on 42499  degrees of freedom
> Residual deviance: 32534  on 42483  degrees of freedom
> AIC: 32568
>
> 
>
> Question No - (1)
>
> What does this means?
>
> Deviance Residuals:
>Min   1Q   Median   3Q  Max
> -1.7888  -0.6910  -0.3220  -0.2179   3.1608
>
>
> Question No - (2)
>
> What does this means?
>
> Null deviance: 39300  on 42499  degrees of freedom
> Residual deviance: 32534  on 42483  degrees of freedom
>
>
> And this is the last question
>
> Question No - (3)
>
> To test Ho : All regression coefficients are ZERO, I need to use Likelihood 
> Ratio Test (G) and the related p value. When I use minitab, I get value of G 
> and related p, but using R language, how do I get value of G and p value?
>
> _
>
> I am sincerely sorry for raising these many questions? But I am sure there 
> will be many like me who will also be immensely benefited by the replies, I 
> may get pertaining to these questions.
>
>
> Thanking you all in advance,
>
> With warm regards
>
> Maithili Shiva
>
>
>
>
>
> __
> 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.
>



-- 
CH Chan
Research Assistant - KWH
http://www.macgrass.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.


Re: [R] kruskal test in R

2008-11-06 Thread C.H.
Are you dealing with some rainfall data for your schoolwork?
Few days ago, somebody asked exactly the same question.

read this one to know how to calculate the H value (An Alternative
Formula for the Calculation of H)
http://faculty.vassar.edu/lowry/ch14a.html

You can calculate the rank by rank()

> rain <- c(1,4,7,8,10,10,20,20,30,51)
> gp <- c(1,1,1,2,2,2,2,3,3,3)
> rain.rank <- rank(rain)

You can extract the rank of each gp by

> rain.rank[gp==1]

and the total rank for each gp (Tg) by

> sum(rain.rank[gp==1])

You can square it using the usual ^2

Once you can obtain the H value, you can calculate the p using pchisq command.
you can use ?pchisq to read the help file.

If you still don't know how to do it, please ask your tutor.

On Fri, Nov 7, 2008 at 8:53 AM, Pang Iverson <[EMAIL PROTECTED]> wrote:
>
> Hi,
> i have a question in R,
> How and what command you need to do to run a kruskal-wallis test without the 
> built in command 'kruskal.test'?
> many thanks.
> _
>
>
>[[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
CH Chan
Research Assistant - KWH
http://www.macgrass.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.


Re: [R] R help

2008-11-28 Thread C.H.
Actually, SPSS do have condition LR which can be simulate using Cox
Proportional Hazards regression.

For R, Conditional LR is clogit inside survival package.

?clogit may help.

Regards,

C


On Fri, Nov 28, 2008 at 5:43 PM, amit nirmalkar <[EMAIL PROTECTED]> wrote:
> Dear Sir
>
> I am Amit Nirmalkar, M. Sc. Statistics.
>
> I generally use SPSS package for analysis.
>
> I wanted to run Conditional Logistic Regression in SPSS but this technique
> is not available.
>
> So I thought of R s/w.
>
> I am totally blank about R.
>
> Can you please send me few of R.
>
> Also how to run Conditional Logistic Regression in R.
>
>
> Thanks
>
> --
> Amit Nirmalkar
>
>[[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.
>



-- 
CH Chan
Research Assistant - KWH
http://www.macgrass.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.


Re: [R] editor for MacOS X

2008-11-28 Thread C.H.
Aquamacs preinstalled ess-mode.

http://aquamacs.org/


On Fri, Nov 28, 2008 at 11:57 PM, Blanchette, Marco
<[EMAIL PROTECTED]> wrote:
> Carbon emacs ( http://homepage.mac.com/zenitani/emacs-e.html) using the 
> ess-mode ( http://ess.r-project.org/). Amazingly good integration of 
> different buffer types for different tasks. You can have your R session 
> running in a buffer, a .R buffer where you edit your functions/sources and 
> with very simple key strokes you can send/run lines, functions or full buffer 
> into the running R session. Great integration of the help pages too.
>
> This as become my central environment where I do all my computing work, 
> programming (perl, python, etc...), shell work, R jobs, MySQL work etc... In 
> addition, your Mac can be configure to run emacs remotely as a client on any 
> other type of machine. For instance, at home, on my PC or on my Mac, I can 
> fire up an SSH connection from either X11 or PuTTY to the Mac desktop in my 
> office, then fire up emacs from the terminal, et voila! I am running jobs on 
> the computer in my office (which as 8 core and 32Mb of RAM) from the same 
> environment as I normally used in my office (can be a bit bandwidth intensive 
> though).
>
> You should also check the noweb mode ( http://www.cs.tufts.edu/~nr/noweb/) 
> for integrating codes and documentation, pretty cool.
>
> Cheers,
>
> Marco
>
>
> On 11/28/08 7:55 AM, "John Fox" <[EMAIL PROTECTED]> wrote:
>
> Dear Bunny,
>
> I've been using Eclipse with the StatET plug-in
>  under both Windows and Mac OS X. Eclipse
> + StatET provides much more than a code editor, such as the ability to check
> and build packages and to interact with an svn archive. On the downside, it
> requires quite a bit of configuration.
>
> I hope this helps,
>  John
>
> --
> John Fox, Professor
> Department of Sociology
> McMaster University
> Hamilton, Ontario, Canada
> web: socserv.mcmaster.ca/jfox
>
>
>> -Original Message-
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> On
>> Behalf Of Bunny, lautloscrew.com
>> Sent: November-28-08 6:16 AM
>> To: r-help@r-project.org
>> Subject: [R] editor for MacOS X
>>
>> Hi all,
>>
>> just wondered again, if there is some R editor for Mac OS X comparable
>> to TINN-R on windows.
>>
>> thx in advance..
>>
>> __
>> 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.
>
>
> --
> Marco Blanchette, Ph.D.
> Assistant Investigator
> Stowers Institute for Medical Research
> 1000 East 50th St.
>
> Kansas City, MO 64110
>
> Tel: 816-926-4071
> Cell: 816-726-8419
> Fax: 816-926-2018
>
> __
> 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.
>



-- 
CH Chan
Research Assistant - KWH
http://www.macgrass.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.