[R-es] help

2021-08-26 Thread fabian mauricio espinosa pinto
estoy intentado descargar el archivo con la siguiente linea:
install_course_github("ifunam", "programacion-estadistica-r")
Pero cada vez que lo intento me sale lo siguiente:
Error in file(con, "wb") : cannot open the connection
In addition: Warning message:
In file(con, "wb") :
  cannot open file
'C:/Users/CCC/Documents/R/win-library/4.1/swirl/Courses/temp.zip': No such
file or directory

Qué debo hacer?

-- 
Cordial Saludo

-- 
AVISO: Los servicios del correo ecci.edu.co  son 
soportados tecnológicamente por © Google para toda la comunidad de la 
Universidad ECCI (Administrtivos, Docentes y Estudiantes), las opiniones 
que contenga este mensaje son exclusivas de su autor y no representan 
necesariamente la opinión de la Universidad ECCI. La Universidad ECCi no 
garantiza la utilización de un antivirus ya que se menciona los servicios 
son soportados © Google, si su antivirus detecta alguna anomalía por favor 
reportelo y elimine, la Universidad no se responsabiliza por los daños 
causados por cualquier virus transmitido en este correo electrónico.


La 
información contenida en este mensaje y en los archivos adjuntos es 
confidencial y reservada y está dirigida exclusivamente a su destinatario, 
sin la intención de que sea conocida por terceros, por lo tanto, de 
conformidad con las normas legales vigentes, su interceptación, 
sustracción, extravío, reproducción, lectura o uso esta prohibido a 
cualquier persona diferente. Se les exige expresamente a la comunidad ECCI 
(Administrtivos, Docentes y Estudiantes) que no realicen declaraciones 
difamatorias, no infrinjan ni autoricen ninguna infracción de las leyes de 
propiedad intelectual o cualquier otro derecho legal mediante 
comunicaciones por correo electrónico.La Universidad ECCI no garantizar 
guardar una copia de respaldo de los archivos, correos.


Si por error ha 
recibido este mensaje por favor discúlpenos, notifiquenoslo y elimínelo.

-- 
AVISO: Los servicios del correo ecci.edu.co  son 
soportados tecnológicamente por © Google para toda la comunidad de la 
Universidad ECCI (Administrtivos, Docentes y Estudiantes), las opiniones 
que contenga este mensaje son exclusivas de su autor y no representan 
necesariamente la opinión de la Universidad ECCI. La Universidad ECCi no 
garantiza la utilización de un antivirus ya que se menciona los servicios 
son soportados © Google, si su antivirus detecta alguna anomalía por favor 
reportelo y elimine, la Universidad no se responsabiliza por los daños 
causados por cualquier virus transmitido en este correo electrónico.


La 
información contenida en este mensaje y en los archivos adjuntos es 
confidencial y reservada y está dirigida exclusivamente a su destinatario, 
sin la intención de que sea conocida por terceros, por lo tanto, de 
conformidad con las normas legales vigentes, su interceptación, 
sustracción, extravío, reproducción, lectura o uso esta prohibido a 
cualquier persona diferente. Se les exige expresamente a la comunidad ECCI 
(Administrtivos, Docentes y Estudiantes) que no realicen declaraciones 
difamatorias, no infrinjan ni autoricen ninguna infracción de las leyes de 
propiedad intelectual o cualquier otro derecho legal mediante 
comunicaciones por correo electrónico.La Universidad ECCI no garantizar 
guardar una copia de respaldo de los archivos, correos.


Si por error ha 
recibido este mensaje por favor discúlpenos, notifiquenoslo y elimínelo.

[[alternative HTML version deleted]]

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


[R-es] alguien me ayuda con algo particular del wordclud

2017-07-02 Thread ALEX FABIAN Mellado
Hola Estimados R Amigos,
queria contarles que he aplicado una rutina para la creacion de un
wordcloud, el proceso super bien pero ahora estoy intentando buscar la
rutinas que me faltan, y esto es lo que deseo si me pueden ayudar.

ahora con el wordcloud quiisiera destacar en él algunas palabras
especificas que estoy buscando en los dicursos de unos niños con los que
trabajo en ciencias y conocer en que en frecuecia y/o porcentaje se
encuentran.

eso mis queridos amigos, espero puedan ayudarme,
Gracias

Alex
Biologo Marino, msc en Epidemiologia

---

[[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] WARNING: Method convertPointFromBase

2016-05-23 Thread Fabian Schalle
Hello,
I’ve noticed a Warning, while working with both the R console and a document 
window in R:
2016-05-23 22:16:17.507 R[2985:466607] *** WARNING: Method 
convertPointFromBase: in class NSView is deprecated on 10.7 and later. It 
should not be used in new applications. 

I have Version R 3.3.0 GUI 1.68 Mavericks build (7202) installed on my Macbook 
Pro running Mac OS X 10.11.5 (15F34).

Is this something to worry about? Can anyone help me out? 

I downloaded R from the official servers. 

Kind regards and thank you in advance  !
Fabian 
__
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] cambiar un valor por NA en data frame

2014-10-09 Thread ALEX FABIAN Mellado
ESTIMADA COMUNIDAD R,

Tengo un data frame de datos de salud sobre Enfermedades de Notificacion
Obligatoria. Algunas variables tienen una codificacion 99, 999, y  para
asiganr los valores perdidos. LAs variables que tienen esta codificacion
son la EDAD, COMUNA_RESIDENCIA y la REGION_RESIDENCIA, respectivamente.

Me gustaria poder editar esos valores a NA, sin tener que hacerlo uno por
uno con la opcion fix() ya que son muchos es una base datos muy grande.

Conoce alguno de esutedes amigos, alguna funcion para realizar dicha
edicion les agradeceria mucho, sus comentarios y ayudas.

Envio una extracto de la base de datos en .txt para mostrar el problemita
por por si alguno le sirviera mirarla se llama ENO2011

Un gran abrazo desde Chile

