similar to: Help on optim

Displaying 20 results from an estimated 1000 matches similar to: "Help on optim"

2005 Oct 19
2
Automatic rounding of values after factors , converted to numeric, are multipled by a real number
I am wondering if someone would have any suggestion about my issue? I have the following code: wgts<-aggregate(subset(lendata,select=c(Length)),list(lendata$Cruise,len data$Station,lendata$Region,lendata$Total),mean) wgts<-wgts[order(wgts$Group.3,wgts$Group.1,wgts$Group.1),] names(wgts)<-c("Cruise","Station","Region","Total","MLen")
2008 Mar 30
1
Second & subsequent calls to function fails. Please help debug.
Dear R-helpers, I'm running Sweave() on a file. First run: > Sweave('20080331.Rnw') Writing to file 20080331.tex Processing code chunks ... 1 : term hide (label=setup) 2 : echo term verbatim (label=oatvar) 3 : echo term verbatim (label=oatvar1) 4 : echo term verbatim (label=oat2wt) 5 : echo term verbatim (label=oat2wt) 6 : echo term verbatim (label=lm) 7 : echo term
2006 Jul 19
2
conditional plot
Hi, Can anyone pls help me in plotting the following data? The data-set contains company name, specification-1, specification-2. The graph would basically plot company name with specification-1 on x-axis, & specification-2 on y-axis. Simply put - company name should get classified into one of the four quardrants created by specification 1 & specification2. Thanks.
2005 May 30
3
Vector Manipulation
Dear All, For any given vector, I want to extract a sub-vector such that the new vector skips all zeros, if any , at the start of vector. Is it possible to achieve this w/o looping? E.G : > x = c(0,0,1,2,3,4,5,0,0,8,9) > y = somefunc(x); > y [1] 1 2 3 4 5 0 0 8 9 In the example above, I want to skip the two
2012 Oct 18
7
summation coding
I would like to code the following in R: a1(b1+b2+b3) + a2(b1+b3+b4) + a3(b1+b2+b4) + a4(b1+b2+b3) or in summation notation: sum_{i=1, j\neq i}^{4} a_i * b_i I realise this is the same as: sum_{i=1, j=1}^{4} a_i * b_i - sum_{i=j} a_i * b_i would appreciate some help. Thank you. -- View this message in context: http://r.789695.n4.nabble.com/summation-coding-tp4646678.html Sent from the R
2006 Apr 19
1
Trouble with glm() .... non-integer #successes in a binomial glm
Hi R-people: When I use the command to fit a model with an intercept, only: glm ( formula=haspdata ~ 1, data=dat, family=binomial, weights= dat$hy.wgt.s, subset=(dat$haspdat0!=3) ) I get the message: Warning message: non-integer #successes in a binomial glm! in: eval(expr, envir, enclos) Does anyone know what this means?? The data for this command is listed below. Thanks, Phil Smith CDC
2007 Aug 31
3
data frame row manipulation
Hello, struggling with the very basic needs... :( any help appreciated. #using the package doBY #who drinks how much beer per day and therefor cannot calculate rowise maxvals evaluation=data.frame(date=c(1,2,3,4,5,6,7,8,9), name=c("Michael","Steve","Bob", "Michael","Steve","Bob","Michael","Steve","Bob"),
2012 Jan 10
1
error in Recursive
Hi I need help in the recursive problem. this is my code #Generate two random Numbers minval=20 maxval=100 cutoffValue=50 optVal<- function(cutoffValue,minval,maxval) { x=runif(2) x=x*cutoffValue for( i in 1:2) { if(x[i] < 30 || x[i] >60) # checking it falls between the range { optVal(cutoffValue,minval,maxval) } } return(x) }
2010 Mar 06
2
memory error in for loop
hi, I have been attempting to run this script and am getting some strange results. The script connects to a database and retrieves a series of tables, using sequential sql statements. I have tested all of the sql statements in the PostGreSQL terminal and they all return the desired results. I place each table into a list and run a FOR loop for 'i' in the list. The script generates
2006 Oct 21
2
problem with mode of marginal distriubtion of rdirichlet{gtools}
Hi all, I have a problem using rdirichlet{gtools}. For Dir( a1, a2, ..., a_n), its mode can be found at $( a_i -1)/ ( \sum_{i}a_i - n)$; The means are $a_i / (\sum_{i} a_i ) $; I tried to study the above properties using rdirichlet from gtools. The code are: ############## library(gtools) alpha = c(1,3,9) #totoal=13 mean.expect = c(1/13, 3/13, 9/13) mode.expect = c(0, 2/10, 8/10) #
2007 Sep 04
4
Q: selecting a name when it is known as a string
I am 100% certain that there is an easy way to do this, but after experimenting off and on for a couple of days, and searching everywhere I could think of, I haven't been able to find the trick. I have this piece of code: ... attach(d) if (ORDINATE == 'ds') { lo <- loess(percent ~ ncms * ds, d, control=loess.control(trace.hat = 'approximate')) grid <-
2024 Jan 04
1
Obtaining a value of pie in a zero inflated model (fm-zinb2)
Are you referring to the zeroinfl() function in the countreg package? If so, I think predict(fm_zinb2, type = "zero", newdata = some.new.data) will give you pi for each combination of covariate values that you provide in some.new.data where pi is the probability to observe a zero from the point mass component. As to your second question, I'm not sure that's possible, for any
2008 Aug 11
3
R-help? how to take difference in next two elements
Hi, I'd like to take difference for a sequence a between a_i and a_i-2, for instance, a<-c(2,3,4,8,1) I need (2, 5, -3) as a result. If not using a for loop, can anyone help me? Thanks a lot. Dot -- View this message in context: http://www.nabble.com/R-help--how-to-take-difference-in-next-two-elements-tp18927968p18927968.html Sent from the R help mailing list archive at Nabble.com.
2003 Feb 19
4
fitting a curve according to a custom loss function
Dear R-Users, I need to find a smooth function f() and coefficients a_i that give the best fit to y ~ a_0 + a_1*f(x_1) + a_2*f(x_2) Note that it is the same non-linear transformation f() that is applied to both x_1 and x_2. So my first question is how can I do it in R? A more general question is this: suppose I have a utility function U(a_i, f()), where f() is say a spline. Is there a general
2008 Oct 06
3
horizontal boxplot + xlim
Hi there, I get a strange behaviour of a boxplot with the following code. There seems to be a problem with the xlim-parameter. Did I do anything wrong? What else can I do to force the boxplot to have a defined x-range? x <- rnorm(100) boxplot(x, notch=TRUE, xlab=parameter, xlim <- c(-4,4), horizontal = TRUE) Antje
2010 Aug 24
1
Constrained non-linear optimisation
I'm relatively new to R, but I'm attempting to do a non-linear maximum likelihood estimation (mle) in R, with the added problem that I have a non-linear constraint. The basic problem is linear in the parameters (a_i) and has only one non-linear component, b, with the problem being linear when b = 0 and non-linear otherwise. Furthermore, f(a_i) <= b <= g(a_i) for some (simple) f
2000 Mar 10
1
logit and polytomous data
I am new to generalized linear models and studying McCullagh & Nelder (1989). Especially, I have a problem resembling the \"cheese taste\" example (5.3.1. p. 109) of the book. I tried to analyse the cheese example with R but failed to do so because R allowed me to use logit link function only with binary family that supposes 0 <= y <= 1. Do I need to scale the y\'s or
2013 Mar 22
1
Integration of vector syntax unknown
Hello, I'm very new to using R, but I was told it could do what I want. I'm not sure how best to enter the information but here goes... I'm trying to transfer the following integral into R to solve for ln(gamma_1), on the left, for multiple instances of gamma_i and variable N_i. gamma_i is, for example, (0, 0.03012048, 0.05000000, 0.19200000, 0.44000000, 0.62566845) N_i (N_1 or
2009 May 07
2
lasso based selection for mixed model
Dear useRs (called Frank Harrell, most likely), after having preached for years to my medical colleagues to be cautious with stepwise selection procedures, they chanted back asking for an alternative when using mixed models. There is a half dozen laXXX packages around for all types of linear models, but as far I see there is none for mixed models such as lme. Even boot.stepAIC (which I
2009 Sep 03
2
[LLVMdev] 2.6 pre-release1 ready for testing
Hi Tanya, I have tried the 2.6 pre-release on the following host : Windows XP pro SP2 with mingw/msys : uname -a MINGW32_NT-5.1 OLIVE 1.0.10(0.46/3/2) 2004-03-15 07:17 i686 unknown gcc -v Reading specs from d:/mingw/bin/../lib/gcc/mingw32/3.4.5/specs Configured with: ../gcc-3.4.5/configure --with-gcc --with-gnu-ld --with-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads