[R] MICE data analysis with glmulti

2018-01-30 Thread Andras Farkas via R-help
Dear All, wonder if you have some thoughts on running the with() function (and perhaps including the pool() function to get the results?) in glmulti? In other words, how to run glmulti with a data set that is produced by mice()? publicly available code: data <- airquality data[4:10,3] <- rep(N

Re: [R] Calculating angle of a polyline

2018-01-30 Thread Eric Berger
nice On Tue, Jan 30, 2018 at 7:05 PM, William Dunlap wrote: > I like to use complex numbers for 2-dimensional geometry. E.g., > > > polyAngles2 > function (xV, yV) > { > stopifnot((length(xV) == length(yV)) && (length(xV) >= 3)) > z <- complex(re = xV, im = yV) > c(NA, diff(Arg(diff

Re: [R] Calculating angle of a polyline

2018-01-30 Thread William Dunlap via R-help
I like to use complex numbers for 2-dimensional geometry. E.g., > polyAngles2 function (xV, yV) { stopifnot((length(xV) == length(yV)) && (length(xV) >= 3)) z <- complex(re = xV, im = yV) c(NA, diff(Arg(diff(z))), NA) # radians, positive is counter-clockwise } > x <- c(0:3) > y <- c(0

Re: [R] Could the Odds represent weight in Generalized Linear Model?

2018-01-30 Thread Thierry Onkelinx
Dear Lenny, You can do this by using Age as an offset factor. dataset$wAge <- dataset$Age * 1.02 glm(cbind(Yes,No) ~ offset(wAge) + Times + Type, family=binomial, data = dataset) Best regards, ir. Thierry Onkelinx Statisticus / Statistician Vlaamse Overheid / Government of Flanders INSTITUU

Re: [R] variable names in lm formula ~.

2018-01-30 Thread Bert Gunter
Well... ?terms.formula says: "data: a data frame from which the meaning of the special symbol . can be inferred. It is unused if there is no . in the formula." So this seems to me to be an obscure bug, as I have found no warning against this admittedly confusing but still, I think, legal syntax.

Re: [R] Calculating angle of a polyline

2018-01-30 Thread Eric Berger
Assuming your polyline is defined by two vectors, one for the x coordinates, one for the y coordinates, you can try the following library(NISTunits) polyangles <- function(xV,yV) { stopifnot( (length(xV)==length(yV)) && (length(xV) >= 3)) v <- function(i) { c( xV[i]-xV[i-1], yV[i]-yV[i-1])}

Re: [R] Could the Odds represent weight in Generalized Linear Model?

2018-01-30 Thread contact retour-client
Dear Thierry, Thanks a lot for this answer, I mean i want to obtain such model *Behavior1 = β0+β1*Age* , the purpose is to obtain *β1*. I want to be sure that the odds value could be the β1. Or how to calculate it ? Thanks again for your precious help. Lenny

Re: [R] Calculating angle of a polyline

2018-01-30 Thread Jeff Newmiller
A polyline by definition has many angles, so your question is ill-formed. And this is a question about math, not R, so is off topic here. I suggest reading Wikipedia. -- Sent from my phone. Please excuse my brevity. On January 29, 2018 11:10:02 PM PST, javad bayat wrote: >Dear R users >I am tr

Re: [R] variable names in lm formula ~.

2018-01-30 Thread Jeff Newmiller
Functions are first class objects, so some kind of collision is bound to happen if you do this... so don't. -- Sent from my phone. Please excuse my brevity. On January 30, 2018 3:11:56 AM PST, "Vito M. R. Muggeo" wrote: >dear all, >Is the following intentional? Am I missing anything in docume

[R] Calculating angle of a polyline

2018-01-30 Thread javad bayat
Dear R users I am trying to find a formula to calculate the angle of a polyline. Is there a way to do this? Many thanks. -- Best Regards Javad Bayat M.Sc. Environment Engineering Alternative Mail: bayat...@yahoo.com [[alternative HTML version deleted]] __

[R] Could the Odds represent weight in Generalized Linear Model?

2018-01-30 Thread contact retour-client
Hello all, I'm sorry if my question seems basic. Im studying a responses (Yes,No) in a survey and, thanks to GLM I obtain the following relation with my variables : (Yes,No)~ β0 + Age We note this this certain type of (Yes,No) response is linked to age (p<0.05 in glm) . After that we calculated

Re: [R] Simulation based on runif to get mean

2018-01-30 Thread ruipbarradas
Hello, Right. Missed that one. Rui Barradas Enviado a partir do meu smartphone Samsung Galaxy. Mensagem original De: Eric Berger Data: 30/01/2018 10:12 (GMT+00:00) Para: Rui Barradas Cc: Daniel Nordlund , smart hendsome , r-help@r-project.org Assunto: Re: [R] Simulation ba

[R] variable names in lm formula ~.

2018-01-30 Thread Vito M. R. Muggeo
dear all, Is the following intentional? Am I missing anything in documentation? d<-data.frame(y=rnorm(10,5,.5),exp=rnorm(10), age=rnorm(10)) formula(lm(exp(y)~exp+age, data=d)) #--> exp(y) ~ exp + age formula(lm(exp(y)~., data=d)) #--> exp(y) ~ age variable 'exp' (maybe indicating "experience")

Re: [R] Simulation based on runif to get mean

2018-01-30 Thread Eric Berger
Or a shorter version of Rui's approach: set.seed(2511)# Make the results reproducible fun <- function(n){ f <- function(){ c(mean(runif(5,1,10)),mean(runif(5,10,20))) } replicate(n, f()) } fun(10) On Tue, Jan 30, 2018 at 12:03 PM, Rui Barradas wrote: > Hello, > > Another way would

Re: [R] Simulation based on runif to get mean

2018-01-30 Thread Rui Barradas
Hello, Another way would be to use ?replicate and ?colMeans. set.seed(2511)# Make the results reproducible fun <- function(n){ f <- function(){ a <- runif(5, 1, 10) b <- runif(5, 10, 20) colMeans(cbind(a, b)) } replicate(n, f()) } fun(10) Hope this hel

Re: [R] Simulation based on runif to get mean

2018-01-30 Thread Daniel Nordlund
On 1/29/2018 9:03 PM, smart hendsome via R-help wrote: Hello everyone, I have a question regarding simulating based on runif.  Let say I have generated matrix A and B based on runif. Then I find mean for each matrix A and matrix B.  I want this process to be done let say 10 times. Anyone can he