Alex Mellado V
Ms(c) en Epidemiología
Universidad Católica de Chile
SERVEDADSEXOCOMUNA_RESIDENCIA   REGION_RESIDENCIA   DIAG
FECHNOT
3   14  2   21012   A01012-01-2011
17  16  2   84178   A01011-04-2011
16  14  1   71027   A01012-05-2011
15  15  1   61106   A01024-05-2011
19  15  2   81108   A01029-06-2011
24  16  1   10108   10  A54917-01-2011
2   16  1   11011   A54924-02-2011
33  16  1   10209   10  A54903-03-2011
10  999 1   13117   13  A54923-02-2011
3   16  2   21012   A54918-02-2011
3   16  1   21012   A54906-04-2011
3   15  1   21012   A54918-04-2011
19  16  1   81108   A54919-05-2011
3   16  1   21012   A54924-05-2011
6   15  1   56035   A54905-06-2011
25  16  2   11101   11  A54910-06-2011
13  15  1   13105   13  A54905-04-2011
5   16  1   41024   A54916-06-2011
3   16  1   21012   A54923-06-2011
14  15  2   13110   13  A54907-04-2011
14  16  1   13110   13  A54905-04-2011
24  16  2   10101   10  A54928-06-2011
19  16  1   81108   A54915-07-2011
28  14  1   82038   A54921-07-2011
10  15  1   13117   13  A54923-06-2011
24  14  1   10101   10  A54909-08-2011
7   16  1   58015   A54905-08-2011
1   14  2   15101   15  A54918-08-2011
7   15  1   51075   A54926-08-2011
1   14  2   15101   15  A54907-09-2011
12  14  1   13122   13  A54904-08-2011
24  16  1   10101   10  A54922-08-2011
33  16  1   10209   10  A54903-03-2011
1   15  2   15101   15  A54914-11-2011
2   15  2   11011   A54911-11-2011
13  15  1   13402   13  A54907-10-2011
24  16  1   10101   10  A54922-11-2011
5   16  2   41024   A54901-12-2011
1   16  2   15101   15  A63004-01-2011
1   15  2   15101   15  A63007-01-2011
1   14  1   15101   15  A63021-01-2011
1   16  1   15101   15  A63021-04-2011
1   16  2   15101   15  A63007-06-2011
1   15  2   15101   15  A63008-07-2011
1   16  1   15101   15  A63019-07-2011
1   14  2   15101   15  A63005-08-2011
1   15  2   15101   15  A63029-08-2011
1   16  2   15101   15  A63024-10-2011
1   16  2   15101   15  A64X11-07-2011
1   15  2   15101   15  A64X20-09-2011
1   15  2   15101   15  A64X14-11-2011
1   16  2   15101   15  B15919-01-2011
1   16  1   15101   15  B15918-01-2011
1   16  1   15101   15  B15921-03-2011
12  15  1   13123   13  B15924-03-2011
1   14  1   15101   15  B15911-04-2011
1   14  1   15101   15  B15911-04-2011
1   16  2   15101   15  B15906-04-2011
1   16  2   15101   15  B15919-05-2011
16  15  1   73047   B15917-05-2011
12  14  1   13122   13  B15901-06-2011
13  14  2   13402   13  B15908-05-2011
1   16  1   15101   15  B15913-06-2011
21  16  1   91019   B15927-05-2011
1   14  2   15101   15  B15925-06-2011
13  16  2   13116   13  B15924-06-2011
1   16  1   15101   15  B15915-07-2011
20  16  2   83018   B15910-08-2011
20  14  2   83018   B15908-08-2011
1   15   

[R] [R-pkgs] New R package ``bvarsv''

2014-09-13 Thread Krueger, Fabian

Dear R users,

please let me draw your attention to my new R package bvarsv (on CRAN 
since August 28) which implements the Primiceri (Review of Economic 
Studies, 2005) vector autoregressive model. The model is popular in 
macroeconomic analysis as it allows to model instabilities (e.g. in the 
mean and volatility dynamics) that are often observed in macroeconomic 
time series like inflation.


The package provides functionality for Bayesian analysis of the 
Primiceri model. To the best of my knowledge, it is the only publicly 
available R code to do so. The underlying Markov Chain Monte Carlo 
algorithm is computationally challenging, since each iteration requires 
multiple calls of a recursive Kalman filter type algorithm. Therefore, 
bvarsv relies on C++ code ported to R via Rcpp and RcppArmadillo. The 
clear focus of the package is on forecasting, as opposed to structural 
analysis of economic relationships. The package allows to compute 
posterior predictive distributions, which can then be plotted and 
analyzed using forecast evaluation techniques. More detailed 
documentation and examples is available here:


https://sites.google.com/site/fk83research/code

Your feedback on any aspects of the package, as well as possible 
improvements or extensions, would be highly appreciated.


Thank you and best wishes,
Fabian Krüger

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

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


Re: [R] data.frame(1)*1:4 = 1?

2014-04-03 Thread fabian

This is because your vector is recycled:

data.frame(1)*1:4 = data.frame(1)*c(1,2,3,4)

only the first element is needed since the data frame has nothing else 
to multiply with c(2,3,4)



(x-data.frame(1:2, 3:4))
  X1.2 X3.4
113
224

(y-x*5:7)

y[1,1] = x[1,1] * 5
y[2,1] = x[2,1] * 6
y[1,2] = x[1,2] * 7
y[2,2] = x[2,2] * 5

since you have e vector with length 3, for the 4th entry in the 
data.frame the first element in the vector is recycled.


hope this helps



On 03-04-2014 08:42, Spencer Graves wrote:

Hello, All:


  What's the logic behind data.frame(1)*1:4 producing a scalar
1?  Or the following:


 data.frame(1:2, 3:4)*5:7
  X1.2 X3.4
15   21
2   12   20


  I stumbled over this, because I thought I was multiplying a
scalar times a vector, and obtaining a scalar rather than the
anticipated vector.  I learned that my scalar was in fact a
data.frame with one row and one column.


  What am I missing?


  Thanks,
  Spencer

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html

and provide commented, minimal, self-contained, reproducible code.


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


Re: [R] mcr mcreg: Why are BCa and quantile se values calculated, stored, then the stored values set to NA?

2014-03-17 Thread Fabian Model
This piece of code is indeed confusing. Generally quantile and BCa 
bootstrap do not estimate a global SE, so the glob.sigma slot you want to 
access is not really meaningful for those methods.
 
