This function estimates maximum likelihood models (e.g., Poisson or Logit) and is efficient to handle fixed effects (i.e. cluster variables). It further allows for nonlinear right hand sides.

1 2 3 4 |

`linear.fml` |
A formula. The linear formula to be estimated. |

`family` |
Character scalar. It should provide the family. Currently |

`data` |
A data.frame containing the necessary variables to run the model. The variables of the non-linear right hand side of the formula are identified with this data.frame names. Note that no NA is allowed. |

`start` |
A list. Starting values for the non-linear parameters. ALL the parameters are to be named and given a staring value. Example: |

`dummy` |
Character vector. The name/s of a/some variable/s within the dataset. These variables should contain the identifier of each observation (e.g., think of it as a panel identifier). |

`linear.start` |
Numeric named vector. The starting values of the linear part. If it is just a numeric scalar, all coefficients are set to |

`useHessian` |
Logical. (Only if omptimization method is |

`opt_method` |
Character scalar. Which optimization method should be used. Either |

`opt.control` |
List of elements to be passed to the optimization method (nlminb or optim). |

`optim.method` |
Character scalar. If |

`debug` |
Logical. If |

`...` |
Not currently used. |

An `feNmlm`

object.

`coef` |
The coefficients. |

`coeftable` |
The table of the coefficients with their standard errors, z-values and p-values. |

`loglik` |
The loglikelihood. |

`iterations` |
Number of iterations of the algorithm. |

`n` |
The number of observations. |

`k` |
The number of parameters of the model. |

`call` |
The call. |

`nonlinear.fml` |
The nonlinear formula of the call. It also contains the dependent variable. |

`linear.formula` |
The linear formula of the call. |

`ll_null` |
Log-likelyhood of the null model |

`pseudo_r2` |
The adjusted pseudo R2. |

`naive.r2` |
The R2 as if the expected predictor was the linear predictor in OLS. |

`message` |
The convergence message from the optimization procedures. |

`sq.cor` |
Squared correlation between the dependent variable and its expected value as given by the optimization. |

`expected.predictor` |
The expected predictor is the expected value of the dependent variable. |

`cov.unscaled` |
The variance covariance matrix of the parameters. |

`sd` |
The standard error of the parameters. |

Laurent Berge

See also `feNmlm`

.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | ```
#The data
n = 100
x = rnorm(n,1,5)**2
y = rnorm(n,-1,5)**2
z = rpois(n,x*y)
base = data.frame(x,y,z)
# Results of the Poisson..
est_poisson = femlm(z~log(x)+log(y),base,family="poisson")
# .. and of the Negative Binomial
est_negbin = femlm(z~log(x)+log(y),base,family="negbin")
# Displaying the results
est_poisson
est_negbin
# Changing the way the standard errors are computed:
summary(est_poisson,sd="white")
summary(est_negbin,sd="white")
#
# Now with dummies
#
# Bilateral network
nb = 20
n = nb**2
k = nb
id1 = factor(rep(1:k,each=n/k))
id2 = factor(rep(1:(n/k),times=k))
x = rnorm(n,1,5)**2
y = rnorm(n,-1,5)**2
z = rpois(n,x*y+rnorm(n,sd = 3)**2)
base = data.frame(x,y,z,id1,id2)
# We want to use the ID's of each observation as a variable: we use the option dummy
est_poisson = femlm(z~log(x)+log(y),base,family="poisson",dummy=c("id1","id2"))
# Displaying the results with twoway clustered santard-errors
print(est_poisson,"t")
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.