Closed denistanjingyu closed 2 years ago
Hi @denistanjingyu, thanks for sharing your issue. Do you have a reproducible example I can run on my end? That would make finding the issue much easier.
Hi Brandon,
Thanks for the prompt reply. I have attached the R script and a CSV file in the email to go with it. Appreciate your help.
Best regards, Denis
From: Brandon Greenwell notifications@github.com Sent: Monday, January 4, 2021 11:30 PM To: bgreenwell/investr investr@noreply.github.com Cc: Tan Jing Yu, Denis 陈劲宇 denis.tanjingyu@Hotmail.sg; Mention mention@noreply.github.com Subject: Re: [bgreenwell/investr] Error inserting new data for multiple linear regression (#43)
Hi @denistanjingyuhttps://github.com/denistanjingyu, thanks for sharing your issue. Do you have a reproducible example I can run on my end? That would make finding the issue much easier.
― You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/bgreenwell/investr/issues/43#issuecomment-754042287, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AK3T324GW3RFPHEXI32WAU3SYHNJHANCNFSM4VSEAMTA.
Hi @denistanjingyu, the issue is that invest()
is checking against the names of all the predictors provided in the formula (which includes those that you try to exclude via the -
operator). This should be an easy fix on my end, but not sure when I'd be able to get to it. A simple workaround would be to provide the data via the data
argument, but exclude the predictors not used in the model, for example:
cols <- c("DO_nit1", names(newdf))
invest(model, y0 = 92, interval = "Wald", x0.name = "DO_nit1", newdata = newdf, data = TN_dataset[, cols])
Thank you for the workaround. May I know whether it's possible to bootstrap for multiple linear regression? All my simulation runs failed.
Certainly the methodology could be extended to the multiple predictor case, but I did not code it in such a way (bootstrap came first in the package). How did the simulation runs fail? Not able to find a point estimate in the search window? Start by turning of confidence interval computation.
Error message:
Code for invest function:
For newdata, I tried both slicing (first row and columns used in model except x0) and manually inserting (as above) but the error message still appear. Please assist thank you!