[R] using transcan for imputation, categorical variable
Frank E Harrell Jr
f.harrell at vanderbilt.edu
Wed Sep 26 19:02:43 CEST 2007
Cary Dehing-Oberije wrote:
> Dear all,
>
> I am using transcan to impute missing values (single imputation). I have
> several dichotomous variables in my dataset, but when I try to impute
> the missings sometimes values are imputed that were originally not in
> the dataset. So, a variable with 2 values (severe weight loss or
> no/limited weight loss) for example coded 0 and 1, shows 3 different
> values after imputation (0, 1 and 2).
>
> I have tried two options:
>
> impfile <- transcan (~age + factor(dumgend) +factor(dumcomorb25_i) +
> factor(dumwght) + factor(dumsmok)
> I(lngtvextra) + eqd2t_i + factor(chemo)+ factor(stage),data=surv.df,
> imputed=TRUE )
>
> and this one (with categorical="dumwght")
>
> impfile <- transcan (~age + factor(dumgend) +factor(dumcomorb25_i) +
> factor(dumwght) + factor(dumsmok)
> I(lngtvextra) + eqd2t_i + factor(chemo) + factor(stage),data=surv.df,
> categorical=("dumwght"), imputed=TRUE )
>
> Have can I handle this problem?
>
> Thanks for your help.
>
> Cary
When a variable is a factor, transcan only imputes actual values.
Please create a tiny example replicating your problem using simulated
data, and I'll take a further look.
Frank
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
Frank E Harrell Jr Professor and Chair School of Medicine
Department of Biostatistics Vanderbilt University
More information about the R-help
mailing list