Re: [R] R logo size in package information tab of Rstudio

2016-03-29 Thread Jeff Newmiller
You are not clarifying yet. If this requires RStudio to reproduce then this 
question doesn't belong here. I am not yet convinced that RStudio IS required, 
but every time you mention it the water gets muddier. 
-- 
Sent from my phone. Please excuse my brevity.

On March 29, 2016 9:07:49 PM PDT, Marc Girondot via R-help 
 wrote:
>Here are my R session information:
> > sessionInfo()
>R version 3.3.0 alpha (2016-03-24 r70373)
>Platform: x86_64-apple-darwin13.4.0 (64-bit)
>Running under: OS X 10.11.4 (El Capitan)
>
>locale:
>[1] fr_FR.UTF-8/fr_FR.UTF-8/fr_FR.UTF-8/C/fr_FR.UTF-8/fr_FR.UTF-8
>
>If the help is displayed within the R gui using:
>help(package='packrat')
>
>The Rlogo.svg is scaled correctly.
>
>However if the help is shown within Rstudio, the Rlogo.svg is not
>scaled 
>corrected and is shown at huge size.
>
>The choice of logo displayed in the help comes from the file in folder 
>html within each package. For example for package numDeriv, within the 
>file: 
>/Library/Frameworks/R.framework/Versions/3.3/Resources/library/numDeriv/html/00Index.html
>
>There is this link:
>
> Accurate Numerical Derivatives
>
>
>
>Whereas for packrat package, within the file
>/Library/Frameworks/R.framework/Versions/3.3/Resources/library/packrat/html/00Index.html
>
>The link is this one:
>
> A Dependency Management System for Projects and their R Package
>Dependencies
>/>
>
>
>And the Rlogo.svg is badly scaled in Rstudio Version 0.99.1119 (beta)
>or 
>in public 0.99.893 version.
>
>So there are two solutions. Or Rstudio changes the way they scale 
>Rlogo.svg, or Rlogo.svg is correctly scaled during R install. Here is a
>
>Rlogo.svg correctly scaled to replace the original version:
>http://www.ese.u-psud.fr/epc/conservation/CRAN/Rlogo.svg
>
>Sincerely,
>
>Marc
>
>
>Le 30/03/2016 00:44, Duncan Murdoch a écrit :
>> On 29/03/2016 3:42 PM, Marc Girondot via R-help wrote:
>>> Two different sizes of R logo are shown in Rstudio in the Help at
>the
>>> package level.
>>>
>>> For example, numderiv shows a nice discreet logo located at (in
>MacosX):
>>>
>/Library/Frameworks/R.framework/Versions/3.3/Resources/doc/html/logo.jpg
>>> whereas packrat shows a huge logo located at:
>>>
>/Library/Frameworks/R.framework/Versions/3.3/Resources/doc/html/Rlogo.svg
>
>>>
>>>
>>> The choice between both depends on the path indicated in the file
>>> Index.html located in html folder for each package.
>>>
>>> It would be better to have svg version of Rlogo.svg of the same size
>>> than logo.jpg (I have converted the Rlogo.svg into the same size
>than
>>> logo.jpg and it looks much better whit the new version).
>>>
>>
>> What versions are you talking about?  I'd guess your packages were 
>> built with different versions of R if they ended up with different 
>> links to the logo.
>>
>> Why is RStudio relevant here?  I don't think RStudio does anything 
>> with the R help files other than to display them in its built-in
>browser.
>>
>>
>>
>> Duncan Murdoch
>>
>>
>
>__
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

[[alternative HTML version deleted]]

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

Re: [R] R logo size in package information tab of Rstudio

2016-03-29 Thread Marc Girondot via R-help

Here are my R session information:
> sessionInfo()
R version 3.3.0 alpha (2016-03-24 r70373)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11.4 (El Capitan)

locale:
[1] fr_FR.UTF-8/fr_FR.UTF-8/fr_FR.UTF-8/C/fr_FR.UTF-8/fr_FR.UTF-8

If the help is displayed within the R gui using:
help(package='packrat')

The Rlogo.svg is scaled correctly.

However if the help is shown within Rstudio, the Rlogo.svg is not scaled 
corrected and is shown at huge size.


The choice of logo displayed in the help comes from the file in folder 
html within each package. For example for package numDeriv, within the 
file: 
/Library/Frameworks/R.framework/Versions/3.3/Resources/library/numDeriv/html/00Index.html


There is this link:

 Accurate Numerical Derivatives



Whereas for packrat package, within the file
/Library/Frameworks/R.framework/Versions/3.3/Resources/library/packrat/html/00Index.html

The link is this one:

 A Dependency Management System for Projects and their R Package
Dependencies



And the Rlogo.svg is badly scaled in Rstudio Version 0.99.1119 (beta) or 
in public 0.99.893 version.


So there are two solutions. Or Rstudio changes the way they scale 
Rlogo.svg, or Rlogo.svg is correctly scaled during R install. Here is a 
Rlogo.svg correctly scaled to replace the original version:

http://www.ese.u-psud.fr/epc/conservation/CRAN/Rlogo.svg

Sincerely,

Marc


Le 30/03/2016 00:44, Duncan Murdoch a écrit :

On 29/03/2016 3:42 PM, Marc Girondot via R-help wrote:

Two different sizes of R logo are shown in Rstudio in the Help at the
package level.

For example, numderiv shows a nice discreet logo located at (in MacosX):
/Library/Frameworks/R.framework/Versions/3.3/Resources/doc/html/logo.jpg
whereas packrat shows a huge logo located at:
/Library/Frameworks/R.framework/Versions/3.3/Resources/doc/html/Rlogo.svg 



The choice between both depends on the path indicated in the file
Index.html located in html folder for each package.

It would be better to have svg version of Rlogo.svg of the same size
than logo.jpg (I have converted the Rlogo.svg into the same size than
logo.jpg and it looks much better whit the new version).



What versions are you talking about?  I'd guess your packages were 
built with different versions of R if they ended up with different 
links to the logo.


Why is RStudio relevant here?  I don't think RStudio does anything 
with the R help files other than to display them in its built-in browser.




Duncan Murdoch




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


[R] Filtering based on the occurrence

