Re: [R] how to overwrite a Unary operator ?

2014-10-17 Thread David Winsemius


On Oct 16, 2014, at 10:36 PM, PO SU wrote:



Tks for your advice,  let the ++ problem alone, how to write an  
Unary operator ? Is it permitted in R?

suchasa-2 , a%+2%  will let a  be 4 .


OK, that's just wrong. Oh, OK, just for fun, as it were:

inc - function(x)
{
 eval.parent(substitute(x - x + 1))
}


 inc(10)
Error in 10 - 10 + 1 : invalid (do_set) left-hand side to assignment
 y=10
 inc(y)
 y
[1] 11


I just want to know it , i won't pollute r with it , because i know  
what is r .  : )


It's certainly permitted. Just look at all the overloadings of the +  
operator in graphics packages. Look up the documentation on methods in  
R.


Why not just use a well-behaved function, though?

.inc - function(x) x+1
 .inc(10)
[1] 11

Then you won't be tempted to try 10 - .inc(10) because it just  
wouldn't make sense.


--
David.


--

PO SU
mail: desolato...@163.com
Majored in Statistics from SJTU




At 2014-10-17 13:09:47, Rolf Turner r.tur...@auckland.ac.nz wrote:

On 17/10/14 17:29, PO SU wrote:


Dear expeRts,
  Now i want to know how to implement an Unary operator like  i++  
in cpp's  synax form.

  e.g.   2++  will let 2 be 3 ,  a-2 ,a++ ,will let a be 3
I tried this :
 '%++%'-function(x){
   x-x+1
}
but it have problem, the biggest one is it seems the function need
twoparams like a%++%b , how to write a function needing just one  
param?


TKS !


Just ***DON'T***.  The ++ operator is useful only for those wish to
write code which is obscure to the point of incomprehensibility.  It
makes C and its offspring write only languages.

If you are going to use R, use R and don't pollute it with such
abominations.

cheers,

Rolf Turner


--
Rolf Turner
Technical Editor ANZJS

__
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
Alameda, CA, USA

__
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 overwrite a Unary operator ?

2014-10-17 Thread Benno Pütz

On 17 Oct 2014, at 06:29, PO SU rhelpmaill...@163.com wrote:

   e.g.   2++  will let 2 be 3
That would not even work in C ...

While I use this in C, I second Rolf on the general issue.

Benno__
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] Difference betweeen cor.test() and formula everyone says to use

2014-10-17 Thread peter dalgaard
This is pretty much standard. I'm quite sure that other stats packages do 
likewise and I wouldn't know who everyone is. It is not unheard of that 
textbook authors give suboptimal formulas in order not to confuse students, 
though.

The basic point is that the t transformation gives the exact distribution under 
the null. Fisher's Z is only approximately normally distributed. 

The t transformation works because if beta is the regression coefficient of y 
on x, beta==0 iff rho==0, and we have exact theory for testing beta==0 by a 
t-test.

Off-null, the t-approach does not readily transfer, so confidence intervals 
tend to be based on the Z-transformation.

-Peter D.



On 17 Oct 2014, at 02:20 , Joshua Wiley jwiley.ps...@gmail.com wrote:

 Hi Jeremy,
 
 I don't know about references, but this around.  See for example:
 http://afni.nimh.nih.gov/sscc/gangc/tr.html
 
 the relevant line in cor.test is:
 
 STATISTIC - c(t = sqrt(df) * r/sqrt(1 - r^2))
 
 You can convert *t*s to *r*s and vice versa.
 
 Best,
 
 Josh
 
 
 
 On Fri, Oct 17, 2014 at 10:32 AM, Jeremy Miles jeremy.mi...@gmail.com
 wrote:
 
 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.
 
 
 
 
 -- 
 Joshua F. Wiley
 Ph.D. Student, UCLA Department of Psychology
 http://joshuawiley.com/
 Senior Analyst, Elkhart Group Ltd.
 http://elkhartgroup.com
 Office: 260.673.5518
 
   [[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.

-- 
Peter Dalgaard, Professor,
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.


[R] {car} outlierTest looses p/q values

2014-10-17 Thread Phil

Hi guys,

I came across a strange phenomena and can't figure out why it happens by 
myself so here we go.


I got a dataframe which consists of double numbers which I want to 
check, row-wise if there are outliers in the rows.


So I iterate over the rows and create a glm using the numbers of that 
particular row. Which might look like this:


case1)
x1x2x3x4x5x6 x7
x8x9x10x11
0.00 3.91 0.00 0.00 0.00   68.03   40.39 0.00 
0.00  0.00   4.11


or like this:
case2)
x1x2x3x4x5x6 x7
x8x9x10x11
 1.00 1.001.00 1.00 1.00 1.00 1.00 1.00 
1.00 1.00  5.34


or any other combination of double numbers...

however, using a glm like this:

glModel - glm(vector ~ some_other_meta_data_which_is_double_numbers)

and testing it with:

 test.Res - outlierTest(glModel,digits=4,cutoff=Inf,n.max=Inf)

I always get a result consisting of the desired p and q values but not 
if the vector I use looks like case2. There is no error message and the 
computation does not stop either.

However, all p and q values are produced except for the last value x11.

Any idea why this particular value gets dropped from the output of the 
outlierTest Method in the car package.


Here is the sessioninfo:

 sessionInfo()
R version 3.1.1 (2014-07-10)
Platform: x86_64-redhat-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.utf8   LC_NUMERIC=C
 [3] LC_TIME=en_US.utf8LC_COLLATE=en_US.utf8
 [5] LC_MONETARY=en_US.utf8LC_MESSAGES=en_US.utf8
 [7] LC_PAPER=en_US.utf8   LC_NAME=C
 [9] LC_ADDRESS=C  LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.utf8 LC_IDENTIFICATION=C

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

other attached packages:
[1] ggplot2_1.0.0  car_2.0-21 RColorBrewer_1.0-5 iNEXT_1.0
[5] vegan_2.0-10   lattice_0.20-29permute_0.8-3

loaded via a namespace (and not attached):
 [1] colorspace_1.2-4 compiler_3.1.1   digest_0.6.4 grid_3.1.1
 [5] gtable_0.1.2 labeling_0.3 MASS_7.3-33 munsell_0.4.2
 [9] nnet_7.3-8   plyr_1.8.1   proto_0.3-10 Rcpp_0.11.2
[13] reshape2_1.4 scales_0.2.4 stringr_0.6.2tools_3.1.1

Any help is highly appreciated.

Thanks

Phil

__
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] need help for error incompatible dimensions

2014-10-17 Thread Swapnil Khobragade






Hello,

I m R user trying  to map and find correlation between two entities i.e. time 
and usability of cup from log file, but its showing error while compilation.
Is there any specific package(s) by means of which I can effectively run the 
code meant for different dimensions computation?


I have attached .R file and log file (.txt)
Please find attachment..






Regards,
Swapnil Khobragade
Larsen  Toubro Infotech Ltd.
Bldg. No.56, 1st Floor,
Airoli, Navi Mumbai - 400708.
e-mail ID: 
swapnil.khobrag...@lntinfotech.commailto:swapnil.khobrag...@lntinfotech.com


The contents of this e-mail and any attachment(s) may contain confidential or 
privileged information for the intended recipient(s). Unintended recipients are 
prohibited from taking action on the basis of information in this e-mail and 
using or disseminating the information, and must notify the sender and delete 
it from their system. LT Infotech will not accept responsibility or liability 
for the accuracy or completeness of, or the presence of any virus or disabling 
code in this e-mail

20:47:15all  5.05  0.00  2.02  0.51  0.00 92.42
20:47:16all  4.02  0.00  2.01  0.00  0.00 93.97
20:47:17all  5.61  0.00  2.55  0.00  0.00 91.84
20:47:18all  3.55  0.00  1.52  0.00  0.00 94.92
20:47:19all  5.58  0.00  2.03  0.00  0.00 92.39
20:47:20all  2.05  0.00  3.08  0.00  0.00 94.87
20:47:21all  3.55  0.00  1.52  0.00  0.00 94.92
20:47:22all  5.64  0.00  2.56  0.00  0.00 91.79
20:47:23all  3.02  0.00  2.51  0.00  0.00 94.47
20:47:24all  3.08  0.00  2.05  0.00  0.00 94.87
20:47:25all  4.06  0.00  2.54  0.00  0.00 93.40
__
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 overwrite a Unary operator ?

2014-10-17 Thread PO SU

Tks for your alternative way's details. but like you mentioned in graphics 
package, i still wonder how to overload an operator which can pass one param 
like +2 .
There seems exists some examples for my needing. But i try to find them but 
without any results.
can you show me some examples from it? 






--

PO SU
mail: desolato...@163.com 
Majored in Statistics from SJTU



At 2014-10-17 15:16:47, David Winsemius dwinsem...@comcast.net wrote:

On Oct 16, 2014, at 10:36 PM, PO SU wrote:


 Tks for your advice,  let the ++ problem alone, how to write an  
 Unary operator ? Is it permitted in R?
 suchasa-2 , a%+2%  will let a  be 4 .

OK, that's just wrong. Oh, OK, just for fun, as it were:

inc - function(x)
{
  eval.parent(substitute(x - x + 1))
}


  inc(10)
Error in 10 - 10 + 1 : invalid (do_set) left-hand side to assignment
  y=10
  inc(y)
  y
[1] 11


 I just want to know it , i won't pollute r with it , because i know  
 what is r .  : )

It's certainly permitted. Just look at all the overloadings of the +  
operator in graphics packages. Look up the documentation on methods in  
R.

Why not just use a well-behaved function, though?

.inc - function(x) x+1
  .inc(10)
[1] 11

Then you won't be tempted to try 10 - .inc(10) because it just  
wouldn't make sense.

-- 
David.

 --

 PO SU
 mail: desolato...@163.com
 Majored in Statistics from SJTU




 At 2014-10-17 13:09:47, Rolf Turner r.tur...@auckland.ac.nz wrote:
 On 17/10/14 17:29, PO SU wrote:

 Dear expeRts,
   Now i want to know how to implement an Unary operator like  i++  
 in cpp's  synax form.
   e.g.   2++  will let 2 be 3 ,  a-2 ,a++ ,will let a be 3
 I tried this :
  '%++%'-function(x){
x-x+1
 }
 but it have problem, the biggest one is it seems the function need
 twoparams like a%++%b , how to write a function needing just one  
 param?

 TKS !

 Just ***DON'T***.  The ++ operator is useful only for those wish to
 write code which is obscure to the point of incomprehensibility.  It
 makes C and its offspring write only languages.

 If you are going to use R, use R and don't pollute it with such
 abominations.

 cheers,

 Rolf Turner


 -- 
 Rolf Turner
 Technical Editor ANZJS
 __
 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
Alameda, CA, USA

__
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] ggplot: Stacked bar/pie chart - Objects above the bar/pie

2014-10-17 Thread Gunnar Oehmichen
Hello,

I would like to draw a circle on top of a pie chart (The plot does not
need to fullfill scientific standards). The circle represents the
relation of a reference-value in comparison to the summed values of the
pie-pieces. To be able to do this I partly followed:
http://rpubs.com/RobinLovelace/11641 . But i have the problem of some
bar/pie pieces being placed above the stacked bar/outside of the pie
chart, see graph PA / PA + coord_polar.

System: $platform [1] i686-pc-linux-gnu; $version.string [1] R
version 3.1.1 (2014-07-10); ggplot2_0.9.3.1



require (ggplot2)

mdf - structure(list(
  VG = structure(c(1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L),
 .Label = c(A, B), class = factor),
  variable = structure(c(4L, 3L, 5L, 1L, 2L, 1L, 4L, 3L, 2L, 5L),
   .Label = c(a, b, c,  d, e), class =
factor),
  value = c(0, 8407346.56, 0, 124901773, 0, 184987520, 14612608,
3165030, 0, 0),
  reference = c(0.75, 0.75, 0.75, 0.75, 0.75, 1.25, 1.25, 1.25, 1.25,
1.25)),
  .Names = c(VG, variable, value, reference),
  row.names = c(16L, 17L, 18L,   19L, 20L, 46L, 47L, 48L, 49L, 50L),
class = data.frame)

# Calculate position
pos - function (x) 0.5 * (cumsum(x) + cumsum(c(0, x[-length(x)])))
lmdf - dlply (mdf, VG)
lmdf - lapply (lmdf, function (X) { X$pos - pos (X$value)
 return (X) })
mdf - rbind.data.frame (lmdf[[1]], lmdf[[2]])

# height (radius) of all pieces (variable) in one bar (pie) will be the
same:
mdf$rad - 1

# abline from the reference column in the dataframe
INTCA - unique (mdf$reference[mdf$VG==A])
PA - ggplot (mdf[mdf$VG==A,], aes (x = pos, y = rad)) +
  geom_bar (stat = identity, aes (fill = variable, width = value)) +
  geom_abline(intercept = INTCA, slope = 0)

PA
PA + coord_polar()
# Object c is placed above its position on the y axis

# abline from the reference column in the dataframe
INTCB - unique (mdf$reference[mdf$VG==B])
PB - ggplot (mdf[mdf$VG==B,], aes (x = pos, y = rad)) +
  geom_bar (stat = identity, aes (fill = variable, width = value)) +
  geom_abline(intercept = INTCB, slope = 0)

PB
PB + coord_polar()
# all objects are within rad = 1

###

Your help would be very much appreciated,

Gunnar

__
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] need help for error incompatible dimensions

2014-10-17 Thread PIKAL Petr
Hi

Your .R attachment did not come through. Included txt file did not have 
headers. Maybe you just want

cor(whatever is the name of your numeric object)

Cheers
Petr


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of Swapnil Khobragade
 Sent: Friday, October 17, 2014 11:04 AM
 To: r-help@r-project.org
 Cc: skhobragad...@gmail.com
 Subject: [R] need help for error incompatible dimensions







 Hello,

 I m R user trying  to map and find correlation between two entities
 i.e. time and usability of cup from log file, but its showing error
 while compilation.
 Is there any specific package(s) by means of which I can effectively
 run the code meant for different dimensions computation?


 I have attached .R file and log file (.txt) Please find attachment..






 Regards,
 Swapnil Khobragade
 Larsen  Toubro Infotech Ltd.
 Bldg. No.56, 1st Floor,
 Airoli, Navi Mumbai - 400708.
 e-mail ID:
 swapnil.khobrag...@lntinfotech.commailto:swapnil.khobragade@lntinfotec
 h.com

 
 The contents of this e-mail and any attachment(s) may contain
 confidential or privileged information for the intended recipient(s).
 Unintended recipients are prohibited from taking action on the basis of
 information in this e-mail and using or disseminating the information,
 and must notify the sender and delete it from their system. LT
 Infotech will not accept responsibility or liability for the accuracy
 or completeness of, or the presence of any virus or disabling code in
 this e-mail


Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny 
pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
svého systému.
Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
zpožděním přenosu e-mailu.

V případě, že je tento e-mail součástí obchodního jednání:
- vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a 
to z jakéhokoliv důvodu i bez uvedení důvodu.
- a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; 
Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce 
s dodatkem či odchylkou.
- trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným 
dosažením shody na všech jejích náležitostech.
- odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost 
žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně 
pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně 
osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi 
či osobě jím zastoupené známá.

This e-mail and any documents attached to it may be confidential and are 
intended only for its intended recipients.
If you received this e-mail by mistake, please immediately inform its sender. 
Delete the contents of this e-mail with all attachments and its copies from 
your system.
If you are not the intended recipient of this e-mail, you are not authorized to 
use, disseminate, copy or disclose this e-mail in any manner.
The sender of this e-mail shall not be liable for any possible damage caused by 
modifications of the e-mail or by delay with transfer of the email.

In case that this e-mail forms part of business dealings:
- the sender reserves the right to end negotiations about entering into a 
contract in any time, for any reason, and without stating any reasoning.
- if the e-mail contains an offer, the recipient is entitled to immediately 
accept such offer; The sender of this e-mail (offer) excludes any acceptance of 
the offer on the part of the recipient containing any amendment or variation.
- the sender insists on that the respective contract is concluded only upon an 
express mutual agreement on all its aspects.
- the sender of this e-mail informs that he/she is not authorized to enter into 
any contracts on behalf of the company except for cases in which he/she is 
expressly authorized to do so in writing, and such authorization or power of 
attorney is submitted to the recipient or the person represented by the 
recipient, or the existence of such authorization is known to the recipient of 
the person represented by the recipient.
__
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] assigning letter to a column

2014-10-17 Thread Monaly Mistry
Hi,

I'm having trouble with assigning a letter to a column based on the value
of another column.
Since I have separate data files I've saved then into one folder and I'm
reading them in separately into the function.

The code is below.

#F= fast; S= slow; I1= Intermediate score 1; I2=Intermediate score 2
filename-list.files(pattern=*.txt)
filename
corloc- function(x){
  x-read.table(filename[x], sep=\t, header=TRUE) #will extract the
relevant data file from folder 1998. ex. corloc(1) will return 1998
breeding year data
  x[,ForS]-0 #new column
  for (i in length(x$CORLOC)){ #this is the bit that I'm having a problem
with since it's not assigning the appropriate letter into the ForS column
  ifelse(x$COR_LOC=3 | x$COR_LOC15.230, ForS-S,
 ifelse(x$COR_LOC=15.230 | x$COR_LOC19.810, ForS-I1,
ifelse(x$COR_LOC=19.810 | x$COR_LOC25.540,
FS-I2,ForS-F)))}
  print(x)
}

