PIKAL Petr
2018-Oct-08 14:26 UTC
[R] Problems to obtain standardized betas in multiply-imputed data
Hi as I wrote I am not an expert in multiple imputation and others are probably more capable to give you an answer so please keep your emails coppied to the list. The error message is straightforward and clear - object has to be of class lm My wild guess is that you must not use the whole object "imp" but only the imputed data.frame. It is probably time for you to read documentation to mice package. It seems to me, that you can get data frame from mice object by function ?complete and use that filled data frame for your lm model and lm.beta. But I may be completely wrong, I do not have any experience with mice. Cheers Petr> -----Original Message----- > From: CHATTON Anne <Anne.Chatton at hcuge.ch> > Sent: Monday, October 8, 2018 12:52 PM > To: PIKAL Petr <petr.pikal at precheza.cz> > Subject: RE: Problems to obtain standardized betas in multiply-imputed data > > Hi Petr, > I apologize for the late reply and thank you very much for your judicious > remarks. > As you appropriately say, I also suspect that 'FitImp' is not an lm object. But the > question of how to obtain these standardized values in the context of multiple > imputations still remains. > As requested, I am sending you herewith the output of the 'str' functions: > > imp = mice(Data, method = "norm.predict", m=5, seed=100, print=FALSE) > FitImp <- with(imp,lm(y ~ x1 + x2 + x3)) > sdBeta <- lm.beta(FitImp) > Error in lm.beta(FitImp) : object has to be of class lm > > > str(Data) > 'data.frame': 996 obs. of 4 variables: > $ x3: num 18 18 18 18 18 19 19 19 19 20 ... > $ x2: num 12 27 20 55 31 24 43 31 25 43 ... > $ x1: num NA NA NA NA NA NA NA NA NA NA ... > $ y : num NA NA NA NA NA NA NA NA NA NA ... > - attr(*, "variable.labels")= Named chr > ..- attr(*, "names")= chr > - attr(*, "codepage")= int 65001 > > > str(imp) > List of 21 > $ data :'data.frame': 996 obs. of 4 variables: > ..$ x3: num [1:996] 18 18 18 18 18 19 19 19 19 20 ... > ..$ x2: num [1:996] 12 27 20 55 31 24 43 31 25 43 ... > ..$ x1: num [1:996] NA NA NA NA NA NA NA NA NA NA ... > ..$ y : num [1:996] NA NA NA NA NA NA NA NA NA NA ... > ..- attr(*, "variable.labels")= Named chr(0) > .. ..- attr(*, "names")= chr(0) > ..- attr(*, "codepage")= int 65001 > $ imp :List of 4 > ..$ x3:'data.frame': 2 obs. of 5 variables: > .. ..$ 1: num [1:2] 26.6 33.9 > .. ..$ 2: num [1:2] 26.6 33.9 > .. ..$ 3: num [1:2] 26.6 33.9 > .. ..$ 4: num [1:2] 26.6 33.9 > .. ..$ 5: num [1:2] 26.6 33.9 > ..$ x2:'data.frame': 2 obs. of 5 variables: > .. ..$ 1: num [1:2] 34.2 33.1 > .. ..$ 2: num [1:2] 34.4 32.6 > .. ..$ 3: num [1:2] 34 32.9 > .. ..$ 4: num [1:2] 34.1 33.2 > .. ..$ 5: num [1:2] 34.5 34.3 > ..$ x1:'data.frame': 245 obs. of 5 variables: > .. ..$ 1: num [1:245] 6.39 12.97 9.9 25.32 14.5 ... > .. ..$ 2: num [1:245] 6.07 12.81 9.79 25.51 14.7 ... > .. ..$ 3: num [1:245] 6.39 12.79 9.54 25.41 14.63 ... > .. ..$ 4: num [1:245] 5.95 12.82 9.85 25.78 14.69 ... > .. ..$ 5: num [1:245] 5.83 13.01 9.76 25.49 14.7 ... > ..$ y :'data.frame': 244 obs. of 5 variables: > .. ..$ 1: num [1:244] 56.2 71.6 64.4 100.6 75.6 ... > .. ..$ 2: num [1:244] 55.9 71.5 64.3 100.8 75.8 ... > .. ..$ 3: num [1:244] 56.2 71.5 64.1 100.7 75.7 ... > .. ..$ 4: num [1:244] 55.8 71.5 64.4 101 75.7 ... > .. ..$ 5: num [1:244] 55.7 71.7 64.3 100.7 75.8 ... > $ m : num 5 > $ where : logi [1:996, 1:4] FALSE FALSE FALSE FALSE FALSE FALSE ... > ..- attr(*, "dimnames")=List of 2 > .. ..$ : chr [1:996] "1" "2" "3" "4" ... > .. ..$ : chr [1:4] "x3" "x2" "x1" "y" > $ blocks :List of 4 > ..$ x3: chr "x3" > ..$ x2: chr "x2" > ..$ x1: chr "x1" > ..$ y : chr "y" > ..- attr(*, "calltype")= Named chr [1:4] "type" "type" "type" "type" > .. ..- attr(*, "names")= chr [1:4] "x3" "x2" "x1" "y" > $ call : language mice(data = Data, m = 5, method = "norm.predict", > printFlag = FALSE, seed = 100) > $ nmis : Named int [1:4] 2 2 245 244 > ..- attr(*, "names")= chr [1:4] "x3" "x2" "x1" "y" > $ method : Named chr [1:4] "norm.predict" "norm.predict" > "norm.predict" "norm.predict" > ..- attr(*, "names")= chr [1:4] "x3" "x2" "x1" "y" > $ predictorMatrix: num [1:4, 1:4] 0 1 1 1 1 0 1 1 1 1 ... > ..- attr(*, "dimnames")=List of 2 > .. ..$ : chr [1:4] "x3" "x2" "x1" "y" > .. ..$ : chr [1:4] "x3" "x2" "x1" "y" > $ visitSequence : chr [1:4] "x3" "x2" "x1" "y" > $ formulas :List of 4 > ..$ x3:Class 'formula' language x3 ~ 0 + x2 + x1 + y > .. .. ..- attr(*, ".Environment")=<environment: 0x000000000f0139c8> > ..$ x2:Class 'formula' language x2 ~ 0 + x3 + x1 + y > .. .. ..- attr(*, ".Environment")=<environment: 0x000000000f0139c8> > ..$ x1:Class 'formula' language x1 ~ 0 + x3 + x2 + y > .. .. ..- attr(*, ".Environment")=<environment: 0x000000000f0139c8> > ..$ y :Class 'formula' language y ~ 0 + x3 + x2 + x1 > .. .. ..- attr(*, ".Environment")=<environment: 0x000000000f0139c8> > $ post : Named chr [1:4] "" "" "" "" > ..- attr(*, "names")= chr [1:4] "x3" "x2" "x1" "y" > $ blots :List of 4 > ..$ x3: list() > ..$ x2: list() > ..$ x1: list() > ..$ y : list() > $ seed : num 100 > $ iteration : num 5 > $ lastSeedValue : int [1:626] 403 593 2082529872 -1076659723 770353271 - > 83917670 1999705384 1490542154 -151817264 1924404941 ... > $ chainMean : num [1:4, 1:5, 1:5] 31 32.6 15.2 73.1 30.4 ... > ..- attr(*, "dimnames")=List of 3 > .. ..$ : chr [1:4] "x3" "x2" "x1" "y" > .. ..$ : chr [1:5] "1" "2" "3" "4" ... > .. ..$ : chr [1:5] "Chain 1" "Chain 2" "Chain 3" "Chain 4" ... > $ chainVar : num [1:4, 1:5, 1:5] 19.621 0.105 80.049 116.363 20.278 ... > ..- attr(*, "dimnames")=List of 3 > .. ..$ : chr [1:4] "x3" "x2" "x1" "y" > .. ..$ : chr [1:5] "1" "2" "3" "4" ... > .. ..$ : chr [1:5] "Chain 1" "Chain 2" "Chain 3" "Chain 4" ... > $ loggedEvents : NULL > $ version :Classes 'package_version', 'numeric_version' hidden list of 1 > ..$ : int [1:3] 3 3 0 > $ date : Date[1:1], format: "2018-10-08" > - attr(*, "class")= chr "mids" > > > str(FitImp) > List of 4 > $ call : language with.mids(data = imp, expr = lm(y ~ x1 + x2 + x3)) > $ call1 : language mice(data = Data, m = 5, method = "norm.predict", > printFlag = FALSE, seed = 100) > $ nmis : Named int [1:4] 2 2 245 244 > ..- attr(*, "names")= chr [1:4] "x3" "x2" "x1" "y" > $ analyses:List of 5 > ..$ :List of 12 > .. ..$ coefficients : Named num [1:4] 44.917 0.957 0.611 -0.121 > .. .. ..- attr(*, "names")= chr [1:4] "(Intercept)" "x1" "x2" "x3" > .. ..$ residuals : Named num [1:996] 4.14e-12 -7.53e-13 -7.10e-14 2.89e-14 > 1.33e-14 ... > .. .. ..- attr(*, "names")= chr [1:996] "1" "2" "3" "4" ... > .. ..$ effects : Named num [1:996] -2.34e+03 4.44e+02 1.94e+02 -4.41e+01 > -1.07e-13 ... > .. .. ..- attr(*, "names")= chr [1:996] "(Intercept)" "x1" "x2" "x3" ... > .. ..$ rank : int 4 > .. ..$ fitted.values: Named num [1:996] 56.2 71.6 64.4 100.6 75.6 ... > .. .. ..- attr(*, "names")= chr [1:996] "1" "2" "3" "4" ... > .. ..$ assign : int [1:4] 0 1 2 3 > .. ..$ qr :List of 5 > .. .. ..$ qr : num [1:996, 1:4] -31.5595 0.0317 0.0317 0.0317 0.0317 ... > .. .. .. ..- attr(*, "dimnames")=List of 2 > .. .. .. .. ..$ : chr [1:996] "1" "2" "3" "4" ... > .. .. .. .. ..$ : chr [1:4] "(Intercept)" "x1" "x2" "x3" > .. .. .. ..- attr(*, "assign")= int [1:4] 0 1 2 3 > .. .. ..$ qraux: num [1:4] 1.03 1 1.03 1.04 > .. .. ..$ pivot: int [1:4] 1 2 3 4 > .. .. ..$ tol : num 1e-07 > .. .. ..$ rank : int 4 > .. .. ..- attr(*, "class")= chr "qr" > .. ..$ df.residual : int 992 > .. ..$ xlevels : Named list() > .. ..$ call : language lm(formula = y ~ x1 + x2 + x3) > .. ..$ terms :Classes 'terms', 'formula' language y ~ x1 + x2 + x3 > .. .. .. ..- attr(*, "variables")= language list(y, x1, x2, x3) > .. .. .. ..- attr(*, "factors")= int [1:4, 1:3] 0 1 0 0 0 0 1 0 0 0 ... > .. .. .. .. ..- attr(*, "dimnames")=List of 2 > .. .. .. .. .. ..$ : chr [1:4] "y" "x1" "x2" "x3" > .. .. .. .. .. ..$ : chr [1:3] "x1" "x2" "x3" > .. .. .. ..- attr(*, "term.labels")= chr [1:3] "x1" "x2" "x3" > .. .. .. ..- attr(*, "order")= int [1:3] 1 1 1 > .. .. .. ..- attr(*, "intercept")= int 1 > .. .. .. ..- attr(*, "response")= int 1 > .. .. .. ..- attr(*, ".Environment")=<environment: 0x000000000eeefd48> > .. .. .. ..- attr(*, "predvars")= language list(y, x1, x2, x3) > .. .. .. ..- attr(*, "dataClasses")= Named chr [1:4] "numeric" "numeric" > "numeric" "numeric" > .. .. .. .. ..- attr(*, "names")= chr [1:4] "y" "x1" "x2" "x3" > .. ..$ model :'data.frame': 996 obs. of 4 variables: > .. .. ..$ y : num [1:996] 56.2 71.6 64.4 100.6 75.6 ... > .. .. ..$ x1: num [1:996] 6.39 12.97 9.9 25.32 14.5 ... > .. .. ..$ x2: num [1:996] 12 27 20 55 31 24 43 31 25 43 ... > .. .. ..$ x3: num [1:996] 18 18 18 18 18 19 19 19 19 20 ... > .. .. ..- attr(*, "terms")=Classes 'terms', 'formula' language y ~ x1 + x2 + x3 > .. .. .. .. ..- attr(*, "variables")= language list(y, x1, x2, x3) > .. .. .. .. ..- attr(*, "factors")= int [1:4, 1:3] 0 1 0 0 0 0 1 0 0 0 ... > .. .. .. .. .. ..- attr(*, "dimnames")=List of 2 > .. .. .. .. .. .. ..$ : chr [1:4] "y" "x1" "x2" "x3" > .. .. .. .. .. .. ..$ : chr [1:3] "x1" "x2" "x3" > .. .. .. .. ..- attr(*, "term.labels")= chr [1:3] "x1" "x2" "x3" > .. .. .. .. ..- attr(*, "order")= int [1:3] 1 1 1 > .. .. .. .. ..- attr(*, "intercept")= int 1 > .. .. .. .. ..- attr(*, "response")= int 1 > .. .. .. .. ..- attr(*, ".Environment")=<environment: 0x000000000eeefd48> > .. .. .. .. ..- attr(*, "predvars")= language list(y, x1, x2, x3) > .. .. .. .. ..- attr(*, "dataClasses")= Named chr [1:4] "numeric" "numeric" > "numeric" "numeric" > .. .. .. .. .. ..- attr(*, "names")= chr [1:4] "y" "x1" "x2" "x3" > .. ..- attr(*, "class")= chr "lm" > ..$ :List of 12 > .. ..$ coefficients : Named num [1:4] 44.917 0.957 0.611 -0.121 > .. .. ..- attr(*, "names")= chr [1:4] "(Intercept)" "x1" "x2" "x3" > .. ..$ residuals : Named num [1:996] 4.59e-12 -9.08e-15 -9.95e-14 -3.33e-14 > -1.88e-14 ... > .. .. ..- attr(*, "names")= chr [1:996] "1" "2" "3" "4" ... > .. ..$ effects : Named num [1:996] -2.34e+03 4.44e+02 1.94e+02 -4.41e+01 > -1.51e-13 ... > .. .. ..- attr(*, "names")= chr [1:996] "(Intercept)" "x1" "x2" "x3" ... > .. ..$ rank : int 4 > .. ..$ fitted.values: Named num [1:996] 55.9 71.5 64.3 100.8 75.8 ... > .. .. ..- attr(*, "names")= chr [1:996] "1" "2" "3" "4" ... > .. ..$ assign : int [1:4] 0 1 2 3 > .. ..$ qr :List of 5 > .. .. ..$ qr : num [1:996, 1:4] -31.5595 0.0317 0.0317 0.0317 0.0317 ... > .. .. .. ..- attr(*, "dimnames")=List of 2 > .. .. .. .. ..$ : chr [1:996] "1" "2" "3" "4" ... > .. .. .. .. ..$ : chr [1:4] "(Intercept)" "x1" "x2" "x3" > .. .. .. ..- attr(*, "assign")= int [1:4] 0 1 2 3 > .. .. ..$ qraux: num [1:4] 1.03 1 1.03 1.04 > .. .. ..$ pivot: int [1:4] 1 2 3 4 > .. .. ..$ tol : num 1e-07 > .. .. ..$ rank : int 4 > .. .. ..- attr(*, "class")= chr "qr" > .. ..$ df.residual : int 992 > .. ..$ xlevels : Named list() > .. ..$ call : language lm(formula = y ~ x1 + x2 + x3) > .. ..$ terms :Classes 'terms', 'formula' language y ~ x1 + x2 + x3 > .. .. .. ..- attr(*, "variables")= language list(y, x1, x2, x3) > .. .. .. ..- attr(*, "factors")= int [1:4, 1:3] 0 1 0 0 0 0 1 0 0 0 ... > .. .. .. .. ..- attr(*, "dimnames")=List of 2 > .. .. .. .. .. ..$ : chr [1:4] "y" "x1" "x2" "x3" > .. .. .. .. .. ..$ : chr [1:3] "x1" "x2" "x3" > .. .. .. ..- attr(*, "term.labels")= chr [1:3] "x1" "x2" "x3" > .. .. .. ..- attr(*, "order")= int [1:3] 1 1 1 > .. .. .. ..- attr(*, "intercept")= int 1 > .. .. .. ..- attr(*, "response")= int 1 > .. .. .. ..- attr(*, ".Environment")=<environment: 0x000000000ee25f90> > .. .. .. ..- attr(*, "predvars")= language list(y, x1, x2, x3) > .. .. .. ..- attr(*, "dataClasses")= Named chr [1:4] "numeric" "numeric" > "numeric" "numeric" > .. .. .. .. ..- attr(*, "names")= chr [1:4] "y" "x1" "x2" "x3" > .. ..$ model :'data.frame': 996 obs. of 4 variables: > .. .. ..$ y : num [1:996] 55.9 71.5 64.3 100.8 75.8 ... > .. .. ..$ x1: num [1:996] 6.07 12.81 9.79 25.51 14.7 ... > .. .. ..$ x2: num [1:996] 12 27 20 55 31 24 43 31 25 43 ... > .. .. ..$ x3: num [1:996] 18 18 18 18 18 19 19 19 19 20 ... > .. .. ..- attr(*, "terms")=Classes 'terms', 'formula' language y ~ x1 + x2 + x3 > .. .. .. .. ..- attr(*, "variables")= language list(y, x1, x2, x3) > .. .. .. .. ..- attr(*, "factors")= int [1:4, 1:3] 0 1 0 0 0 0 1 0 0 0 ... > .. .. .. .. .. ..- attr(*, "dimnames")=List of 2 > .. .. .. .. .. .. ..$ : chr [1:4] "y" "x1" "x2" "x3" > .. .. .. .. .. .. ..$ : chr [1:3] "x1" "x2" "x3" > .. .. .. .. ..- attr(*, "term.labels")= chr [1:3] "x1" "x2" "x3" > .. .. .. .. ..- attr(*, "order")= int [1:3] 1 1 1 > .. .. .. .. ..- attr(*, "intercept")= int 1 > .. .. .. .. ..- attr(*, "response")= int 1 > .. .. .. .. ..- attr(*, ".Environment")=<environment: 0x000000000ee25f90> > .. .. .. .. ..- attr(*, "predvars")= language list(y, x1, x2, x3) > .. .. .. .. ..- attr(*, "dataClasses")= Named chr [1:4] "numeric" "numeric" > "numeric" "numeric" > .. .. .. .. .. ..- attr(*, "names")= chr [1:4] "y" "x1" "x2" "x3" > .. ..- attr(*, "class")= chr "lm" > ..$ :List of 12 > .. ..$ coefficients : Named num [1:4] 44.917 0.957 0.611 -0.121 > .. .. ..- attr(*, "names")= chr [1:4] "(Intercept)" "x1" "x2" "x3" > .. ..$ residuals : Named num [1:996] 3.54e-12 -9.01e-14 -6.32e-14 1.80e-14 > 1.59e-14 ... > .. .. ..- attr(*, "names")= chr [1:996] "1" "2" "3" "4" ... > .. ..$ effects : Named num [1:996] -2.34e+03 4.44e+02 1.94e+02 -4.41e+01 > -8.79e-14 ... > .. .. ..- attr(*, "names")= chr [1:996] "(Intercept)" "x1" "x2" "x3" ... > .. ..$ rank : int 4 > .. ..$ fitted.values: Named num [1:996] 56.2 71.5 64.1 100.7 75.7 ... > .. .. ..- attr(*, "names")= chr [1:996] "1" "2" "3" "4" ... > .. ..$ assign : int [1:4] 0 1 2 3 > .. ..$ qr :List of 5 > .. .. ..$ qr : num [1:996, 1:4] -31.5595 0.0317 0.0317 0.0317 0.0317 ... > .. .. .. ..- attr(*, "dimnames")=List of 2 > .. .. .. .. ..$ : chr [1:996] "1" "2" "3" "4" ... > .. .. .. .. ..$ : chr [1:4] "(Intercept)" "x1" "x2" "x3" > .. .. .. ..- attr(*, "assign")= int [1:4] 0 1 2 3 > .. .. ..$ qraux: num [1:4] 1.03 1 1.03 1.04 > .. .. ..$ pivot: int [1:4] 1 2 3 4 > .. .. ..$ tol : num 1e-07 > .. .. ..$ rank : int 4 > .. .. ..- attr(*, "class")= chr "qr" > .. ..$ df.residual : int 992 > .. ..$ xlevels : Named list() > .. ..$ call : language lm(formula = y ~ x1 + x2 + x3) > .. ..$ terms :Classes 'terms', 'formula' language y ~ x1 + x2 + x3 > .. .. .. ..- attr(*, "variables")= language list(y, x1, x2, x3) > .. .. .. ..- attr(*, "factors")= int [1:4, 1:3] 0 1 0 0 0 0 1 0 0 0 ... > .. .. .. .. ..- attr(*, "dimnames")=List of 2 > .. .. .. .. .. ..$ : chr [1:4] "y" "x1" "x2" "x3" > .. .. .. .. .. ..$ : chr [1:3] "x1" "x2" "x3" > .. .. .. ..- attr(*, "term.labels")= chr [1:3] "x1" "x2" "x3" > .. .. .. ..- attr(*, "order")= int [1:3] 1 1 1 > .. .. .. ..- attr(*, "intercept")= int 1 > .. .. .. ..- attr(*, "response")= int 1 > .. .. .. ..- attr(*, ".Environment")=<environment: 0x000000000c2916d0> > .. .. .. ..- attr(*, "predvars")= language list(y, x1, x2, x3) > .. .. .. ..- attr(*, "dataClasses")= Named chr [1:4] "numeric" "numeric" > "numeric" "numeric" > .. .. .. .. ..- attr(*, "names")= chr [1:4] "y" "x1" "x2" "x3" > .. ..$ model :'data.frame': 996 obs. of 4 variables: > .. .. ..$ y : num [1:996] 56.2 71.5 64.1 100.7 75.7 ... > .. .. ..$ x1: num [1:996] 6.39 12.79 9.54 25.41 14.63 ... > .. .. ..$ x2: num [1:996] 12 27 20 55 31 24 43 31 25 43 ... > .. .. ..$ x3: num [1:996] 18 18 18 18 18 19 19 19 19 20 ... > .. .. ..- attr(*, "terms")=Classes 'terms', 'formula' language y ~ x1 + x2 + x3 > .. .. .. .. ..- attr(*, "variables")= language list(y, x1, x2, x3) > .. .. .. .. ..- attr(*, "factors")= int [1:4, 1:3] 0 1 0 0 0 0 1 0 0 0 ... > .. .. .. .. .. ..- attr(*, "dimnames")=List of 2 > .. .. .. .. .. .. ..$ : chr [1:4] "y" "x1" "x2" "x3" > .. .. .. .. .. .. ..$ : chr [1:3] "x1" "x2" "x3" > .. .. .. .. ..- attr(*, "term.labels")= chr [1:3] "x1" "x2" "x3" > .. .. .. .. ..- attr(*, "order")= int [1:3] 1 1 1 > .. .. .. .. ..- attr(*, "intercept")= int 1 > .. .. .. .. ..- attr(*, "response")= int 1 > .. .. .. .. ..- attr(*, ".Environment")=<environment: 0x000000000c2916d0> > .. .. .. .. ..- attr(*, "predvars")= language list(y, x1, x2, x3) > .. .. .. .. ..- attr(*, "dataClasses")= Named chr [1:4] "numeric" "numeric" > "numeric" "numeric" > .. .. .. .. .. ..- attr(*, "names")= chr [1:4] "y" "x1" "x2" "x3" > .. ..- attr(*, "class")= chr "lm" > ..$ :List of 12 > .. ..$ coefficients : Named num [1:4] 44.917 0.957 0.611 -0.121 > .. .. ..- attr(*, "names")= chr [1:4] "(Intercept)" "x1" "x2" "x3" > .. ..$ residuals : Named num [1:996] 4.33e-12 1.59e-12 -4.68e-13 7.83e-14 > 2.85e-15 ... > .. .. ..- attr(*, "names")= chr [1:996] "1" "2" "3" "4" ... > .. ..$ effects : Named num [1:996] -2.34e+03 4.44e+02 1.94e+02 -4.41e+01 > -1.27e-13 ... > .. .. ..- attr(*, "names")= chr [1:996] "(Intercept)" "x1" "x2" "x3" ... > .. ..$ rank : int 4 > .. ..$ fitted.values: Named num [1:996] 55.8 71.5 64.4 101 75.7 ... > .. .. ..- attr(*, "names")= chr [1:996] "1" "2" "3" "4" ... > .. ..$ assign : int [1:4] 0 1 2 3 > .. ..$ qr :List of 5 > .. .. ..$ qr : num [1:996, 1:4] -31.5595 0.0317 0.0317 0.0317 0.0317 ... > .. .. .. ..- attr(*, "dimnames")=List of 2 > .. .. .. .. ..$ : chr [1:996] "1" "2" "3" "4" ... > .. .. .. .. ..$ : chr [1:4] "(Intercept)" "x1" "x2" "x3" > .. .. .. ..- attr(*, "assign")= int [1:4] 0 1 2 3 > .. .. ..$ qraux: num [1:4] 1.03 1 1.03 1.04 > .. .. ..$ pivot: int [1:4] 1 2 3 4 > .. .. ..$ tol : num 1e-07 > .. .. ..$ rank : int 4 > .. .. ..- attr(*, "class")= chr "qr" > .. ..$ df.residual : int 992 > .. ..$ xlevels : Named list() > .. ..$ call : language lm(formula = y ~ x1 + x2 + x3) > .. ..$ terms :Classes 'terms', 'formula' language y ~ x1 + x2 + x3 > .. .. .. ..- attr(*, "variables")= language list(y, x1, x2, x3) > .. .. .. ..- attr(*, "factors")= int [1:4, 1:3] 0 1 0 0 0 0 1 0 0 0 ... > .. .. .. .. ..- attr(*, "dimnames")=List of 2 > .. .. .. .. .. ..$ : chr [1:4] "y" "x1" "x2" "x3" > .. .. .. .. .. ..$ : chr [1:3] "x1" "x2" "x3" > .. .. .. ..- attr(*, "term.labels")= chr [1:3] "x1" "x2" "x3" > .. .. .. ..- attr(*, "order")= int [1:3] 1 1 1 > .. .. .. ..- attr(*, "intercept")= int 1 > .. .. .. ..- attr(*, "response")= int 1 > .. .. .. ..- attr(*, ".Environment")=<environment: 0x000000000e870a48> > .. .. .. ..- attr(*, "predvars")= language list(y, x1, x2, x3) > .. .. .. ..- attr(*, "dataClasses")= Named chr [1:4] "numeric" "numeric" > "numeric" "numeric" > .. .. .. .. ..- attr(*, "names")= chr [1:4] "y" "x1" "x2" "x3" > .. ..$ model :'data.frame': 996 obs. of 4 variables: > .. .. ..$ y : num [1:996] 55.8 71.5 64.4 101 75.7 ... > .. .. ..$ x1: num [1:996] 5.95 12.82 9.85 25.78 14.69 ... > .. .. ..$ x2: num [1:996] 12 27 20 55 31 24 43 31 25 43 ... > .. .. ..$ x3: num [1:996] 18 18 18 18 18 19 19 19 19 20 ... > .. .. ..- attr(*, "terms")=Classes 'terms', 'formula' language y ~ x1 + x2 + x3 > .. .. .. .. ..- attr(*, "variables")= language list(y, x1, x2, x3) > .. .. .. .. ..- attr(*, "factors")= int [1:4, 1:3] 0 1 0 0 0 0 1 0 0 0 ... > .. .. .. .. .. ..- attr(*, "dimnames")=List of 2 > .. .. .. .. .. .. ..$ : chr [1:4] "y" "x1" "x2" "x3" > .. .. .. .. .. .. ..$ : chr [1:3] "x1" "x2" "x3" > .. .. .. .. ..- attr(*, "term.labels")= chr [1:3] "x1" "x2" "x3" > .. .. .. .. ..- attr(*, "order")= int [1:3] 1 1 1 > .. .. .. .. ..- attr(*, "intercept")= int 1 > .. .. .. .. ..- attr(*, "response")= int 1 > .. .. .. .. ..- attr(*, ".Environment")=<environment: 0x000000000e870a48> > .. .. .. .. ..- attr(*, "predvars")= language list(y, x1, x2, x3) > .. .. .. .. ..- attr(*, "dataClasses")= Named chr [1:4] "numeric" "numeric" > "numeric" "numeric" > .. .. .. .. .. ..- attr(*, "names")= chr [1:4] "y" "x1" "x2" "x3" > .. ..- attr(*, "class")= chr "lm" > ..$ :List of 12 > .. ..$ coefficients : Named num [1:4] 44.917 0.957 0.611 -0.121 > .. .. ..- attr(*, "names")= chr [1:4] "(Intercept)" "x1" "x2" "x3" > .. ..$ residuals : Named num [1:996] 4.78e-12 2.82e-12 -2.51e-13 -1.75e-16 > 6.59e-15 ... > .. .. ..- attr(*, "names")= chr [1:996] "1" "2" "3" "4" ... > .. ..$ effects : Named num [1:996] -2.34e+03 4.44e+02 1.94e+02 -4.41e+01 > -1.35e-13 ... > .. .. ..- attr(*, "names")= chr [1:996] "(Intercept)" "x1" "x2" "x3" ... > .. ..$ rank : int 4 > .. ..$ fitted.values: Named num [1:996] 55.7 71.7 64.3 100.7 75.8 ... > .. .. ..- attr(*, "names")= chr [1:996] "1" "2" "3" "4" ... > .. ..$ assign : int [1:4] 0 1 2 3 > .. ..$ qr :List of 5 > .. .. ..$ qr : num [1:996, 1:4] -31.5595 0.0317 0.0317 0.0317 0.0317 ... > .. .. .. ..- attr(*, "dimnames")=List of 2 > .. .. .. .. ..$ : chr [1:996] "1" "2" "3" "4" ... > .. .. .. .. ..$ : chr [1:4] "(Intercept)" "x1" "x2" "x3" > .. .. .. ..- attr(*, "assign")= int [1:4] 0 1 2 3 > .. .. ..$ qraux: num [1:4] 1.03 1 1.03 1.04 > .. .. ..$ pivot: int [1:4] 1 2 3 4 > .. .. ..$ tol : num 1e-07 > .. .. ..$ rank : int 4 > .. .. ..- attr(*, "class")= chr "qr" > .. ..$ df.residual : int 992 > .. ..$ xlevels : Named list() > .. ..$ call : language lm(formula = y ~ x1 + x2 + x3) > .. ..$ terms :Classes 'terms', 'formula' language y ~ x1 + x2 + x3 > .. .. .. ..- attr(*, "variables")= language list(y, x1, x2, x3) > .. .. .. ..- attr(*, "factors")= int [1:4, 1:3] 0 1 0 0 0 0 1 0 0 0 ... > .. .. .. .. ..- attr(*, "dimnames")=List of 2 > .. .. .. .. .. ..$ : chr [1:4] "y" "x1" "x2" "x3" > .. .. .. .. .. ..$ : chr [1:3] "x1" "x2" "x3" > .. .. .. ..- attr(*, "term.labels")= chr [1:3] "x1" "x2" "x3" > .. .. .. ..- attr(*, "order")= int [1:3] 1 1 1 > .. .. .. ..- attr(*, "intercept")= int 1 > .. .. .. ..- attr(*, "response")= int 1 > .. .. .. ..- attr(*, ".Environment")=<environment: 0x000000000c5b6b88> > .. .. .. ..- attr(*, "predvars")= language list(y, x1, x2, x3) > .. .. .. ..- attr(*, "dataClasses")= Named chr [1:4] "numeric" "numeric" > "numeric" "numeric" > .. .. .. .. ..- attr(*, "names")= chr [1:4] "y" "x1" "x2" "x3" > .. ..$ model :'data.frame': 996 obs. of 4 variables: > .. .. ..$ y : num [1:996] 55.7 71.7 64.3 100.7 75.8 ... > .. .. ..$ x1: num [1:996] 5.83 13.01 9.76 25.49 14.7 ... > .. .. ..$ x2: num [1:996] 12 27 20 55 31 24 43 31 25 43 ... > .. .. ..$ x3: num [1:996] 18 18 18 18 18 19 19 19 19 20 ... > .. .. ..- attr(*, "terms")=Classes 'terms', 'formula' language y ~ x1 + x2 + x3 > .. .. .. .. ..- attr(*, "variables")= language list(y, x1, x2, x3) > .. .. .. .. ..- attr(*, "factors")= int [1:4, 1:3] 0 1 0 0 0 0 1 0 0 0 ... > .. .. .. .. .. ..- attr(*, "dimnames")=List of 2 > .. .. .. .. .. .. ..$ : chr [1:4] "y" "x1" "x2" "x3" > .. .. .. .. .. .. ..$ : chr [1:3] "x1" "x2" "x3" > .. .. .. .. ..- attr(*, "term.labels")= chr [1:3] "x1" "x2" "x3" > .. .. .. .. ..- attr(*, "order")= int [1:3] 1 1 1 > .. .. .. .. ..- attr(*, "intercept")= int 1 > .. .. .. .. ..- attr(*, "response")= int 1 > .. .. .. .. ..- attr(*, ".Environment")=<environment: 0x000000000c5b6b88> > .. .. .. .. ..- attr(*, "predvars")= language list(y, x1, x2, x3) > .. .. .. .. ..- attr(*, "dataClasses")= Named chr [1:4] "numeric" "numeric" > "numeric" "numeric" > .. .. .. .. .. ..- attr(*, "names")= chr [1:4] "y" "x1" "x2" "x3" > .. ..- attr(*, "class")= chr "lm" > - attr(*, "class")= chr [1:2] "mira" "matrix" > > Thank you, > > Anne > > -----Message d'origine----- > De : PIKAL Petr [mailto:petr.pikal at precheza.cz] > Envoy? : jeudi, 27 septembre 2018 09:20 > ? : CHATTON Anne <Anne.Chatton at hcuge.ch> > Objet : RE: Problems to obtain standardized betas in multiply-imputed data > > Hi > > I am not an expert in multiple imputation but from mice help page the > resulting object is not a simple data frame. lm does not complain but maybe > FitImp is not "standard" lm object. > > Without detailed info about used objects it is difficult to tell what is reason for > error. > > You should send us result (or part) of > > str(data) > str(imp) > str(FitImp) > > to get better answer. > > Cheers > Petr > > > -----Original Message----- > > From: R-help <r-help-bounces at r-project.org> On Behalf Of CHATTON Anne > > via R-help > > Sent: Wednesday, September 26, 2018 10:43 AM > > To: r-help at r-project.org > > Subject: [R] Problems to obtain standardized betas in multiply-imputed > > data > > > > Dear all, > > > > I am having problems in obtaining standardized betas on a > > multiply-imputed data set. Here are the codes I used : > > imp = mice(data, 5, maxit=10, seed=42, print=FALSE) > > FitImp <- with(imp,lm(y ~ x1 + x2 + x3)) Up to here everything is fine. But > when > > I ask for the standardized coefficients of the multiply-imputed > > regressions using this command : > > sdBeta <- lm.beta(FitImp) > > I get the following error message: > > Error in b * sx : argument non num?rique pour un op?rateur binaire > > > > Can anyone help me with this please? > > > > Anne > > > > ______________________________________________ > > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > > 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. > Osobn? ?daje: Informace o zpracov?n? a ochran? osobn?ch ?daj? obchodn?ch > partner? PRECHEZA a.s. jsou zve?ejn?ny na: https://www.precheza.cz/zasady- > ochrany-osobnich-udaju/ | Information about processing and protection of > business partner?s personal data are available on website: > https://www.precheza.cz/en/personal-data-protection-principles/ > D?v?rnost: Tento e-mail a jak?koliv k n?mu p?ipojen? dokumenty jsou d?v?rn? > a podl?haj? tomuto pr?vn? z?vazn?mu prohl??en? o vylou?en? odpov?dnosti: > https://www.precheza.cz/01-dovetek/ | This email and any documents > attached to it may be confidential and are subject to the legally binding > disclaimer: https://www.precheza.cz/en/01-disclaimer/Osobn? ?daje: Informace o zpracov?n? a ochran? osobn?ch ?daj? obchodn?ch partner? PRECHEZA a.s. jsou zve?ejn?ny na: https://www.precheza.cz/zasady-ochrany-osobnich-udaju/ | Information about processing and protection of business partner?s personal data are available on website: https://www.precheza.cz/en/personal-data-protection-principles/ D?v?rnost: Tento e-mail a jak?koliv k n?mu p?ipojen? dokumenty jsou d?v?rn? a podl?haj? tomuto pr?vn? z?vazn?mu prohl??en? o vylou?en? odpov?dnosti: https://www.precheza.cz/01-dovetek/ | This email and any documents attached to it may be confidential and are subject to the legally binding disclaimer: https://www.precheza.cz/en/01-disclaimer/