The result object of a BCa bootstrap as calculated by the mc.bootstrap 
function will contain a glob.sigma slot that is set to the analytical SE 
estimates of the complete data set for regression methods where analytical 
estimates of SE are available (LinReg, WLinReg, Deming). For the other 
regression methods (WDeming, PaBa) glob.sigma will already be NA. Since the 
analytical SE estimates are not relevant when you perform quantile or BCa 
bootstrap we decided at some point to always set them NA for these 
bootstrap methods - independent of regression method. The code copying the 
glob.sigma results is pointless and we'll remove it in the next release.
 
Now, if you want to calculate the mean or the sd of the individual 
bootstrap estimates, you can directly access the MCResultResampling and 
MCResultBCa objects. They store the estimates of regression coefficients 
for each bootstrap sample in slots B0 (intercept) and B1 (slope). Example:

library(mcr)
data(creatinine)
m - mcreg(as.matrix(creatinine), method.bootstrap.ci = quantile, na.rm = 
TRUE)
mean.slope.est- mean(m@B1)
sd.slope.est- sd(m@B1)
mean.intercept.est - mean(m@B0)
sd.intercept.est - sd(m@B1)
 
However, note that these estimates have no direct relationship to the BCa 
confidence intervals.
Best regards,
Fabian
 

On Tuesday, February 25, 2014 3:54:11 PM UTC+1, Peter Crowther wrote:

 In mcreg, there's the following snippet for bootstrap CI method of BCa 
 (and a very similar one for quantile): 

 else if (method.bootstrap.ci == BCa) { 
 bootB0 - mc.calc.bca(Xboot = B0, Xjack = B0jack, 
 xhat = glob.coef[1], alpha) 
 bootB1 - mc.calc.bca(Xboot = B1, Xjack = B1jack, 
 xhat = glob.coef[2], alpha) 
 bootB0$se - glob.sigma[1] 
 bootB1$se - glob.sigma[2] 
 bootB0$se - NA 
 bootB1$se - NA 
 } 
 [...] 
 mc.res - mc.make.CIframe(b0 = glob.coef[1], b1 = glob.coef[2], 
 se.b0 = bootB0$se, se.b1 = bootB1$se, CI.b0 = bootB0$CI, 
 CI.b1 = bootB1$CI) 

 I'd quite like to use in my code the SE values that were calculated in 
 mcreg.  Can any kind soul shed light on why they're calculated, 
 stored, then the stored values set to NA? 

 Thanks in advance for any insight! 

 - Peter 
 -- 
 Peter Crowther, Director, Melandra Limited 

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

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


Re: [R] function doesn't change the variable in the right way

2014-03-07 Thread fabian

Hello

The function does exactly what you tell it to do; first you substitute 
all NA with the mean; then you subtract the mean;  for the NA this 
meand: mean-mean=0; and this is what you get.


the problem is not the function but the z-score of means.

lg fabian

On 07-03-2014 12:17, David Croll wrote:

Dear R users and friends,


I would like to ask you about the weird behaviour of a function I just
wrote. This little function should take a vector, find NAs and
substitute them for the mean of the vector, and return the normalized
value of that vector.

I've tried both - and - for changing the variables.

That's what I do:

# just a vector:
b - c(1,1,1,NA,3,2)

# my function:
normalize - function(x) {

# copy x into new vector
xn - x

# index of NAs
nas - which(is.na(xn) ==TRUE)
m - mean(xn, na.rm=TRUE)

# insert mean for NAs
xn[nas] - m

# normalize
return((xn - mean(xn))/sd(xn))

}

# run...
normalize(b)

# here's what I get:
# [1] -0.75 -0.75 -0.75  0.00  1.75  0.50


The 4th value should be 1.6, but is 0.


I believe the answer to my problem is pretty obvious, but I can't see 
it...



Best regards,


David

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html

and provide commented, minimal, self-contained, reproducible code.


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


[R] Negative binomial distribution mixture model

2014-02-25 Thread Fabian Amman

Dear R community

I'm new to R and I'd like to ask for hints how to approach the following 
problem:


I have two vectors of count data 'observed_S' and 'observed_A'. Whereas 
'observed_S' follows a neg. binomial distribution but 'observed_A' is a 
mixture of an unknown variable 'A' (also from a neg. binomial 
distribution) and a shadow of 'observed_S', so to say.


Therefore my model can be expressed by: observed_A = factor*observed_S + A

I d like to find the factor explaining my two data vector most 
coherently. but I m overwhelmed by the different packages dealing with 
neg. binomial distribution regression. Can someone please point me which 
package is most useful for the above described purpose?


Thank you very much in advance

Regards
Fabian

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


Re: [R] Problem with metaMDS in vegan

2014-02-11 Thread Fabian B
Thank you very much!

This is exactly the problem, I am in. I ran the NMDS for only one gender and
it shows me the results, I was expecting. 

I was told to use bray-curtis, because there are a lot of 0s in my data
set and in e.g. manhattan these would have to much influence on the result.
But in nature, chemicals that are only weakly represented may not have very
much influence on the other individuals. For the moment, I won't question
that decision, because it's quite a convention in chemical ecology, as I
heard.

Regards, 

Fabian



--
View this message in context: 
http://r.789695.n4.nabble.com/Problem-with-metaMDS-in-vegan-tp4685022p4685134.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] Problem with metaMDS in vegan

2014-02-10 Thread Fabian B
Hello,

I am relatively new to vegan and need some help with metaMDS. My R is
Version 3.0.2. I am analysing cuticular profiles of flys from different
locations an different gender. My data is in a 48 x 70 matrix. It is about
percentages and so, there are a lot of 0s included. If I run metaMDS, it
just gives me: 

Warning message:
In metaMDS(data1, distance = bray, k = 2, trymax = 100, autotransform = F)
:
  Stress is (nearly) zero - you may have insufficient data