I've tried some of the solutions on stackoverflow but still was
unsuccessful.

Best,

Monaly.

[[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] Making a very specific heatmap in R (ggplot2?)

2014-10-17 Thread Jeff Newmiller
As the Posting Guide indicates, this is a text-only mailing list, and small, 
reproducible (self-contained) examples of R code are expected. You are not 
getting much response because what you sent is not what we see, and we cannot 
tweak code you do not share.
---
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 October 16, 2014 7:02:37 PM PDT, Alexander Predeus pred...@gmail.com wrote:
Hello All,

I'm trying to figure out the (automated) way to generate heatmaps from
simple data tables with annotated rows and columns. In the end, I need
these files to be easily viewed in a browser.

The initial data tables are simple; numbers are row-normalized (values
are
real numbers varying from -1.0 to +1.0), with rows numbered from a zero
to
a certain integer, and columns are named with (sometimes lengthy)
strings.

What I came up with so far is building the heatmap using standard
facility
with a set resolution of the final png file:

Which sort of works sometimes:

And fails pretty miserably other times:

What I really would like to do, is to make a heatmap with set number of
pixels per square, with a set font size (in pixels as well), and then
save
it as a .png with variable resolution (appropriate for each concrete
heatmap). That way, a cell would be always say 10 by 10 pixels, and the
text on the right is always 8 pixels tall.

Alternatively, of course, it would be very neat to save it in some
vector
format easily interpreted by the browser, but I have an impression it
is
not an easy feat to accomplish.

Thank you very much 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.

__
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] assigning letter to a column

2014-10-17 Thread David L Carlson
I think it is doing exactly what you have told it to do, but that is probably 
not what you want it to do.

First, you do not need a loop since the ifelse() function is vectorized. Read 
the manual page and the examples carefully. Also you are coding ifelse() as if 
it were the same as if() {} else() {}. Again you need to refer to the 
documentation.

Second, this seems like a job for cut() not ifelse().

Third, look at your code. The first statement is x$COR_LOC=3 | 
x$COR_LOC15.230 so everything greater than 3 will be coded as S. That is 
probably all of your data. You probably want to use  (and) instead of | (or). 
It is not clear what you want to happen for values less than 3 but they will be 
NA (missing).

Your entire ifelse() boils down to

set.seed(42)
x - data.frame(COR_LOC=runif(100, 0, 30))
x$ForS - cut(x$COR_LOC, breaks=c(3, 15.23, 19.81, 25.40, Inf),
labels=c(S, I1, I2, F), right=FALSE)

No loops, no ifelse's. Anything below 3 will 

-
David L Carlson
Department of Anthropology
Texas AM University
College Station, TX 77840-4352



-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Monaly Mistry
Sent: Friday, October 17, 2014 8:27 AM
To: r-help@r-project.org
Subject: [R] assigning letter to a column

Hi,

I'm having trouble with assigning a letter to a column based on the value
of another column.
Since I have separate data files I've saved then into one folder and I'm
reading them in separately into the function.

The code is below.

#F= fast; S= slow; I1= Intermediate score 1; I2=Intermediate score 2
filename-list.files(pattern=*.txt)
filename
corloc- function(x){
  x-read.table(filename[x], sep=\t, header=TRUE) #will extract the
relevant data file from folder 1998. ex. corloc(1) will return 1998
breeding year data
  x[,ForS]-0 #new column
  for (i in length(x$CORLOC)){ #this is the bit that I'm having a problem
with since it's not assigning the appropriate letter into the ForS column
  ifelse(x$COR_LOC=3 | x$COR_LOC15.230, ForS-S,
 ifelse(x$COR_LOC=15.230 | x$COR_LOC19.810, ForS-I1,
ifelse(x$COR_LOC=19.810 | x$COR_LOC25.540,
FS-I2,ForS-F)))}
  print(x)
}

I've tried some of the solutions on stackoverflow but still was
unsuccessful.

Best,

Monaly.

[[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] assigning letter to a column

2014-10-17 Thread David L Carlson
Minor correction, given your code, values less than 3 will be coded as S 
since they are less than 15.23. In the code I suggested, values less than 3 
will be coded as missing (NA).

David C

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of David L Carlson
Sent: Friday, October 17, 2014 9:15 AM
To: Monaly Mistry; r-help@r-project.org
Subject: Re: [R] assigning letter to a column

I think it is doing exactly what you have told it to do, but that is probably 
not what you want it to do.

First, you do not need a loop since the ifelse() function is vectorized. Read 
the manual page and the examples carefully. Also you are coding ifelse() as if 
it were the same as if() {} else() {}. Again you need to refer to the 
documentation.

Second, this seems like a job for cut() not ifelse().

Third, look at your code. The first statement is x$COR_LOC=3 | 
x$COR_LOC15.230 so everything greater than 3 will be coded as S. That is 
probably all of your data. You probably want to use  (and) instead of | (or). 
It is not clear what you want to happen for values less than 3 but they will be 
NA (missing).

Your entire ifelse() boils down to

set.seed(42)
x - data.frame(COR_LOC=runif(100, 0, 30))
x$ForS - cut(x$COR_LOC, breaks=c(3, 15.23, 19.81, 25.40, Inf),
labels=c(S, I1, I2, F), right=FALSE)

No loops, no ifelse's. Anything below 3 will 

-
David L Carlson
Department of Anthropology
Texas AM University
College Station, TX 77840-4352



-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Monaly Mistry
Sent: Friday, October 17, 2014 8:27 AM
To: r-help@r-project.org
Subject: [R] assigning letter to a column

Hi,

I'm having trouble with assigning a letter to a column based on the value
of another column.
Since I have separate data files I've saved then into one folder and I'm
reading them in separately into the function.

The code is below.

#F= fast; S= slow; I1= Intermediate score 1; I2=Intermediate score 2
filename-list.files(pattern=*.txt)
filename
corloc- function(x){
  x-read.table(filename[x], sep=\t, header=TRUE) #will extract the
relevant data file from folder 1998. ex. corloc(1) will return 1998
breeding year data
  x[,ForS]-0 #new column
  for (i in length(x$CORLOC)){ #this is the bit that I'm having a problem
with since it's not assigning the appropriate letter into the ForS column
  ifelse(x$COR_LOC=3 | x$COR_LOC15.230, ForS-S,
 ifelse(x$COR_LOC=15.230 | x$COR_LOC19.810, ForS-I1,
ifelse(x$COR_LOC=19.810 | x$COR_LOC25.540,
FS-I2,ForS-F)))}
  print(x)
}

I've tried some of the solutions on stackoverflow but still was
unsuccessful.

Best,

Monaly.

[[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-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] {car} outlierTest looses p/q values

2014-10-17 Thread John Fox
Dear Phil,

After reading your posting several times, I still don't understand what you 
did. As usual, having a reproducible example illustrating the error would be a 
great help. I do have a guess about the source of the error: glm() failed in 
some way for the problematic case.

Best,
 John


John Fox, Professor
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox/


On Fri, 17 Oct 2014 12:53:30 +0200
 Phil chobop...@gmail.com wrote:
 Hi guys,
 
 I came across a strange phenomena and can't figure out why it happens by 
 myself so here we go.
 
 I got a dataframe which consists of double numbers which I want to check, 
 row-wise if there are outliers in the rows.
 
 So I iterate over the rows and create a glm using the numbers of that 
 particular row. Which might look like this:
 
 case1)
  x1x2x3x4x5x6 x7
 x8x9x10x11
  0.00 3.91 0.00 0.00 0.00   68.03   40.39 0.00 
 0.00  0.00   4.11
 
 or like this:
 case2)
  x1x2x3x4x5x6 x7
 x8x9x10x11
   1.00 1.001.00 1.00 1.00 1.00 1.00 1.00 
 1.00 1.00  5.34
 
 or any other combination of double numbers...
 
 however, using a glm like this:
 
 glModel - glm(vector ~ some_other_meta_data_which_is_double_numbers)
 
 and testing it with:
 
   test.Res - outlierTest(glModel,digits=4,cutoff=Inf,n.max=Inf)
 
 I always get a result consisting of the desired p and q values but not if the 
 vector I use looks like case2. There is no error message and the computation 
 does not stop either.
 However, all p and q values are produced except for the last value x11.
 
 Any idea why this particular value gets dropped from the output of the 
 outlierTest Method in the car package.
 
 Here is the sessioninfo:
 
   sessionInfo()
 R version 3.1.1 (2014-07-10)
 Platform: x86_64-redhat-linux-gnu (64-bit)
 
 locale:
   [1] LC_CTYPE=en_US.utf8   LC_NUMERIC=C
   [3] LC_TIME=en_US.utf8LC_COLLATE=en_US.utf8
   [5] LC_MONETARY=en_US.utf8LC_MESSAGES=en_US.utf8
   [7] LC_PAPER=en_US.utf8   LC_NAME=C
   [9] LC_ADDRESS=C  LC_TELEPHONE=C
 [11] LC_MEASUREMENT=en_US.utf8 LC_IDENTIFICATION=C
 
 attached base packages:
 [1] stats graphics  grDevices utils datasets  methods base
 
 other attached packages:
 [1] ggplot2_1.0.0  car_2.0-21 RColorBrewer_1.0-5 iNEXT_1.0
 [5] vegan_2.0-10   lattice_0.20-29permute_0.8-3
 
 loaded via a namespace (and not attached):
   [1] colorspace_1.2-4 compiler_3.1.1   digest_0.6.4 grid_3.1.1
   [5] gtable_0.1.2 labeling_0.3 MASS_7.3-33 munsell_0.4.2
   [9] nnet_7.3-8   plyr_1.8.1   proto_0.3-10 Rcpp_0.11.2
 [13] reshape2_1.4 scales_0.2.4 stringr_0.6.2tools_3.1.1
 
 Any help is highly appreciated.
 
 Thanks
 
 Phil
 
 __
 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 overwrite a Unary operator ?