2016-03-29 Thread Farnoosh Sheikhi via R-help
Hello, 
I have a data set similar to below and I wanted to keep the observations after 
the first occurrence of these department: "B", "D", "F".For example for ID=2, 
the observation with deps=B and anything after will be kept in the data. For 
ID=3, observations with deps=D and anything after will be included.
Subject<- c("2", "2", "2", "3", "3", "3", "4", "4", "5", "5", "5", 
"5")dates<-seq(as.Date('2011-01-01'),as.Date('2011-01-12'),by = 1) deps<-c("A", 
"B", "C", "C", "D", "A", "F", "G", "A", "F", "A", "D")df <- data.frame(Subject, 
dates, deps)df
The final data should look like this:final<-c("2 2011-01-02    B","2 2011-01-03 
   C","3 2011-01-05    D","3 2011-01-06    A","4 2011-01-07    F","4 2011-01-08 
   G","5 2011-01-10    F","5 2011-01-11    A","5 2011-01-12    D") Thank you 
tons for your help. 
Farnoosh


[[alternative HTML version deleted]]

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

[R] Compute the Gini coefficient

2016-03-29 Thread Marine Regis
Hello,

I would like to build a Lorenz curve and calculate a Gini coefficient in order 
to find how much parasites does the top 20% most infected hosts support.

Here is my data set:

Number of parasites per host:
parasites = c(0,1,2,3,4,5,6,7,8,9,10)

Number of hosts associated with each number of parasites given above:
hosts = c(18,20,28,19,16,10,3,1,0,0,0)

To represent the Lorenz curve:
I manually calculated the cumulative percentage of parasites and hosts:

cumul_parasites <- cumsum(parasites)/max(cumsum(parasites))
cumul_hosts <- cumsum(hosts)/max(cumsum(hosts))
plot(cumul_hosts, cumul_parasites, type= "l")

>From this Lorenz curve, how can I calculate the Gini coefficient with the 
>function "gini" in R (package reldist) given that the vector "hosts" is not a 
>vector of weights ?

Thank you very much for your help.
Have a nice day
Marine


[[alternative HTML version deleted]]

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


Re: [R] Accented characters, windows

2016-03-29 Thread Duncan Murdoch

On 29/03/2016 5:39 PM, Jan Kacaba wrote:

I have problem with accented characters. My OS is Win 8.1 and I'm using
RStudio.

I make string :
av="ěščřž"

When I call "av" I get result bellow.

av

[1] "ìšèøž"

The resulting characters are different. I have similar problem when I write
string to a file. In RGUI if I call "av" it prints characters correctly,
but using "write" function to print string in a file results in the same
problem.

Can you please help me how to deal with it?


You don't say what code page you're using.

R in Windows has a long standing problem that it works mainly in the 
local code page, rather than working in UTF-8 as most other systems do. 
 (This is due to the fact that when the internationalization was put 
in, UTF-8 was exotic, rather than ubiquitous as it is now.)  So R can 
store UTF-8 strings on any system, but for display it converts them to 
the local code page, and that conversion can lose information if the 
characters aren't supported locally.


With your string, I don't see the same thing as you, I see

"ešcrž"

which is also incorrect, but looks a little closer, because it does a 
better approximation in my code page.


So if you think my result is better than yours, you could change your 
system to code page 437 as I'm using, but that will probably cause you 
worse problems.


Probably the only short term solution that would be satisfactory is to 
stop using Windows.  At some point in the future the internal character 
handling in R needs an overhaul, but that's a really big, really 
thankless job.  Perhaps Microsoft/Revolution will donate some programmer 
time to do it, but more likely, it will wait for volunteers in R Core to 
do it.  I don't think it will happen in 2016.


Duncan Murdoch

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

Re: [R] R logo size in package information tab of Rstudio

2016-03-29 Thread Duncan Murdoch

On 29/03/2016 3:42 PM, Marc Girondot via R-help wrote:

Two different sizes of R logo are shown in Rstudio in the Help at the
package level.

For example, numderiv shows a nice discreet logo located at (in MacosX):
/Library/Frameworks/R.framework/Versions/3.3/Resources/doc/html/logo.jpg
whereas packrat shows a huge logo located at:
/Library/Frameworks/R.framework/Versions/3.3/Resources/doc/html/Rlogo.svg

The choice between both depends on the path indicated in the file
Index.html located in html folder for each package.

It would be better to have svg version of Rlogo.svg of the same size
than logo.jpg (I have converted the Rlogo.svg into the same size than
logo.jpg and it looks much better whit the new version).



What versions are you talking about?  I'd guess your packages were built 
with different versions of R if they ended up with different links to 
the logo.


Why is RStudio relevant here?  I don't think RStudio does anything with 
the R help files other than to display them in its built-in browser.




Duncan Murdoch

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


[R] Convergence issues when using ns splines (pkg: spline) in Cox model (coxph) even when changing coxph.control

2016-03-29 Thread Jennifer Wu, Miss
Hi,

I am currently using R v3.2.3 and on Windows 10 OS 64Bit.

I am having convergence issues when I use coxph with a interaction term 
(glarg*bca_py) and interaction term with the restricted cubic spline 
(glarg*bca_time_ns). I use survival and spline package to create the Cox model 
and cubic splines respectively. Without the interaction term and/or spline, I 
have no convergence problem. I read some forums about changing the iterations 
and I have but it did not work. I was just wondering if I am using the 
inter.max and outer.max appropriately. I read the survival manual, other R-help 
and stackoverflow pages and it suggested changing the iterations but it doesn't 
specify what is the max I can go. I ran something similar in SAS and did not 
run into a convergence problem.

This is my code:

bca_time_ns <- ns(ins_ca$bca_py, knots=3, Boundary.knots=range(2,5,10))
test <- ins_ca$glarg*ins_ca$bca_py
test1 <- ins_ca$glarg*bca_time_ns

coxit <- coxph.control(iter.max=1, outer.max=1)

bca<-coxph(Surv(bca_py,bca) ~ glarg + test + test1 + age + calyr + diab_dur + 
hba1c + adm_met + adm_sulfo + adm_tzd + adm_oth +
med_statin + med_aspirin + med_nsaids + bmi_cat + ccscat + alc + 
smk, data=ins_ca, control=coxit, ties=c("breslow"))


This is the error message I get:

Warning message:
In fitter(X, Y, strats, offset, init, control, weights = weights,  :
  Ran out of iterations and did not converge



[[alternative HTML version deleted]]

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


[R] Accented characters, windows

2016-03-29 Thread Jan Kacaba
I have problem with accented characters. My OS is Win 8.1 and I'm using
RStudio.

I make string :
av="ěščřž"

When I call "av" I get result bellow.
> av
[1] "ìšèøž"

The resulting characters are different. I have similar problem when I write
string to a file. In RGUI if I call "av" it prints characters correctly,
but using "write" function to print string in a file results in the same
problem.

Can you please help me how to deal with it?

[[alternative HTML version deleted]]

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

Re: [R] How to solve an NLME problem?

2016-03-29 Thread Ben Bolker
David C Blouin  lsu.edu> writes:

>  I have a nonlinear model where I want to include random
> coefficients for a sample of random SUBJECTS. The fixed effects part
> of the model is Y ~ B + (T - B) / (1 + 10**(X - C)) and I would like
> to include random coefficients b for B, t for T, and c for C. The
> model is a fairly well-known three-parameter log-inhibitor model
> where Y is a measure of growth at X = log(CONCENTRATION), B is the
> unknown lower asymptote, T is the unknown upper asymptote, and C is
> the unknown log(IC50), where IC50 is the half maximal inhibitory
> concentration. I do not know how to solve this problem in R, where I
> am assuming NLME contains the appropriate methodology.
> [[alternative HTML version deleted]]

  something like

  nlme(Y ~ B + (T - B) / (1 + 10**(X - C)),
   random=B+T+C~group,
   data=your_data,
   start=list(fixed=c(B=something,T=something2,C=something3)))

 Follow-ups to r-sig-mixed-mod...@r-project.org, please ...

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


Re: [R] [FORGED] help in maximum likelihood estimation

2016-03-29 Thread Jeff Newmiller
The R software is a product of many individuals contributions... when you 
implement that function please contribute it. 

Until then, a little more effort on your part really is needed to convey your 
problem clearly... the usual standard of clarity is a minimal reproducible 
example. Discussions of such are found in multiple places on the Internet, 
including the Posting Guide mentioned in the footer of this message, which also 
mentions the need to post in plain text rather than html to avoid corruption of 
your message on the mailing list. 
-- 
Sent from my phone. Please excuse my brevity.

On March 29, 2016 12:29:01 PM PDT, heba eldeeb via R-help 
 wrote:
>Dear Rolf
>I wish this function is written as soon as possible to know how anyone
>spend time to reply as you did
>
>Thanks
> 
>
>On Tuesday, March 29, 2016 9:07 PM, Heba 
>wrote:
> 
>
> Dear Rolf
>I wish this function is written as soon as possible to know how anyone
>spend time to reply as you did
>
>Thanks
>
>Sent from my iPhone
>
>> On Mar 29, 2016, at 12:32 AM, Rolf Turner 
>wrote:
>> 
>>> On 29/03/16 09:19, heba eldeeb via R-help wrote:
>>>  Dear All
>>> I'm trying to find the maximum likelihood estimator of a certain
>>> distribution using nlm command but I receive an error as:
>>> non-finite value supplied by 'nlm' can't figure out what is wrong in
>>> my function Any help? Thank you in advance.
>> 
>> Sorry, the mind_read() function in R has not yet been written.
>> 
>> cheers,
>> 
>> Rolf Turner
>> 
>> -- 
>> Technical Editor ANZJS
>> Department of Statistics
>> University of Auckland
>> Phone: +64-9-373-7599 ext. 88276
>
>  
>   [[alternative HTML version deleted]]
>
>__
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

[[alternative HTML version deleted]]

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

[R] Total Least Squares Regression

2016-03-29 Thread Lorenzo Isella

Dear All,
I am looking for an R package to handle total least square regression
(TLS).

See http://bit.ly/1pSf4Bg

I am in a situation in which I have errors in both the dependent
variables X (plural because I have several predictors) and the
independent variable y.
I found several discussion inside and outside the R mailing list, e.g.

http://bit.ly/1pSfveQ

http://bit.ly/1RDAPuA (stackexchange)

In my understanding, when the variance of the error on all the
predictors and the dependent variable is identical, the problem
reduces to the orthogonal least squares and that is partially
addressed in the stackexchange link.
However, there are some bits missing

1) in the example given in stackexchange, how do I calculate the
confidence intervals of my prediction?
2) Suppose that the variances of the errors in the predictors and the
independent variables are not identical and I have somehow estimated
their ratio. How can I then generalize the example in the stackexchange link?

