Re: [R] R enquiry: Replace blank spaces with a character value

2006-09-18 Thread Marco Geraci
Dear Bob, It's not clear to me what you want to do. You provided my example, which I already know, and you didn't provide yours. Marco --- Bob Green [EMAIL PROTECTED] wrote: Marco, I saw your January e-mail to an enquiry about filling in missing values with a zero I tried adapting the

Re: [R] how to pick a value from AR equation

2006-05-26 Thread Marco Geraci
]- (???) # see before omega[i,7]- (???)} # see before Finally, if 'y' is a prespecified matrix I suggest you to take a look at ?rowMeans, ?rowSums, and ?apply in order to execute 'mean' or 'sd' or any other function applied to 'y[i,]' at once instead of N times Hope this helps, Marco Geraci

Re: [R] hist function: freq=FALSE for standardised histograms

2006-04-05 Thread Marco Geraci
Hi, how did you evaluate the total area? Here is a simple example ### set.seed(100) x - rnorm(100) x.h - hist(x, freq=F, plot=F) x.h $breaks [1] -2.5 -2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0 2.5 3.0 $counts [1] 3 4 9 14 22 20 13 7 5 2 1 $intensities [1] 0.0599 0.0800

Re: [R] EM algorithm

2006-04-04 Thread Marco Geraci
Hi Michela, I'd like to add to Ted's message that the statistical journals represent a good 'source' for R to look at. Sometimes the authors of the papers need to implement their own algorithms and they make them available upon request. You might want to check the literature and send some emails

[R] loglikelihood and lmer

2006-03-31 Thread Marco Geraci
Dear R users, I am estimating Poisson mixed models using glmmPQL (MASS) and lmer (lme4). We know that glmmPQL do not provide the correct loglikelihood for such models (it gives the loglike of a 'pseudo' or working linear mixed model). I would like to know how the loglike is calculated by lmer. A

Re: [R] Integration subroutine?

2006-03-13 Thread Marco Geraci
Hi, the function 'fr' evaluates each element of the vector 'x', independently of its length. 'fr2' does not. Try with fr2-function(x){ ifelse(x1, x*x, 1) } integrate(fr2,-1,2) 1.67 with absolute error 3.4e-05 Marco --- Lynette Sun [EMAIL PROTECTED] wrote: Hi all, Why

Re: [R] subsetting a list of matrices

2006-02-28 Thread Marco Geraci
Hi. Have you tried 'help.search('list')' ? See ?lapply lapply(z, function(s) s[2:3,,drop=F]) [[1]] [,1] [,2] [1,]25 [2,]36 [[2]] [,1] [,2] [,3] [,4] [,5] [,6] [1,] 19 22 25 28 31 34 [2,] 20 23 26 29 32 35 Marco Geraci --- Federico Calboli

Re: [R] I need your help

2006-02-21 Thread Marco Geraci
you to consider any value between 0 and 1 for level. Otherwise, you must write a 'neverending' list of 'if else'. If I assumed wrong, put back in the code the 'if else' statement. 3) The 'kronecker' function avoids the loops for 'i' and 'j' I hope this is what you want. Marco Geraci

Re: [R] How to select only certain rows when making a new dataframe?

2006-02-21 Thread Marco Geraci
I think ?merge is what you need. The help page of this function is veryhelpful Marco --- [EMAIL PROTECTED] wrote: Dear R-users, I have two data frames. The FIRST data frame has 100 rows, the SECOND data frame has only 50 rows. The data frames have different variables in columns

Re: [R] cdf of multivariate normal

2006-02-07 Thread Marco Geraci
Hi, you can check ?pmvnorm in package 'mvtnorm' Marco --- Juan Pablo Lewinger [EMAIL PROTECTED] wrote: I was wondering if anybody has written R code to compute the cdf of a multivariate (or at least a bivariate) normal distribution with given covariance structure.

Re: [R] iteration history

2006-02-06 Thread Marco Geraci
this helps, Marco Geraci --- Robert Mcfadden [EMAIL PROTECTED] wrote: Dear R Users I would like to use optim function to optimize a function. I read help but I couldn't find what I need: is it possible to get information after each iteration, for example as there is in MATLAB

Re: [R] sampling and nls formula

2006-02-06 Thread Marco Geraci
Hi --- Susan Imholt [EMAIL PROTECTED] wrote: Hello, I am trying to bootstrap a function that extracts the log-likelihood value and the nls coefficients from an nls object. I want to sample my dataset (pdd) with replacement and for each sampled dataset, I want to run nls and output

Re: [R] weighted likelihood for lme

2006-01-28 Thread Marco Geraci
by Pinheiro and Bates and I do really have to spend some time with it. Thanks very much, Marco hope this helps. spencer graves Marco Geraci wrote: Dear R users, I'm trying to fit a simple random intercept model with a fixed intercept. Suppose I want

[R] avoiding warning messages on the screen with 'lme'

2006-01-27 Thread Marco Geraci
printed on the screen during the loop. Thanks, Marco Geraci sessionInfo() R version 2.2.1, 2005-12-20, i386-pc-mingw32 attached base packages: [1] methods stats graphics grDevices utils datasets [7] base other attached packages: nlme 3.1-66

[R] weighted likelihood for lme

2006-01-23 Thread Marco Geraci
not maximize the likelihood Sum_i {w_i * logLik_i}, since 'weight' describes the with-in heteroscedasticity structure. I think I need something like the option 'iweight' (importance weight) for the command 'xtreg' of Stata. Any suggestion for R? Thanks in advance, Marco

Re: [R] function kde2d

2006-01-21 Thread Marco Geraci
--- From : Marco Geraci [EMAIL PROTECTED] To : Marta Colombo [EMAIL PROTECTED] Cc : Date : Fri, 20 Jan 2006 10:25:22 -0800 (PST) Subject : Re: [R] function kde2d http://www.R-project.org/posting-guide.html and ?kde2d Marta Colombo wrote: Good evening, I am Marta Colombo, student at Milan's

Re: [R] big difference in estimate between dmvnorm and dnorm, how come?

2006-01-20 Thread Marco Geraci
Maybe I am missing something, but I do believe that the function dmvnorm is in the package 'mvtnorm'. If you take a look at ?dmvnorm you'll see that you must specify the variance/covariance, while dnorm takes the standard deviation, so your code should be

Re: [R] r-help, how can i use my own distance matrix without using dist()

2006-01-18 Thread Marco Geraci
see ?dist there's an example x - matrix(rnorm(100), nrow=5) m - as.matrix(dist(x)) d - as.dist(m) 'as.dist' is what you're probably looking for regards, Marco [EMAIL PROTECTED] wrote: Dear R-helpers, i am a beginner of R and i am using cluster

Re: [R] better way to replace missing values with zero

2006-01-14 Thread Marco Geraci
I hope this helps: foo - data.frame(x=1:3,y=letters[1:3],z=4:6, w=as.Date(c(02/27/92, 02/27/92, 01/14/92), %m/%d/%y)) foo[2,] - NA foo xy z w 1 1a 4 1992-02-27 2 NA NA NA NA 3 3c 6 1992-01-14 class(foo$w) [1] Date mode(foo$w) [1] numeric a -

[R] update 'groupedData' and 'lme' objects

2006-01-13 Thread Marco Geraci
that this problem is related to different evaluation frames, the one invoked by 'myfunc' and the one invoked by 'update' (both for 'lme' and 'groupedData' objects). Any suggestion to overcome this problem would be greatly appreciated Marco Geraci R version: 2.2.1 nlme version

[R] R for Windows server

2005-12-14 Thread Marco Geraci
of R? If so, can I set up the program for the CPU usage like I do for the memory usage? Is there a version of R for servers? Thank you in advance, Marco Geraci - [[alternative HTML version deleted