similar to: loop in optim

Displaying 20 results from an estimated 200 matches similar to: "loop in optim"

2011 Jul 06
1
Group Data indexed by n Variables
Hello, the more general thing I'd like to learn here is how to compute Function of Data on the basis of grouping determiend by n variables. In terms of the reason why I am interested in this, I need to compute the average of my data based on the value of the month and day across years. I have come up withy the code below which, as far as I can see, does what I need but getting either a more
2011 Jul 03
3
Hint improve my code
Hi I have developed the code below. I am worried that the parameters I want to be estimated are "not being found" when I ran my code. Is there a way I can code them so that R recognize that they should be estimated. This is the error I am getting. > out1=optim(llik,par=start.par) Error in pnorm(au_j, mean = b_j * R_m, sd = sigma_j) : object 'au_j' not found #Yet
2011 Jul 01
2
Help fix last line of my optimization code
Hi I need help figure out how to fix my code. When I call into R >optimize(llik,init.params=F) I get this error message ####Error in optimize(llik, init.params = F) : element 1 is empty; the part of the args list of 'min' being evaluated was: (interval)#### My data and my code looks like below. R_j R_m 0.002 0.026567296 0.01 0.003194435 . . . . . . . . 0.0006
2011 Jul 23
1
Extend my code to run several data at once.
Hi I have a code that calculate maximisation using optimx and it is working just fine. I want to extend the code to run several colomns of R_j where j runs from 1 to 200. If I am to run the code in its current state, it means I will have to run it 200 times manually. May you help me adjust it to accomodate several rows of R_j and print the 200 results. ***Please do not get intimidated by the
2011 Oct 03
1
Matrix/Vector manipulation
Hi guys, Have the following problem computing vectors with pure vector algebra and end up reverting to recursion or for-looping. Function my_cumsum calculates a weighted average (W) of ratios (R), but only up to the given size/volume (v). Now I recurse into the vector (from left to right) with what you have left from the difference of volume minus current weight, and stop when the difference is
2007 Apr 18
3
Problems in programming a simple likelihood
As part of carrying out a complicated maximum likelihood estimation, I am trying to learn to program likelihoods in R. I started with a simple probit model but am unable to get the code to work. Any help or suggestions are most welcome. I give my code below: ************************************ mlogl <- function(mu, y, X) { n <- nrow(X) zeta <- X%*%mu llik <- 0 for (i in 1:n) { if
2009 Jul 19
1
trouble using optim for maximalisation of 2-parameter function
Hello, I am having trouble using "optim". I want to maximalise a function to its parameters [kind of like: univariate maximum likelihood estimation, but i wrote the likelihood function myself because of data issues ] When I try to optimize a function for only one parameter there is no problem: llik.expo<-function(x,lam){(length(x)*log(lam))-(length(x)*log(1-exp(-1*lam*
2008 Dec 27
1
Want to create empty vectors inside a empty data frame
Hi All, I want to create empty vectors inside an empty data frame.The name of the vectors has to come dynamically. For example if record_mean is my empty data frame,and i have say 4 categories,the category names for record mean data frame has to recmeanC1,recmeanC2,recmeanC3,recmeanC4,which will be dynamically created and which will again be inserted in my data frame's as column values.Each
2005 Oct 07
2
AIC in lmer
Hello all, Is AIC calculated incorrectly in lmer? It appears as though it uses AIC = -2*logLik - 2*#parms, instead of -2*LogLik + 2*#parms? Below is output from one of many models I have tried: Generalized linear mixed model fit using PQL Formula: cswa ~ pcov.ess1k + (1 | year) Data: ptct50.5 Family: poisson(log link) AIC BIC logLik deviance 224.8466 219.19 -114.4233 228.8466
2012 Aug 27
2
randomLCA
Can anybody, please, explain me how many parameter are estimated using randomLCA? For examples, model "dentistry.lca2random" estimate 1 scale (or variance, b_j) parameter and 2 position parameters (a_cj)? Doesn't it? Do I need at least 4 diagnostic tests for such a model? What happens if I specify options blocksize and byclass? How many diagnostic tests (or rater) I need?
2011 Dec 19
1
pls help to print out first row of terms(model) output in example program
Greetings. I've written a convenience function for multicollinearity diagnosis. I'd like to report to the user the formula that is used in a regression. I get output like this: > mcDiagnose(m1) [1] "The following auxiliary models are being estimated and returned in a list:" [1] "`x1` ~ ." formula(fmla)() [1] "`x2` ~ ." I'd like to fill in the period
2011 Jun 14
1
Using MLE Method to Estimate Regression Coefficients
Good Afternoon, I am relatively new to R and have been trying to figure out how to estimate regression coefficients using the MLE method. Some background: I am trying to examine scenarios in which certain estimators might be preferred to others, starting with MLE. I understand that MLE will (should) produce the same results as Ordinary Least Squares if the assumption of normality holds. That
2003 Sep 08
1
Probit and optim in R
I have had some weird results using the optim() function. I wrote a probit likelihood and wanted to run it with optim() with simulated data. I did not include a gradient at first and found that optim() would not even iterate using BFGS and would only occasionally work using SANN. I programmed in the gradient and it iterates fine but the estimates it returns are wrong. The simulated data work
1999 Dec 10
1
orthogonal and nested model
I'm working with a orthogonal and nested model (mixed). I have four factors, A,B,C,D; A and B are fixed and orthogonal C is nested in AB interaction and finally, D is nested in C. I would like to model the following Y_ijklm=Mu+A_i+B_j+AB_ij+C_k(ij)+D_l(k(ij))+Error_m(...) I used the next command >summary(aov(abund~A*B + C % in % A:B + D % in % C % in % A:B ,datos)) Is it the correct
2012 Oct 29
2
Two-way Random Effects with unbalanced data
Hi there, I am looking to fit a two-way random effects model to an *unblalanced* layout, y_ijk = mu + a_i + b_j + eps_ijk, i=1,...,R, j=1,...,C, k=1,...,K_ij. I am interested first of all in estimates for the variance components, sigsq_a, sigsq_b and sigsq_error. In the balanced case, there are simple (MM, MLE) estimates for these; In the unbalanced setup,
2006 Oct 24
1
Variance Component/ICC Confidence Intervals via Bootstrap or Jackknife
I'm using the lme function in nmle to estimate the variance components of a fully nested two-level model: Y_ijk = mu + a_i + b_j(i) + e_k(j(i)) lme computes estimates of the variances for a, b, and e, call them v_a, v_b, and v_e, and I can use the intervals function to get confidence intervals. My understanding is that these intervals are probably not that robust plus I need intervals on the
2007 Apr 14
6
[LLVMdev] Regalloc Refactoring
On Thu, 12 Apr 2007, Fernando Magno Quintao Pereira wrote: >> I'm definitely interested in improving coalescing and it sounds like >> this would fall under that work. Do you have references to papers >> that talk about the various algorithms? > > Some suggestions: > > @InProceedings{Budimlic02, > AUTHOR = {Zoran Budimlic and Keith D. Cooper and Timothy
2004 Jun 17
0
beta regression in R
Hello, I'm using optim to program a set of mle regression procedures for non-normal disturbances. This is for teaching and expository purposes only. I've successfully programmed the normal, generalized gamma, gamma, weibull, exponential, and lognormal regression functions. And optim returns reasonable answers for all of these compared with the identical optimization problems in STATA and
2010 Oct 18
0
specifying lme function with a priori hypothesis concerning between-group variation in slopes
I want to specify a 2-level mixed model using the lme function in order to test an a priori hypothesis about the between-group values of the slopes but don't know how to do this . Here is the problem. Consider first the case of a single group. The model is: Y_i= a +bX_i + error where I indexes the different values of X and Y in this group . The a priori hypothesis of the slope is: b=K.
2012 Feb 02
0
glmer question
I would like to fit the following model: logit(p_{ij}) = \mu + a_i + b_j where a_i ~ N(0, \sigma_a^2) , b_j ~ N(0, \sigma_b^2) and \sigma_a = \sigma_b. Is it possible to fit a model with such a constraint on the variance components in glmer? -- View this message in context: http://r.789695.n4.nabble.com/glmer-question-tp4351829p4351829.html Sent from the R help mailing list archive at