To fix the ideas, I paste some R code a the end of the email. Any
suggestion is welcome.
Many thanks

Lorenzo

#

library(dplyr)


tls <- function(X,y){

v <- prcomp(cbind(X,y))$rotation
beta <- -v[-ncol(v),ncol(v)] / v[ncol(v),ncol(v)]
return(beta)

}

tls_beta0 <- function(X,y, beta){
   beta0 <- mean(y)-sum(colMeans(X)*beta)
   return(beta0)

}


## some data to work upon

dd <- structure(list(mn = c(9226, 9404, 9604, 10183, 10788, 11352,
11984, 12921, 14057, 15235, 15560, 15738, 16039, 16729, 17332,
18398, 19458, 20001, 19861, 20690, 21495, 21869, 22145, 22521
), ind = c(43862, 40621, 37884, 36039, 35228, 34336, 33684, 33816,
33593, 33861, 33817, 33139, 32250, 31796, 31276, 30934, 31340,
32078, 31366, 30800, 31410, 31975, 32120, 32254), gov = c(1183695,
1281056, 1334560, 1390475, 1439175, 1472564, 1495661, 1520460,
1565451, 1604454, 1654996, 1672559, 1701664, 1722003, 1751547,
1793235, 1824640, 1874300, 1894248, 1939610, 2001224, 2056539,
2104642, 2156210), berd = c(26245.5, 26579, 25933, 25910, 26816.6,
27211, 28909.8, 30334.44, 33622.55, 35600, 36331.9, 36950, 38029,
38363, 38651.038, 41148, 43034, 46073, 45275, 46929, 51077.2,
53790.1, 53566.2, 56226)), row.names = c(NA, 24L), .Names = c("mn",
"ind", "gov", "berd"), class = "data.frame")


