You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
first of all thanks a ton for providing marginal effects for R!
I've identified an issue when there's a survival object in the data set. data.table::rbindlist won't like it at the moment and throws an error. The issue happens even if the object is not in the model.
Thank you if you could take a look into this.
Cheers!
MCVE:
str(dat)
# 'data.frame': 5 obs. of 3 variables:# $ y: num -2.9816 1.6618 -0.0912 1.3168 0.7922# $ x: num 0.194 -1.116 -0.125 -0.679 -1.658# $ s: 'Surv' num [1:5, 1:3] 0- 0- 0- 0- ...# ..- attr(*, "dimnames")=List of 2# .. ..$ : NULL# .. ..$ : chr [1:3] "time1" "time2" "status"# ..- attr(*, "type")= chr "interval"fit1<- lm(y~x, dat) ## with survival object in datamargins::margins(fit1)
# Error in data.table::rbindlist(list(d0, d1)) : # Column 1 of item 1 is length 5 inconsistent with column 3 which is length 15. # Only length-1 columns are recycled.fit2<- lm(y~x, dat[-3]) ## survival object removed from data margins::margins(fit2)
# Average marginal effects# lm(formula = y ~ x, data = dat[-3])## x# -1.874## Datadat<- structure(list(y= c(-2.98156392748949, 1.66179894021854, -0.0912380677316067,
1.31682259604163, 0.792210663360883), x= c(0.194347777395277,
-1.11603405271533, -0.125314349609543, -0.679074978115255, -1.6581749663707
), s= structure(c(0, 0, 0, 0, 9, 1, 1, 1, 1, 1, 2, 2, 2, 2,
1), .Dim= c(5L, 3L), .Dimnames=list(NULL, c("time1", "time2",
"status")), type="interval", class="Surv")), class="data.frame", row.names= c(NA,
-5L))
## Session InfoRversion4.0.1 RC (2020-05-30r78647)
Platform:x86_64-w64-mingw32/x64 (64-bit)
Runningunder:Windows7 x64 (build7601) ServicePack1Matrixproducts:defaultlocale:
[1] LC_COLLATE=English_UnitedStates.1252LC_CTYPE=English_UnitedStates.1252
[3] LC_MONETARY=English_UnitedStates.1252LC_NUMERIC=C
[5] LC_TIME=English_UnitedStates.1252attachedbasepackages:
[1] statsgraphicsgrDevicesutilsdatasetsmethodsbaseotherattachedpackages:
[1] margins_0.3.23loadedviaa namespace (andnotattached):
[1] MASS_7.3-51.6compiler_4.0.1tools_4.0.1data.table_1.12.8prediction_0.3.14
The text was updated successfully, but these errors were encountered:
Thanks - this might need to be fixed upstream in data.table but I'll investigate if there's anything we can do here. If you find a solution in the meantime, I'd accept a PR.
Hi,
first of all thanks a ton for providing marginal effects for R!
I've identified an issue when there's a survival object in the data set.
data.table::rbindlist
won't like it at the moment and throws an error. The issue happens even if the object is not in the model.Thank you if you could take a look into this.
Cheers!
MCVE:
The text was updated successfully, but these errors were encountered: