[R] get index of elements in vector

2006-09-28 Thread Cleber N. Borges

Hello all


Is There a fuction that return a index of a element in vector?
like this semantic example:

vector = c( 100, 200, 300 )

getINDEX( vector, value = 200 )

Thanks in advance for your attention.


Cleber Borges

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


Re: [R] [R-pkgs] New package Ryacas

2006-10-16 Thread Cleber N. Borges
Hello,

First,
I would like to congratulations for very cool package! It's very 
nice
idea!...
Secondly,
Is there a way to send R'objects (variables) to yacas and make 
symbolic
operations??
for example:

d <- diag(3)
a <- "A"

yacas(   d * a )

Thanks,
Cleber Borges


Gabor Grothendieck wrote:

>Ryacas is an R interface to the free yacas computer algebra
>system.  Ryacas allows one to send R expressions,
>unprocessed yacas strings and certain other R objects to a
>separate yacas process from R and get back the result.  It
>also has facilities for manipulating yacas strings and R
>expressions destined for yacas processing.
>
>It can be used for exact arithmetic, symbolic math, ASCII
>pretty printing and translating R to TeX.
>
>
>Online info.  For overview, pointers to additional
>information, installation instructions and a sample session
>see:
>
>http://code.google.com/p/ryacas/
>
>The vignettes can be viewed online here:
>
>http://ryacas.googlecode.com/svn/trunk/inst/doc/Ryacas.pdf
>http://ryacas.googlecode.com/svn/trunk/inst/doc/Ryacas-Sym.pdf
>
>
>More. Once Ryacas is installed, pointers to additional
>information can be found with these R commands:
>
>library(Ryacas)
>package?Ryacas
>
>
>---
>  
>

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


[R] mcmcsamp - How does it work?

2006-10-20 Thread Cleber N. Borges

Hello,

I am a chemical student and I make use of 'lme/lmer function'
to handle experiments in split-plot structures.
I know about the mcmcsamp and I think that it's very promissory.

I would like knowing "the concept behind" of the mcmcsamp function.
I do not want the C code of the MCMCSAMP function.
I would like to get the "pseudo-algorithm" to understanding
that it does.

I accompanied the threads [1] and [2] and 'googled' several terms but
I do not obtained success about this matter.

[ 1 ] fixed effects following lmer and mcmcsamp - which to present? - 
8/8/2006
[ 2 ] mcmcsamp-CI instead of P-values - references? - 3/10/2006


Thanks in advanced for yours attention!

Cleber Borges

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


Re: [R] R vs. Excel (R-squared)

2006-01-25 Thread Cleber N. Borges



I was quite interested in this thread (discussion),
once that I am chemistry student and I work with Mixtures Designs that are
models without intercept.

I thought quite attention the follow afirmation:

' Thus SST, the "corrected" total
sum of squares, should be used when you have a model with an intercept
term but the uncorrected total sum of squares should be used when you
do not have an intercept term. ' (Douglas Bates)


I have as reference a book called:

"Experiments with Mixtures: Designs, Models, and the Analysis of Mixture 
Data"
second edition

John A. Cornell
(Professor of Statistics in University Of Florida)


In this book, pg 42: item 2.7 - THE ANALYSIS OF VARIANCE TABLE,
I have the model below:


y(x) = 11.7x1 + 9.4x2 + 16.4x3 + 19.0x1x2 + 11.4x1x3 - 9.6x2x3


with the follow ANOVA Table:


source of variationD.F.SSMS

Regressionp-1SSR=\sum( y_{pred} - y_{mean} )^2ssR/(p-1)

ResidualN-pSSE=\sum( y_{exp} - y_{pred} )^2ssE/(N-p)   

TotalN-1SSE=\sum( y_{exp} - y_{mean} )^2


pred = predicted
exp = experimental

and in many others books.

I always see the ANOVA Table of Mixtures systems with SST, the 
"corrected" total
sum of squares ( N-1 degrees freedom ).



I would like to ask:

1) What is approach ( point view ) more adequate ?

2) Could someone indicate some reference about this subject ?


Thanks a lot.
Regards


Cleber N. Borges





 Dados
x1  x2  x3  y
10011
10012.4
0.50.5015
0.50.5014.8
0.50.5016.1
0108.8
01010
00.50.510
00.50.59.7
00.50.511.8
00116.8
00116
0.500.517.7
0.500.516.4
0.500.516.6

## Model

d.lm <- lm( y ~ -1 + x1*x2*x3 - x1:x2:x3, data = Dados )



### Anova like in the book
d.aov <- aov( y ~  x1*x2*x3 - x1:x2:x3, data = Dados )
 SSR (fitted Model) = 128.296



















Douglas Bates wrote:

>On 1/24/06, Lance Westerhoff <[EMAIL PROTECTED]> wrote:
>  
>
>>Hi-
>>
>>On Jan 24, 2006, at 12:08 PM, Peter Dalgaard wrote:
>>
>>
>>
>>>Lance Westerhoff <[EMAIL PROTECTED]> writes:
>>>
>>>  
>>>
>>>>Hello All-
>>>>
>>>>I found an inconsistency between the R-squared reported in Excel vs.
>>>>that in R, and I am wondering which (if any) may be correct and if
>>>>this is a known issue.  While it certainly wouldn't surprise me if
>>>>Excel is just flat out wrong, I just want to make sure since the R-
>>>>squared reported in R seems surprisingly high.  Please let me know if
>>>>this is the wrong list.  Thanks!
>>>>
>>>>
>>>Excel is flat out wrong. As the name implies, R-squared values cannot
>>>be less than zero (adjusted R-squared can, but I wouldn't think
>>>that is what Excel does).
>>>  
>>>
>>I had thought the same thing, but then I came across the following
>>site which states: "Note that it is possible to get a negative R-
>>square for equations that do not contain a constant term. If R-square
>>is defined as the proportion of variance explained by the fit, and if
>>the fit is actually worse than just fitting a horizontal line, then R-
>>square is negative. In this case, R-square cannot be interpreted as
>>the square of a correlation." Since
>>
>>R^2 = 1 - (SSE/SST)
>>
>>I guess you can have SSE > SST which would result in a R^2 of less
>>then 1.0.  However, it still seems very strange which made me wonder
>>what is going on in Excel needless to say!
>>
>>http://www.mathworks.com/access/helpdesk/help/toolbox/curvefit/
>>ch_fitt9.html
>>
>>
>
>This seems to be a case of using the wrong formula.  R^2 should
>measure the amount of variation for which the given model accounts
>relative to the amount of variation for which the *appropriate* null
>model does not account.  If you have a constant or intercept term in a
>linear model then the null model for comparison is one with the
>intercept only.  If you have a linear model without an intercept term
>then the appropriate null model for comparison is the model that
>predicts all the responses as zero.  Thus SST, the "corrected" total
>sum of squares, should be used when you have a model with an intercept
>term but the uncorrected total sum of squares should be used when you
>do not have an intercept term.
>
>It is disappointing to see the MathWorks propagating such an
>elementary misconception.
>
>__
>R-help@stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>.
>
>  
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] PowerPoint

2006-06-23 Thread Cleber N. Borges

Hello,
IMHO,

for the printer

1 - The best choice of  graphics format is postscript ( PS )  in
Microsoft ( M$ ), since you install the M$ Convert Pack [1]!
Make a preview in PS file with EMF format! use epstool for this

2 - Enhanced MetaFile ( EMF ) in M$ and OpenOffice ( OOo) is not the
same... This can be a problem! See pstoedit page [2]

3 - In OOo, I use the EPS file with the follow procedure:
  - save my graphic in PS
  - make to use de EPSTOOL for to produce EPS ( ps with tiff 
preview
) -> preview is a tiff graphic with low quality

*note:  emf can be also to included for preview


  - I need a PS-printer... in the case of NO-ps-printer, the 
tiff
(low quality) will be printed! { :-(  }, then, I make a PDF final 
report
with ExtendendPDF!

  - this procedure also work in the M$-Word


HTH,
Cleber N. Borges {klebyn}
---

[1] -
http://www.microsoft.com/downloads/details.aspx?FamilyID=cf196df0-70e5-4595-8a98-370278f40c57&DisplayLang=en

[2] - http://www.pstoedit.net/pstoedit

[3] - http://www.3bview.com/epdf-home.html







Marc Bernard wrote:

>Dear All,
>   
>  I am looking for the best way to use graphs from R (like xyplot, curve ...)  
>  for a presentation with powerpoint. I used to save my plot as pdf and after 
> to copy them as image in powerpoint but the quality is not optimal by so 
> doing.
>   
>  Another completely independent question is the following: when I use "main"  
> in the  xyplot, the main title is very close to my plot, i.e. no ligne 
> separate the main and the plot. I would like my title to be well 
> distinguished from the plots.
>   
>  I would be grateful for any improvements...
>   
>  Many thanks,
>   
>  Bernard,
>   
>
>
>   
>-
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
>.
>
>  
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html