Mlogit: Missing Value Where True/False Needed

Error in mlogit package R missing value where TRUE/FALSE needed

The main error was that the varying columns were stated as:

"Metro", "Bus", "Apie", "Taxi", "Bicicleta".

While my choice variable values were:

"Metro", "Bus Alimentador", "A pie", "Taxi o Radio Taxi", "Bicicleta".

So you want to make sure that the values of the choice variables and the varying variables are the same!

R mlogit model, , missing value where TRUE/FALSE needed, 20 invalid factor level warnings

Try

m2 <- mlogit(f2, lfsm2, weights=PWT14)

Note the f2 in the call to mlogit.

In your second call to mlogit.data, you have specified that multi is the choice variable, and the data are prepared accordingly. Yet, in the formula that you are using, f1, the dependent variable is specified as PWK, so that mlogit is expecting a dataframe with one row for each alternative as defined by PMK, not multi.

Missing value where TRUE/FALSE needed - Where to put is.na()?

How about inserting pvals <- pvals[!is.na(pvals)] before M <- length(pvals)?

GAM model error - missing value where TRUE/FALSE needed

You're asking gam() to fit a model assuming an integer response and passing it a real-valued (decimal) variable.

If you have replicate counts and averaged them to get the mean variable, then don't do the averaging. Include all rows of data and deal with the clustering by subject with a random effect term.

If you got mean by scaling by an effort variable, you should fit the model with the original count/integer values and add offset(log(effort_var)) to the formula where effort_var is the variable you divided the original response by to get mean.



Related Topics



Leave a reply



Submit