similar to: aggregating using 'with' function

Displaying 20 results from an estimated 1000 matches similar to: "aggregating using 'with' function"

2011 Mar 12
3
betareg help
Dear R users, I'm trying to do betareg on my dataset. Dependent variable is not normally distributed and is proportion (of condom use (0,1)). But I'm having problems: gyl<-betareg(cond ~ alcoh + drug, data=results) Error in optim(par = start, fn = loglikfun, gr = gradfun, method = method, : initial value in 'vmmin' is not finite Why is R returning me error in optim()? What
2010 Feb 17
1
Replicating output from a function
Hi All, I have a function that is used with data frames having multiple id's per row and it aggregates the data down to 1 id per row. It also randomly selects one of the within-id values of a variable (mod), which often differ within-id. Assume this data frame (below) is much larger and I want to repeat this function, say 100 times, and then derive the mean values of r over those 100
2012 Jul 02
1
How to get prediction for a variable in WinBUGS?
Dear all,I am a new user of WinBUGS and need your help. After running the following code, I got parameters of beta0 through beta4 (stats, density), but I don't know how to get the prediction of the last value of h, the variable I set to NA and want to model it using the following code.Does anyone can given me a hint? Any advice would be greatly appreciated.Best
2009 Oct 07
1
Buglet in qbeta?
Hi, I sometimes play around with extreme parameters for distributions and found that qbeta is not always monotone as the following example shows. I don't know whether this is serious enough to submit a bug report (as this example is near to the limitations of floating point arithmetic). Josef > x <- qbeta((0:100)/100,0.01,5) > x [1] 0.000000e+00 1.253990e-201 1.589622e-171
2009 Jul 08
2
Formatting a Table
I've created a short program to print a table of learning curve factors. However, I cannot figure out how to format the table to: 1) Get rid of the [1]s in the first column and replace it with the values of N. 2) Line up the first row with the factors (decimal fractions). Thanks for any help. The complete program and output is as follows: > Lc<-seq(0.70,0.95,0.05) #Specify learning
2009 Jul 09
2
Improvement of [dpq]wilcox functions
Hi, I believe I have significantly improved [dpq]wilcox functions by implementing Harding's algorithm: Harding, E.F. (1984): An Efficient, Minimal-storage Procedure for Calculating the Mann-Whitney U, Generalized U and Similar Distributions, App. Statist., 33, 1-6 Results on my computer show (against R-2.9.1): > system.time( dwilcox( 800, 800, 80) ) user system elapsed 0.240
2010 Nov 25
2
aftreg vs survreg loglogistic aft model (different intercept term)
Hi, I'm estimating a loglogistic aft (accelerated failure time) model, just a simple plain vanilla one (without time dependent covariates), I'm comparing the results that I obtain between aftreg (eha package) and survreg(surv package). If I don't use any covariate the results are identical , if I add covariates all the coefficients are the same until a precision of 10^4 or 10^-5 except
2010 Jan 28
2
Data.frame manipulation
Hi All, I'm conducting a meta-analysis and have taken a data.frame with multiple rows per study (for each effect size) and performed a weighted average of effect size for each study. This results in a reduced # of rows. I am particularly interested in simply reducing the additional variables in the data.frame to the first row of the corresponding id variable. For example:
2012 May 04
1
NV43: Native resolution not available on Dell 2007FP
I have a Dell 2007FP monitor. NV43 (GeForce 6600) can not use the native resolution. 1600x1200 is listed under "DDC gathered Modelines" with the rest of the info, but then is missing from "probed modes". I have a secondary card, NV4a (GeForce 6200, PCI). It works with this card. This card does not show "DDC gathered modelines" at all, and 1600x1200 is listed
2009 Jun 17
2
djustment values not defined
Hello,   I am using mod1 <- lrm(y~x1+x2,na.action=na.pass,method="lrm.fit") summary(mod1) and I've got the following error: Error in summary.Design(mod1) : adjustment values not defined here or with datadist for x1 x2   Many thank, Amor [[alternative HTML version deleted]]
2006 Mar 14
1
Ordered logistic regression in R vs in SAS
I tried the following ordered logistic regression in R: mod1 <- polr(altitude~sp + wind_dir + wind_speed + hr, data=altioot) But when I asked The summary of my regression I got the folloing error message: > summary (mod1) Re-fitting to get Hessian Error in optim(start, fmin, gmin, method = "BFGS", hessian = Hess, ...) : the initial value of 'vmin' is not
2010 Feb 15
2
creating functions question
Hi All, I am interested in creating a function that will take x number of lm objects and automate the comparison of each model (using anova). Here is a simple example (the actual function will involve more than what Im presenting but is irrelevant for the example): # sample data: id<-rep(1:20) n<-c(10,20,13,22,28,12,12,36,19,12,36,75,33,121,37,14,40,16,14,20)
2004 Jul 28
2
Simulation from a model fitted by survreg.
Dear list, I would like to simulate individual survival times from a model that has been fitted using the survreg procedure (library survival). Output shown below. My plan is to extract the shape and scale arguments for use with rweibull() since my error terms are assumed to be Weibull, but it does not make any sense. The mean survival time is easy to predict, but I would like to simulate
2011 Apr 08
1
Variance of random effects: survreg()
I have the following questions about the variance of the random effects in the survreg() function in the survival package: 1) How can I extract the variance of the random effects after fitting a model? For example: set.seed(1007) x <- runif(100) m <- rnorm(10, mean = 1, sd =2) mu <- rep(m, rep(10,10)) test1 <- data.frame(Time = qsurvreg(x, mean = mu, scale= 0.5, distribution =
2009 Mar 05
1
problems with nls?
I need to make nonlinear regression with the posterior script, but how is the problem? I have error in library (nls), package 'nls' has been merged into 'stats'. I need help? What other forms I have to make nonlinear regression? and how I find to calculate statistics y residuals, scatterplot. thanks SCRIPT ros<-read.table("Dataset.csv",header=T,sep=",")
2012 Jun 29
1
number of items to replace is not a multiple of replacement length
Hello, I'm a complete newbie to R so sorry if this is too basic..:-S I have to modify some scripts someone else did to make it work with my data. For some reason, one of the scripts which were supposed to work is not, and I get the error message "number of items to replace is not a multiple of replacement length". The script is this one: *open_lpj_nc_gpp <-
2006 Oct 04
1
extracting nested variances from lme4 model
I have a model: mod1<-lmer( x ~ (1|rtr)+ trth/(1|cs) , data=dtf) # Here, cs and rtr are crossed random effects. cs 1-5 are of type TRUE, cs 6-10 are of type FALSE, so cs is nested in trth, which is fixed. So for cs I should get a fit for 1-5 and 6-10. This appears to be the case from the random effects: > mean( ranef(mod1)$cs[[1]][1:5] ) [1] -2.498002e-16 > var(
2013 Nov 25
4
lmer specification for random effects: contradictory reults
Hi All, I was wondering if someone could help me to solve this issue with lmer. In order to understand the best mixed effects model to fit my data, I compared the following options according to the procedures specified in many papers (i.e. Baayen <http://www.google.it/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CDsQFjAA
2011 Oct 26
2
Error in summary.mlm: formula not subsettable
When I fit a multivariate linear model, and the formula is defined outside the call to lm(), the method summary.mlm() fails. This works well: > y <- matrix(rnorm(20),nrow=10) > x <- matrix(rnorm(10)) > mod1 <- lm(y~x) > summary(mod1) ... But this does not: > f <- y~x > mod2 <- lm(f) > summary(mod2) Error en object$call$formula[[2L]] <- object$terms[[2L]]
2012 May 27
2
Unable to fit model using “lrm.fit”
Hi, I am running a logistic regression model using lrm library and I get the following error when I run the command: mod1 <- lrm(death ~ factor(score), x=T, y=T, data = env1) Unable to fit model using ?lrm.fit? where score is a numeric variable from 0 to 6. LRM executes fine for the following commands: mod1 <- lrm(death ~ score, x=T, y=T, data = env1) mod1<- lrm(death ~