search for: dat_

Displaying 2 results from an estimated 2 matches for "dat_".

Did you mean: dat
2011 Sep 05
1
In optim() function, second parameter in par() missing
Hi, First time using the optim(), can someone please tell me what I am doing wrong? The error looks like this Error in .Internal(pnorm(q, mean, sd, lower.tail, log.p)) : 'sd' is missing An example of the error dat = c(20, 19, 9, 8, 7, 4, 3, 2) dat_mu=mean(dat) dat_s=sd(dat) max.func = function(dat, mu, sd) { pnorm(dat, mu, sd) } optim(fn=max.func, dat=dat, par=c(mu=dat_mu, s=dat_s)) I get sd is missing error. If I wrote par=c(s=dat_s, mu=dat_mu) , then it tells me mu is missing. Can someone please help? Thanks! Colin -- View this...
2011 May 19
2
balanced panel data
I have a dataframe with many firm-year observations and many variables. Not all firms have information for all the years. I want another dataframe with only those firms that have information all years. This is, I want a balanced panel data, but with the maximum number of years. In my reprocucible example I want to keep firms 1,2 and 3 (period 2000 to 2004). I need your help to create a