Estimate regression coefficients based on Full Information Maximum Likelihood Estimation, which can couple missing data, including response missing or covariates missing.

fimlreg(...)

  # S3 method for formula
fimlreg(formula, data=NULL, ...)
  # S3 method for numeric
fimlreg(Y, X, ...)

Arguments

formula

an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted. The details of model specification are given under 'Details'.

Y

a numeric vector, the reponse variable.

X

a numeric matrix that may include NAs, the covariate matrix.

data

an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which clse is called.

...

Optional arguments.

Details

Note that arguments ... of stats::nlm are the parameters of algorithm, see the details in help file of "nlm". "fimlreg" can cople with any type of missing data.

Value

Return a list including following components:

beta

A named vector of coefficients

formula

The formula used

data

The raw data

Author

Liu Wei

See also

Examples

data(nhanes) ## example one: include missing value fiml1 <- fimlreg(age~., data=nhanes) print(fiml1)
#> $beta #> intercept bmi hyp chl #> 2.37216291 -0.13518966 0.46886921 0.01253721 #> #> $formula #> age ~ . #> <environment: 0x00000000168f1200> #>
# example two: No missing vlaue ## example two: No missing value n <- 100 group <- rnorm(n, sd=4) weight <- 3.2*group + 1.5 + rnorm(n, sd=0.1) fimllm <- fimlreg(weight~group, data=data.frame(weight=weight, group=group)) print(fimllm)
#> $beta #> intercept group #> 1.511669 3.199354 #> #> $formula #> weight ~ group #> <environment: 0x00000000168f1200> #>