no matter, what I change. The error is always around 9.241406e-05, which
seems to be far to low for my data. By inspecting the data sheet, I clearly
see that there must be two clusters – but there are still some differences
in these (meaning: Not all female flies show the same pattern than the
others and there are slight differences in the locations …) - so I expect to
see two clusters for the sexes and in these, an accumulation of the
different locations. 
But metaMDS just gives me 2 points (with ordiplot), where the 24 males and
the 24 females are completely stacked. That's just some kind of worthless
for me.
So is there any chance to get some nice clusters? I tried to limit the
number of iterationswith maxit, but had to go down to 10 to reach a suitable
result. And I don't think, I may limit the number of iterations that much.
What could possibly be the problem?

It would be great if somebody could help me.

Thaks!

Fabian



--
View this message in context: 
http://r.789695.n4.nabble.com/Problem-with-metaMDS-in-vegan-tp4685022.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Problem with metaMDS in vegan

2014-02-10 Thread Fabian B
Thanks for the fast response!

My data is actually just the percentages of the substances found in the
cuticular layer of the flies. The quantitative and qualitative composition
of this layer differs in gender, locality and so on. 
My 70 „species“ are the chemical compounds we identified and my 48 „sites“
are the individuals (location and gender are encrypted in the individuals'
recognition code). Therefore, I have the percentages of one chemical
compound over all tested individuals in one row (as numeric data). You could
say that these are the abundances of the species (the compounds) at the
different sites (individuals). So my data is quite similar to community
structure. I have done this before and it worked just fine. I used:

metaMDS(data, distance=“bray“, k=2, trymax=1, autotransform=F)

As I mentioned before, this time the stress is very low (around 9.5 * 10^-5)
and R gives me that warning message. Though I have always had data in the
same structure, I've never been in this situation. The NMDS just stops after
the first run, because of the low stress. But there are obviously some
differences in my data – I can see them with my eye. If I discard the
'distance=”bray”', nothing changes.
May it be possible that these are simply just to little to be recognised
correctly? How could I change that?

If I add 'maxit=10', I get quite what I assumed. Two completely separated
clusters with cloudlike appearance (stress around 0.02). The clusters are
the two sexes and in each cluster, the localities group together. But I'm
not quite sure, if I may set a maxit-level that low – or if I just create
some false relations with that. 

I also recognised , that the stress gets lower, the higher I set 'maxit' and
the lower I set 'trymax'. 

What could be going wrong? I really have no clue … 

Thanks for your help!

Regards,

Fabian






--
View this message in context: 
http://r.789695.n4.nabble.com/Problem-with-metaMDS-in-vegan-tp4685022p4685043.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] comparison of bivariate normal distributions

2012-04-27 Thread Fabian Roger
Hello Petr and thanks for your help! Thanks also for the correction on the 
code, of cause it is better to use the real mean and covariance than those 
estimated by mean() and cov(). What I am after is that if I have the two 
two-dimensional probability density functions of the distribution of my 
parameters, these functions should have an intersect. And if I know the 
intersect I should be able to say that a certain volume under both functions 
is shared by both comparable to the surface shared by two one-dimensional 
normal distributions.  From there on I was hoping to be able to say something 
about how high the probability is that my samples come from two different 
populations (in the logic of a t-test).

Would this be possible or reasonable at all?

Thank again, I really appreciate your help!

best

Fabian

Would it be possible, too to
On 26 Apr 2012, at 10:56, Petr Savicky wrote:

On Wed, Apr 25, 2012 at 08:43:34PM +, Fabian Roger wrote:
sorry for cross-posting

Dear all,

I have tow (several) bivariate distributions with a known mean and 
variance-covariance structure (hence a known density function) that I would 
like to compare in order to get an intersect that tells me something about how 
different these distributions are (as t-statistics for univariate 
distributions).

In order to visualize what I mean hear a little code example:


library(mvtnorm)

c-data.frame(rnorm(1000,5,sd=1),rnorm(1000,6,sd=1))
c2-data.frame(rnorm(1000,10,sd=2),rnorm(1000,7,sd=1))

xx=seq(0,20,0.1)
yy=seq(0,20,0.1)
xmult=cbind(rep(yy,201),rep(xx,each=201))
dens=dmvnorm(xmult,mean(c),cov(c))
dmat=matrix(dens,ncol=length(yy),nrow=length(xx),byrow=F)

dens2=dmvnorm(xmult,mean(c2),cov(c2))
dmat2=matrix(dens2,ncol=length(yy),nrow=length(xx),byrow=F)
contour(xx,yy,dmat,lwd=2)
contour(xx,yy,dmat2,lwd=2,add=T)
##

Is their an easy way to do this (maybe with dmvnorm()?) and could I interpret 
the intersect (shared volume) in the sense of a t-statistic?

Hello:

I am not sure, what is exactly the question. The parameters
of a bivariate normal distribution are the covariance matrix and
the mean vector. For the distributions above, these are

 mean1 - c(5, 6)
 cov1 - diag(c(1, 1))

 mean2 - c(10, 7)
 cov2 - diag(c(2, 1)^2)

These parameters may be used in the code above instead of mean(c), cov(c)
and mean(c2), cov(c2).

The curves of equal density are ellipses, whose equations may be derived
from the mean vector mu and covariance matrix Sigma using the formula for
the exponent in the bivariate density of normal distribution. For any
fixed value of the density, the formula has the form

 (x - mu)' Sigma^(-1) (x - mu) = const

where (x - mu)' is the transpose of (x - mu), (x - mu) is a column
vector and const is some constant. The value of const may be derived
using the full formula for the bivariate density, which is at

 http://en.wikipedia.org/wiki/Multivariate_normal_distribution

In order to compute the area of this ellipse, we have to specify a required
density, more exactly a lower bound on the density. The area of an ellipse
is \pi a b, where a, b, are its axes. If we have two such ellipses, it is
possible to compute the area of their intersection, but again, for each
ellipse, a lower bound on the density is needed.

Is the area of the intersection of two ellipses for some specified lower
bounds on the density, what you want to compute?

Petr Savicky.

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

Fabian Roger, Ph.D. student
Dept of Biological and Environmental Sciences
University of Gothenburg
Box 461
SE-405 30 Göteborg
Sweden
Tel. +46 31 786 2933




[[alternative HTML version deleted]]

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


[R] comparison of bivariate normal distributions

2012-04-25 Thread Fabian Roger
sorry for cross-posting

Dear all,