y <- dd$berd
X <- select(dd,mn, ind, gov)


beta_perp <- tls(X,y)
beta0_perp <- tls_beta0(X,y, beta_perp)


mymodel <- beta0_perp+beta_perp[1]*X[ ,1]+beta_perp[2]*X[ ,2]+
   beta_perp[3]*X[ ,3]


## what is the confidence level of my model?
## what if I do not assume that the error variance is the same for all
## the regressors in X and for the independent variable in y?

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


[R] R logo size in package information tab of Rstudio

2016-03-29 Thread Marc Girondot via R-help
Two different sizes of R logo are shown in Rstudio in the Help at the 
package level.


For example, numderiv shows a nice discreet logo located at (in MacosX):
/Library/Frameworks/R.framework/Versions/3.3/Resources/doc/html/logo.jpg
whereas packrat shows a huge logo located at:
/Library/Frameworks/R.framework/Versions/3.3/Resources/doc/html/Rlogo.svg

The choice between both depends on the path indicated in the file 
Index.html located in html folder for each package.


It would be better to have svg version of Rlogo.svg of the same size 
than logo.jpg (I have converted the Rlogo.svg into the same size than 
logo.jpg and it looks much better whit the new version).


Sincerely

Marc




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


Re: [R] [FORGED] help in maximum likelihood estimation

2016-03-29 Thread heba eldeeb via R-help
Dear Rolf
I wish this function is written as soon as possible to know how anyone spend 
time to reply as you did

Thanks
 

On Tuesday, March 29, 2016 9:07 PM, Heba  wrote:
 

 Dear Rolf
I wish this function is written as soon as possible to know how anyone spend 
time to reply as you did

Thanks

Sent from my iPhone

> On Mar 29, 2016, at 12:32 AM, Rolf Turner  wrote:
> 
>> On 29/03/16 09:19, heba eldeeb via R-help wrote:
>>  Dear All
>> I'm trying to find the maximum likelihood estimator of a certain
>> distribution using nlm command but I receive an error as:
>> non-finite value supplied by 'nlm' can't figure out what is wrong in
>> my function Any help? Thank you in advance.
> 
> Sorry, the mind_read() function in R has not yet been written.
> 
> cheers,
> 
> Rolf Turner
> 
> -- 
> Technical Editor ANZJS
> Department of Statistics
> University of Auckland
> Phone: +64-9-373-7599 ext. 88276

  
[[alternative HTML version deleted]]

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

Re: [R] help in maximum likelihood estimation

2016-03-29 Thread Marc Girondot via R-help

Le 28/03/2016 22:19, heba eldeeb via R-help a écrit :

  Dear AllI'm trying to find the maximum likelihood estimator  of a certain 
distribution using nlm command but I receive an error as:
  non-finite value supplied by 'nlm'
can't figure out what is wrong in my function
Any help?
Thank you in advance



Hi,

Whitout rproducible example, it will be impossible to help you 
efficiently. See https://www.r-project.org/posting-guide.html
Anyway, this error means that your function returns NA or error for some 
combination of parameters.


Marc

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

Re: [R] Export the result k-means cluster to CSV file

2016-03-29 Thread S Ellison
> i am confusing about your code , i can not get the  the desired result . can 
> you
> more clear for the code?
The code I suggested just  provided a structured text output of the kmeans 
object.

If you want a cluster-by-cluster output of the original data, you will need to 
write a function that does what you want for each cluster. For example you 
could write a function that would take a cluster index as the first argument, 
the kmeans object as a second argument, and the original data as the third. 
Then you can use something like lapply to apply that function to each subset of 
your data.

For example, again using the example in kmeans, a simple list of the cluster 
coordinate sets can be obtained using 
by.index <- function(index, km, x) {
x[km$cluster==index, ] #returns the subset of original data in cluster 
(index)
}

lapply(unique(cl$cluster), by.index, km=cl, x=x)
#cl was the kmeans object generated from the data set x used in the 
example
#Using unique(cl$cluster) means that all the clusters identified in the 
kmeans object are included in the list

This generates a list, identified by cluster index number, that contains the 
coordinates for each cluster. If you assign that list to an object you can then 
write a separate function to format and write out the coordinates and use 
lapply to run that on the list. Or you can include formatted write calls in the 
by.index function, writing to a file as before.


S Ellison




***
This email and any attachments are confidential. Any use, copying or
disclosure other than by the intended recipient is unauthorised. If 
you have received this message in error, please notify the sender 
immediately via +44(0)20 8943 7000 or notify postmas...@lgcgroup.com 
and delete this message and any copies from your computer and network. 
LGC Limited. Registered in England 2991879. 
Registered office: Queens Road, Teddington, Middlesex, TW11 0LY, UK
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Can forecasting is possible through R Studio on the basis of past experience of data

2016-03-29 Thread Bert Gunter
You should have first searched the RStudio website, where you would have found:

https://www.rstudio.com/online-learning/#R


Cheers,
Bert


Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Tue, Mar 29, 2016 at 8:37 AM, Prasad Kale
 wrote:
> Hi All,
>
> I am very new to the R. I just want to ask whether through R Studio can I
> able to build forecasting module.
>
> Means on the basis of past experience can I able to predict future trend.
>
> To start up can you please provide me any useful links or documents so by
> referring this i will try at my end.
>
> Thanks in advance.
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] Can forecasting is possible through R Studio on the basis of past experience of data

2016-03-29 Thread Boris Steipe
R Studio is basically a wrapper for R. To find out more about how to work with 
R, just use Google. Or, for a more focussed experience, navigate to  
www.rseek.org

B.


On Mar 29, 2016, at 11:37 AM, Prasad Kale  wrote:

> Hi All,
> 
> I am very new to the R. I just want to ask whether through R Studio can I
> able to build forecasting module.
> 
> Means on the basis of past experience can I able to predict future trend.
> 
> To start up can you please provide me any useful links or documents so by
> referring this i will try at my end.
> 
> Thanks in advance.
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