2014-10-17 Thread Greg Snow
You may be interested in looking at Reference Classes/objects (see
?setRefClass).  This is a form of OO programming that is more similar
to C++ and Java.  You could create a counter object that you could
then increment with syntax like:

x$inc()
x$inc(5)

The first would increment by the default (1), the second would then
increment by 5.



On Fri, Oct 17, 2014 at 2:06 AM, PO SU rhelpmaill...@163.com wrote:

 Tks for your alternative way's details. but like you mentioned in graphics 
 package, i still wonder how to overload an operator which can pass one param 
 like +2 .
 There seems exists some examples for my needing. But i try to find them but 
 without any results.
 can you show me some examples from it?






 --

 PO SU
 mail: desolato...@163.com
 Majored in Statistics from SJTU



 At 2014-10-17 15:16:47, David Winsemius dwinsem...@comcast.net wrote:

On Oct 16, 2014, at 10:36 PM, PO SU wrote:


 Tks for your advice,  let the ++ problem alone, how to write an
 Unary operator ? Is it permitted in R?
 suchasa-2 , a%+2%  will let a  be 4 .

OK, that's just wrong. Oh, OK, just for fun, as it were:

inc - function(x)
{
  eval.parent(substitute(x - x + 1))
}


  inc(10)
Error in 10 - 10 + 1 : invalid (do_set) left-hand side to assignment
  y=10
  inc(y)
  y
[1] 11


 I just want to know it , i won't pollute r with it , because i know
 what is r .  : )

It's certainly permitted. Just look at all the overloadings of the +
operator in graphics packages. Look up the documentation on methods in
R.

Why not just use a well-behaved function, though?

.inc - function(x) x+1
  .inc(10)
[1] 11

Then you won't be tempted to try 10 - .inc(10) because it just
wouldn't make sense.

--
David.

 --

 PO SU
 mail: desolato...@163.com
 Majored in Statistics from SJTU




 At 2014-10-17 13:09:47, Rolf Turner r.tur...@auckland.ac.nz wrote:
 On 17/10/14 17:29, PO SU wrote:

 Dear expeRts,
   Now i want to know how to implement an Unary operator like  i++
 in cpp's  synax form.
   e.g.   2++  will let 2 be 3 ,  a-2 ,a++ ,will let a be 3
 I tried this :
  '%++%'-function(x){
x-x+1
 }
 but it have problem, the biggest one is it seems the function need
 twoparams like a%++%b , how to write a function needing just one
 param?

 TKS !

 Just ***DON'T***.  The ++ operator is useful only for those wish to
 write code which is obscure to the point of incomprehensibility.  It
 makes C and its offspring write only languages.

 If you are going to use R, use R and don't pollute it with such
 abominations.

 cheers,

 Rolf Turner


 --
 Rolf Turner
 Technical Editor ANZJS
 __
 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
Alameda, CA, USA

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



-- 
Gregory (Greg) L. Snow Ph.D.
538...@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.


Re: [R] assigning letter to a column

2014-10-17 Thread Monaly Mistry
Thank you for your help David, will make sure to check the documentation.

Best,

Monaly

On Fri, Oct 17, 2014 at 3:27 PM, David L Carlson dcarl...@tamu.edu wrote:

 Minor correction, given your code, values less than 3 will be coded as S
 since they are less than 15.23. In the code I suggested, values less than 3
 will be coded as missing (NA).

 David C

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
 On Behalf Of David L Carlson
 Sent: Friday, October 17, 2014 9:15 AM
 To: Monaly Mistry; r-help@r-project.org
 Subject: Re: [R] assigning letter to a column

 I think it is doing exactly what you have told it to do, but that is
 probably not what you want it to do.

 First, you do not need a loop since the ifelse() function is vectorized.
 Read the manual page and the examples carefully. Also you are coding
 ifelse() as if it were the same as if() {} else() {}. Again you need to
 refer to the documentation.

 Second, this seems like a job for cut() not ifelse().

 Third, look at your code. The first statement is x$COR_LOC=3 |
 x$COR_LOC15.230 so everything greater than 3 will be coded as S. That is
 probably all of your data. You probably want to use  (and) instead of |
 (or). It is not clear what you want to happen for values less than 3 but
 they will be NA (missing).

 Your entire ifelse() boils down to

 set.seed(42)
 x - data.frame(COR_LOC=runif(100, 0, 30))
 x$ForS - cut(x$COR_LOC, breaks=c(3, 15.23, 19.81, 25.40, Inf),
 labels=c(S, I1, I2, F), right=FALSE)

 No loops, no ifelse's. Anything below 3 will

 -
 David L Carlson
 Department of Anthropology
 Texas AM University
 College Station, TX 77840-4352



 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
 On Behalf Of Monaly Mistry
 Sent: Friday, October 17, 2014 8:27 AM
 To: r-help@r-project.org
 Subject: [R] assigning letter to a column

 Hi,

 I'm having trouble with assigning a letter to a column based on the value
 of another column.
 Since I have separate data files I've saved then into one folder and I'm
 reading them in separately into the function.

 The code is below.

 #F= fast; S= slow; I1= Intermediate score 1; I2=Intermediate score 2
 filename-list.files(pattern=*.txt)
 filename
 corloc- function(x){
   x-read.table(filename[x], sep=\t, header=TRUE) #will extract the
 relevant data file from folder 1998. ex. corloc(1) will return 1998
 breeding year data
   x[,ForS]-0 #new column
   for (i in length(x$CORLOC)){ #this is the bit that I'm having a problem
 with since it's not assigning the appropriate letter into the ForS column
   ifelse(x$COR_LOC=3 | x$COR_LOC15.230, ForS-S,
  ifelse(x$COR_LOC=15.230 | x$COR_LOC19.810, ForS-I1,
 ifelse(x$COR_LOC=19.810 | x$COR_LOC25.540,
 FS-I2,ForS-F)))}
   print(x)
 }

 I've tried some of the solutions on stackoverflow but still was
 unsuccessful.

 Best,

 Monaly.

 [[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 overwrite a Unary operator ?

2014-10-17 Thread David Winsemius

On Oct 17, 2014, at 1:06 AM, PO SU wrote:

 
 Tks for your alternative way's details. but like you mentioned in graphics 
 package, i still wonder how to overload an operator which can pass one param 
 like +2 .
 There seems exists some examples for my needing. But i try to find them but 
 without any results.
 can you show me some examples from it? 
 

I think this might be a case of if you don't know enough to do it, then you 
don't know why you shouldn't do it. (Or vice versa?) I did search for a 
relevant fortune to support my impression, but the various entries for 
fortune(parse) and fortune(eval) didn't seem to hit the mark.

library(ggplot2)
help(pack=ggplot2)  # scroll to bottom of page
ggplot2:::`+.gg`   # this shows the S3 method of adding an operator based on 
the S3 method dispatch.

I was able to emulate that example to create a C-like, unary `+` operator for a 
new class, but I'm not willing to put it in print for fear that my karmic 
account might be depleted.

-- 
David.

 --
 
 PO SU
 mail: desolato...@163.com 
 Majored in Statistics from SJTU
 
 
 
 At 2014-10-17 15:16:47, David Winsemius dwinsem...@comcast.net wrote:
 
 On Oct 16, 2014, at 10:36 PM, PO SU wrote:
 
 
 Tks for your advice,  let the ++ problem alone, how to write an  
 Unary operator ? Is it permitted in R?
 suchasa-2 , a%+2%  will let a  be 4 .
 
 OK, that's just wrong. Oh, OK, just for fun, as it were:
 
 inc - function(x)
 {
 eval.parent(substitute(x - x + 1))
 }
 
 
 inc(10)
 Error in 10 - 10 + 1 : invalid (do_set) left-hand side to assignment
 y=10
 inc(y)
 y
 [1] 11
 
 
 I just want to know it , i won't pollute r with it , because i know  
 what is r .  : )
 
 It's certainly permitted. Just look at all the overloadings of the +  
 operator in graphics packages. Look up the documentation on methods in  
 R.
 
 Why not just use a well-behaved function, though?
 
 .inc - function(x) x+1
 .inc(10)
 [1] 11
 
 Then you won't be tempted to try 10 - .inc(10) because it just  
 wouldn't make sense.
 
 -- 
 David.
 
 --
 
 PO SU
 mail: desolato...@163.com
 Majored in Statistics from SJTU
 
 
 
 
 At 2014-10-17 13:09:47, Rolf Turner r.tur...@auckland.ac.nz wrote:
 On 17/10/14 17:29, PO SU wrote:
 
 Dear expeRts,
  Now i want to know how to implement an Unary operator like  i++  
 in cpp's  synax form.
  e.g.   2++  will let 2 be 3 ,  a-2 ,a++ ,will let a be 3
 I tried this :
 '%++%'-function(x){
   x-x+1
 }
 but it have problem, the biggest one is it seems the function need
 twoparams like a%++%b , how to write a function needing just one  
 param?
 
 TKS !
 
 Just ***DON'T***.  The ++ operator is useful only for those wish to
 write code which is obscure to the point of incomprehensibility.  It
 makes C and its offspring write only languages.
 
 If you are going to use R, use R and don't pollute it with such
 abominations.
 
 cheers,
 
 Rolf Turner
 
 
 -- 
 Rolf Turner
 Technical Editor ANZJS
 __
 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
 Alameda, CA, USA
 

David Winsemius
Alameda, CA, USA

__
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] {car} outlierTest looses p/q values

