Re: [R] Cumulative Incident Function does not go to end of dataset

2016-09-23 Thread Donald Catanzaro
Hi All,

I have been working on a Competing Risks analysis using the mstate package
and when I run my analysis I was surprised to see the cumulative incident
function ending substantially before my data set did.

You can reproduce the behavior (kind of) using the data that was provided
with mstate:

library(mstate)
data(aidssi)
ci <- Cuminc(time=aidssi$time, status=aidssi$status)


and you can see that ci goes to 10.448

However, when you use the cmprsk package, the CIF goes pretty much to the
end of the data


library(cmprsk)
CI.overall <- cuminc(ftime =aidssi$time, fstatus=aidssi$status)

and you can see that CI.overall ends at 12

Using the data provided in the package, a difference of < 2 years is not
terrible but with my dataset mstate ends at 1.02 while cmprsk ends at 4 (my
max for event time is 4.9) and that is a substantial difference.

 I believe I must be missing something here.  Is there a way to get mstate to
report the entire CIF ?

-- 
- Don

Donald Catanzaro PhD
dgcatanz...@gmail.com
16144 Sigmond Lane
Lowell, AR 72745
479-721-2533

[[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] Svyglm Error in Survey Package

2016-09-23 Thread Anthony Damico
hi could you make this a minimal reproducible example?

On Sep 24, 2016 12:03 PM, "Courtney Benjamin"  wrote:

> In attempting to use the svyglm call in the R Survey Package, I am
> receiving the error: Error in pwt[i] : invalid subscript type 'list'
>
> I have not been able to find a lot of information on how to resolve the
> error; one source advised it was related to how the subsetting command was
> executed.
>
> This was my initial attempt:
>
> mc1 <- 
> svyglm(F3ATTAINMENT~F1SES2QU+F1RGPP2,elsq1ch_brr,subset(elsq1ch_brr,BYSCTRL==1
> & G10COHRT==1),na.action)
> summary(mc1)
> This was my second approach trying to change up how I had subsetted the
> data:
> summary(mc1)
> samp1 <- subset(elsq1ch_brr,BYSCTRL==1 & G10COHRT==1)
> dim(samp1)
> mc1 <- svyglm(F3ATTAINMENT~F1SES2QU+F1RGPP2,elsq1ch_brr,subset=
> samp1,na.action)
> summary(mc1)?
>
> Both attempts resulted in the same error stated above.  Any advisement in
> how to resolve this error would be greatly appreciated.
> Sincerely,
> Courtney Benjamin
>
> ?
>
>
>
> Courtney Benjamin
>
> Broome-Tioga BOCES
>
> Automotive Technology II Teacher
>
> Located at Gault Toyota
>
> Doctoral Candidate-Educational Theory & Practice
>
> State University of New York at Binghamton
>
> cbenj...@btboces.org
>
> 607-763-8633
>
> [[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] Svyglm Error in Survey Package

2016-09-23 Thread Courtney Benjamin
In attempting to use the svyglm call in the R Survey Package, I am receiving 
the error: Error in pwt[i] : invalid subscript type 'list'

I have not been able to find a lot of information on how to resolve the error; 
one source advised it was related to how the subsetting command was executed.

This was my initial attempt:

mc1 <- 
svyglm(F3ATTAINMENT~F1SES2QU+F1RGPP2,elsq1ch_brr,subset(elsq1ch_brr,BYSCTRL==1 
& G10COHRT==1),na.action)
summary(mc1)
This was my second approach trying to change up how I had subsetted the data:
summary(mc1)
samp1 <- subset(elsq1ch_brr,BYSCTRL==1 & G10COHRT==1)
dim(samp1)
mc1 <- svyglm(F3ATTAINMENT~F1SES2QU+F1RGPP2,elsq1ch_brr,subset=samp1,na.action)
summary(mc1)?

Both attempts resulted in the same error stated above.  Any advisement in how 
to resolve this error would be greatly appreciated.
Sincerely,
Courtney Benjamin

?



Courtney Benjamin

Broome-Tioga BOCES

Automotive Technology II Teacher

Located at Gault Toyota

Doctoral Candidate-Educational Theory & Practice

State University of New York at Binghamton

cbenj...@btboces.org

607-763-8633

[[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 freezing issue when checking to see if variable belongs to two different vectors

2016-09-23 Thread Duncan Murdoch

On 23/09/2016 2:42 PM, Joel Stewart wrote:

I often find myself trying to get a quick assessment of how much of one vector 
is inside of another vector. I almost always try this with variables that are 
some sort of identifier, like a client id number or an SSN. I typically do this:

table( DF1$Identifier %in% DF2$Identifier)

This will return a count of True and False logical responses. However, 
sometimes when I try to do this my computer will freeze and I am unable to stop 
or escape the process, requiring me to shutdown R via the task manager. I was 
wondering if anybody else experiences this and, if so, why this might be 
happening.


No, I've never seen that.

If you ever find a reproducible example to trigger that, please post it 
to the bug list.  (This might be a little hard if you've never posted 
there before; due to abuse by spammers, we need to authorize each user 
manually.  But at least we only need to do that once per user.)


If you can't make this happen reproducibly, it probably won't get 
investigated.


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 freezing issue when checking to see if variable belongs to two different vectors

2016-09-23 Thread Bert Gunter
It might help if you specify your hardware, OS (presumably Windows?)
and version, and your R version. Also possibly how large your vectors
are and what other processes you have running.

Other than that, I have no clue, of course.

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 Fri, Sep 23, 2016 at 11:42 AM, Joel Stewart  wrote:
> I often find myself trying to get a quick assessment of how much of one 
> vector is inside of another vector. I almost always try this with variables 
> that are some sort of identifier, like a client id number or an SSN. I 
> typically do this:
>
> table( DF1$Identifier %in% DF2$Identifier)
>
> This will return a count of True and False logical responses. However, 
> sometimes when I try to do this my computer will freeze and I am unable to 
> stop or escape the process, requiring me to shutdown R via the task manager. 
> I was wondering if anybody else experiences this and, if so, why this might 
> be happening.
>
> Thanks in advance,
>
> Joel
>
>
> [[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] R freezing issue when checking to see if variable belongs to two different vectors

2016-09-23 Thread Joel Stewart
I often find myself trying to get a quick assessment of how much of one vector 
is inside of another vector. I almost always try this with variables that are 
some sort of identifier, like a client id number or an SSN. I typically do this:

table( DF1$Identifier %in% DF2$Identifier)

This will return a count of True and False logical responses. However, 
sometimes when I try to do this my computer will freeze and I am unable to stop 
or escape the process, requiring me to shutdown R via the task manager. I was 
wondering if anybody else experiences this and, if so, why this might be 
happening.

Thanks in advance,

Joel


[[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] Formación en bigdata

2016-09-23 Thread emoro
Hola Jesús

Yo te puedo hablar de dos programas en Madrid en los que participo.

1. El "Master in Big Data Analytics” de la UC3M (universidad) 
http://www.uc3m.es/ss/Satellite/Postgrado/en/Detalle/Estudio_C/1418713500746/1371208956904/Master_in_Big_Data_Analytics
 


2. El “Master en Data Science y Big Data” de la Escuela de Finanzas AFI 
http://www.afiescueladefinanzas.es/efa/comun/master-data-science-big-data.html 


En ambos se entra a fondo en la parte de data science y de 
almacenamiento/arquitectura. 

Un saludo


> El 23 sept 2016, a las 8:53, Jesús Para Fernández 
> > escribió:
> 
> Buenas,
> 
> �Alguien ha hecho algun curso sobre bigdata que merezca la pena? La verdad es 
> quequiero adquirir competencias sobre el manejo de grandes volumenes de 
> informaci�n, hadoop, spark, etc y no se muy bien que estudios cursar. He 
> estado mirando, pero veo que las escuelas de negocio lo orientan a big data + 
> business analytics y no se si pueden pasar muy por encim adel tema o estar 
> centrados en la venta de un determinado software comercial.
> 
> 
> �Alg�n consejo?
> 
> 
> Gracias
> 
> Jes�s
> 
>   [[alternative HTML version deleted]]
> 
> ___
> R-help-es mailing list
> R-help-es@r-project.org 
> https://stat.ethz.ch/mailman/listinfo/r-help-es

Esteban Moro Egido
Dept. Mathematics | Universidad Carlos III de Madrid 
Tel.: (+34) 916248727 · estebanmoro.org 


Esteban Moro Egido
Dept. Mathematics | Universidad Carlos III de Madrid 
Tel.: (+34) 916248727 · estebanmoro.org 

[[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] how to pass multiple pattern varibles to grep()

2016-09-23 Thread Bert Gunter
"The | symbol has a completely different meaning in R syntax than it
has in regular expression syntax."

Well, actually it doesn't -- loosely speaking, they both mean "or" (ok
-- interpreting concatenation as "or" is a bit of a stretch). Perhaps
to clarify your statement (stop here if none is needed!):

1) z|v  is an R expression that evaluates to the disjunction of the
values of objects z and v, which should be logical (and will be
coerced to logicals if needed and possible). That is, the result is
logical,

2) paste(z,v, sep = "|") evaluates to a character string which is the
concatenation of character string values of z and v with "|" in the
middle. regex needs character strings to define its patterns.

Clear?

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 Fri, Sep 23, 2016 at 9:34 AM, Jeff Newmiller
 wrote:
> The | symbol has a completely different meaning in R syntax than it has in
> regular expression syntax. R hands of pattern strings to the regex library
> without looking inside the strings any more than it has to. Likewise, the
> regex library has no clue about R syntax. Your attempt failed to create a
> character string for grep to give to the regex library. To do that read
> ?paste.
>
> grep( paste( z, v, sep = "|" ), a )
>
>
> On Thu, 22 Sep 2016, Fix Ace via R-help wrote:
>
>> Hello, there,
>> My patterns are defined by variables, for example:z="h"v="x"
>> I have a vector: a=c("th","mx","t")
>> I would like to find elements in vector a that contain either "h", or "x"
>> grep("h|x", a) apparently works. However, when I tried: grep(z|v,a), it
>> did not work. Can anyone help how to handle such situation?
>> Thanks.
>> Ace
>>On Wednesday, March 18, 2015 5:52 PM, Fix Ace 
>> wrote:
>>
>>
>> Thank you very much!
>> I do need to learn more about R!!
>>
>> On Tuesday, March 17, 2015 9:26 PM, William Dunlap 
>> wrote:
>>
>>
>> Fix Ace wroteWhat is the default "n"?
>> 512:   > length(density(rnorm(10^6))$x)   [1] 512   >
>> args(density.default)   function (x, bw = "nrd0", adjust = 1, kernel =
>> c("gaussian","epanechnikov", "rectangular", "triangular",
>> "biweight","cosine", "optcosine"), weights = NULL, window = kernel,
>> width, give.Rkern = FALSE, n = 512, from, to, cut = 3, na.rm = FALSE,
>> ...)   NULL   > ?density # or ?density.default, should also tell you about
>> its meaning
>>
>> Bill Dunlap
>> TIBCO Software
>> wdunlap tibco.com
>> On Tue, Mar 17, 2015 at 7:02 PM, Fix Ace  wrote:
>>
>> Thank you for the email.
>> What is the default "n"?
>> Thanks!
>>
>> On Tuesday, March 17, 2015 4:06 PM, William Dunlap 
>> wrote:
>>
>>
>> Increasing the value of 'n' given to density will give an estimate at more
>> points so it will look smoother.  Try n=2^18.
>> Bill Dunlap
>> TIBCO Software
>> wdunlap tibco.com
>> On Tue, Mar 17, 2015 at 12:06 PM, Fix Ace  wrote:
>>
>>
>>
>>  I have a dataset with 6187 elements, ranged from 3 to 104028. When I
>> tried to examine only small range of data, I found that the plot was not
>> smooth (as shown below):
>> plot(density(test$V2), xlim=c(0,1000))
>>
>>
>>  Is there away to make it smoother?
>> Thanks a lot!!
>>
>>
>>
>>
>>
>>
>>
>>
>>   __
>> 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.
>
>
> ---
> Jeff NewmillerThe .   .  Go Live...
> DCN:Basics: ##.#.   ##.#.  Live Go...
>   Live:   OO#.. Dead: OO#..  Playing
> Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
> /Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
> ---
>
> __
> 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, 

Re: [R] how to pass multiple pattern varibles to grep()

2016-09-23 Thread Jeff Newmiller
The | symbol has a completely different meaning in R syntax than it has in 
regular expression syntax. R hands of pattern strings to the regex library 
without looking inside the strings any more than it has to. Likewise, the 
regex library has no clue about R syntax. Your attempt failed to create a 
character string for grep to give to the regex library. To do that read 
?paste.


grep( paste( z, v, sep = "|" ), a )

On Thu, 22 Sep 2016, Fix Ace via R-help wrote:


Hello, there,
My patterns are defined by variables, for example:z="h"v="x"
I have a vector: 
a=c("th","mx","t")

I would like to find elements in vector a that contain either "h", or "x"
grep("h|x", a) apparently works. However, when I tried: grep(z|v,a), it did not 
work. Can anyone help how to handle such situation?
Thanks.
Ace 


   On Wednesday, March 18, 2015 5:52 PM, Fix Ace  wrote:


Thank you very much!
I do need to learn more about R!! 



On Tuesday, March 17, 2015 9:26 PM, William Dunlap  
wrote:


Fix Ace wrote    What is the default "n"?
512:   > length(density(rnorm(10^6))$x)   [1] 512   > args(density.default)   function (x, bw = "nrd0", adjust = 1, kernel = c("gaussian",     
   "epanechnikov", "rectangular", "triangular", "biweight",        "cosine", "optcosine"), weights = NULL, 
window = kernel,        width, give.Rkern = FALSE, n = 512, from, to, cut = 3, na.rm = FALSE,        ...)   NULL   > ?density # or ?density.default, should also tell 
you about its meaning

Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Tue, Mar 17, 2015 at 7:02 PM, Fix Ace  wrote:

Thank you for the email.
What is the default "n"?
Thanks! 



On Tuesday, March 17, 2015 4:06 PM, William Dunlap  
wrote:


Increasing the value of 'n' given to density will give an estimate at more 
points so it will look smoother.  Try n=2^18.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Tue, Mar 17, 2015 at 12:06 PM, Fix Ace  wrote:



 I have a dataset with 6187 elements, ranged from 3 to 104028. When I tried to 
examine only small range of data, I found that the plot was not smooth (as 
shown below):
plot(density(test$V2), xlim=c(0,1000))


 Is there away to make it smoother?
Thanks a lot!!

 


 



  
__

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.


---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
---
__
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] Replacing value with "1"

2016-09-23 Thread Jeff Newmiller
Another approach using in-place replacement and thinking with matrix 
operations instead of vector operations:


DF <- matrix( c( 0,  0, 1, 0, 0
   , NA, 0, 1, 1, 0
   , 0,  1, 0, 0, NA )
, byrow=TRUE
, nrow=3 )
DF2 <- DF
DF2[ , -1 ] <- ifelse(   !is.na( DF[ , -ncol( DF ) ] )
   & 1 == DF[ , -ncol( DF ) ]
 , 1
 , DF[ , -1 ]
 )

On Thu, 22 Sep 2016, Henrik Bengtsson wrote:


which(df == 1, arr.ind=TRUE) is useful here:


df <- matrix(c(0,NA,0,0,0,1,1,1,0,0,1,0,0,0,NA), nrow=3)
df

[,1] [,2] [,3] [,4] [,5]
[1,]00100
[2,]   NA0110
[3,]0100   NA


## Identify (row,col) indices for 1:s
idxs <- which(df == 1, arr.ind=TRUE)
idxs

row col
[1,]   3   2
[2,]   1   3
[3,]   2   3
[4,]   2   4


## Drop any in the last column
idxs <- idxs[idxs[,"col"] < ncol(df), , drop=FALSE]
idxs

row col
[1,]   3   2
[2,]   1   3
[3,]   2   3
[4,]   2   4


idxs[,"col"] <- idxs[,"col"] + 1L
idxs

row col
[1,]   3   3
[2,]   1   4
[3,]   2   4
[4,]   2   5


df[idxs] <- 1
df

[,1] [,2] [,3] [,4] [,5]
[1,]00110
[2,]   NA0111
[3,]0110   NA

/Henrik

On Thu, Sep 22, 2016 at 8:13 PM, Jim Lemon  wrote:

Hi Saba,
Try this:

df<-matrix(c(0,NA,0,0,0,1,1,1,0,0,1,0,0,0,NA),nrow=3)
dimdf<-dim(df)
df1<-df==1
df[cbind(rep(FALSE,dimdf[1]),df1[,-dimdf[2]])]<-1

Jim



On Fri, Sep 23, 2016 at 12:27 PM, Saba Sehrish via R-help
 wrote:

Hi

I have a matrix that contains 1565 rows and 132 columns. All the observations are either "0" or 
"1". Now I want to keep all the observations same but just one change, i.e. whenever there is "1", 
the very next value in the same row should become "1". Please see below as a sample:


df


 00100
NA0110
 0100NA

What I want is:


00110
   NA0111
0110NA



I shall be thankful for the reply.


Saba

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



---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k

__
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] Formación en bigdata

2016-09-23 Thread Carlos Ortega
Si estás por Madrid, hablan bien de este sitio:
http://www.devacademy.es/

Saludos,
Carlos Ortega
www.qualityexcellence.es

El 23 de septiembre de 2016, 14:53, Jesús Para Fernández <
j.para.fernan...@hotmail.com> escribió:

> Buenas,
>
> ¿Alguien ha hecho algun curso sobre bigdata que merezca la pena? La verdad
> es quequiero adquirir competencias sobre el manejo de grandes volumenes de
> información, hadoop, spark, etc y no se muy bien que estudios cursar. He
> estado mirando, pero veo que las escuelas de negocio lo orientan a big data
> + business analytics y no se si pueden pasar muy por encim adel tema o
> estar centrados en la venta de un determinado software comercial.
>
>
> ¿Algún consejo?
>
>
> Gracias
>
> Jesús
>
> [[alternative HTML version deleted]]
>
>
> ___
> R-help-es mailing list
> R-help-es@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es
>



-- 
Saludos,
Carlos Ortega
www.qualityexcellence.es

[[alternative HTML version deleted]]

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


Re: [R] R Help: System Identification for First order delay and dead time with TF model

2016-09-23 Thread Eduardo M. A. M. Mendes
Hi 

This is a continuous time system.  Are you willing to discretize the model?  

Regards 

Ed

Enviado do meu iPhone

> Em 23 de set de 2016, às 06:15, Yoshikazu Noguchi  
> escreveu:
> 
> Hello,
> 
> 
> 
> May I ask your help?
> 
> 
> 
> I would like to do System Identification using time series data which has
> transport delay. 
> 
> First of all, I would like to identify the following parameters (K, Tau, TD)
> for SISO case in the following Laplace domain equation: 
> 
> K, Tau, TD:   ymodel = (K/(Tau*s +1)) * exp(-TD*s) 
> 
> I have time series data, y (Process output) and U (process input). 
> 
> 
> 
> Object function: Min ( (y-ymodel)^2) 
> 
> 
> 
> I failed to find the right package in R for this issue? Could you please
> tell me which package I should use to solve this issue?
> 
> 
> 
> Thanks. 
> 
> 
> 
> Y. Noguchi
> 
> 
>[[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 construct a double-entry with variables from a dataset

2016-09-23 Thread ruipbarradas

Hello,

Is this what you mean?

dat <- data.frame(x = rnorm(100), A = factor(sample(3, 100, TRUE)), B  
= factor(sample(3, 100, TRUE)))

xtabs(~ A + B, dat)


Hope this helps,

Rui Barradas


Citando Andrea Marcela Huerfano Barbosa :


Hi everyone,
My name is Marcela, I am bachelor student of statistics.
I have a data frame with 59 variables and two of them are categorical  and
 have three levels each one,  I would like to construct a double -entry
table with this variables, I mean the categorical ones.

Any help will be really thankful

Thanks for reading
Andrea Marcela
--

[[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 construct a double-entry with variables from a dataset

2016-09-23 Thread Michael Dewey

Dear Marcela

Can you clarify what you mean by a double entry table?

On 23/09/2016 15:07, Andrea Marcela Huerfano Barbosa wrote:

Hi everyone,
My name is Marcela, I am bachelor student of statistics.
I have a data frame with 59 variables and two of them are categorical  and
 have three levels each one,  I would like to construct a double -entry
table with this variables, I mean the categorical ones.

Any help will be really thankful

Thanks for reading
Andrea Marcela
--

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



--
Michael
http://www.dewey.myzen.co.uk/home.html

__
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 pass multiple pattern varibles to grep()

2016-09-23 Thread Fix Ace via R-help
Hello, there,
My patterns are defined by variables, for example:z="h"v="x"
I have a vector: 
a=c("th","mx","t")
I would like to find elements in vector a that contain either "h", or "x"
grep("h|x", a) apparently works. However, when I tried: grep(z|v,a), it did not 
work. Can anyone help how to handle such situation?
Thanks.
Ace 

On Wednesday, March 18, 2015 5:52 PM, Fix Ace  wrote:
 

 Thank you very much!
I do need to learn more about R!! 


 On Tuesday, March 17, 2015 9:26 PM, William Dunlap  
wrote:
   

 Fix Ace wrote    What is the default "n"?
512:   > length(density(rnorm(10^6))$x)   [1] 512   > args(density.default)   
function (x, bw = "nrd0", adjust = 1, kernel = c("gaussian",        
"epanechnikov", "rectangular", "triangular", "biweight",        "cosine", 
"optcosine"), weights = NULL, window = kernel,        width, give.Rkern = 
FALSE, n = 512, from, to, cut = 3, na.rm = FALSE,        ...)   NULL   > 
?density # or ?density.default, should also tell you about its meaning

Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Tue, Mar 17, 2015 at 7:02 PM, Fix Ace  wrote:

Thank you for the email.
What is the default "n"?
Thanks! 


 On Tuesday, March 17, 2015 4:06 PM, William Dunlap  
wrote:
   

 Increasing the value of 'n' given to density will give an estimate at more 
points so it will look smoother.  Try n=2^18.
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Tue, Mar 17, 2015 at 12:06 PM, Fix Ace  wrote:



 I have a dataset with 6187 elements, ranged from 3 to 104028. When I tried to 
examine only small range of data, I found that the plot was not smooth (as 
shown below):
plot(density(test$V2), xlim=c(0,1000))


 Is there away to make it smoother?
Thanks a lot!!

 


 



  
__
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] MLE Estimation in Extreme Value Approach to VaR (using Frechet distribution)

2016-09-23 Thread Preetam Pal
Hi R-Users,

I am trying to estimate 95%-le VaR (Value-at-Risk) of a portfolio using
Extreme Value Theory. In particular, I'll use the Frechet distribution
(heavy left tail),

I have data on percentage returns ( R_t) for T = 5000 past dates. This data
has been divided into g = 50 non-overlapping periods of size n = 100 each
and we compute the minimum return r_i over each period (i = 1,2,3,,50)

Firstly, I need to estimate, by maximum likelihood approach, the 3 unknown
parameters:  a (scale), b (shift) and alpha = -1/k (tail index)
 Interpretation: *(r_i - b)/a*  converges to the *Frechet distribution*,
which is given by: *F*(x) = 1 - exp[ -( 1+kx )^(1/k) ]*


 The likelihood (to be maximized wrt a,b and k ) is given by: L = f(r_1) *
f(r_2) *..*f(r_g),
 where *f(r_i)  =  (1/a) * [ 1 + k*m_i ]^(-1+ 1/k) * exp[- ( 1 +
k*m_i)^(1/k) ]*  i = 1,2,3,.g
 Here, as a short-hand, I have used m_i = (r_i - b)/a

My question is: this ML-estimation by differentiating L is going to be
extremely messy and the data may be poorly-conditioned (eg, the returns
data may be positive, negative and of very small magnitude [~ 10^(-5) to
10^(-3) ].)
Wanted your help in performing this estimation process efficiently.

As a wrap, the 95%-le VaR would finally come to *VaR = b - (a/k) * [ 1 -
{-n*log(0.95)}^k ]*, but of course, I need to plug in the estimated a,b and
k values here.

Any help will be sincerely appreciated.
(For details, you can use Section 7.5.2 & 7.6 of '*Analysis of Financial
Time Series*' by Ruey S.Tsay -2nd edition)


- -
Preetam Pal
(+91)-9432212774
M-Stat 2nd Year, Room No. N-114
Statistics Division,   C.V.Raman
Hall
Indian Statistical Institute, B.H.O.S.
Kolkata.

[[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] Problem Mixstock in R

2016-09-23 Thread FIORAVANTI TATIANA
I know that currently the Mixstock package is not available on CRAN, I have 
downloaded the Mixstock v.0.9.5.1 from CRAN's archive, but this version is not 
supported by R v.3.3.1, for this reason I have used an older version of R (v. 
2.14). I have followed, without any problems, all the passages described in 
"Mixed stock analysis in R: getting started with the mixstock package" (2012), 
and I performed my mixed stock analysis used the MCMC. At the end of the 
analysis I would get all the statistical results (mean, standard deviation, 
median, 2.5 and 97.5 percentile, etc). I have read on the manual of the package 
mixstock v.0.9.5.1 that the mysum() function could be useful to calculate 
summary statistics of one or more columns of MCMC output, but I am not able to 
set it correctly because I do not understand which are the arguments of the 
functions ("x" and "names"). I tried with: mysum(mydata.mcmc, myvec = NULL) 
where "mydata.mcmc" is the result of the mixed stock analysis with MCMC and 
"myvec" is a vector that contain all the column names but I obtained only an 
error message. Following your instructions I wrote to the maintener of the 
package and I hope for an answer, but if someone could help me it would be 
great.


Thank you so much

Tatiana



Da: R-help  per conto di Nordlund, Dan (DSHS/RDA) 

Inviato: mercoled� 21 settembre 2016 22.33
A: r-help@r-project.org
Oggetto: Re: [R] Problem Mixstock in R

Googling "mixstock CRAN" I found the following:

Package 'mixstock' was removed from the CRAN repository.
Formerly available versions can be obtained from the archive.
Archived on 2014-08-30 as long-term memory-access errors were not corrected.


You might want to contact the maintainer of the package directly with your 
questions.

Dan

Daniel Nordlund, PhD
Research and Data Analysis Division
Services & Enterprise Support Administration
Washington State Department of Social and Health Services


> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Marc
> Girondot via R-help
> Sent: Wednesday, September 21, 2016 12:18 PM
> To: r-help@r-project.org; t.fiorava...@pm.univpm.it
> Subject: Re: [R] Problem Mixstock in R
>
> Le 19/09/2016 � 10:53, FIORAVANTI TATIANA a �crit :
> > Dear members of the R-project
> >
> > I am doing a mixed stock analysis with the Mixstock Package in R, at
> > the end of the analysis I would summarize all my results (mean,
> > standard deviation, median, percentile, etc...) using the mysum(x,
> > name=NULL) function, but I don't understand which is the correct
> > manner to set up it, what "x" and "name"are? ..Can you help me? Thank
> > you very much,
> >
> > Tatiana
> >
> Dear Tatiana,
>
> First: I don't find the Mixstock package in CRAN. You should indicate how to
> install it.
> Second: I don't find anywhere a function mysum(). Is it part of the Mixstock
> package?
> Third: Send a reproducible exemple to show what you tried to use the
> function.
>
> Finaly you should read the posting guide in this list to have more chance to
> have answers.
>
> 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.

__
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] How to construct a double-entry with variables from a dataset

2016-09-23 Thread Andrea Marcela Huerfano Barbosa
Hi everyone,
My name is Marcela, I am bachelor student of statistics.
I have a data frame with 59 variables and two of them are categorical  and
 have three levels each one,  I would like to construct a double -entry
table with this variables, I mean the categorical ones.

Any help will be really thankful

Thanks for reading
Andrea Marcela
--

[[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 Help: System Identification for First order delay and dead time with TF model

2016-09-23 Thread Yoshikazu Noguchi
Hello,

 

May I ask your help?

 

I would like to do System Identification using time series data which has
transport delay. 

First of all, I would like to identify the following parameters (K, Tau, TD)
for SISO case in the following Laplace domain equation: 

K, Tau, TD:   ymodel = (K/(Tau*s +1)) * exp(-TD*s) 

I have time series data, y (Process output) and U (process input). 

 

Object function: Min ( (y-ymodel)^2) 

 

I failed to find the right package in R for this issue? Could you please
tell me which package I should use to solve this issue?

 

Thanks. 

 

Y. Noguchi


[[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] distribuciones multimodales

2016-09-23 Thread Julio Alejandro Di Rienzo
Mclust

Dr. Julio Di Rienzo
Estadística y Biometría
FCA- U.N. Córdoba
http://sites.google.com/site/juliodirienzo


El 22 de septiembre de 2016, 13:01, Carlos Fernández-Delgado <
ba1fe...@uco.es> escribió:

> Estimados amigos, ¿hay algún paquete que me ayude a diferenciar las
> distribuciones (normales) existentes en una variable multimodal como la que
> os envío en archivo adjunto?. Esta distribución se trata de diámetro de
> óvulos intraováricos de un pez. Me gustaría extraer cada una de las
> distribuciones que la distribución global muestra.
> Muchas gracias
> Carlos
> **
> Dr. Carlos Fernández-Delgado
> Grupo de Investigación "Aphanius"
> Departamento de Zoología
> Edificio Charles Darwin 3ª pta.
> Campus Universitario de Rabanales
> Universidad de Córdoba
> 14071 Córdoba (Spain)
> Tlfno./Fax: +34 957 218 605
> Móvil: 616486912
> correo-e: carlos.fdelg...@uco.es
> http://www.uco.es/aphanius
> *
> Libro sobre los peces del Guadalquivir:
> 1.- Alta resolución, sigue este enlace:
> http://www.uco.es/aphanius/includes/descarga.php?id=16
> 2.- Baja resolución, sigue este otro:
> http://www.sibic.org/ictio-blog/Entradas/2014/7/20_Nuevo_
> libro_sobre_los_peces_dulceacuicolas_del_rio_Guadalviquir.html
>
>
>
> ___
> 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


[R] R_LIBS_SITE in Renviron ignored (?)

2016-09-23 Thread Sebastian Schubert
Hi all,

I am on CentOS 7.2 (Linux x86_64) with R from EPEL.

Maybe I get the documentation wrong but it seems, the variable
R_LIBS_SITE in Renviron is ignored while, for example, R_LIBS_USER is
not.

What R tells me:

R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
...
Platform: x86_64-redhat-linux-gnu (64-bit)
...
> .libPaths()
[1] "/usr/lib64/R/library" "/usr/share/R/library"
> .Library
[1] "/usr/lib64/R/library"
> .Library.site
[1] "/usr/lib64/R/library" "/usr/share/R/library"
> R.home(component = "home")
[1] "/usr/lib64/R"

However, the respective Renviron includes the following:
# grep R_LIBS_SITE /usr/lib64/R/etc/Renviron
R_LIBS_SITE=${R_LIBS_SITE-'/usr/local/lib/R/site-library:/usr/local/lib/R/library:/usr/lib64/R/library:/usr/share/R/library'}

Apparently, this setting is not applied when I start R. However,
changes for example in R_LIBS_USER in the same file are applied, thus
the file must be read...

I don't see where R_LIBS_SITE could be overwritten elsewhere. I get
the same behaviour in R when I start it with

R --no-environ --no-site-file --no-init-file

Any idea?

Thanks a lot,
Sebastian

__
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] Replacing value with "1"

2016-09-23 Thread Henrik Bengtsson
which(df == 1, arr.ind=TRUE) is useful here:

> df <- matrix(c(0,NA,0,0,0,1,1,1,0,0,1,0,0,0,NA), nrow=3)
> df
 [,1] [,2] [,3] [,4] [,5]
[1,]00100
[2,]   NA0110
[3,]0100   NA

> ## Identify (row,col) indices for 1:s
> idxs <- which(df == 1, arr.ind=TRUE)
> idxs
 row col
[1,]   3   2
[2,]   1   3
[3,]   2   3
[4,]   2   4

> ## Drop any in the last column
> idxs <- idxs[idxs[,"col"] < ncol(df), , drop=FALSE]
> idxs
 row col
[1,]   3   2
[2,]   1   3
[3,]   2   3
[4,]   2   4

> idxs[,"col"] <- idxs[,"col"] + 1L
> idxs
 row col
[1,]   3   3
[2,]   1   4
[3,]   2   4
[4,]   2   5

> df[idxs] <- 1
> df
 [,1] [,2] [,3] [,4] [,5]
[1,]00110
[2,]   NA0111
[3,]0110   NA

/Henrik

On Thu, Sep 22, 2016 at 8:13 PM, Jim Lemon  wrote:
> Hi Saba,
> Try this:
>
> df<-matrix(c(0,NA,0,0,0,1,1,1,0,0,1,0,0,0,NA),nrow=3)
> dimdf<-dim(df)
> df1<-df==1
> df[cbind(rep(FALSE,dimdf[1]),df1[,-dimdf[2]])]<-1
>
> Jim
>
>
>
> On Fri, Sep 23, 2016 at 12:27 PM, Saba Sehrish via R-help
>  wrote:
>> Hi
>>
>> I have a matrix that contains 1565 rows and 132 columns. All the 
>> observations are either "0" or "1". Now I want to keep all the observations 
>> same but just one change, i.e. whenever there is "1", the very next value in 
>> the same row should become "1". Please see below as a sample:
>>
>>>df
>>
>>  00100
>> NA0110
>>  0100NA
>>
>> What I want is:
>>
>>
>> 00110
>>NA0111
>> 0110NA
>>
>>
>>
>> I shall be thankful for the reply.
>>
>>
>> Saba
>>
>> __
>> 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@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.