search for: r_m

Displaying 7 results from an estimated 7 matches for "r_m".

Did you mean: r_
2011 Jul 03
3
Hint improve my code
...elow. 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 al_j,au_j,sigma_j and b_j are just estimates that balance the likelihood function? llik=function(R_j,R_m) if(R_j< 0) { sum[log(1/(2*pi*(sigma_j^2)))-(1/(2*(sigma_j^2))*(R_j+al_j-b_j*R_m))^2] }else if(R_j>0) { sum[log(1/(2*pi*(sigma_j^...
2011 Jul 01
2
Help fix last line of my optimization code
...t 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 0.010281122 a=read.table("D:/ff.txt",header=T) attach(a) llik=function(R_j,R_m) #The parameters al_j, au_j, b_j , and sigma_j need to be estimated and there are no initial estimates to them. if(R_j< 0) { LF=sum[log(1/(2*...
2011 Jul 04
3
loop in optim
...h of 0 to 20, 21 to 40, 41 to 60. ###MY code is n=20 runs=4 out=matrix(0,nrow=runs) llik = function(x) { al_j=x[1]; au_j=x[2]; sigma_j=x[3]; b_j=x[4] sum(na.rm=T, ifelse(a$R_j< 0, -log(1/(2*pi*(sigma_j^2)))- (1/(2*(sigma_j^2))*(a$R_j+al_j-b_j*a$R_m))^2, ifelse(a$R_j>0 , -log(1/(2*pi*(sigma_j^2)))- (1/(2*(sigma_j^2))*(a$R_j+au_j-b_j*a$R_m))^2, -log(pnorm(au_j,mean=b_j*a$R_m,sd=sqrt(sigma_j^2))- pnorm(au_j,mean=b_j*a$R_m,sd=sqrt(sigma_j^2)))))...
2011 Jul 23
1
Extend my code to run several data at once.
...#### afull=read.table("D:/hope.txt",header=T) library(optimx) llik = function(x) { al_j=x[1]; au_j=x[2]; sigma_j=x[3]; b_j=x[4] sum(na.rm=T, ifelse(a$R_j< 0, log(1 / ( sqrt(2*pi) * sigma_j) )- (1/( 2*sigma_j^2 ) ) * ( (a$R_j+al_j-b_j*a$R_m)^2 ) , ifelse(a$R_j>0 , log(1 / ( sqrt(2*pi) * sigma_j) )- (1/( 2*sigma_j^2 ) ) * ( (a$R_j+al_j-b_j*a$R_m)^2 ) , log(ifelse (( pnorm (au_j, mean=b_j * a$R_m, sd= sqrt(sigma_j^2))- pnorm(al_j, mean=b_j * a$R_m, sd=sqrt (sigma_...
2011 Jul 06
1
Group Data indexed by n Variables
...is > > n=20 > runs=4 > out=matrix(0,nrow=runs) > > llik = function(x) > { > al_j=x[1]; au_j=x[2]; sigma_j=x[3]; b_j=x[4] > sum(na.rm=T, > ifelse(a$R_j< 0, -log(1/(2*pi*(sigma_j^2)))- > (1/(2*(sigma_j^2))*(a$R_j+al_j-b_j*a$R_m))^2, > ifelse(a$R_j>0 , -log(1/(2*pi*(sigma_j^2)))- > (1/(2*(sigma_j^2))*(a$R_j+au_j-b_j*a$R_m))^2, > > -log(pnorm(au_j,mean=b_j*a$R_m,sd=sqrt(sigma_j^2))- > pnorm(au_j,mean=b_j*a$R_m,sd=sqrt(sigma_j^2))))) > >...
2011 Oct 03
1
Matrix/Vector manipulation
...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 less than or equal to the current weight. Vectors W and R have the same length, and v is always a positive integer. W: {w_1 w_2 .. w_m} R: {r_1 r_2 .. r_m} my_cumsum <- function(v, R, W) { if (v <= W[1]) # check the head v*R[1] else W[1]*R[1] + my_cumsum(v - W[1], R[2:length(R)], W[2:length(W)]) # recurse the tail } Any help is greatly appreciated! Fernando Alvarez "Great ideas originate in the muscles." ~ Thomas A. Edison
2008 Dec 27
1
Want to create empty vectors inside a empty data frame
...values) Category2 say has==>i3,i4(10 records ) recmeanC1=>means of each i1,i2 value per record for category 1 as vector (i keep adding rows of means ,using rbind) recmeanC2=>means of each i3,i4 value per record for category 1 as vector what i did was:-- cat_record_mean_dfs<-data.frame(r_m=NULL) #Preparing the number of categories mean storage dfs for(catno in 1:catnam_dataset_data_size[1]) { cat_record_mean<-paste("recmeanC",1:catno,sep="") cat_mean_vector<-as.vector(cat...