I have tow (several) bivariate distributions with a known mean and 
variance-covariance structure (hence a known density function) that I would 
like to compare in order to get an intersect that tells me something about how 
different these distributions are (as t-statistics for univariate 
distributions).

In order to visualize what I mean hear a little code example:


library(mvtnorm)

c-data.frame(rnorm(1000,5,sd=1),rnorm(1000,6,sd=1))
c2-data.frame(rnorm(1000,10,sd=2),rnorm(1000,7,sd=1))

xx=seq(0,20,0.1)
yy=seq(0,20,0.1)
xmult=cbind(rep(yy,201),rep(xx,each=201))
dens=dmvnorm(xmult,mean(c),cov(c))
dmat=matrix(dens,ncol=length(yy),nrow=length(xx),byrow=F)

dens2=dmvnorm(xmult,mean(c2),cov(c2))
dmat2=matrix(dens2,ncol=length(yy),nrow=length(xx),byrow=F)
contour(xx,yy,dmat,lwd=2)
contour(xx,yy,dmat2,lwd=2,add=T)
##

Is their an easy way to do this (maybe with dmvnorm()?) and could I interpret 
the intersect (shared volume) in the sense of a t-statistic?

Thanks a lot for your help!

_
Fabian Roger, Ph.D. student
Dept of Biological and Environmental Sciences
University of Gothenburg
Box 461
SE-405 30 Göteborg
Sweden
Tel. +46 31 786 2933




[[alternative HTML version deleted]]

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


[R] compare bivariate normal distributions

2012-04-23 Thread Fabian Roger
Dear all, 

I have tow (several) bivariate distributions with a known mean and 
variance-covariance structure (hence a known density function) that I would 
like to compare in order to get an intersect that tells me something about how 
different these distributions are (as t-statistics for univariate 
distributions). 

In order to visualize what I mean hear a little code example:


library(mvtnorm)

c-data.frame(rnorm(1000,5,sd=1),rnorm(1000,6,sd=1))
c2-data.frame(rnorm(1000,10,sd=2),rnorm(1000,7,sd=1))

xx=seq(0,20,0.1)
yy=seq(0,20,0.1)
xmult=cbind(rep(yy,201),rep(xx,each=201))
dens=dmvnorm(xmult,mean(c),cov(c))
dmat=matrix(dens,ncol=length(yy),nrow=length(xx),byrow=F)

dens2=dmvnorm(xmult,mean(c2),cov(c2))
dmat2=matrix(dens2,ncol=length(yy),nrow=length(xx),byrow=F)
contour(xx,yy,dmat,lwd=2)
contour(xx,yy,dmat2,lwd=2,add=T)
## 

Is their an easy way to do this (maybe with dmvnorm()?) and could I interpret 
the intersect (shared volume) in the sense of a t-statistic? 

Thanks a lot for your help!

sincerely,

_
Fabian 
Fabian Roger, Ph.D. student
Dept of Biological and Environmental Sciences
University of Gothenburg
Box 461
SE-405 30 Göteborg
Sweden
Tel. +46 31 786 2933

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


[R] (no subject)

2011-05-12 Thread Fabian
#subject: type III sum of squares - anova() Anova() AnovaM()
#R-version: 2.12.2

#Hello everyone,

#I am currently evaluating experimental data of a  two factor 
experiment. to illustrate de my problem I will use following #dummy 
dataset: Factor T1 has 3 levels (A,B,C) and factor T2 has 2 
levels E and F. The design is #completly balanced, each factor 
combinations has 4 replicates.

#the dataset looks like this:

T1-(c(rep(c(A,B,C),each=8)))
T2-(c(rep(rep(c(E,F),each=4),3)))
RESPONSE-c(1,2,3,2,2,1,3,2,9,8,8,9,6,5,5,6,5,5,5,6,1,2,3,3)
  DF-as.data.frame(cbind(T1,T2,RESPONSE))
DF$RESPONSE-as.numeric(DF$RESPONSE)

  DF
T1 T2 RESPONSE
1   A  E1
2   A  E2
3   A  E3
4   A  E2
5   A  F2
6   A  F1
7   A  F3
8   A  F2
9   B  E7
10  B  E6
11  B  E6
12  B  E7
13  B  F5
14  B  F4
15  B  F4
16  B  F5
17  C  E4
18  C  E4
19  C  E4
20  C  E5
21  C  F1
22  C  F2
23  C  F3
24  C  F3

library(biology)
replications(RESPONSE ~ T1*T2,data=DF)
T1T2 T1:T2
 812 4
  is.balanced(RESPONSE ~ T1*T2,data=DF)
[1] TRUE


#Now I would like to know whether T1, T2 or T1*T2 have a significant 
effect on RESPONSE. As far as I know, the #theory says that I should use 
a type III sum of squares, but the theory also says that if the design 
is completely #balanced, there is no difference between type I,II or III 
sum of squares.

#so I first fit a linear model:

my.anov-lm(RESPONSE~T1+T2+T1:T2)

#then I do a normal Anova

  anova(my.anov)

Analysis of Variance Table

Response: RESPONSE
   Df Sum Sq Mean Sq F valuePr(F)
T1 2  103.0  51.500  97.579 2.183e-10 ***
T2 1   24.0  24.000  45.474 2.550e-06 ***
T1:T2  2   12.0   6.000  11.368  0.000642 ***
Residuals 189.5   0.528

#When I do the same with the Anova() function from the car package I 
get the same result

Anova(my.anov)

Anova Table (Type II tests)

Response: RESPONSE
   Sum Sq Df F valuePr(F)
T1 103.0  2  97.579 2.183e-10 ***
T2  24.0  1  45.474 2.550e-06 ***
T1:T2   12.0  2  11.368  0.000642 ***
Residuals9.5 18

#(type two sees to be the default and type=I produces an error (why?))

#yet, when I specify type=III it gives me something completely different:

Anova(my.anov,type=III)
Anova Table (Type III tests)

Response: RESPONSE
 Sum Sq Df F valuePr(F)
(Intercept)   16.0  1  30.316 3.148e-05 ***
T184.5  2  80.053 1.100e-09 ***
T2 0.0  1   0.000  1.00
T1:T2 12.0  2  11.368  0.000642 ***
Residuals  9.5 18

#an the AnovaM() function from the biology package does the same for 
type I and II and produces the following #result:

library(biology)
  AnovaM(my.anov,type=III)
 Df Sum Sq Mean Sq F value   Pr(F)
T1   2   84.5  42.250  80.053 1.10e-09 ***
T2   1   24.0  24.000  45.474 2.55e-06 ***
T1:T22   12.0   6.000  11.368 0.000642 ***
Residuals   189.5   0.528

#Is type 3 the Type I should use and why do the results differ if the 
design is balanced? I am really confused, it would #be great if someone 
could help me out!

#Thanks a lot for your help!

#/Fabian
#University of Gothenburg



















[[alternative HTML version deleted]]

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


[R] [R-pkgs] spikeSlabGAM

2011-04-28 Thread Fabian Scheipl
spikeSlabGAM_0.9-6 (initial public release)

spikeSlabGAM implements Bayesian variable selection, model choice,
and regularized estimation in  (geo-)additive mixed models for
Gaussian, binomial, and Poisson responses.

Its purpose is (1) to choose an appropriate subset of potential
covariates and their interactions, (2) to determine whether linear
or more flexible functional forms (P-splines, tensor product
splines) are required to model the (joint) effects of the respective
covariates, and (3) to fit these regularized effects and return
(model-averaged) estimates.

Selection and regularization of the model terms is based on a novel
spike-and-slab-type prior on coefficient groups associated with
parametric and semi-parametric effects. Inference is fully Bayesian
with an underlying MCMC sampler implemented in C and can take
advantage of multi-core processors via multicore or snow. The
package uses standard formula syntax so that complex models can be
specified very concisely. It features powerful and user friendly
visualizations using ggplot2.



--
Fabian Scheipl
Department of Statistics
Ludwig-Maximilians-University Munich
Ludwigstr. 33, room 239
80539 Munich
Germany
Phone: +49-89-2180-2284
http://www.statistik.lmu.de/~scheipl/

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

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


[R] lme:correlationstructure AR1 and random factor

2011-03-29 Thread yvonne fabian
Dear helpers,

I tried these models to run in the package nlme, but allways got the same
error message...

I have a correlation in 5 sessions within a field (n=12) with ten traps in
one field.

res2a - lme(response~x+y+z+treatment),correlation =
corARMA(form = ~ session|trapfield, p = 1, q = 0), random=~1|field,
na.action=na.omit, data=plates, method=ML)

res2a - lme(response~x+y+z+treatment,correlation =
corCAR1(form = ~ session|trapfield), random=~1|field, na.action=na.omit,
data=plates, method=ML)

 Error: Incompatible formulas for groups in random and correlation

What is the problem?
thanks a lot!
Yvonne

--
View this message in context: 
http://r.789695.n4.nabble.com/lme-correlationstructure-AR1-and-random-factor-tp3416248p3416248.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] binary data with correlation

2011-03-21 Thread yvonne fabian
Dear posters,
I have a question concerning binary data analysis. I have presence absence
data of 5 sampling sessions within 3 years, of 12 fields. Each field had 12
traps. I would like to analyse the data with a Generalized Estimating
Equations (GEE) Model in R. For the abundance data I used a gls with the
function: 
correlation = corARMA(form = ~ session|trapfield, p = 1, q = 0)

But now I want to use presence absence data…I know about the problem with
correlated -binary data- but maybe somebody already created a solution?
Something like that, which is not working….

rgee1 - geeglm(Alus01 ~ treatment + scale(LAI) + scale(log(Tot_Sp)) +
scale(AveH) , data = plates, family = binomial, waves = session, id =
trapfield, corstr = ar1)

Any help is appreciated a lot….
Thanks
Yvonne


--
View this message in context: 
http://r.789695.n4.nabble.com/binary-data-with-correlation-tp3393884p3393884.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] merge table rows (\multirow)

2010-07-26 Thread Fabian Scheipl
You can also automate it with this:

do.multirow-function(df, which=1:ncol(df)){
    for(c in which){
        runs - rle(as.character(df[,c]))
        if(all(runs$lengths1)){
            tmp - rep(, nrow(df))
            tmp[c(1, 1+head(cumsum(runs$lengths),-
1))] -
                    paste(\\multirow{,runs$lengths,}{*}{,df[c(1,
1+head(cumsum(runs$lengths),-1)),c],},sep=)
            df[,c] - tmp
        }
    }
    return(df)
}

This will replace the which-columns of data.frame df that have
only repeated entries  with the appropriate \multirow commands.

You then have to use print.xtable with sth like
print(xtable(do.multirow(df)),
        sanitize.text.function = function(x){
            return(x)
        }
)
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Modify the plotting parameters for Vennerable obj.

2010-07-13 Thread Fabian Grammes

Dear List,

I would like to modify the settings for plotting a Vennerable object,  
but I don't know how...so if anyone has an idea I would be really  
graetfull.


best, Fabian

some R code to illustrate my problem:

library(Vennerable)

ven - compute.Venn(Venn(SetNames=c(A, B), Weight=c(0,111,106, 26)))

# now my problem is that whenever I plot the object, the plot appears  
in box, and for cosmetic reasons I would like to get rid of that.

plot(ven)

sessionInfo()
R version 2.10.0 (2009-10-26)
i386-apple-darwin8.11.1

locale:
[1] C

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

other attached packages:
 [1] Vennerable_2.0 RColorBrewer_1.0-2 lattice_0.18-3  
RBGL_1.22.0
 [5] graph_1.24.0   ggplot2_0.8.5  digest_0.4.2
reshape_0.8.3

 [9] plyr_0.1.9 proto_0.3-8limma_3.2.1

loaded via a namespace (and not attached):
[1] tools_2.10.0



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


[R] selection of optim parameters

2010-07-05 Thread Fabian Gehring

Hi all,

I am trying to rebuild the results of a study using a different data 
set. I'm using about 450 observations. The code I've written seems to 
work well, but I have some troubles minimizing the negative of the 
LogLikelyhood function using 5 free parameters.


As starting values I am using the result of the paper I am rebuiling. 
The system.time of the calculation of the function is about 0.65 sec. 
Since the free parameters should be within some boundaries I am using 
the following command:


optim(fn=calculateLogLikelyhood, c(0.4, 2, 0.4, 8, 0.8), 
lower=c(0,0,0,0,0), upper=c(1, 5, Inf, Inf, 1), control=list(trace=1, 
maxit=1000))


Unfortunately the result doesn't seem to be reasonable. 3 of the 
optimized parameters are on the boundaries.


Unfortunately I don't have much experience using optimizatzion methods. 
That's why I am asking you.
Do you have any hints for me what should be taken into account when 
doing such an optimization.


Is there a good way to implement the boundaries into the code (instead 
of doing it while optimizing)? I've read about parscale in the 
help-section. Unfortunately I don't really know how to use it. And 
anyways, could this help? What other points/controls should be taken 
into account?


I know that this might be a bit little information about my current 
code. But I don't know what you need to give me some advise. Just let me 
know what you need to know.


Thankds

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


[R] Error when callin g C-Code

2010-06-15 Thread Fabian Zäpernick
Hi

when I call the function below in R, i get the error: Object 'pairlist'
can't be converted to 'double'.

#include R.h
#include Rdefines.h
#include Rmath.h

SEXP CSimPoisson(SEXP lambda, SEXP tgrid, SEXP T2M, SEXP Ni, SEXP NT)
{
double sign, EVar;
double *xlambda, *xtgrid, *xT2M, *xNi, *xNT, *xtau;
SEXP tau;
int ltgrid =0;
int i = 0;
int j = 0;
sign = 0;
EVar = 0;

ltgrid  = LENGTH(tgrid);
PROTECT(lambda = AS_NUMERIC(lambda));
PROTECT(tgrid = AS_NUMERIC(tgrid));
PROTECT(T2M = AS_NUMERIC(T2M));
PROTECT(Ni = AS_NUMERIC(Ni));
PROTECT(NT = AS_NUMERIC(NT));
PROTECT(tau = NEW_NUMERIC(1));
xlambda = NUMERIC_POINTER(lambda);
xtgrid = NUMERIC_POINTER(tgrid);
xT2M = NUMERIC_POINTER(T2M);
xNi = NUMERIC_POINTER(Ni);
xNT = NUMERIC_POINTER(NT);
xtau = NUMERIC_POINTER(tau);
GetRNGstate();
if(xlambda[0] != 0)
{
while(1)
{
EVar = rexp(xlambda[0]);
sign = sign + EVar;
if (sign  xT2M[0])
{
break;
}
xtau = Realloc(xtau, i+1, double);
xtau[i] = sign;
i = i+1;
for(j; j  ltgrid;j++)
{
if (xtgrid[j]  sign)
{
xNi[j] = xNT[0];
}
{
break;
}
}
xNT[0] = xNT[0] + 1;
}
for(j;j  ltgrid;j++)
{
xNi[j] = xNT[0];
}
}
PutRNGstate();
UNPROTECT(6);
return tau;
}

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


[R] Simulating a Poisson Process in R by calling C Code over .Call

2010-06-13 Thread Fabian Zäpernick
Hi

I want to write a C function for the R Code below and call it with .Call:

SimPoisson - function(lambda,tgrid,T2M)
#Simulation eines Poissonprozesses
{
NT - 0
Ni - rep(0,length(tgrid))
tau - 0
sign - 0
if(lambda != 0)
{
i=1
j=1
while (1)
{
EVar - rexp(1,lambda)
sign - sign + EVar
if (sign  T2M)
{
break
}
tau[i] - sign
i = i+1
for (j in j:length(tgrid))
{
if (tgrid[j]  sign)
{
Ni[j] - NT
}else
{
break
}
}
NT - NT + 1
}
for (j in j:length(tgrid))
{
Ni[j] - NT
}
}
return(list(NT=NT,Ni=Ni,tau=tau))
}

I read the manual writing R extensions over and over again, but i have
no idea, how to solve the problem with tau because i dont no the length
of tau at the begining of the function

Fabian

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


[R] Help with R graphics

2010-05-29 Thread Fabian
I need to make a plot illustrating main characterisitig of river 
drainage data. For this I have 2 questions:


how can I rotate a histogram -90° (or 270°) (like the horizontal=TRUE 
with plot)?


how can I use split.screen to produce 3 plot with uneuqal size (1/5, 
2/5, 2/5 of the screen width)?


thank you very much in advance for your help

fabian

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


[R] [R-pkgs] amer: generalized additive mixed models with lme4

2009-09-07 Thread Fabian Scheipl
Dear R-users,

I'd like to announce the release of the amer-package that adds the
capability to fit generalized additive mixed models to lme4.
It includes a vignette with real data examples and a brief summary of the
theory behind the implementation.

Best,
Fabian

[[alternative HTML version deleted]]

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

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


Re: [R] Function match.call or saving all initial parameters

2009-07-30 Thread Fabian Scheipl
This does what you want:

expand.call - function(definition = NULL, call = sys.call(sys.parent()),
expand.dots = TRUE)
# like match.call, but with all formal args instead of only the specified
ones
{
ans - as.list(match.call(definition, call, expand.dots))
frmls - formals(deparse(ans[[1]]))
add - which(!(names(frmls) %in% names(ans)))
return(as.call(c(ans, frmls[add])))
}

Best,
Fabian

[[alternative HTML version deleted]]

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


Re: [R] Function match.call or saving all initial parameters

2009-07-30 Thread Fabian Scheipl
it doesn't actually- this should work:

expand.call - function(call=sys.call(sys.parent(1)), expand.dots = TRUE)
# similar to match.call, but with all formal args not the specified ones
only
{
ans - as.list(call)
frmls - formals(deparse(ans[[1]]))
add - which(!(names(frmls) %in% names(ans)))
return(as.call(c(ans, frmls[add])))
}

On Thu, Jul 30, 2009 at 11:22 AM, Fabian Scheipl 
fabian.sche...@stat.uni-muenchen.de wrote:

 This does what you want:

 expand.call - function(definition = NULL, call = sys.call(sys.parent()),
 expand.dots = TRUE)
 # like match.call, but with all formal args instead of only the specified
 ones
 {
 ans - as.list(match.call(definition, call, expand.dots))
 frmls - formals(deparse(ans[[1]]))
 add - which(!(names(frmls) %in% names(ans)))
 return(as.call(c(ans, frmls[add])))
 }

 Best,
 Fabian


