Re: [R] How to stack two Stack manhattan plots?

2020-06-10 Thread John via R-help
On Wed, 10 Jun 2020 15:36:11 -0500
Ana Marija  wrote:

> Hello,
> 
> I have a data frame like this:
> 
> > head(tmp1)  
>   CHR  BP   PoldPnew
> 1   1  785989 0.9521 0.09278
> 2   1 1130727 0.4750 0.19010
> 3   1 1156131 0.5289 0.48520
> 4   1 1158631 0.2554 0.18140
> 5   1 1211292 0.2954 0.48590
> 6   1 1478153 0.5542 0.68790
> ...
> 
> I did:
> tmp.tidy <- tmp1 %>% gather(key, value, -BP, -CHR)
> jpeg("over.jpeg")
> ggplot(tmp.tidy, aes(BP, value, color=key)) + geom_point() +
> facet_wrap(~CHR, nrow=1)
> dev.off()
> 
> but I got this plot in attach which doesn't make sense. Can you please
> advise how to make this plot?
> 
> thanks
> Ana

If you would, the str() output might help people understand what is
happening, and also how many records you're looking at.  The head()
output is a bit thin on information.  There are various manhattan plot
packages for R including a specialized package for ggplot2. 

JWDougherty

__
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 with a (g)lmer code

2020-06-10 Thread Jim Lemon
Hi Saudi,
I can only make a guess, but that is that a variable having a unique
value for each participant has been read in as a factor. I assume that
"better" is some combination of "hum" and "cul" and exactly what is
WF?

Jim

On Thu, Jun 11, 2020 at 5:27 AM Saudi Sadiq  wrote:
>
> Dear Sir/Madam,
>
> Hope everyone is safe and sound. I appreciate your help a lot.
>
> I am evaluating two Arabic subtitles of a humorous English scene and asked
> 263 participants (part) to evaluate the two subtitles (named Standard
> Arabic, SA, and Egyptian Arabic, EA) via a questionnaire that asked them to
> rank the two subtitles in terms of how much each subtitle is
>
> 2) more humorous (hum),
>
> 5) closer to Egyptian culture (cul)
>
>
>
> The questionnaire contained two 1-10 linear scale questions regarding the 2
> points clarified, with 1 meaning the most humorous and closest to Egyptian
> culture, and 1 meaning the least humorous and furthest from Egyptian
> culture. Also, the questionnaire had a general multiple-choice question
> regarding which subtitle is better in general (better). General information
> about the participants were also collected concerning gender (categorical
> factor), age (numeric factor) and education (categorical factor).
>
> Two versions of the questionnaire were relied on: one showing the ‘SA
> subtitle first’ and another showing the ‘EA subtitle first’. Nearly half
> the participants answered the first and nearly half answered the latter.
>
> I am focusing on which social factor/s lead/s the participants to evaluate
> one of the two subtitles as generally better and which subtitle is more
> humorous and closer to Egyptian culture. Each of these points alone can be
> the dependent factor, but the results altogether can be linked.
>
> I thought that mixed effects analyses would clarify the picture and answer
> the research questions (which  factor/s lead/s participants to favour a
> subtitle over another?) and, so,  tried the lme4 package in R and ran many
> models but all the codes I have used are not working.
>
> I ran the following codes, which yielded Error messages, like:
>
> model1<- lmer (better ~ gender + age + education + WF + (1 | part),
> data=sub_data)
>
> Error: number of levels of each grouping factor must be < number of
> observations (problems: part)
>
>
>
> Model2 <- glmer (better ~ gender + age + education + WF + (1 | part), data
> = sub_data, family='binomial')
>
> Error in mkRespMod(fr, family = family) :
>
>   response must be numeric or factor
>
>
>
> Model3 <- glmer (better ~ age + gender + education + WF + (1 | part), data
> = sub_data, family='binomial', control=glmerControl(optimizer=c("bobyqa")))
>
> Error in mkRespMod(fr, family = family) :
>
>   response must be numeric or factor
>
>
>
> Why does the model crash? Does the problem lie in the random factor part 
> (which
> is a code for participants)? Or is it something related to the mixed
> effects analysis?
>
> Best
> Saudi Sadiq
>
> [[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] how to extract specific subscript of a matrix

2020-06-10 Thread Rasmus Liland
On 2020-06-10 18:01 -0700, Jeff Newmiller wrote:
> On June 10, 2020 5:29:10 PM PDT, Jinsong Zhao wrote:
> > 
> > (3,1), (5,1), (5,2), (4,2), (4,3), (1,3), (1,2), (3,2)
> 
> M <- matrix(c(2,2,rep(1,12), 2), nrow = 5,byrow = FALSE)
> ix <- expand.grid( r = seq.int( nrow( M ) )
>  , c = seq.int( ncol( M ) )
>  )
> ix[ 1 == c(M), ]

Dear Jinsong and Jeff,

I thought out this, really similar to Jeff's answer:

M <- matrix(c(2, 2, rep(1, 12), 2),
nrow=5, byrow=FALSE)

points <- expand.grid(1:nrow(M), 1:ncol(M))
points <- apply(points, 1, paste, collapse=",")
points <- matrix(paste0("(", points, ")"),
 nrow=nrow(M))

paste(points[M==1], collapse=", ")

you get

[1] "(3,1), (4,1), (5,1), (1,2), (2,2), (3,2), (4,2), (5,2), (1,3), 
(2,3), (3,3), (4,3)"

Best,
Rasmus


signature.asc
Description: PGP signature
__
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 extract specific subscript of a matrix

2020-06-10 Thread Jeff Newmiller
M <- matrix(c(2,2,rep(1,12), 2), nrow = 5,byrow = FALSE)
ix <- expand.grid( r = seq.int( nrow( M ) )
 , c = seq.int( ncol( M ) )
 )
ix[ 1 == c(M), ]


On June 10, 2020 5:29:10 PM PDT, Jinsong Zhao  wrote:
>Hi there,
>
>I have a matrix similar as:
>
>M <- matrix(c(2,2,rep(1,12), 2), nrow = 5,byrow = FALSE)
>
>I hope to get the border subscript of the block with value 1. In the 
>above example, I hope to get:
>
>(3,1), (5,1), (5,2), (4,2), (4,3), (1,3), (1,2), (3,2)
>
>Is there any function can do that? or any implement idea? Thanks!
>
>Best,
>Jinsong
>
>__
>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.

-- 
Sent from my phone. Please excuse my brevity.

__
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 extract specific subscript of a matrix

2020-06-10 Thread Jinsong Zhao

Hi there,

I have a matrix similar as:

M <- matrix(c(2,2,rep(1,12), 2), nrow = 5,byrow = FALSE)

I hope to get the border subscript of the block with value 1. In the 
above example, I hope to get:


(3,1), (5,1), (5,2), (4,2), (4,3), (1,3), (1,2), (3,2)

Is there any function can do that? or any implement idea? Thanks!

Best,
Jinsong

__
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 about extracting data

2020-06-10 Thread Greg Snow
There are more than one way to do it, and it would help if you
provided some sample data.

But here is an example for one way to do it:

examp.dat <- as.data.frame(matrix(sample(1:5, 100*6, replace=TRUE), ncol=6)
tmp.count <- apply(examp.dat, 1, function(x) sum(x>=3))
examp2.dat <- examp.dat[tmp.count <= 4, ]

examp.dat is a data frame with example data.
tmp.count is then the result of applying an anonymous function to each
row, the function counts how many entries in each row are greater than
or equal to 3
examp2.dat is then created as the subset where tmp.count is less than
or equal to 4.


On Wed, Jun 10, 2020 at 12:47 PM Aya Gilad  wrote:
>
> Hello,
> I'm analyzing a 6-question questionnaire. I need to exclude participants
> who answered more than 4 questions with a grade of 3 or higher.
> How do I write such a code?
> Thank you!
>
> [[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.



-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.com

__
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 stack two Stack manhattan plots?

2020-06-10 Thread cpolwart

What did you expect?

I'm assuming two plots (based on the subject) and side by side based on 
the code (nrow =1)


But you are getting several graphs (facets) on the row and only expected 
2?


What is in CHR?  i.e. summary(tmp1$CHR)

I'm assuming its not a factor with 2 elements...?



> Hello,
>
> I have a data frame like this:
>
> > head(tmp1)
>   CHR  BP   PoldPnew
> 1   1  785989 0.9521 0.09278
> 2   1 1130727 0.4750 0.19010
> 3   1 1156131 0.5289 0.48520
> 4   1 1158631 0.2554 0.18140
> 5   1 1211292 0.2954 0.48590
> 6   1 1478153 0.5542 0.68790
> ...
> ggplot(tmp.tidy, aes(BP, value, color=key)) + geom_point() +
> facet_wrap(~CHR, nrow=1)


__
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] Seeking implementation of my algorithm 'spdspds' - a novel algorithm for solving Linear Programming Problems with O(L^1.5) computational complexity

2020-06-10 Thread J C Nash
Your best chance to get some interest is to adapt an existing package
such as linprog or lpSolve to use your algorithm. Then there will be
sufficient structure to allow R users and developers to see your
ideas working, even if they are not efficiently programmed. It's
always easier to start with something that is working and improve it.
And you would be able to show comparisons of the existing examples by
the current and new methods.

I've worked on a lot of optimization (mainly function minimization) methods
over many decades, and there are several "brilliant" ideas that have not
turned out to be very good practical methods, while some rather pedestrian
ideas have proved reliable and effective, even if they don't fulfill nice
theoretical properties. There are, however, a few nice cases where theory
and practice are both great.

JN

On 2020-06-10 12:36 a.m., Keshava PRASADa Halemane wrote:
> Friends:
> i am a retired Professor -
> not having any access to the resources (human/financial/business/whatever)
> that may be required -
> therefore i am seeking implementation of my algorithm 'spdspds' -
> a novel algorithm for solving Linear Programming Problems with O(L^1.5)
> computational complexity -
> in order to show/convince the esteemed world optimization community
> that it is indeed a great grand breakthrough in terms of achievement of the
> linear programming performance challenge of the millennium -
> with far reaching deep impact on optimization algorithm development in
> general -
> holy grail fantasy realized!
> 
> I need some individual or team who is interested & willing to work on this.
> Earlier experience in implementation of optimization/LP algorithms will
> greatly help.
> 
> You may access / download / read my paper -
> "Unbelievable *O*(*L*^1.5) worst case computational complexity achieved by
> spdspds algorithm for linear programming problem"
> which is available at - arxiv . org / abs / 1405 . 6902
> 
> Thanks a lot.
>  - Dr(Prof) Keshava Prasad Halemane
> 
>   [[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-es] for-loop con partial

2020-06-10 Thread Javier Marcuzzi
Estimado Manuel Mendoza

Habría que verlo, en forma rápida y con un posible error de mi parte, puede
radicar en que la primer ventana tiene los parámetros y las segundas no, o
dicho de otra forma, algún índice se crea en la primera y en las sucesivas
no se crea nuevamente este índice, se me ocurre que la ventana no tiene que
ver con R, sino con el sistema operativo que recibe la orden desde R, de
ahí el posible conflicto en el índice. Pero no estoy seguro, tomarlo con
pinzas.

Javier Rubén Marcuzzi

El mié., 10 jun. 2020 a las 16:15, Manuel Mendoza (<
mmend...@fulbrightmail.org>) escribió:

> Muy buenas, ¿a ver si hay alguien que sepa por qué en este loop, si hago,
> p.e., i = 1 y corro las 2 filas de dentro, me abre una ventana y me hace el
> PDP de frg, es decir, lo hace bien, pero si corro todo el loop me abre las
> ventanas pero las deja vacías?
>
> predictores <- c("frg","omn","bc","co","pr","gg","fg","mf","br","hc")
> for(i in 1:length(predictores)){
> windows()
> partial(RFfit, pred.var = predictores[i], which.class = "Ard", plot =
> T,prob = T, chull=T, type="classification",plot.engine = "ggplot2", rug=T)
>   }
>
> Gracias,
> Manuel
>
> [[alternative HTML version deleted]]
>
> ___
> 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] kernlab ksvm rbfdot kernel - prediction returning fewer rows than provided for input

2020-06-10 Thread Tom Woolman
forgot to mention, the training and testing dataframes are composed of  
4 IVs (one double numeric IV and three factor IVs) and one DV  
(dichotomous factor, i.e. true or false).


The training dataframe consists of 48819 rows and test dataframe  
consists of 24408 rows.




Thanks again.



Quoting Tom Woolman :

Hi everyone. I'm using the kernlab ksvm function with the rbfdot  
kernel for a binary classification problem and getting a strange  
result back. The predictions seem to be very accurate judging by the  
training results provided by the algorithm, but I'm unable to  
generate a confusion matrix because there is a difference in the  
number of output records from my model test compared to what was  
input into the test dataframe.


I've used ksvm before but never had this problem.

Here's my sample code:



install.packages("kernlab")
library(kernlab)


set.seed(3233)


trainIndex <-  
caret::createDataPartition(dataset_labeled_fraud$isFraud,  
p=0.70,kist=FALSE)


train <- dataset_labeled_fraud[trainIndex,]
test <- dataset_labeled_fraud[-trainIndex,]


#clear out the training model
filter <- NULL

filter <-  
kernlab::ksvm(isFraud~.,data=train,kernel="rbfdot",kpar=list(sigma=0.5),C=3,prob.model=TRUE)



#clear out the test results
test_pred_rbfdot <- NULL

test_pred_rbfdot <- kernlab::predict(filter,test,type="probabilities")

dataframe_test_pred_rbfdot <- as.data.frame(test_pred_rbfdot)


nrow(dataframe_test_pred_rbfdot)


23300


nrow(test)


24408



# ok, how did I go from 24408 input rows to only 23300 output  
prediction rows? :(



Thanks in advance anyone!




Thomas A. Woolman
PhD Candidate, Technology Management
Indiana State University


__
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] kernlab ksvm rbfdot kernel - prediction returning fewer rows than provided for input

2020-06-10 Thread Tom Woolman



Hi everyone. I'm using the kernlab ksvm function with the rbfdot  
kernel for a binary classification problem and getting a strange  
result back. The predictions seem to be very accurate judging by the  
training results provided by the algorithm, but I'm unable to generate  
a confusion matrix because there is a difference in the number of  
output records from my model test compared to what was input into the  
test dataframe.


I've used ksvm before but never had this problem.

Here's my sample code:



install.packages("kernlab")
library(kernlab)


set.seed(3233)


trainIndex <-  
caret::createDataPartition(dataset_labeled_fraud$isFraud,  
p=0.70,kist=FALSE)


train <- dataset_labeled_fraud[trainIndex,]
test <- dataset_labeled_fraud[-trainIndex,]


#clear out the training model
filter <- NULL

filter <-  
kernlab::ksvm(isFraud~.,data=train,kernel="rbfdot",kpar=list(sigma=0.5),C=3,prob.model=TRUE)



#clear out the test results
test_pred_rbfdot <- NULL

test_pred_rbfdot <- kernlab::predict(filter,test,type="probabilities")

dataframe_test_pred_rbfdot <- as.data.frame(test_pred_rbfdot)


nrow(dataframe_test_pred_rbfdot)


23300


nrow(test)


24408



# ok, how did I go from 24408 input rows to only 23300 output  
prediction rows? :(



Thanks in advance anyone!




Thomas A. Woolman
PhD Candidate, Technology Management
Indiana State University

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


Re: [R] request

2020-06-10 Thread Jim Lemon
Hi Mozhgan,
This is pretty obscure. If you have entered all of the variables in
your attached list, You can start by looking at the summary of the
output. This may help:

https://stat.ethz.ch/R-manual/R-devel/library/mgcv/html/summary.gam.html

Jim

On Thu, Jun 11, 2020 at 4:47 AM Mozhgan Soleimani
 wrote:
>
> Hello
> thank you for reading email
> please help me,
> I have used mgcv package for GAM model.
>
> To get contributions of each variable, Which code should I write in the R
> software?
> please see attached file
> __
> 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 to stack two Stack manhattan plots?

2020-06-10 Thread Ana Marija
HI Jim

I run it like this:
Rscript --no-save Manhattan_plot.R

and just in case I added: stringsAsFactors=FALSE

so the script looks like this:
library(qqman)
results_log <- read.table("logistic_results_M3.assoc.logistic.C",
head=TRUE,stringsAsFactors=FALSE)
jpeg("M3.assoc.logistic.jpeg")
manhattan(results_log,chr="CHR",bp="BP",p="P",snp="SNP", main =
"Manhattan plot:logistic")
dev.off()

this code does work with another data set, the jpeg() does work. I
will try now with PNG

On Wed, Jun 10, 2020 at 5:17 PM Jim Lemon  wrote:
>
> Hi Ana,
> The problem may be that the JPEG device doesn't handle transparency.
> Perhaps PNG?
>
> Jim
>
> On Thu, Jun 11, 2020 at 6:48 AM Ana Marija  
> wrote:
> >
> > Hello,
> >
> > I have a data frame like this:
> >
> > > head(tmp1)
> >   CHR  BP   PoldPnew
> > 1   1  785989 0.9521 0.09278
> > 2   1 1130727 0.4750 0.19010
> > 3   1 1156131 0.5289 0.48520
> > 4   1 1158631 0.2554 0.18140
> > 5   1 1211292 0.2954 0.48590
> > 6   1 1478153 0.5542 0.68790
> > ...
> >
> > I did:
> > tmp.tidy <- tmp1 %>% gather(key, value, -BP, -CHR)
> > jpeg("over.jpeg")
> > ggplot(tmp.tidy, aes(BP, value, color=key)) + geom_point() +
> > facet_wrap(~CHR, nrow=1)
> > dev.off()
> >
> > but I got this plot in attach which doesn't make sense. Can you please
> > advise how to make this plot?
> >
> > thanks
> > Ana
> > __
> > 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 to stack two Stack manhattan plots?

2020-06-10 Thread Jim Lemon
Hi Ana,
The problem may be that the JPEG device doesn't handle transparency.
Perhaps PNG?

Jim

On Thu, Jun 11, 2020 at 6:48 AM Ana Marija  wrote:
>
> Hello,
>
> I have a data frame like this:
>
> > head(tmp1)
>   CHR  BP   PoldPnew
> 1   1  785989 0.9521 0.09278
> 2   1 1130727 0.4750 0.19010
> 3   1 1156131 0.5289 0.48520
> 4   1 1158631 0.2554 0.18140
> 5   1 1211292 0.2954 0.48590
> 6   1 1478153 0.5542 0.68790
> ...
>
> I did:
> tmp.tidy <- tmp1 %>% gather(key, value, -BP, -CHR)
> jpeg("over.jpeg")
> ggplot(tmp.tidy, aes(BP, value, color=key)) + geom_point() +
> facet_wrap(~CHR, nrow=1)
> dev.off()
>
> but I got this plot in attach which doesn't make sense. Can you please
> advise how to make this plot?
>
> thanks
> Ana
> __
> 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] Error in plot.window(...) : need finite 'ylim' values

2020-06-10 Thread Jim Lemon
Hi Ana,
I don't have the qqman package, but is your "P" column in
"M3.assoc.logistic.C" numeric or has it been read in as a factor?

Jim

On Thu, Jun 11, 2020 at 4:13 AM Ana Marija  wrote:
>
> Hello,
>
> I do have a file like this:
> head M3.assoc.logistic.C
> CHR SNP BP P
> 1 1:785989:T:C 785989 0.4544
> 1 1:785989:T:C 785989 0.689
> 1 1:1130727:A:C 1130727 0.05068
> 1 1:1130727:A:C 1130727 0.07381
> 1 1:1156131:T:C 1156131 0.6008
> 1 1:1156131:T:C 1156131 0.8685
> ...
>
> And I don't have any "NA" or "inf" values in it
>
> and I am plotting it in R via:
>
> library(qqman)
> results_log <- read.table("M3.assoc.logistic.C", head=TRUE)
> jpeg("Logistic_manhattan_retinopathy_M3.jpeg")
> manhattan(results_log,chr="CHR",bp="BP",p="P",snp="SNP", main =
> "Manhattan plot: logistic")
> dev.off()
>
> but I am getting:
>
> Error in plot.window(...) : need finite 'ylim' values
> Calls: manhattan ... do.call -> plot -> plot.default -> localWindow ->
> plot.window
> Execution halted
>
> Please advise,
>
> Thanks
> Ana
>
> __
> 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 to stack two Stack manhattan plots?

2020-06-10 Thread Jeff Newmiller
?dput

We cannot tell how the columns are being stored in memory from your head() 
output.

On June 10, 2020 1:36:11 PM PDT, Ana Marija  wrote:
>Hello,
>
>I have a data frame like this:
>
>> head(tmp1)
>  CHR  BP   PoldPnew
>1   1  785989 0.9521 0.09278
>2   1 1130727 0.4750 0.19010
>3   1 1156131 0.5289 0.48520
>4   1 1158631 0.2554 0.18140
>5   1 1211292 0.2954 0.48590
>6   1 1478153 0.5542 0.68790
>...
>
>I did:
>tmp.tidy <- tmp1 %>% gather(key, value, -BP, -CHR)
>jpeg("over.jpeg")
>ggplot(tmp.tidy, aes(BP, value, color=key)) + geom_point() +
>facet_wrap(~CHR, nrow=1)
>dev.off()
>
>but I got this plot in attach which doesn't make sense. Can you please
>advise how to make this plot?
>
>thanks
>Ana

-- 
Sent from my phone. Please excuse my brevity.

__
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] Creating one df from 85 df present in a list

2020-06-10 Thread Bert Gunter
?do.call  -- takes a list of arguments to a function
... as in
do.call(merge, yourlist)  ## or similar perhaps


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 Wed, Jun 10, 2020 at 11:48 AM Alejandro Ureta 
wrote:

> hi, I am trying to fuse (cbind, merge... NOT rbind) several dataframes with
> different numbers of rows, all df included in a list, and using the code
> extract shown below. The function merge() works well with two df but not
> more than two...I have 85 dataframes to join in this way (85 df in the
> list)could you please let me know how to get all 85 df merged ?,
> thanks
>
> fusion_de_tablas = merge(red_tablas_por_punto[["1 - Bv.Artigas y la Rambla
> (Terminal CUTCSA)"]],
> red_tablas_por_punto[["10 - Avenida Millán 2515 (Hospital Vilardebó)"]],
> red_tablas_por_punto[["100 - Fauquet 6358 (Hospital Saint Bois)"]],
> by= 'toma_de_muestras', all = T )
>
> --
> *Alejandro *
>
> [[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] Error messages (Long vectors not supported)

2020-06-10 Thread David Winsemius
If that is an exact copy of the issued command than it should be 
throwing an error related to the use of "smart quotes".



Furthermore it was not clear if that command was the proximate cause of 
the error or perhaps it was encountered when you tried to load (rather 
than install) the Rserve package?


--

David

On 6/10/20 11:33 AM, Kayla Song wrote:

Hello there,

I hope this email finds you well.

I’m just having a difficulty running RServe, which I’m trying to get 
communicate with Tableau. I have this error message every time I try to do this:

Error: long vectors not supported yet: qap_encode.c:36
Fatal error: unable to initialize the JIT

I searched some online forums but could not find the answer that resolved this 
problem. For example, I tried:

install.packages("Rserve", "Rserve_1.8-6.tgz", "http://www.rforge.net/“)

But the error message still appears.
Could you please advise?

thanks so much,
Kayla
[[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] Help with a (g)lmer code

2020-06-10 Thread Saudi Sadiq
Dear Sir/Madam,

Hope everyone is safe and sound. I appreciate your help a lot.

I am evaluating two Arabic subtitles of a humorous English scene and asked
263 participants (part) to evaluate the two subtitles (named Standard
Arabic, SA, and Egyptian Arabic, EA) via a questionnaire that asked them to
rank the two subtitles in terms of how much each subtitle is

2) more humorous (hum),

5) closer to Egyptian culture (cul)



The questionnaire contained two 1-10 linear scale questions regarding the 2
points clarified, with 1 meaning the most humorous and closest to Egyptian
culture, and 1 meaning the least humorous and furthest from Egyptian
culture. Also, the questionnaire had a general multiple-choice question
regarding which subtitle is better in general (better). General information
about the participants were also collected concerning gender (categorical
factor), age (numeric factor) and education (categorical factor).

Two versions of the questionnaire were relied on: one showing the ‘SA
subtitle first’ and another showing the ‘EA subtitle first’. Nearly half
the participants answered the first and nearly half answered the latter.

I am focusing on which social factor/s lead/s the participants to evaluate
one of the two subtitles as generally better and which subtitle is more
humorous and closer to Egyptian culture. Each of these points alone can be
the dependent factor, but the results altogether can be linked.

I thought that mixed effects analyses would clarify the picture and answer
the research questions (which  factor/s lead/s participants to favour a
subtitle over another?) and, so,  tried the lme4 package in R and ran many
models but all the codes I have used are not working.

I ran the following codes, which yielded Error messages, like:

model1<- lmer (better ~ gender + age + education + WF + (1 | part),
data=sub_data)

Error: number of levels of each grouping factor must be < number of
observations (problems: part)



Model2 <- glmer (better ~ gender + age + education + WF + (1 | part), data
= sub_data, family='binomial')

Error in mkRespMod(fr, family = family) :

  response must be numeric or factor



Model3 <- glmer (better ~ age + gender + education + WF + (1 | part), data
= sub_data, family='binomial', control=glmerControl(optimizer=c("bobyqa")))

Error in mkRespMod(fr, family = family) :

  response must be numeric or factor



Why does the model crash? Does the problem lie in the random factor part (which
is a code for participants)? Or is it something related to the mixed
effects analysis?

Best
Saudi Sadiq

[[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] Error messages (Long vectors not supported)

2020-06-10 Thread Kayla Song
Hello there,

I hope this email finds you well.

I’m just having a difficulty running RServe, which I’m trying to get 
communicate with Tableau. I have this error message every time I try to do this:

Error: long vectors not supported yet: qap_encode.c:36
Fatal error: unable to initialize the JIT

I searched some online forums but could not find the answer that resolved this 
problem. For example, I tried:

install.packages("Rserve", "Rserve_1.8-6.tgz", "http://www.rforge.net/“)

But the error message still appears. 
Could you please advise?

thanks so much,
Kayla
[[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-es] for-loop con partial

2020-06-10 Thread Manuel Mendoza
Muy buenas, ¿a ver si hay alguien que sepa por qué en este loop, si hago,
p.e., i = 1 y corro las 2 filas de dentro, me abre una ventana y me hace el
PDP de frg, es decir, lo hace bien, pero si corro todo el loop me abre las
ventanas pero las deja vacías?

predictores <- c("frg","omn","bc","co","pr","gg","fg","mf","br","hc")
for(i in 1:length(predictores)){
windows()
partial(RFfit, pred.var = predictores[i], which.class = "Ard", plot =
T,prob = T, chull=T, type="classification",plot.engine = "ggplot2", rug=T)
  }

Gracias,
Manuel

[[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] Creating one df from 85 df present in a list

2020-06-10 Thread Alejandro Ureta
hi, I am trying to fuse (cbind, merge... NOT rbind) several dataframes with
different numbers of rows, all df included in a list, and using the code
extract shown below. The function merge() works well with two df but not
more than two...I have 85 dataframes to join in this way (85 df in the
list)could you please let me know how to get all 85 df merged ?,
thanks

fusion_de_tablas = merge(red_tablas_por_punto[["1 - Bv.Artigas y la Rambla
(Terminal CUTCSA)"]],
red_tablas_por_punto[["10 - Avenida Millán 2515 (Hospital Vilardebó)"]],
red_tablas_por_punto[["100 - Fauquet 6358 (Hospital Saint Bois)"]],
by= 'toma_de_muestras', all = T )

-- 
*Alejandro *

[[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] request

2020-06-10 Thread Mozhgan Soleimani
Hello
thank you for reading email
please help me,
I have used mgcv package for GAM model.

To get contributions of each variable, Which code should I write in the R
software?
please see attached file
__
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 about extracting data

2020-06-10 Thread Aya Gilad
Hello,
I'm analyzing a 6-question questionnaire. I need to exclude participants
who answered more than 4 questions with a grade of 3 or higher.
How do I write such a code?
Thank you!

[[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] Seeking implementation of my algorithm 'spdspds' - a novel algorithm for solving Linear Programming Problems with O(L^1.5) computational complexity

2020-06-10 Thread Keshava PRASADa Halemane
Friends:
i am a retired Professor -
not having any access to the resources (human/financial/business/whatever)
that may be required -
therefore i am seeking implementation of my algorithm 'spdspds' -
a novel algorithm for solving Linear Programming Problems with O(L^1.5)
computational complexity -
in order to show/convince the esteemed world optimization community
that it is indeed a great grand breakthrough in terms of achievement of the
linear programming performance challenge of the millennium -
with far reaching deep impact on optimization algorithm development in
general -
holy grail fantasy realized!

I need some individual or team who is interested & willing to work on this.
Earlier experience in implementation of optimization/LP algorithms will
greatly help.

You may access / download / read my paper -
"Unbelievable *O*(*L*^1.5) worst case computational complexity achieved by
spdspds algorithm for linear programming problem"
which is available at - arxiv . org / abs / 1405 . 6902

Thanks a lot.
 - Dr(Prof) Keshava Prasad Halemane

[[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] Error in plot.window(...) : need finite 'ylim' values

2020-06-10 Thread Ana Marija
Hello,

I do have a file like this:
head M3.assoc.logistic.C
CHR SNP BP P
1 1:785989:T:C 785989 0.4544
1 1:785989:T:C 785989 0.689
1 1:1130727:A:C 1130727 0.05068
1 1:1130727:A:C 1130727 0.07381
1 1:1156131:T:C 1156131 0.6008
1 1:1156131:T:C 1156131 0.8685
...

And I don't have any "NA" or "inf" values in it

and I am plotting it in R via:

library(qqman)
results_log <- read.table("M3.assoc.logistic.C", head=TRUE)
jpeg("Logistic_manhattan_retinopathy_M3.jpeg")
manhattan(results_log,chr="CHR",bp="BP",p="P",snp="SNP", main =
"Manhattan plot: logistic")
dev.off()

but I am getting:

Error in plot.window(...) : need finite 'ylim' values
Calls: manhattan ... do.call -> plot -> plot.default -> localWindow ->
plot.window
Execution halted

Please advise,

Thanks
Ana

__
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] almost logistic data evaluation

2020-06-10 Thread Stephen Ellison


I'm not sure this is really a statistical problem, in the sense of looking for 
a convenient but arbitrary statistical function; to do it well is more of a 
physicochemical modelling problem.
I can't give you an answer but maybe a direction I'd consider if I wanted to 
take it seriously ...

You have a steady heat input (which is initially a straight line but becomes 
asymptotic as cooling rate approaches heating rate),  plus an exothermic 
reaction whose rate will almost certainly depend on temperature (I guess close 
to the usual 'double every 10K' rule of thumb for chemistry, but of course 
there are plenty of exceptions and diffusion control doesn't follow Arrhenius 
rate dependence. ). On a bad day it may self-catalyse as well, but it's already 
self-accelerating in the sense that the rate will go up with the temperature 
and the temperature will go up faster at higher rates.

To model that you would ideally set up a kinetic model for the chemistry, with 
coefficients for (probably) an activation energy rather than a simple rate 
constant, enthalpy of reaction, heat input and at least one arbitrary heat 
capacity so that you have something that relates heat input and enthalpy to 
temperature. There'll be another term (probably based on newton's law of 
cooling) to model external heating and cooling, again with that system heat 
capacity to convert energy to temperature.
 
That'll be a moderately awkward differential equation.  For the common 
exponential relation of temperature and rate (assuming an Arrhenius 
relationship for the rate constant), with temperature not constant, it will 
almost certainly need numerical solution with something like the deSolve 
package. That can give you an integrated change at different times. After that 
'all' you need to do is wrap that in a function to return a residual sum of 
squares and then plug that into something like optim() or perhaps nls() to fit 
the curve. 

You may want to set I say 'all you need ...'; obviously, that's a fair bit of 
work...


From: PIKAL Petr [petr.pi...@precheza.cz]
Sent: 10 June 2020 07:59
To: Stephen Ellison; r-help@r-project.org
Subject: RE: [R] almost logistic data evaluation

Hi

External heating. Normally I would use TA instrumentation but for technical
reasons it is impossible. And other complicating factor is that temperature
rise is from beginning almost parabolic (it's derivation is straight line).

Therefore I started with double exponential fit, which is sometimes
satisfactory but sometimes gives nonsense result. After help from R
community I got in almost all cases reasonable fit.

However I want to concentrate on just the reaction part and to find some
more simple way how to get slope for temperature rise and maybe other
parameters related to changes in experiments.

I was advised to look at "growth curve analysis" which I will try to, but I
wonder if due to twisted data is appropriate.

Thanks.
Petr

> -Original Message-
> From: R-help  On Behalf Of Stephen Ellison
> Sent: Tuesday, June 9, 2020 7:11 PM
> To: r-help@r-project.org
> Subject: Re: [R] almost logistic data evaluation
>
> > Actually "y" is growing temperature, which, at some point, rise more
rapidly
> due to exothermic reaction.
> > This reaction starts and ends and proceed with some speed (hopefully
> different in each material).
>
> Are you applying external heating or is it solely due to reaction
kinetics?
>
>
> Steve E
>
> *
> **
> This email and any attachments are confidential. Any u...{{dropped:19}}

__
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 convert European short dates to ISO format?

2020-06-10 Thread Rich Shepard

On Wed, 10 Jun 2020, Jeff Newmiller wrote:


Fix your format specification?
?strptime



I have been trying to convert European short dates formatted as dd/mm/yy
into the ISO 8601 but the function as.Dates interprets them as American
ones (mm/dd/yy), thus I get:


Look at Hadley Wickham's 'tidyverse' collection as described in R for Data
Science. There are date, datetime, and time functions that will do just what
you want.

Rich

__
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 convert European short dates to ISO format?

2020-06-10 Thread Jeff Newmiller
Fix your format specification?

?strptime

On June 10, 2020 1:20:01 AM PDT, Luigi Marongiu  
wrote:
>Hello,
>I have been trying to convert European short dates formatted as
>dd/mm/yy into the ISO 8601 but the function as.Dates interprets them
>as American ones (mm/dd/yy), thus I get:
>
>```
>oriDates = c("23/01/20", "24/01/20", "25/01/20", "26/01/20",
>"27/01/20", "28/01/20", "29/01/20", "30/01/20",
> "31/01/20", "01/02/20", "02/02/20", "03/02/20",
>"04/02/20", "05/02/20", "06/02/20", "07/02/20")
>isoDates = as.Date(oriDates, format = "%m/%d/%y")
>> isoDates
> [1] NA   NA   NA   NA   NA
>NA   NA
> [8] NA   NA   "2020-01-02" "2020-02-02" "2020-03-02"
>"2020-04-02" "2020-05-02"
>[15] "2020-06-02" "2020-07-02"
>```
>
>How can I convert properly?

-- 
Sent from my phone. Please excuse my brevity.

__
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] segmented do not correctly fit data (variable names problem)

2020-06-10 Thread Bert Gunter
Note: My warning was for "stepwise" regression, which is what *you wrote*,
not "segmented".

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 Wed, Jun 10, 2020 at 3:09 AM PIKAL Petr  wrote:

> Dear all
>
> To make my problem more on topic I would like to ask about weird results
> from segmented fit, despite of Bert's warning.
>
> Here is my data
>
> temp <- structure(list(V1 = c(0L, 15L, 30L, 45L, 60L, 75L, 90L, 105L, 120L,
> 135L, 150L, 165L, 180L, 195L, 210L, 225L, 240L, 255L, 270L, 285L, 300L,
> 315L, 330L, 345L, 360L), V2 = c(98.6867, 100.8, 103.28, 107.44, 110.06,
> 114.26, 117.6, 121.04, 123.853, 126.66, 129.98, 134.187, 139.04,
> 144.6, 152.08, 161.3, 169.873, 176.613, 181.92, 186.027,
> 188.753, 190.707, 192.053, 192.993, 193.353)), class =
> "data.frame", row.names = c(NA,
> + -25L))
>
> Here is the fit.
>
> library(segmented)
> plot(temp$V1, temp$V2)
> fit <- lm(V2~V1, temp)
> fit.s <- segmented(fit, seg.Z = ~ V1, npsi=2)
> plot(fit.s, add=TRUE, col=2)
>
> which is wrong.
>
> If I take example from web, the result is OK.
>
> set.seed(12)
> xx <- 1:100
> zz <- runif(100)
> yy <- 2 + 1.5*pmax(xx - 35, 0) - 1.5*pmax(xx - 70, 0) + 15*pmax(zz - .5, 0)
> +  rnorm(100,0,2)
> dati <- data.frame(x = xx, y = yy, z = zz)
> out.lm <- lm(y ~ x, data = dati)
> o <- segmented(out.lm, seg.Z = ~x, psi = list(x = c(30,60)),  control =
> seg.control(display = FALSE)
> )
> plot(dati$x, dati$y)
> plot(o, add=TRUE, col=2)
>
> What am I doing wrong? Is there a bug in segmented? BTW, if I change column
> names in temp to x and y, segmented found correct fit.
>
> names(temp) <- c("x", "y")
> plot(temp$x, temp$y)
> fit <- lm(y~x, temp)
> fit.s <- segmented(fit, seg.Z = ~x, npsi=2)
> plot(fit.s, add=TRUE, col=2)
>
> > sessionInfo()
> R Under development (unstable) (2020-03-08 r77917)
> Platform: x86_64-w64-mingw32/x64 (64-bit)
> Running under: Windows 10 x64 (build 18363)
>
> Matrix products: default
>
> locale:
> [1] LC_COLLATE=Czech_Czechia.1250  LC_CTYPE=Czech_Czechia.1250
> [3] LC_MONETARY=Czech_Czechia.1250 LC_NUMERIC=C
> [5] LC_TIME=Czech_Czechia.1250
>
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods   base
>
> other attached packages:
> [1] segmented_1.1-0
>
> loaded via a namespace (and not attached):
> [1] compiler_4.0.0 tools_4.0.0splines_4.0.0
>
>
> Cheers
> Petr
>
>
> __
> 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] Doubling time definition package incidence

2020-06-10 Thread Luigi Marongiu
The package incidence provides the function fit_optim_split that
returns a predicted doubling time in days. Would this be serial
interval described in the epidemiology manuals?
Thank you

__
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] segmented do not correctly fit data (variable names problem)

2020-06-10 Thread PIKAL Petr
Dear all

To make my problem more on topic I would like to ask about weird results
from segmented fit, despite of Bert's warning.

Here is my data

temp <- structure(list(V1 = c(0L, 15L, 30L, 45L, 60L, 75L, 90L, 105L, 120L,
135L, 150L, 165L, 180L, 195L, 210L, 225L, 240L, 255L, 270L, 285L, 300L,
315L, 330L, 345L, 360L), V2 = c(98.6867, 100.8, 103.28, 107.44, 110.06,
114.26, 117.6, 121.04, 123.853, 126.66, 129.98, 134.187, 139.04,
144.6, 152.08, 161.3, 169.873, 176.613, 181.92, 186.027,
188.753, 190.707, 192.053, 192.993, 193.353)), class =
"data.frame", row.names = c(NA,
+ -25L))

Here is the fit.

library(segmented)
plot(temp$V1, temp$V2)
fit <- lm(V2~V1, temp)
fit.s <- segmented(fit, seg.Z = ~ V1, npsi=2)
plot(fit.s, add=TRUE, col=2)

which is wrong.

If I take example from web, the result is OK.

set.seed(12)
xx <- 1:100
zz <- runif(100)
yy <- 2 + 1.5*pmax(xx - 35, 0) - 1.5*pmax(xx - 70, 0) + 15*pmax(zz - .5, 0)
+  rnorm(100,0,2)
dati <- data.frame(x = xx, y = yy, z = zz)
out.lm <- lm(y ~ x, data = dati)
o <- segmented(out.lm, seg.Z = ~x, psi = list(x = c(30,60)),  control =
seg.control(display = FALSE)
)
plot(dati$x, dati$y)
plot(o, add=TRUE, col=2)

What am I doing wrong? Is there a bug in segmented? BTW, if I change column
names in temp to x and y, segmented found correct fit.

names(temp) <- c("x", "y")
plot(temp$x, temp$y)
fit <- lm(y~x, temp)
fit.s <- segmented(fit, seg.Z = ~x, npsi=2)
plot(fit.s, add=TRUE, col=2)

> sessionInfo()
R Under development (unstable) (2020-03-08 r77917)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=Czech_Czechia.1250  LC_CTYPE=Czech_Czechia.1250   
[3] LC_MONETARY=Czech_Czechia.1250 LC_NUMERIC=C  
[5] LC_TIME=Czech_Czechia.1250

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

other attached packages:
[1] segmented_1.1-0

loaded via a namespace (and not attached):
[1] compiler_4.0.0 tools_4.0.0splines_4.0.0 


Cheers
Petr


__
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 convert European short dates to ISO format?

2020-06-10 Thread Heinz Tuechler

maybe
isoDates <- as.Date(oriDates, format = "%d/%m/%y")

Heinz

Luigi Marongiu wrote/hat geschrieben on/am 10.06.2020 10:20:

Hello,
I have been trying to convert European short dates formatted as
dd/mm/yy into the ISO 8601 but the function as.Dates interprets them
as American ones (mm/dd/yy), thus I get:

```
oriDates = c("23/01/20", "24/01/20", "25/01/20", "26/01/20",
"27/01/20", "28/01/20", "29/01/20", "30/01/20",
 "31/01/20", "01/02/20", "02/02/20", "03/02/20",
"04/02/20", "05/02/20", "06/02/20", "07/02/20")
isoDates = as.Date(oriDates, format = "%m/%d/%y")

isoDates

 [1] NA   NA   NA   NA   NA
NA   NA
 [8] NA   NA   "2020-01-02" "2020-02-02" "2020-03-02"
"2020-04-02" "2020-05-02"
[15] "2020-06-02" "2020-07-02"
```

How can I convert properly?



__
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 convert European short dates to ISO format?

2020-06-10 Thread Berend Hasselman
Luigi,

Try format = "%d/%m/%y"

Berend Hasselman

> On 10 Jun 2020, at 10:20, Luigi Marongiu  wrote:
> 
>  ISO 8601

__
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 convert European short dates to ISO format?

2020-06-10 Thread Luigi Marongiu
Thank you!

On Wed, Jun 10, 2020 at 10:29 AM Daniel Nordlund  wrote:
>
> On 6/10/2020 1:20 AM, Luigi Marongiu wrote:
> > isoDates = as.Date(oriDates, format = "%m/%d/%y")
>
> You need to use the format for European short dates.
>
> isoDates = as.Date(oriDates, format = "%d/%m/%y")
>
>
> Hope this is helpful,
>
> Dan
>
> --
> Daniel Nordlund
> Port Townsend, WA  USA
>


-- 
Best regards,
Luigi

__
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 convert European short dates to ISO format?

2020-06-10 Thread Kimmo Elo
Hi!

Should it be:

as.Date(oriDates, format="%d/%m/%y") # See the order of %d and %m!!

This command seems to work for me, here the output:

 [1] "2020-01-23" "2020-01-24" "2020-01-25" "2020-01-26" "2020-01-27"
"2020-01-28" "2020-01-29" "2020-01-30"
 [9] "2020-01-31" "2020-02-01" "2020-02-02" "2020-02-03" "2020-02-04"
"2020-02-05" "2020-02-06" "2020-02-07"

HTH,
Kimmo

ke, 2020-06-10 kello 10:20 +0200, Luigi Marongiu kirjoitti:
> Hello,
> I have been trying to convert European short dates formatted as
> dd/mm/yy into the ISO 8601 but the function as.Dates interprets them
> as American ones (mm/dd/yy), thus I get:
> 
> ```
> oriDates = c("23/01/20", "24/01/20", "25/01/20", "26/01/20",
> "27/01/20", "28/01/20", "29/01/20", "30/01/20",
>  "31/01/20", "01/02/20", "02/02/20", "03/02/20",
> "04/02/20", "05/02/20", "06/02/20", "07/02/20")
> isoDates = as.Date(oriDates, format = "%m/%d/%y")
> > isoDates
> 
>  [1] NA   NA   NA   NA   NA
> NA   NA
>  [8] NA   NA   "2020-01-02" "2020-02-02" "2020-03-02"
> "2020-04-02" "2020-05-02"
> [15] "2020-06-02" "2020-07-02"
> ```
> 
> How can I convert properly?

__
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 convert European short dates to ISO format?

2020-06-10 Thread Daniel Nordlund

On 6/10/2020 1:20 AM, Luigi Marongiu wrote:

isoDates = as.Date(oriDates, format = "%m/%d/%y")


You need to use the format for European short dates.

isoDates = as.Date(oriDates, format = "%d/%m/%y")


Hope this is helpful,

Dan

--
Daniel Nordlund
Port Townsend, WA  USA

__
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 convert European short dates to ISO format?

2020-06-10 Thread Ivan Krylov
On Wed, 10 Jun 2020 10:20:01 +0200
Luigi Marongiu  wrote:

> the function as.Dates interprets them as American ones (mm/dd/yy)

> isoDates = as.Date(oriDates, format = "%m/%d/%y")

> How can I convert properly?

Pass the correct format? (Swap m and d in the format string.)

-- 
Best regards,
Ivan

__
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 convert European short dates to ISO format?

2020-06-10 Thread Luigi Marongiu
Hello,
I have been trying to convert European short dates formatted as
dd/mm/yy into the ISO 8601 but the function as.Dates interprets them
as American ones (mm/dd/yy), thus I get:

```
oriDates = c("23/01/20", "24/01/20", "25/01/20", "26/01/20",
"27/01/20", "28/01/20", "29/01/20", "30/01/20",
 "31/01/20", "01/02/20", "02/02/20", "03/02/20",
"04/02/20", "05/02/20", "06/02/20", "07/02/20")
isoDates = as.Date(oriDates, format = "%m/%d/%y")
> isoDates
 [1] NA   NA   NA   NA   NA
NA   NA
 [8] NA   NA   "2020-01-02" "2020-02-02" "2020-03-02"
"2020-04-02" "2020-05-02"
[15] "2020-06-02" "2020-07-02"
```

How can I convert properly?
-- 
Best regards,
Luigi

__
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] almost logistic data evaluation

2020-06-10 Thread PIKAL Petr
Hi

External heating. Normally I would use TA instrumentation but for technical
reasons it is impossible. And other complicating factor is that temperature
rise is from beginning almost parabolic (it's derivation is straight line).

Therefore I started with double exponential fit, which is sometimes
satisfactory but sometimes gives nonsense result. After help from R
community I got in almost all cases reasonable fit. 

However I want to concentrate on just the reaction part and to find some
more simple way how to get slope for temperature rise and maybe other
parameters related to changes in experiments.

I was advised to look at "growth curve analysis" which I will try to, but I
wonder if due to twisted data is appropriate.

Thanks.
Petr

> -Original Message-
> From: R-help  On Behalf Of Stephen Ellison
> Sent: Tuesday, June 9, 2020 7:11 PM
> To: r-help@r-project.org
> Subject: Re: [R] almost logistic data evaluation
> 
> > Actually "y" is growing temperature, which, at some point, rise more
rapidly
> due to exothermic reaction.
> > This reaction starts and ends and proceed with some speed (hopefully
> different in each material).
> 
> Are you applying external heating or is it solely due to reaction
kinetics?
> 
> 
> Steve E
> 
> *
> **
> This email and any attachments are confidential. Any use...{{dropped:8}}
> 
> __
> 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.