[R] Can forecasting is possible through R Studio on the basis of past experience of data

2016-03-29 Thread Prasad Kale
Hi All,

I am very new to the R. I just want to ask whether through R Studio can I
able to build forecasting module.

Means on the basis of past experience can I able to predict future trend.

To start up can you please provide me any useful links or documents so by
referring this i will try at my end.

Thanks in advance.

[[alternative HTML version deleted]]

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


[R] [R-pkgs] New R package for K-S goodness-of-fit tests

2016-03-29 Thread Novack-Gottshall, Philip M.
Greetings,

We wanted to announce a new R package 'KScorrect' that carries out the 
Lilliefors correction to the Kolmogorov-Smirnoff test for use in (one-sample) 
goodness-of-fit tests.

It's well-established it's inappropriate to use the K-S test when sample 
statistics are used to estimate parameters, which results in substantially 
increased Type-II errors. This warning is mentioned in the ks.test Help page, 
but no general solution is currently available for non-normal distributions.

The 'KScorrect' package corrects for the bias by using Monte Carlo simulation, 
a solution first recommended by Lilliefors (1967) but not widely heeded. The 
primary function 'LcKS()' is written to complement, and can be used directly in 
place of, 'ks.test()'. It can be used with most continuous distribution 
functions, including normal, univariate mixture of normals, lognormal, uniform, 
loguniform (flat when data are log-transformed), exponential, gamma, and 
Weibull distributions, and corresponding maximum-likelihood parameters are 
estimated automatically from the provided sample.

Distribution functions are provided in the package for the loguniform and 
univariate mixture of normal distributions, which are not included in the R 
base installation.

Simple examples are provided by calling example(KScorrect) or example(LcKS).

Additional details are available at 
https://cran.r-project.org/web/packages/KScorrect. Bug reports, suggestions, 
and feature requests are encouraged at 
https://github.com/pnovack-gottshall/KScorrect. 

We hope you find the functions useful when conducting goodness-of-fit tests 
using the K-S test.

Sincerely,
Phil Novack-Gottshall and Steve Wang

-- 
~
 Phil Novack-Gottshall
 Associate Professor
 Department of Biological Sciences
 Benedictine University
 5700 College Road 
 Lisle, IL 60532

 pnovack-gottsh...@ben.edu
 Phone: 630-829-6514
 Fax: 630-829-6547
 Office: 332 Birck Hall
 Lab: 316 Birck Hall
 http://www.ben.edu/faculty/pnovack-gottshall
~


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

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


[R] How to solve an NLME problem?

2016-03-29 Thread David C Blouin
I have a nonlinear model where I want to include random coefficients for a 
sample of random SUBJECTS. The fixed effects part of the model is Y ~ B + (T - 
B) / (1 + 10**(X - C)) and I would like to include random coefficients b for B, 
t for T, and c for C. The model is a fairly well-known three-parameter 
log-inhibitor model where Y is a measure of growth at X = log(CONCENTRATION), B 
is the unknown lower asymptote, T is the unknown upper asymptote, and C is the 
unknown log(IC50), where IC50 is the half maximal inhibitory concentration. I 
do not know how to solve this problem in R, where I am assuming NLME contains 
the appropriate methodology.

[[alternative HTML version deleted]]

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


Re: [R] converting a class dataframe (chars) to transaction class

2016-03-29 Thread Giorgio Garziano

mydf <- data.frame(d1 = LETTERS[1:10], d2 = letters[11:20])

> str(mydf)
'data.frame':   10 obs. of  2 variables:
$ d1: Factor w/ 10 levels "A","B","C","D",..: 1 2 3 4 5 6 7 8 9 10
$ d2: Factor w/ 10 levels "k","l","m","n",..: 1 2 3 4 5 6 7 8 9 10
>

library(arules)
trans1 <- as(mydf, "transactions")


> trans1
transactions in sparse format with
10 transactions (rows) and
20 items (columns)

> str(trans1)
Formal class 'transactions' [package "arules"] with 3 slots
  ..@ data   :Formal class 'ngCMatrix' [package "Matrix"] with 5 slots
  .. .. ..@ i   : int [1:20] 0 10 1 11 2 12 3 13 4 14 ...
  .. .. ..@ p   : int [1:11] 0 2 4 6 8 10 12 14 16 18 ...
  .. .. ..@ Dim : int [1:2] 20 10
  .. .. ..@ Dimnames:List of 2
  .. .. .. ..$ : NULL
  .. .. .. ..$ : NULL
  .. .. ..@ factors : list()
  ..@ itemInfo   :'data.frame': 20 obs. of  3 variables:
  .. ..$ labels   : chr [1:20] "d1=A" "d1=B" "d1=C" "d1=D" ...
  .. ..$ variables: Factor w/ 2 levels "d1","d2": 1 1 1 1 1 1 1 1 1 1 ...
  .. ..$ levels   : Factor w/ 20 levels "A","B","C","D",..: 1 2 3 4 5 6 7 8 9 
10 ...
  ..@ itemsetInfo:'data.frame': 10 obs. of  1 variable:
  .. ..$ transactionID: chr [1:10] "1" "2" "3" "4" ...>


Reference:

http://www.inside-r.org/packages/cran/arules/docs/transactionInfo


--

Best,

GG

[[alternative HTML version deleted]]

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


Re: [R] How to form groups for this specific problem?

2016-03-29 Thread Adams, Jean
You're welcome, Satish.

Yes, questions that are seeking solutions in R code are appropriate for
this group.  It's helpful if you provide sample data (for example, using
dput()) and sample R code that folks can use.  And it's helpful if you show
the results that you are hoping to achieve (as you did).

Jean

On Mon, Mar 28, 2016 at 1:15 PM, Satish Vadlamani <
satish.vadlam...@gmail.com> wrote:

> Jean:
> Wow. Thank you so much for this. I will read up igraph and then see if
> this is going to work for me for the larger dataset.
>
> Thanks for the wonderful snippet code you wrote. Basically, the
> requirement is this:
> TLA1 (Top Level Assembly) and its components should belong to the same
> group. If a component belongs to a different TLA (say TLA2), then that TLA1
> and all of its components should belong to the same as that of TLA1.
>
> Are these types of questions appropriate for this group?
>
> Thanks,
> Satish
>
>
> On Mar 28, 2016 9:10 AM, "Adams, Jean"  wrote:
>
>> Satish,
>>
>> If you rearrange your data into a network of nodes and edges, you can use
>> the igraph package to identify disconnected (mutually exclusive) groups.
>>
>> # example data
>> df <- data.frame(
>>   Component = c("C1", "C2", "C1", "C3", "C4", "C5"),
>>   TLA = c("TLA1", "TLA1", "TLA2", "TLA2", "TLA3", "TLA3")
>> )
>>
>> # characterize data as a network of nodes and edges
>> nodes <- levels(unlist(df))
>> edges <- apply(df, 2, match, nodes)
>>
>> # use the igraph package to identify disconnected groups
>> library(igraph)
>> g <- graph(edges)
>> ngroup <- clusters(g)$membership
>> df$Group <- ngroup[match(df$Component, nodes)]
>> df
>>
>>   Component  TLA Group
>> 1C1 TLA1 1
>> 2C2 TLA1 1
>> 3C1 TLA2 1
>> 4C3 TLA2 1
>> 5C4 TLA3 2
>> 6C5 TLA3 2
>>
>> Jean
>>
>> On Sun, Mar 27, 2016 at 7:56 PM, Satish Vadlamani <
>> satish.vadlam...@gmail.com> wrote:
>>
>>> Hello All:
>>> I would like to get some help with the following problem and understand
>>> how
>>> this can be done in R efficiently. The header is given in the data frame.
>>>
>>> *Component, TLA*
>>> C1, TLA1
>>> C2, TLA1
>>> C1, TLA2
>>> C3, TLA2
>>> C4, TLA3
>>> C5, TLA3
>>>
>>> Notice that C1 is a component of TLA1 and TLA2.
>>>
>>> I would like to form groups of mutually exclusive subsets and create a
>>> new
>>> column called group for this subset. For the above data, the subsets and
>>> the new group column value will be like so:
>>>
>>> *Component, TLA, Group*
>>> C1, TLA1, 1
>>> C2, TLA1, 1
>>> C1, TLA2, 1
>>> C3, TLA2, 1
>>> C4, TLA3, 2
>>> C5, TLA3, 2
>>>
>>> Appreciate any help on this. I could have looped through the observations
>>> and tried some logic but I did not try that yet.
>>>
>>> --
>>>
>>> Satish Vadlamani
>>>
>>> [[alternative HTML version deleted]]
>>>
>>> __
>>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>>

[[alternative HTML version deleted]]

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


Re: [R-es] Mann-Whitney con datos temporales

2016-03-29 Thread Carlos J. Gil Bellosta
Hola, ¿qué tal?

Estoy de acuerdo en todo menos en una cosa: que si las series están
autocorrelaccionadas (que lo estarán casi seguro), las diferencias también
lo estarán (necesariamente). Porque la primera cosa que se me ocurre (y no
me parece descabellada) es que si el efecto de la ubicación es aditivo, es
decir, si las temperaturas son

temp(t) + a1 + e1(t) para el sitio 1
temp(t) + a2 + e2(t) para el sitio 2

al tomar las diferencias hora a hora desaparecería el efecto de la serie
temporal subyacente, independientemente de su estructura y la prueba
pareada lo sería sobre la diferencia entre a1 y a2. Y la prueba por parejas
(de horas) tendría sentido.

Se puede comprobar (incluso a ojo; o más bien, primero y fundamentalmente a
ojo) si las diferencias tienen algún tipo de estructura temporal; en este
caso, quedaría invalidado todo lo dicho. Por supuesto.

Eso sí, sigue existiendo el problema de si las diferencias se deben a las
ubicaciones o a los sensores.

Salud,

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

El 29 de marzo de 2016, 12:15, José Trujillo Carmona 
escribió:

> En mi modesta opinión el problema planteado no es con las réplicas.
>
> Efectivamente el problema de las réplicas existe. Al haber un único sensor
> en cada sitio no podrás saber si las diferencias las crea el sitio o el
> sensor. Para mí la solución, si fuese factible, sería intercambiar sensores
> un tiempo.
>
> Pero en todo caso el problema planteado creo que es comparar los dos
> conjuntos de datos, con la salvedad de que las diferencias pueden ser
> debidas al sitio o al sensor. Este problema topa con el problema principal
> de la falta de independencia entre observaciones.
>
> El test de Mann-Whitney-Wilcoxon, como los tests paramétricos
> convencionales, incluyen la suposición de que se está trabajando con una
> muestra obtenida mediante muestreo aleatorio simple, o lo que es lo mismo
> que los sucesivos valores encontrados son independientes entre sí. De hecho
> el calculo de la distribución de probabilidad del estadístico de contraste
> depende fuertemente de esta suposición.
>
> La solución que propone Carlos (tomar diferencias en datos apareados) no
> resuelve para nada el problema: si las series están autocorrelacionadas,
> las diferencias también lo estarán.
>
> En métodos paramétricos la solución es eliminar las componentes de
> autocorrelación hasta conseguir que la serie sea ruido blanco. Las
> soluciones no paramétricas suele ir en la misma dirección; aunque no creo
> que esté indicada la estimación de un modelo ARIMA (paramétrico). Ahora
> mismo no tengo tiempo de buscar las soluciones concretas, pero yo iría en
> la siguiente dirección:
>
> 1º Comprobar si efectivamente la serie está autocorrelacionada mediante
> algún test tipo test de Wald-Wolfowitz (ver en el paquete randtests). Si no
> lo estuviese la utilización directa de Mann-Whitney no tendría ningún
> problema.
>
> 2º Eliminar la autocorrelación mediante procedimientos de suavizado que
> por no necesitar la estimación de parámetros son "free distribution" como
> los de Suavizado Exponencial de Brown o los más complejos de Holt o incluso
> Holt-Winter.
>
> Con los residuos de la serie suavizada (o alisada) hasta que las
> observaciones sean independientes entre sí, utilizar el test de
> Mann-Whitney.
>
> Saludos.
>
>
>
> El 29/03/16 a las 10:05, Carlos J. Gil Bellosta escribió:
>
>> Hola, ¿qué tal?
>>
>> En el peor de los casos, tendrías que comparar parejas de temperaturas
>> (por
>> hora). Es decir, con paired = T. Aún así, como dices, tendrías el problema
>> de la correlación entre medidas.
>>
>> En este caso, como en casi todos, lo ideal es plantear un modelo similar a
>>
>> temp ~ temp(h) + sitio + error
>>
>> y ver si el coeficiente de sitio es o no cero. El problema particular de
>> este ejemplo es que temp(h) (un modelo para la temperatura en función de
>> la
>> hora) es una función no lineal. Igual podrías probar con los GAM.
>>
>> Un saludo,
>>
>> Carlos J. Gil Bellosta
>> http://www.datanalytics.com
>>
>>
>> El 28 de marzo de 2016, 16:56, Javier Martínez-López <
>> javi.martinez.lo...@gmail.com> escribió:
>>
>> Hola a tod@s,
>>>
>>> queremos hacer una comparación entre dos lugares muy alejados entre sí
>>> en relación a la temperatura de cada sitio usando medias horarias de
>>> un período determinado. Sólo hay medidas de un sensor en cada sitio y
>>> queremos saber si las diferencias son significativas o no entre
>>> sitios/curvas. Hemos usado un test de Mann–Whitney U con la función
>>> wilcox.test (paired=F) ya que los valores no son normales (n = 24; 24h
>>> en base a medias minutales). ¿Creéis que es correcto o estaríamos
>>> incumpliendo alguna asunción del test al ser datos temporales y/o no
>>> tener réplicas de los sensores?
>>>
>>> Muchas gracias y saludos,
>>>
>>> Javier
>>>
>>> ___
>>> R-help-es mailing list
>>> R-help-es@r-project.org
>>> 

