search for: mu0

Displaying 17 results from an estimated 17 matches for "mu0".

Did you mean: md0
2009 May 03
3
Optim function in the loop
...the following lines of codes try to do some iterations to find the global optimal values, but the function does not execute properly. Every time codes stop after one iteration right after executing the optim() function. Does anyone could have me to take a look? Thanks. if (count>0){ k=k+0.05; mu0=c(83+k,0,0) Sigma0= diag(0.4,3) initpar=c(.1+10*k,10*k,10*k,10*k) # initial parameters for Phi[1,1], the 2 Q?s and R est=optim(initpar,Linn,NULL,method="BFGS",hessian=TRUE,control=list(trace=1,REPORT=1,maxit=300)) stderr=sqrt(diag(solve(est$hessian))) estimate=est$par u=cbind(estima...
2009 Aug 20
1
Understanding R code
What is 1. par.ests <- optimfit$par 2. fisher <- hessb(negloglik, par.ests, maxvalue=maxima); 3. varcov <- solve(fisher); 4. par.ses <- sqrt(diag(varcov)); Thanks a lot, fit.GEV <- function(maxima) { sigma0 <- sqrt((6. * var(maxima))/pi) mu0 <- mean(maxima) - 0.57722 * sigma0 xi0 <- 0.1 theta <- c(xi0, mu0, sigma0) #10/5/2007: removed assign() for maxima.nl #10/5/2007: passed additional parameter to avoid using assign() negloglik <- function(theta, maxvalue) { -sum(dGEV(maxvalue,theta[1],theta[2],abs(theta[3]),logvalue=TRU...
2007 Oct 14
1
Adjusting for heaping in data
Hi R users. I am new to the community and have got myself into a little problem. I have a dataset of birth weights recorded by nurses at a delivery clinic in an developing country. The weights are entered in KiloGrams with one decimal. However there is substantial heaping at each 500g when looking at the sample in a histogram. Do anyone of you know a easy way to adjust for this and if it exists
2008 Dec 31
2
function of mixture normal with covariates
...gt; > opp<-optim(c(meany0,meany1,stdy0,stdy1,dx,V,d),logl) Error in optim(c(meany0, meany1, stdy0, stdy1, dx, V, d), logl) : function cannot be evaluated at initial parameters > This is what I wrote # maximizing the log likelihood function logl<-function(param,y,x) { mu0=param[1] mu1=param[2] sdy0=param[3] sdy1=param[4] pix_pred=param[5] v_pred=param[6] dxynew=param[7] f3=-(sum(dxynew*(log(pix_pred)-log(sdy1)-0.5*((y-mu1-(rho*sdy1*x)/sdy1)^2))+ sum((1-dxynew)*(log(1-pix_pred)-log(sdy0) -0.5*((y-mu0-(rho*sdy0*x)/sdy0)^2)) +log(v_pred)) return (-...
2010 Jul 18
2
loop troubles
...way to create a loop, the only problem is I want to have elements from the previous posterior to be the new prior and now I cant figure out how to do the code below in a loop. The data below is dummy data, I used a starting mu of 1, and starting precision of 0. bayes.analysis.treat<-function(mu0,p0){ n1 = 5 n2 = 10 n3 = 15 ybar1 = 12 ybar2 = 13 ybar3 = 14 sd1 = 2 sd2 = 3 sd3 = 4 #posterior 1 var1 = sd1^2 #sample variance p1 = n1/var1 #sample precision p1n = p0+p1 mu1 = ((p0)/(p1n)*mu0)+((p1)/(p1n))*ybar1 sigma1 = 1/sqrt(p1n) #posterior 2 var2 = sd2^2 #sample variance p2 =...
2011 Feb 03
1
"hubers" function in R MASS library : problem and solution
...,7.19,7.19,7.19,7.19,7.19,7.19,7.19,6.79,6.79,7.19,6.79,7.19,7.19,1.407,7.19,4.42,9,1.64,1.64,6.79,1.664,1.664) > > library(MASS) > hubers(a) ## NO response! I think it is due to the infinite loop caused by the following line in the code of "hubers" (around Line 30): if ((abs(mu0 - mu1) < tol * s0) && abs(s0 - s1) < tol * s0) break where "s0" evaluates to ZERO initially (due to more than 50% of the number 7.19). I propose to change the "<" sign to "<=": if ((abs(mu0 - mu1) <= tol * s0) && abs(s0...
2010 Nov 30
1
StructTS with 2 seasons
...time-varying trend and season), the top line s determines the number of seasons in a year (3 and 4 work fine, 2 gives the above error), and at the end tries to fit the model. I am using R version 2.11.1, Windows XP. # ----- Basic structural model ----- s <- 2 # frequency or period mu0 <- 6 beta0 <- 1 it0 <- 0 it.states <- sample(1:6,s) mu <- numeric() # mean beta <- numeric() # slope it <- numeric() # seasonal state mu[1] <- mu0 + beta0 + rnorm(1,0,2) beta[1] <- beta0 + rnorm(1,0,0.5) it[1] <- - sum(it.states...
2007 Mar 09
1
MCMC logit
...ackage (MCMCpack) ## Copyright (C) 2003-2007 Andrew D. Martin and Kevin M. Quinn ## ## Support provided by the U.S. National Science Foundation ## (Grants SES-0350646 and SES-0350613) ## [1] TRUE Warning message: package 'MASS' was built under R version 2.4.1 > a0 = 0.5 > b0 = 1 > mu0 = 0 > beta.init=list(c(0, rep(0.1,4)), c(0, rep(-0.1,4)), c(0, rep(0, 4))) > burnin.cycles = 1000 > mcmc.cycles = 25000 > # three chains > post.list <- lapply(beta.init, function(vec) + { + posterior <- MCMClogit(y~x1+x2+x3+x4, data=c.df, burnin=burnin.cycles, mcmc=mcmc.cycles,...
2004 Dec 02
3
R and Fortran in Windows
I just joined the list and appologize if this has been answered before but I am trying to interface between R and the Compaq Visual Fortran compiler version 6.6 for Windows. I found the following instructions on the web -- and an example. When I follow these directions exactly. R 2.0.0 crashes. Has anyone had any experience with this? Below are the instructions that I located: Thanks Dan
2003 Apr 03
1
Tukey's one degree of freedom for nonadditivity?
Is there code available to decompose interactions involving at least one nominal factor with more than 2 levels as described, e.g., by Tukey or by Mandel (1971, Technometrics, 13: 1-18)? Tukey's model: E(y[i,j]) = mu0 + a[i] + b[j] + c*a[i]*b[j], estimating a, b, and c so sum(a) = sum(b)= 0. Mandel essentially describes a singular value decomposition of the interaction. Thanks, Spencer Graves
2000 Aug 22
0
Using RNG from MS [forwarded message from Xiaoqiang Li]
...int k; d_y=sqrt(-8*log(y)); k=(int)floor( (mu+d_y/2-z)/d_y ); return z+k*d_y; } double norm(double mu,double sigma,double x){ double pi=3.141592679565; return 1/sqrt(2*pi*sigma)*exp(-(x-mu)*(x-mu)/sigma/sigma/2); } void stepzero(double *X0, double *mu0, long *length, double *X1){ long i; double Z1, Y1; GetRNGstate(); Z1=rnorm(0,1); Y1=norm(0,1,Z1)*unif_rand(); for (i=0;i<*length;i++) X1[i]=MS(Z1,Y1,*X0+mu0[i]); PutRNGstate(); } ******************************************...
2007 Dec 28
1
unit attribute to list elements
...isting common physical constants (Planck's constant, the speed of light in vacuum, etc). I'm wondering what would be a good way of dealing with pairs of value/unit. > constants <- list( cel = 2.99792458e8 , #m/s > Z0 = 376.730313461, #ohm > eps0 = 8.854187817e-12,#F/m > mu0 = 4*pi*1e-7,#N/A^2 > G = 6.67428e-11 # m^3 kg-1 s-2 > ) I thought I could include the unit in the names attribute of each element, as in : > names(constants$cel)<- " speed of light in vacuum [m.s^-1]" Writing this for every element is very redundant... Is there any way...
2010 Sep 21
2
Trouble with Optimization in "Alabama" Package
...])))-((y[1]^y[5])*(y[3]^(1-y[5]))) h[2]=((x[2]^y[6])*(x[4]^(1-y[6])))-((y[2]^y[6])*(y[4]^(1-y[6]))) return(h) } heq=function(x,...){ h=rep(NA,2) h[1]=x[1]+x[2]-y[1]-y[2] h[2]=x[3]+x[4]-y[3]-y[4] return(h) } ans2=constrOptim.nl(par=p1,fn=fn,hin=hin,heq=heq,control.outer=list(itmax= 1000,mu0=.00001),list(y,y,y)) Any advice or explanation of my errors would be greatly appreciated! -- Erik O. Kimbrough Department of Economics (AE1) School of Business and Economics Maastricht University [[alternative HTML version deleted]]
2008 Nov 23
0
why this function give error message
...-nlm(garch.gjr.d,par0,y=y,X=X,Z=X,hessian=TRUE, iterlim=200) se <- sqrt(diag(solve(a$hessian))) a$estimate 2*(1-pnorm(abs(a$estimate/se))) ################ # # To get estimated variance and residuals# # ############### garch.gjr.d0 <- function(par,y,X=0,Z=0,iterate=TRUE) { T<-length(y) mu0<-par[1] g1<-par[2] g2<-par[3] g3<-par[4] a0<-par[5] a1<-par[6] a2 <-par[7] b1 <- par[8] e <- s2 <- numeric(T) if(is.matrix(X)){ n.dummies.mean <- dim(X)[2] g <- par[9:(8+n.dummies.mean)] y <- y - X%*%g } else n.dummies.mean <-0 if(...
2006 Oct 03
1
HP Toolbox kills Samba
...U!IL[ +&(&';\F$T MRF*F[@#&K8?>`$8"C%9J++3N`$:+G+H#&)W0*")T`*.5F&(Z@#$&#&H^C!ZU MF$Y@C-"-'< 8C$86TP&,44(W\F&,!JLFNH Q^ @8N3"NS&_ V &,0<-OY,,H ME4>!M0,8O1PHC'W:H*>47)/?V%.!#3G8F 4>@ ?@`3;H88,>-NA]?JUKM4/F MU0&,02+SXL/HU%#7'?4J\W+>"F1>4%I0W. !> `>(/,">9!Y]4NDU5BL%6LP MKA"4,3F#!^ !> "1!I$&D?;Y19H6:U>E8%PA*&-R!@_ `_ `(@TB[0L5:4J< MWZS2.A5IJX7AS84:]<^-,LW:&/DR+>M%)XO7>V(;#]KN_4.6WDU63&U>U/Q9 M"K'AU>]?M&KU$3E6EYHX...
2008 Jun 30
4
Rebuild of kernel 2.6.9-67.0.20.EL failure
Hello list. I'm trying to rebuild the 2.6.9.67.0.20.EL kernel, but it fails even without modifications. How did I try it? Created a (non-root) build environment (not a mock ) Installed the kernel.scr.rpm and did a rpmbuild -ba --target=`uname -m` kernel-2.6.spec 2> prep-err.log | tee prep-out.log The build failed at the end: Processing files: kernel-xenU-devel-2.6.9-67.0.20.EL Checking
2009 Jul 23
1
[PATCH server] changes required for fedora rawhide inclusion.
...uNzo3#&1EfYoL%jRf;Du+BVzw6>U6R8wE2A5uJQx7i2p2J^bC zjvF)-%zmP+;wJTf^A at C5nYR&ilX-{wwmASv%YakZQj@=W*Y-(cF}lBLJ!*S}9XIbG z{0Z|ae}%On{41>8tjF4_6{VTPP9hdoD&{?17)v-m!cUowJ#?OEF2uU$f_W91<)V2X zil^H=1O7R)2CJ#l=Aezf;ok(`v*r+Tb;&%1Fg at luaJtMc(C5wj=rzmG^G)bNVPB4} zZ$ga<`wA?ROg4;Mu0)qMEsv0odoq7_Wu69Q{sv^u?wF5hOg%LD6O{CU`4lex%=X;W zpTqswd;xrFK1cbVm>CB8yqRg(jWy7Xc1xB)6_{<%r!3S!nQFu)?ksx_!mY&=ZMRG_ zXiQC)ely}Brr8JNSj#npeI1r&b~cj^+~?T&ETl8rKHI>^E#rKSk!MezYrqb(&ok(+ z5oC)gti;Y;c~TUe=`OMJkIgk;W!UK~t=OI|1Y2aM<A@?V|5-ZnSYYQLS4XV*hU^Y> z_Bh{OAVmz(iJ+bKh8N...