user87562 - 2 months ago 13

R Question

I would like to use the R package

`smcfcs`

CRAN:https://cran.r-project.org/web/packages/smcfcs/smcfcs.pdf

Examples are as follows.

`imps <- smcfcs(ex_linquad, smtype="lm", smformula="y~z+x+xsq",`

method=c("","","norm","x^2",""))

imps <- smcfcs(ex_coxquad, smtype="coxph", smformula="Surv(t,d)~z+x+xsq",

method=c("","","","norm","x^2",""))

I cannot understand "method".

Does it means the type of explanatory or explained variables?

y and z is no type and x is norm type and xsq means squared type?

logreg means 0 or 1 ?

What does the mean of last ""?

Answer

Basically all information you request is already in the documentation.

https://cran.r-project.org/web/packages/smcfcs/smcfcs.pdf

For function **smcfcs**, parameter **method** you get the following information:

method: A required vector of strings specifying for each variable either that it does not need to be imputed (""), the type of regression model to be be used to impute. Possible values are "norm" (normal linear regression), "logreg" (logistic regression), "poisson" (Poisson regression), "podds" (proportional odds regression for ordered categorical variables), "mlogit" (multinomial logistic regression for unordered categorical variables), or a custom expression which defines a passively imputed variable, e.g. "x^2" or "x1*x2".

This means for the example:

```
imps <- smcfcs(ex_linquad, smtype="lm", smformula="y~z+x+xsq",
method=c("","","norm","x^2",""))
```

ex_linquad is the dataset that shall be imputed (comes with smcfcs package)

This dataset has 5 variables.

Accoring to the documentation method=c("","","norm","x^2","") means:

- Variable 1 wont be imputed: ""
- Variable 2 wont be imputed: ""
- For Variable 3 normal linear regression will be used: norm
- For Variable 4 a custom expression is used: x^2
- Variable 5 wont be imputed: ""