[[alternative HTML version deleted]]

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


[R] nlme weighted

2009-04-06 Thread Mollet, Fabian
Dear R-expert
 
I'm fitting a non linear model (energy allocation model to individual
growth data) using your nlme routine. For each individual I have thus a
number of observations (age and size) to which I fit the nonlinear
function, with random effects for the individuals on the estimated
parameters (individual as the grouping factor). The sampling of these
individuals was stratified (size stratified) and the observations are
thus not representative for the population. But as we know the true size
distributions over the strata, we can compute a statistical weight for
each individual, given by the frequency of the size at age of that
individual in the true population distribution. To obtain representative
estimates in the nlme, I would therefore preferably weight the fitting
by these statistical weights. In each group (which is the individual) a
different weighting factor would apply (I guess that the individual
estimation will not be much affected by these weights, but the
population mean). I don't quite see how to do this weighting by
nlme-group. 
 
I think what I need is something that multiplies these weights to the
residual variance. My first hint would be something as it is described
by the function varIdent or varFixed, but it is not quite clear to me
what is being done by these (e.g. what is meant by variance covariate
etc.?).
 
I thank you very much in advance if you could briefly comment on that
and point out the function for the weighting that should be applied.
 
All the best
 
Fabian Mollet 
 
 

[[alternative HTML version deleted]]

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


[R] Survival Regression with multiple records per subject

2008-04-30 Thread Fabian Hefner
Dear R users!

I reformulate the question with another example perhaps my question will be
more clearly now.
 
I have several subjects. One subject has multiple records. Only a starting
point exists the end point is vague.
Here is an example:
 
   itm  ID exercise  time
1.40186910 1
1.32439010 2
1.32439010 3
1.3810 4
1.34676110 5
1.31544111 6
1.33781220 1
1.31991520 2
1.35123521 3
itm is the covariate;
ID is the subject Id;
exercise indicates if the subject is dead=1 or alive=0
 
How can I allocate the multiple records to one subject (for example record
1-6 are part of subject with ID 1 record 7-9 are part of subject with ID2)
and process a survival regression.
 
the survRegData - survreg(formula=Surv(time,exercise)~itm, data=Data,
dist=weibull) command doesn't take into account that multiple records are
part of one subject.
 
Many thanks!
 
Fabian Hefner

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


[R] Survival Regression with multiple events per subject

2008-04-28 Thread Fabian Hefner
Dear R users!

I want to process a maximum likelihood estimation for a parametric
regression survival time model with multiple events per subject.

the STATA command for this survival regression is:

use survreg
stset failure(exercise), id(optionid)
local regressors itm posret negret
streg `regressors', distribution(weibull)

explanation:
stset declares data to be survival-time data;
exercise is the indicator variable, which shows if the subject is dead or
alive;
optionid is the multiple-record ID variable which means every subject has a
unique id and one subject can have multiple events. (see example below)

streg computes a maximum likelihood estimation for parametric regression
survival time models with multiple record data

now I search an equivalent command in R
I found the survival package but I have no solution for the use with
multiple records per subject.

library(survival)
survRegData - survreg(formula=Surv(time,exercise)~itm+posret+negret,
data=Data, dist=weibull)
summary(survRegData)

My Question is: how can I modify the above command for the use of multiple
events per subject when the optionid is used for indicating the subject?

The dataset look like:

data  | exercisedate | itm| posret  | negret | optionid| exercise | time
1996  | 1996 | 1.4518 | 0.05487 |-0.4485 |1|   0  |   1
1997  | 1997 | 2.4535 | 0.00385 |-0.2525 |1|   1  |   5
1998  | 1998 | 1.2523 | 0.04486 |-0.1482 |2|   1  |   8
1999  | 1999 | 3.4257 | 0.15287 |-0.8615 |3|   0  |   4
2000  | 2000 | 1.1457 | 0.07487 |-0.5485 |3|   1  |   5
2001  | 2001 | 2.4418 | 0.09553 |-0.3772 |3|   0  |   2


Thank you,

Fabian Hefner

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


[R] How do I use as.Date when day values are missing?

2008-02-24 Thread Anupa Fabian
I have a data frame which contains some valuable date information. But for a 
few of the dates, the day information missing .

Viz:
 interesting.data$date 
[1] 1/22/93 1/22/93 1/23/93 1/00/93 1/28/93 1/31/93 1/12/93

i.e. for dates where the day info is missing, the %d part of the %m/%d/%yy 
format is simply represented as 00.

When I apply as.Date to the date information, the dates which don't contain 
exact day information are converted to NA.

Viz:
 as.Date(interesting.data$date)
[1] 1993-01-22 1993-01-22 1993-01-23 NA 1993-01-28 1993-01-31 
1993-01-12

Is there a way of using the as.Date function when I only have partial dates (eg 
missing day information  which is represented as 00, as above) such
 that the date isn't represented as NA?

Thanks, 
Anupa







  

Never miss a thing.  Make Yahoo your home page. 

[[alternative HTML version deleted]]

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


[R] Storing Variables of different types

2007-09-15 Thread Garavito,Fabian

Hi there,

I have an ixjxk array where I want to store dates in the first column of
all sub-matrices (i.e. j=1 is a column with dates) and real numbers in
the rest of the columns...I have been trying many things, but I am
not getting anywhere. 

Thank you very much for your help,

Fabian


This message and any attachment are confidential and may be privileged or 
otherwise protected  from disclosure. If you are not the intended recipient, 
please telephone or email the sender and delete this message and any attachment 
from your system. If you are not the intended recipient you must not copy this 
message or attachment or disclose the contents to any other person. Nothing 
contained in the attached email shall be regarded as an offer to sell or as a 
solicitation of an offer to buy any  services, funds or products or an 
expression of any opinion or views of the firm or its employees. Nothing 
contained in the attached email shall be deemed to be an advise of, or 
recommendation by, the firm or its employees. No representation is made as to 
accuracy, completeness, reliability or appropriateness of the information 
contained in the attached email. 

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