Re: [R] how can I count data points outside the main plot line?

2016-03-29 Thread Giorgio Garziano
As a "quick solution", I would explore the use of stat_smooth() and then 
extract fit data from,
as herein shown:

library(ggplot2)
p <- qplot(hp, wt, data=mtcars) + stat_smooth(method="loess")
p
ggplot_build(p)$data[[2]]

   xy ymin ymaxse PANEL group  colour   fill
1   52.0 1.993594 1.149150 2.838038 0.433 1-1 #3366FF grey60
2   55.58228 2.039986 1.303264 2.776709 0.3586695 1-1 #3366FF grey60
3   59.16456 2.087067 1.443076 2.731058 0.3135236 1-1 #3366FF grey60

Reference:

http://stackoverflow.com/questions/9789871/method-to-extract-stat-smooth-line-fit


In place of mtcars, your dataset.

Then, some more work to compare each (x,y) of your dataset with {(x,ymin), 
(x.ymax)} of
table above and to determine if (x,y) point stays within the smooth lines band 
or not.

Anyway, I would be interested in hearing about other approaches.

--

Best,

GG

[[alternative HTML version deleted]]

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


Re: [R] Performance Analytics Modigliani Code help

2016-03-29 Thread Jim Lemon
Hi Jessy,
I had a look at:

http://www.rdocumentation.org/packages/PerformanceAnalytics/functions/Modigliani

and it doesn't include a "Value" section, so I don't know what the
return value should be. Have you tried running the examples to see
what they return?

Jim

On Sat, Mar 26, 2016 at 12:10 AM, Jessy-Esther Missengue
 wrote:
> Hi all,
>
> I am researching performance of funds in the FTSE100 and am using the
> Modigliani function in the PerformanceAnalytics package.
>
> I have attached my raw data for your reference.
>
> When I try to use the Modigliani code as follows:
>
> Modigliani (a,b,c=0)
> where a is my data set "1000 RANDOM...", b is the data of FTSE "FTSE
> ALLSHARE..." returns, c is the risk free rate "LIBOR".
>
> This code returns the data attached "Modigliani from R" which seems to be a
> calculation for only the first 2 columns of my data set. I would have
> expected to have R return the same amount of rows and columns when using
> the Modigliani function i.e 108 rows and 1001 columns.
>
> Is there something I need to add to the code to have it calculate for each
> row/column?
>
> Thanks,
> Jessy *very confused student*
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] how can I count data points outside the main plot line?

2016-03-29 Thread PIKAL Petr
Hi

Did you try residuals and/or influence.measures?

Cheers
Petr


-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of raz
Sent: Tuesday, March 29, 2016 10:51 AM
To: r-help@r-project.org
Subject: [R] how can I count data points outside the main plot line?

How can I count data points that lay outside of the main plot line?
I have a plot in which most data points create a sigmoid line, but some are 
spread throughout the plot area, these points dont fit the curve. I would like 
to count them to know the ratio between the main curve and the data points that 
dont fit, any ideas?

Thanks,

Raz

--
\m/

[[alternative HTML version deleted]]

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


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 -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

[R] how can I count data points outside the main plot line?

2016-03-29 Thread raz
How can I count data points that lay outside of the main plot line?
I have a plot in which most data points create a sigmoid line, but some are
spread throughout the plot area, these points dont fit the curve. I would
like to count them to know the ratio between the main curve and the data
points that dont fit, any ideas?

Thanks,

Raz

-- 
\m/

[[alternative HTML version deleted]]

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


Re: [R-es] Mann-Whitney con datos temporales

2016-03-29 Thread Carlos J. Gil Bellosta
Hola, ¿qué tal?

En el peor de los casos, tendrías que comparar parejas de temperaturas (por
hora). Es decir, con paired = T. Aún así, como dices, tendrías el problema
de la correlación entre medidas.

En este caso, como en casi todos, lo ideal es plantear un modelo similar a

temp ~ temp(h) + sitio + error

y ver si el coeficiente de sitio es o no cero. El problema particular de
este ejemplo es que temp(h) (un modelo para la temperatura en función de la
hora) es una función no lineal. Igual podrías probar con los GAM.

Un saludo,

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


El 28 de marzo de 2016, 16:56, Javier Martínez-López <
javi.martinez.lo...@gmail.com> escribió:

> Hola a tod@s,
>
> queremos hacer una comparación entre dos lugares muy alejados entre sí
> en relación a la temperatura de cada sitio usando medias horarias de
> un período determinado. Sólo hay medidas de un sensor en cada sitio y
> queremos saber si las diferencias son significativas o no entre
> sitios/curvas. Hemos usado un test de Mann–Whitney U con la función
> wilcox.test (paired=F) ya que los valores no son normales (n = 24; 24h
> en base a medias minutales). ¿Creéis que es correcto o estaríamos
> incumpliendo alguna asunción del test al ser datos temporales y/o no
> tener réplicas de los sensores?
>
> Muchas gracias y saludos,
>
> Javier
>
> ___
> R-help-es mailing list
> R-help-es@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-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

Re: [R] Please guide -- UTF-8 locale setting fails on Windows on writing

2016-03-29 Thread Sunny Singha
Milan,
Anwer to your queries:
-- But how do you read back the contents of the file? You need to specify
the encoding when reading it too.
Answer: I read back as stated in 'Case 2'

-- Are you sure the notepad saved the text as UTF-8?
Answer: Yes.

Regards,
Sunny

On Mon, Mar 28, 2016 at 9:58 PM, Milan Bouchet-Valat  wrote:
> Le lundi 28 mars 2016 à 20:12 +0530, Sunny Singha a écrit :
>> Milan,
>> Ok, Let me take a case of facebook. I used Rfacebook package
>>  to get posts (getPost()) which returns list() of data frames(post,
>> comments, Likes)
>>
>> let me demonstrate 2 cases of read and write just as you suggested,
>> Case 1:
>> Lets say one of the facebook comment has below string value, in
>> Japanese language-->
>> "世界餐福事工 - 餐廳員工沒精打采 老是打盤子"
>>
>> On R console I now assign above string to variableas: x <- "世界餐福事工 -
>> 餐廳員工沒精打采 老是打盤子"
>> and write it as below:
>> write.csv(x, file='x.csv', row.names=F, fileEncoding='UTF-8')
>> I get this string in the file
>> "" -
>>  "
> But how do you read back the contents of the file? You need to specify
> the encoding when reading it too.
>
>> Case 2::
>> I create a notepad 'x.txt' and save Japanese string "世界餐福事工 - 餐廳員工沒精打采 老是打盤子"
>> and read it as below:
>> read.table('x.txt', fileEncoding='UTF-8'), I get below output:
>>
>>   V1
>> 1  ?
>> Warning messages:
>> 1: In read.table("x.txt", fileEncoding = "UTF-8") :
>>   invalid input found on input connection 'x.txt'
>> 2: In read.table("x.txt", fileEncoding = "UTF-8") :
>>   incomplete final line found by readTableHeader on 'x.txt'
> Are you sure the notepad saved the text as UTF-8?
>
>> Above was for demonstration, I'm infact reading social media data
>> extracted, which ultimately is somewhere using httr package and
>> returning data frames.
>> I'm not sure how should I get it handled in Windows as I don't observe
>> this behavior in Mac where system locase is set to 'en_US.UTF-8'
>>
>> Regards,
>> Sunny
>>
>>
>>
>>
>> On Mon, Mar 28, 2016 at 7:39 PM, Milan Bouchet-Valat  wrote:
>> >
>> > Le lundi 28 mars 2016 à 19:16 +0530, Sunny Singha a écrit :
>> > >
>> > > Hi,
>> > > I think I'm experiencing an issue regarding system Locale. I have
>> > > exported '.csv' formatted data frames gathered from various social
>> > > media platforms like facebook/twitter/G+, etc.
>> > >
>> > > I observe many variable/columns consists of strings formatted similar to 
>> > > below:
>> > > "
>> > > "
>> > >
>> > > As expected and I confirmed, in social media data, they are strings in
>> > > different languages.
>> > > Platform details are provide in the end of this mail. OS locale is set
>> > > to English (United States) hence 'R' locale is 'English_United
>> > > States.1252'
>> > >
>> > > I have attempted to change it to UTF-8 but receives below warning 
>> > > message:
>> > >
>> > > Warning message:
>> > > In Sys.setlocale("LC_ALL", "UTF-8") :
>> > >   OS reports request to set locale to "UTF-8" cannot be honored
>> > You don't need to set the locale. Just pass an appropriate value (e.g.
>> > "UTF-8") to read.csv() or write.csv()'s fileEncoding argument.
>> >
>> > You also didn't tell us what program you used to read these files. Some
>> > might guess the encoding incorrectly, or require you to choose it
>> > manually.
>> >
>> >
>> > Regards
>> >
>> > >
>> > > I have gone through below forums but no resolution so far:
>> > > --- 
>> > > http://stackoverflow.com/questions/20571147/how-to-set-unicode-locale-in-r
>> > > --- https://stat.ethz.ch/pipermail/r-devel/2013-November/067940.html
>> > > --- http://stackoverflow.com/questions/19877676/write-utf-8-files-from-r
>> > > --- https://tomizonor.wordpress.com/2013/04/17/file-utf8-windows/
>> > > --- 
>> > > http://withr.me/configure-character-encoding-for-r-under-linux-and-windows/
>> > >
>> > > I'm not sure whether the issue is while reading/extracting the data
>> > > from media or while writing/exporting in Windows directory, but I
>> > > don't experience similar issue in my personal Mac machine. I need some
>> > > clarification here.
>> > >
>> > > How could I export the data just as I see on web ?  Please guide.
>> > >
>> > > Regards,
>> > > Sunny
>> > >
>> > > Platform I'm using
>> > > Operating System : Windows 7 Professional SP1
>> > > R version details:
>> > > platform   x86_64-w64-mingw32
>> > > arch   x86_64
>> > > os mingw32
>> > > system x86_64, mingw32
>> > > status
>> > > major  3
>> > > minor  2.3
>> > > year   2015
>> > > month  12
>> > > day10
>> > > svn rev69752
>> > > language   R
>> > > version.string R version 3.2.3 (2015-12-10)
>> > > nickname   Wooden Christmas-Tree
>> > >
>> > > __
>> > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> > > https://stat.ethz.ch/mailman/listinfo/r-help
>> > > PLEASE do read the posting guide 
>> > >