2014-10-17 Thread John Fox
Dear Phil,

Yes, that's a bit clearer. One can invent data configurations where certain 
studentized residuals are undefined. For example, try the following:

y - c(0, 0, 0, 0, 0, 1)
x - 1:6
xx - (1:6 - 3.5)^2
rstudent(lm(y ~ x))
rstudent(lm(y ~ xx))
plot(x, y)
plot(xx, y)

The plots should clarify what's going on.

I'm copying to r-help since the discussion began there.

I hope this helps,
 John

On Fri, 17 Oct 2014 18:35:59 +0200
 Philip Stevens chobop...@gmail.com wrote:
 Dear John,
 
 Thank you for your fast reply. Unfortunately I am out of office right now
 but I will get back to you on Monday asap with a toy example and some code.
 Meanwhile let me try to explain further.
 
 Basically not the glm but the outlierTest afterwards fails. And it only
 fails if all values, used to set up the glm, are exactly 1 except for one
 value which can be arbitrary large. I construct the glm from a vector of
 doubles (the target values) and a vector of other numeric values(metadata).
 (So this should be fit - glm(targetVector ~ metadata) ) And want to check
 if one of those doubles(in the target vector) is an outlier using
 outlierTest(fit). The residuals are calculated by the glm but the
 outlierTest does not report a p nor a q value for the one value in the
 target vector which is not 1. And I can't figure out why...
 
 I hope this makes it a bit clearer.
 Anyways I will come back to you on Monday.
 
 Best,
 
 Phil
 Am 17.10.2014 17:43 schrieb John Fox j...@mcmaster.ca:
 
  Dear Phil,
 
  After reading your posting several times, I still don't understand what
  you did. As usual, having a reproducible example illustrating the error
  would be a great help. I do have a guess about the source of the error:
  glm() failed in some way for the problematic case.
 
  Best,
   John
 
  
  John Fox, Professor
  McMaster University
  Hamilton, Ontario, Canada
  http://socserv.mcmaster.ca/jfox/
 
 
  On Fri, 17 Oct 2014 12:53:30 +0200
   Phil chobop...@gmail.com wrote:
   Hi guys,
  
   I came across a strange phenomena and can't figure out why it happens by
  myself so here we go.
  
   I got a dataframe which consists of double numbers which I want to
  check, row-wise if there are outliers in the rows.
  
   So I iterate over the rows and create a glm using the numbers of that
  particular row. Which might look like this:
  
   case1)
x1x2x3x4x5x6 x7
   x8x9x10x11
0.00 3.91 0.00 0.00 0.00   68.03   40.39 0.00
   0.00  0.00   4.11
  
   or like this:
   case2)
x1x2x3x4x5x6 x7
   x8x9x10x11
 1.00 1.001.00 1.00 1.00 1.00 1.00 1.00
   1.00 1.00  5.34
  
   or any other combination of double numbers...
  
   however, using a glm like this:
  
   glModel - glm(vector ~ some_other_meta_data_which_is_double_numbers)
  
   and testing it with:
  
 test.Res - outlierTest(glModel,digits=4,cutoff=Inf,n.max=Inf)
  
   I always get a result consisting of the desired p and q values but not
  if the vector I use looks like case2. There is no error message and the
  computation does not stop either.
   However, all p and q values are produced except for the last value x11.
  
   Any idea why this particular value gets dropped from the output of the
  outlierTest Method in the car package.
  
   Here is the sessioninfo:
  
 sessionInfo()
   R version 3.1.1 (2014-07-10)
   Platform: x86_64-redhat-linux-gnu (64-bit)
  
   locale:
 [1] LC_CTYPE=en_US.utf8   LC_NUMERIC=C
 [3] LC_TIME=en_US.utf8LC_COLLATE=en_US.utf8
 [5] LC_MONETARY=en_US.utf8LC_MESSAGES=en_US.utf8
 [7] LC_PAPER=en_US.utf8   LC_NAME=C
 [9] LC_ADDRESS=C  LC_TELEPHONE=C
   [11] LC_MEASUREMENT=en_US.utf8 LC_IDENTIFICATION=C
  
   attached base packages:
   [1] stats graphics  grDevices utils datasets  methods base
  
   other attached packages:
   [1] ggplot2_1.0.0  car_2.0-21 RColorBrewer_1.0-5 iNEXT_1.0
   [5] vegan_2.0-10   lattice_0.20-29permute_0.8-3
  
   loaded via a namespace (and not attached):
 [1] colorspace_1.2-4 compiler_3.1.1   digest_0.6.4 grid_3.1.1
 [5] gtable_0.1.2 labeling_0.3 MASS_7.3-33 munsell_0.4.2
 [9] nnet_7.3-8   plyr_1.8.1   proto_0.3-10 Rcpp_0.11.2
   [13] reshape2_1.4 scales_0.2.4 stringr_0.6.2tools_3.1.1
  
   Any help is highly appreciated.
  
   Thanks
  
   Phil
  
   __
   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.
 
 
 
 
 


John Fox, Professor
McMaster University
Hamilton, 

Re: [R] Difference betweeen cor.test() and formula everyone says to use

2014-10-17 Thread JLucke
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.


[R] Microsoft fighting against cxxfunction() and winning

2014-10-17 Thread Rainer K. SACHS
Running Windows 7, 64 bit (but also including, I think, 32 bit R files)
RStudio 0.98.501
win-library 3.1

Getting error messages, probably related to add_path, for the
following example script; I did look within RStudio and on the
internet but can't understand the errors, let alone fix them, so any
hints would be appreciated.

library(inline)
library(Rcpp)
library(devtools)
f2 - cxxfunction( signature(x = integer, y = numeric ) , '
  return wrap( asint(x) * asdouble(y) ) ;
', plugin = Rcpp )
fx( 2L, 5 )
# add_path(Rtools\\bin,after=0)
# add_path(Rtools\\gcc-4.6.3\\bin,after=1)
# get_path()

1) If I run as is, the error message is:
Error in compileCode(f, code, language = language, verbose = verbose) :
  Compilation ERROR, function(s)/method(s) not created! Warning message:
running command 'make -f C:/PROGRA~1/R/R-31~1.1/etc/x64/Makeconf -f
C:/PROGRA~1/R/R-31~1.1/share/make/winshlib.mk
SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)'
SHLIB=file1a2c862738.dll WIN=64 TCLBIN=64
OBJECTS=file1a2c862738.o' had status 127
In addition: Warning message:
running command 'C:/PROGRA~1/R/R-31~1.1/bin/x64/R CMD SHLIB
file1a2c862738.cpp 2 file1a2c862738.cpp.err.txt' had status 1

2) If I uncomment the commented lines I get a longer, more
interesting, even less comprehensible error message:
Error in compileCode(f, code, language = language, verbose = verbose) :
  Compilation ERROR, function(s)/method(s) not created! cygwin warning:
  MS-DOS style path detected: C:/PROGRA~1/R/R-31~1.1/etc/x64/Makeconf
  Preferred POSIX equivalent is:
/cygdrive/c/PROGRA~1/R/R-31~1.1/etc/x64/Makeconf
  CYGWIN environment variable option nodosfilewarning turns off this warning.
  Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
Syntax error: EOF in backquote substitution
make: *** [file20681e531a0b.o] Error 2
Warning message:
running command 'make -f C:/PROGRA~1/R/R-31~1.1/etc/x64/Makeconf -f
C:/PROGRA~1/R/R-31~1.1/share/make/winshlib.mk
SHLIB_LDFLAGS='$(SHLIB_CXXLDFLAGS)' SHLIB_LD='$(SHLIB_CXXLD)'
SHLIB=file20681e531a0b.dll WIN=64 TCLBIN=64
OBJECTS=file20681e531a0b.o' had status 2
In addition: Warning message:
running command 'C:/PROGRA~1/R/R-31~1.1/bin/x64/R CMD SHLIB
file20681e531a0b.cpp 2 file20681e531a0b.cpp.err.txt' had status 1


3) If I try to read cygwin-ug-net/using.html they don't seem to
address 64 bit Windows.

Any suggestions? Thank you, Ray Sachs

__
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] [survMisc]: error message in examples of comp()

2014-10-17 Thread Gerrit Eichner

Hello, list members,

I have tried to contact the maintainer of the survMisc package, but my 
message could not be delivered. I can't get survMisc package to work as 
expected or documented, respectively. Maybe one of you has an idea 
regarding the following problem:


When, e.g., trying to executed the first few lines of code in the examples 
section of comp() (one of the package functions), i.e.,



data(kidney,package=KMsurv)
s1 - survfit(Surv(time=time, event=delta) ~ type, data=kidney)
comp(s1)



I receive the following error message:

