Skip to content

Dealing with NAs

3 messages · Ville Iiskola, Jeff Newmiller, PIKAL Petr

#
Hi

I am trying to estimate parameter values with mlogit. I attach a part of my data.

My code is

x=mlogit.data(y,choice="voittaja",shape="long",id.var="id",alt.var="numero")

summary(mlogit(voittaja  ~ Ie-1 , data=x, na.action=na.pass))



But i get 



Error in if (abs(x - oldx) < ftol) { : 
  missing value where TRUE/FALSE needed


Because there is Na in D2. 

What should i do to make it work?
#
Read the posting guide. An example is not reproducible without sample data.

You may need to remove data records containing NA. It may not even be a true NA, depending how you got your data into R.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.
Ville Iiskola <ville.iiskola at uta.fi> wrote:

            
#
Hi

Without knowing details about mlogit and without any data from your side 
to check I guess that you shall put

na.omit or na.exclude instead of na.pass to na.action

Regards
Petr
my data.
x=mlogit.data(y,choice="voittaja",shape="long",id.var="id",alt.var="numero")
http://www.R-project.org/posting-guide.html