Error in parse(text = t2) : text:1:8: unexpected input
1: paste( ``
^


Could this be an encoding-related issue inside the code? Does somebody 
have an idea where to look for a solution for this problem?


Below you'll find my survMisc version and R session info. Thanks for any 
support!


 Kind regards  --  Gerrit

-
Dr. Gerrit Eichner   Mathematical Institute, Room 212
gerrit.eich...@math.uni-giessen.de   Justus-Liebig-University Giessen
Tel: +49-(0)641-99-32104  Arndtstr. 2, 35392 Giessen, Germany
Fax: +49-(0)641-99-32109http://www.uni-giessen.de/cms/eichner
-



citation( survMisc)


To cite package .survMisc. in publications use:

  Chris Dardis (2014). survMisc: Miscellaneous functions for survival
  data.. R package version 0.4.2.
  http://CRAN.R-project.org/package=survMisc



sessionInfo()

R version 3.1.1 (2014-07-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252
[3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
[5] LC_TIME=German_Germany.1252

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

other attached packages:
[1] survMisc_0.4.2   rpart_4.1-8  data.table_1.9.2 ggplot2_1.0.0
[5] survival_2.37-7  fortunes_1.5-2

loaded via a namespace (and not attached):
 [1] colorspace_1.2-4 digest_0.6.4 gam_1.09.1   grid_3.1.1
 [5] gtable_0.1.2 km.ci_0.5-2  KMsurv_0.1-5 MASS_7.3-33
 [9] munsell_0.4.2plyr_1.8.1   proto_0.3-10 Rcpp_0.11.2
[13] reshape2_1.4 scales_0.2.4 stringr_0.6.2tools_3.1.1

__
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] [survMisc]: error message in examples of comp()

2014-10-17 Thread David Winsemius

On Oct 17, 2014, at 1:39 PM, Gerrit Eichner wrote:

 Hello, list members,
 
 I have tried to contact the maintainer of the survMisc package, but my 
 message could not be delivered. I can't get survMisc package to work as 
 expected or documented, respectively. Maybe one of you has an idea regarding 
 the following problem:
 
 When, e.g., trying to executed the first few lines of code in the examples 
 section of comp() (one of the package functions), i.e.,
 
 data(kidney,package=KMsurv)
 s1 - survfit(Surv(time=time, event=delta) ~ type, data=kidney)
 comp(s1)
 
 
 I receive the following error message:
 
 Error in parse(text = t2) : text:1:8: unexpected input
 1: paste( ``
^

I get the same error on a Mac in an English locale. I'm afraid the code in the 
offending function `.getTne` appears somewhat cobbled together. When I try to 
debug, I get a single row, 1920 column matrix for n1 which is numeric with all 
entries == 1. Object `t1` cannot be found.

{
s - Es - .SD - NULL
n1 - names(dt1)
f1 - function(x) paste(dQuote(paste(x, =, sep = )), 
, get(, dQuote(x), ), sep = )
t1 - paste(sapply(n1, f1), sep = ,)
if (length(t1)  1) {
t1[2:length(t1)] - sub(\, \_, t1[2:length(t1)], 
fixed = TRUE)
}
t1 - paste(t1, collapse = ,)
t2 - paste(paste(, t1, , sep=''))

# next line throw the error.

p1 - parse(text = t2)
q - quote(eval(p1))
dt1[, `:=`(s, as.factor(eval(q, envir = .SD)))]
stopifnot(attr(model.response(mf), type) == right)
y - data.table(unclass(model.response(mf, numeric)))

I'm afraid I have been o help.

-- 
David.
 
 
 Could this be an encoding-related issue inside the code? Does somebody have 
 an idea where to look for a solution for this problem?
 
 Below you'll find my survMisc version and R session info. Thanks for any 
 support!
 
 Kind regards  --  Gerrit
 
 -
 Dr. Gerrit Eichner   Mathematical Institute, Room 212
 gerrit.eich...@math.uni-giessen.de   Justus-Liebig-University Giessen
 Tel: +49-(0)641-99-32104  Arndtstr. 2, 35392 Giessen, Germany
 Fax: +49-(0)641-99-32109http://www.uni-giessen.de/cms/eichner
 -
 
 
 citation( survMisc)
 
 To cite package .survMisc. in publications use:
 
  Chris Dardis (2014). survMisc: Miscellaneous functions for survival
  data.. R package version 0.4.2.
  http://CRAN.R-project.org/package=survMisc
 
 
 sessionInfo()
 R version 3.1.1 (2014-07-10)
 Platform: x86_64-w64-mingw32/x64 (64-bit)
 
 locale:
 [1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252
 [3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
 [5] LC_TIME=German_Germany.1252
 
 attached base packages:
 [1] splines   stats graphics  grDevices utils datasets  methods
 [8] base
 
 other attached packages:
 [1] survMisc_0.4.2   rpart_4.1-8  data.table_1.9.2 ggplot2_1.0.0
 [5] survival_2.37-7  fortunes_1.5-2
 
 loaded via a namespace (and not attached):
 [1] colorspace_1.2-4 digest_0.6.4 gam_1.09.1   grid_3.1.1
 [5] gtable_0.1.2 km.ci_0.5-2  KMsurv_0.1-5 MASS_7.3-33
 [9] munsell_0.4.2plyr_1.8.1   proto_0.3-10 Rcpp_0.11.2
 [13] reshape2_1.4 scales_0.2.4 stringr_0.6.2tools_3.1.1
 
 __
 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
Alameda, CA, USA

__
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] [survMisc]: error message in examples of comp()

2014-10-17 Thread William Dunlap
If you execute the command
  options(useFancyQuotes=FALSE)
before calling comp(s1) that error should go away.

dQuote() was being used inappropriately - its value depends on the
option useFancyQuotes so should really only be used for messages or
text that machines don't have to parse.

Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Fri, Oct 17, 2014 at 5:34 PM, David Winsemius dwinsem...@comcast.net wrote:

 On Oct 17, 2014, at 1:39 PM, Gerrit Eichner wrote:

 Hello, list members,

 I have tried to contact the maintainer of the survMisc package, but my 
 message could not be delivered. I can't get survMisc package to work as 
 expected or documented, respectively. Maybe one of you has an idea regarding 
 the following problem:

 When, e.g., trying to executed the first few lines of code in the examples 
 section of comp() (one of the package functions), i.e.,

 data(kidney,package=KMsurv)
 s1 - survfit(Surv(time=time, event=delta) ~ type, data=kidney)
 comp(s1)


 I receive the following error message:

 Error in parse(text = t2) : text:1:8: unexpected input
 1: paste( ``
^

 I get the same error on a Mac in an English locale. I'm afraid the code in 
 the offending function `.getTne` appears somewhat cobbled together. When I 
 try to debug, I get a single row, 1920 column matrix for n1 which is numeric 
 with all entries == 1. Object `t1` cannot be found.

 {
 s - Es - .SD - NULL
 n1 - names(dt1)
 f1 - function(x) paste(dQuote(paste(x, =, sep = )),
 , get(, dQuote(x), ), sep = )
 t1 - paste(sapply(n1, f1), sep = ,)
 if (length(t1)  1) {
 t1[2:length(t1)] - sub(\, \_, t1[2:length(t1)],
 fixed = TRUE)
 }
 t1 - paste(t1, collapse = ,)
 t2 - paste(paste(, t1, , sep=''))

 # next line throw the error.

 p1 - parse(text = t2)
 q - quote(eval(p1))
 dt1[, `:=`(s, as.factor(eval(q, envir = .SD)))]
 stopifnot(attr(model.response(mf), type) == right)
 y - data.table(unclass(model.response(mf, numeric)))

 I'm afraid I have been o help.

 --
 David.


 Could this be an encoding-related issue inside the code? Does somebody have 
 an idea where to look for a solution for this problem?

 Below you'll find my survMisc version and R session info. Thanks for any 
 support!

 Kind regards  --  Gerrit

 -
 Dr. Gerrit Eichner   Mathematical Institute, Room 212
 gerrit.eich...@math.uni-giessen.de   Justus-Liebig-University Giessen
 Tel: +49-(0)641-99-32104  Arndtstr. 2, 35392 Giessen, Germany
 Fax: +49-(0)641-99-32109http://www.uni-giessen.de/cms/eichner
 -


 citation( survMisc)

 To cite package .survMisc. in publications use:

  Chris Dardis (2014). survMisc: Miscellaneous functions for survival
  data.. R package version 0.4.2.
  http://CRAN.R-project.org/package=survMisc


 sessionInfo()
 R version 3.1.1 (2014-07-10)
 Platform: x86_64-w64-mingw32/x64 (64-bit)

 locale:
 [1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252
 [3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
 [5] LC_TIME=German_Germany.1252

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

 other attached packages:
 [1] survMisc_0.4.2   rpart_4.1-8  data.table_1.9.2 ggplot2_1.0.0
 [5] survival_2.37-7  fortunes_1.5-2

 loaded via a namespace (and not attached):
 [1] colorspace_1.2-4 digest_0.6.4 gam_1.09.1   grid_3.1.1
 [5] gtable_0.1.2 km.ci_0.5-2  KMsurv_0.1-5 MASS_7.3-33
 [9] munsell_0.4.2plyr_1.8.1   proto_0.3-10 Rcpp_0.11.2
 [13] reshape2_1.4 scales_0.2.4 stringr_0.6.2tools_3.1.1

 __
 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
 Alameda, CA, USA

 __
 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] Comparing values of different columns: Error: level sets of factors are different

2014-10-17 Thread Chichi Shu
Hi, R listers,
I��m trying to compare a value of a row in a column to values of previous rows 
in another column in a loop. ��i�� is just from first row to the last row. j is 
an another looping controller indicating the rows that row[i] will be compared 
to and j will be rows before row[i]. I want to compare phone_1[i] with 
phone_2[j] and vise versa.
for (i in 1: nrow(df)) {
  if (df$Incremental[i] == 1) {mark[i] - 1}
else {for (j in (i �C df$Incremental[i] + 1) : (i - 1)) {
  if ((df$Phone_1[i] !=   df$Phone_1[i] == df$Phone_2[j]) | 
(df$Phone_2[i] !=   df$Phone_2[i] == df$Phone_1[j])) {
mark[i] - mark[j]}
  else {mark[i] - mark[i-1] + 1}

   }
}
However I��m getting an error with phone_1[i] and phone_2[j], indicating that 
��level sets of factors are different��. I��m not sure what I need to do to fix 
it.
Thanks!
[[alternative HTML version deleted]]

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


Re: [R] Comparing values of different columns: Error: level sets of factors are different

2014-10-17 Thread David Winsemius

On Oct 17, 2014, at 1:21 PM, Chichi Shu wrote:

 Hi, R listers,
 I¡¯m trying to compare a value of a row in a column to values of previous 
 rows in another column in a loop. ¡°i¡± is just from first row to the last 
 row. j is an another looping controller indicating the rows that row[i] will 
 be compared to and j will be rows before row[i]. I want to compare phone_1[i] 
 with phone_2[j] and vise versa.
 for (i in 1: nrow(df)) {
  if (df$Incremental[i] == 1) {mark[i] - 1}
else {for (j in (i ¨C df$Incremental[i] + 1) : (i - 1)) {
  if ((df$Phone_1[i] !=   df$Phone_1[i] == df$Phone_2[j]) | 
 (df$Phone_2[i] !=   df$Phone_2[i] == df$Phone_1[j])) {
mark[i] - mark[j]}
  else {mark[i] - mark[i-1] + 1}
   
 }
 }
 However I¡¯m getting an error with phone_1[i] and phone_2[j], indicating that 
 ¡°level sets of factors are different¡±. I¡¯m not sure what I need to do to 
 fix it.

Factor fixing. An ancient, aRcane sport.

Perhaps:
lev2 - unique( c( levels(phone_1), levels(phone_2) ) )
phone_1 - factor(phone_1, levels=lev2)
phone_2 - factor(phone_2, levels=lev2)




 Thanks!
   [[alternative HTML version deleted]]

And HTML posting is not well supported. Learn to post in that most ancient of 
computer tongues, plain text.

 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

-- 

David Winsemius
Alameda, CA, USA

__
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-es] [Grupo Usuarios de R de Madrid]: Siguiente reunión 15-octubre....(*Material Disponible*)

2014-10-17 Thread Carlos Ortega
Hola,

Ya está disponible todo el material que presentamos durante la reunión del
pasado miércoles.

Los detalles los podéis encontrar aquí:

http://madrid.r-es.org/miercoles-15-de-octubre-2014/

Saludos,
Carlos Ortega
www.qualityexcellence.es

El 15 de octubre de 2014, 10:06, Carlos Ortega c...@qualityexcellence.es
escribió:

 Hola,

 Un a breve nota para recordar que hoy tendremos la reunión del Grupo de
 Usuarios de R de Madrid.

- La agenda es la misma que anunciamos.
- La reunión será en la Facultad de Educación (UNED) en la sala
Fernández Huertas, planta 1ª.

 Los detalles de la convocatoria los podéis encontrar en el portal del
 grupo:

 http://madrid.r-es.org/

 Gracias,
 Carlos Ortega
 www.qualityexcellence.es


 El 8 de octubre de 2014, 10:47, Carlos Ortega c...@qualityexcellence.es
 escribió:

 Buenas a todos,

 Ya tenemos programada la agenda de la siguiente reunión del grupo.
 De forma escueta:


- *Presentaciones:*
   - Pedro Valverde
   
 https://www.linkedin.com/profile/view?id=232087352authType=NAME_SEARCHauthToken=qJG6locale=es_ESsrchid=51802411410559294801srchindex=1srchtotal=139trk=vsrp_people_res_nametrkInfo=VSRPsearchId%3A51802411410559294801%2CVSRPtargetId%3A232087352%2CVSRPcmpt%3Aprimary
   : “Modelización de los salarios en España”.
   - Pedro Concejero:
   
 https://www.linkedin.com/profile/view?id=8293681authType=NAME_SEARCHauthToken=VdNxlocale=en_USsrchid=51802411412718027835srchindex=1srchtotal=3trk=vsrp_people_res_nametrkInfo=VSRPsearchId%3A51802411412718027835%2CVSRPtargetId%3A8293681%2CVSRPcmpt%3Aprimary“decidiR
   – teoría del prospecto – paquete pt
   http://cran.r-project.org/web/packages/pt/index.html
   “.
   - Carlos Ortega:
   https://www.linkedin.com/in/carlosortegafernandez
   “Otros diveRtimentos sobre Money-is-a-gas”.
- *Píldoras:*
   - Jorge Ayuso

 https://www.linkedin.com/profile/view?id=229197095authType=NAME_SEARCHauthToken=GvWulocale=es_ESsrchid=51802411412718420247srchindex=1srchtotal=33trk=vsrp_people_res_nametrkInfo=VSRPsearchId%3A51802411412718420247%2CVSRPtargetId%3A229197095%2CVSRPcmpt%3Aprimary
: “OpenCpu
http://cran.r-project.org/web/packages/opencpu/index.html
y Docker https://www.docker.com/“.



 Más detalles aquí:

 http://madrid.r-es.org/miercoles-15-de-octubre-2014/

 --
 Saludos,
 Carlos Ortega
 www.qualityexcellence.es




 --
 Saludos,
 Carlos Ortega
 www.qualityexcellence.es




-- 
Saludos,
Carlos Ortega
www.qualityexcellence.es

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


[R-es] Fwd: Question about GEE and interaction plot

2014-10-17 Thread Luis Fernando García
Hello all!

I am trying to analyze a dataset using the GEE.

This is what I have so far

C=read.table(Cnarinofinal4.txt,header=T)
attach(C)
names(C)
library(geepack)
Form -
formula(Conteo~Grupo+Tiempo+Comportamiento+Comportamiento*Grupo+Comportamiento*Hora)
M4 - geeglm(Form,family = poisson, id =Individuo, corstr = exchangeable)
anova(M4)

1) I want to know if someboy knows how to perform post hoc comparisons for
significant terms, in this case I have a significance result for the
interaction Comportamiento*Hora and the factor Comportamiento.

2) I want to perform and interaction plot, I tried with the following code:
 interaction.plot(C$Comportamiento,C$Tiempo,C$Conteo)

Nevertheless, I would like to plot the graph in a decreasing order by the
mean and also add the error bars. For the first approach I do not have
available info, and for the second one I found that data must be sorted
before using the function summarySE from the ggplot2 library, nevertheless
it does not seem to work anymore.

Any help you can provide will be welcome!
HoraIndividuo   Comportamiento  Tiempo  Grupo   Conteo
0   1   Exploración NOCHE   MACHO   1
0   1   interacciones   NOCHE   MACHO   0
0   1   Mantenimiento   NOCHE   MACHO   0
0   1   AlimentaciónNOCHE   MACHO   5
0   1   ReproducciónNOCHE   MACHO   0
0   1   Reposo  NOCHE   MACHO   2
0   1   Exacavación NOCHE   MACHO   0
0   2   Exploración NOCHE   MACHO   0
0   2   interacciones   NOCHE   MACHO   0
0   2   Mantenimiento   NOCHE   MACHO   0
0   2   AlimentaciónNOCHE   MACHO   0
0   2   ReproducciónNOCHE   MACHO   0
0   2   Reposo  NOCHE   MACHO   7
0   2   Exacavación NOCHE   MACHO   0
0   3   Exploración NOCHE   MACHO   1
0   3   interacciones   NOCHE   MACHO   0
0   3   Mantenimiento   NOCHE   MACHO   0
0   3   AlimentaciónNOCHE   MACHO   0
0   3   ReproducciónNOCHE   MACHO   0
0   3   Reposo  NOCHE   MACHO   7
0   3   Exacavación NOCHE   MACHO   0
0   4   Exploración NOCHE   MACHO   3
0   4   interacciones   NOCHE   MACHO   0
0   4   Mantenimiento   NOCHE   MACHO   0
0   4   AlimentaciónNOCHE   MACHO   1
0   4   ReproducciónNOCHE   MACHO   0
0   4   Reposo  NOCHE   MACHO   5
0   4   Exacavación NOCHE   MACHO   0
0   5   Exploración NOCHE   MACHO   1
0   5   interacciones   NOCHE   MACHO   0
0   5   Mantenimiento   NOCHE   MACHO   0
0   5   AlimentaciónNOCHE   MACHO   1
0   5   ReproducciónNOCHE   MACHO   0
0   5   Reposo  NOCHE   MACHO   8
0   5   Exacavación NOCHE   MACHO   0
0   6   Exploración NOCHE   MACHO   3
0   6   interacciones   NOCHE   MACHO   0
0   6   Mantenimiento   NOCHE   MACHO   0
0   6   AlimentaciónNOCHE   MACHO   0
0   6   ReproducciónNOCHE   MACHO   0
0   6   Reposo  NOCHE   MACHO   2
0   6   Exacavación NOCHE   MACHO   0
0   7   Exploración NOCHE   HEMBRA  3
0   7   interacciones   NOCHE   HEMBRA  0
0   7   Mantenimiento   NOCHE   HEMBRA  0
0   7   AlimentaciónNOCHE   HEMBRA  0
0   7   ReproducciónNOCHE   HEMBRA  0
0   7   Reposo  NOCHE   HEMBRA  5
0   7   Exacavación NOCHE   HEMBRA  0
0   8   Exploración NOCHE   HEMBRA  2
0   8   interacciones   NOCHE   HEMBRA  0
0   8   Mantenimiento   NOCHE   HEMBRA  0
0   8   AlimentaciónNOCHE   HEMBRA  0
0   8   ReproducciónNOCHE   HEMBRA  0
0   8   Reposo  NOCHE   HEMBRA  2
0   8   Exacavación NOCHE   HEMBRA  0
0   9   Exploración NOCHE   HEMBRA  2
0   9   interacciones   NOCHE   HEMBRA  0
0   9   Mantenimiento   NOCHE   HEMBRA  0
0   9   AlimentaciónNOCHE   HEMBRA  0
0   9   ReproducciónNOCHE   HEMBRA  0
0   9   Reposo  NOCHE   HEMBRA  5
0   9   Exacavación NOCHE   HEMBRA  0
0   10  Exploración NOCHE   HEMBRA  6
0   10  interacciones   NOCHE   HEMBRA  0
0   10  Mantenimiento   NOCHE   HEMBRA  0
0   10  AlimentaciónNOCHE   HEMBRA  0
0   10  ReproducciónNOCHE   HEMBRA  0
0   10  Reposo  NOCHE   HEMBRA  2
0   10  Exacavación NOCHE   HEMBRA  0
0   11  Exploración NOCHE   HEMBRA  1
0   11  interacciones   NOCHE   HEMBRA  0
0   11  Mantenimiento   NOCHE   HEMBRA  0
0   11  AlimentaciónNOCHE   HEMBRA  2
0   11  ReproducciónNOCHE   HEMBRA  0
0   11  Reposo  NOCHE   HEMBRA  4
0   11  Exacavación NOCHE   HEMBRA  0
0   12  Exploración NOCHE   HEMBRA  2
0   12  interacciones   NOCHE   HEMBRA  0
0   12  

Re: [R-es] Ayuda prueba de significancia funcion nls()

2014-10-17 Thread Carlos J. Gil Bellosta
Hola, ¿qué tal?

Hu... no conozco ese modelo que tratas de ajustar demasiado bien,
pero creo que el parámetro A significa demasiadas cosas (y depende de
demasiadas cosas) a la vez. Por ejemplo, seguro, está muy
correlacionado con alfa porque opera como una especie de término
independiente de lo que hay dentro de exp y su valor depende mucho,
por ejemplo, de si normalizas o no la edad.

Yo buscaría una formulación o reparametrización alternativa.

Pero en este caso en particular, parecía claro que el problema estaba
en la falta de ajuste en esa cola poco relevante.

Un saludo,

Carlos J. Gil Bellosta
http://www.datanalytics.com

El día 16 de octubre de 2014, 22:12, Boris Polanco
borisc...@gmail.com escribió:
 Hola, he vuelto a realizar el ajuste con la sugerencia que me diste y ha
 funcionado, pero mi pregunta es si para con otro modelo similar no  me sale
 un parámetro no significativo, cómo interpreto el no rechazo de la hipótesis
 nula?

 saludos

 El 15 de octubre de 2014, 17:44, Carlos J. Gil Bellosta
 c...@datanalytics.com escribió:

 Hola, ¿qué tal?

 Yo eliminaría las observaciones por encima de los noventaitantos (¿o
 cien?) años. Son solo ruido, como puede observarse. Estarán basadas en
 un porcentaje nimio de la muestra.

 Igual entonces cambian las cosas.

 Un saludo,

 Carlos J. Gil Bellosta
 http://www.datanalytics.com


 El día 15 de octubre de 2014, 23:18, Boris Polanco
 borisc...@gmail.com escribió:
  Hola, estoy haciendo un estudio de la desaceleración de la mortalidad y
  tengo dudas con la función nls(), adjunto un archivo donde he redactado
  mi
  inquietud.
 
  saludos cordiales
  Boris Polanco
 
  ___
  R-help-es mailing list
  R-help-es@r-project.org
  https://stat.ethz.ch/mailman/listinfo/r-help-es
 



___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es