使用 Microsoft 登入
登入或建立帳戶。
您好:
選取其他帳戶。
您有多個帳戶
選擇您要用來登入的帳戶。

若要完成這項作業的方法之一是使用 'rxDataStep' 和 'impute' 的函式,從 R 套件 'Hmisc'。

 

以下是一些範例 R 程式碼以 impute 平均單價宣告︰

car.insurance.df <- data.frame(AgeLevel=factor(c(rep("17-20",4),      rep("21-24",4),rep("25-29",4),rep("30-34",4), 
     rep("35-39",4),rep("40-49",4),rep("50-59",4), 
     rep("60+",4))), Car.group = factor(rep(c("A","B","C","D"),8)), 
     Veh.Age=factor(rep(c(rep("0-3",4),rep("4-7",4),rep("8-9",4), 
     rep("10+",4)),2)), 
     AvgCost.claim = c(289,372,189,763,282,249,288,850,133,288,179, 
             NA,160,11,NA,NA,302,420,268,407,194,243,343,320,135,196,293,205,166,135,104,NA), 
  claims.weights = c(8,10,9,3,8,28,13,2,4,1,1,0,1,1,0,0,18,59,44,24,31,96,39,18,10,13,7,2,4,3,2,0))

 

rxDataFrameToXdf(data = car.insurance.df, outFile = "car.insurance.xdf") 
 install.packages("Hmisc")
 library(Hmisc) 
 rxDataStep(inData = "car.insurance.xdf", outFile = "car.insurance-imputed.xdf", transforms = list(AvgCost.claim.New = impute(AvgCost.claim)), 
 transformPackages = "Hmisc") 
 rxSummary(~Car.group + AvgCost.claim, data = "car.insurance-imputed.xdf", fweights ="claims.weights")

需要更多協助嗎?

想要其他選項嗎?

探索訂閱權益、瀏覽訓練課程、瞭解如何保護您的裝置等等。

社群可協助您詢問並回答問題、提供意見反應,以及聆聽來自具有豐富知識的專家意見。

這項資訊有幫助嗎?

您對語言品質的滿意度如何?
以下何者是您會在意的事項?
按下 [提交] 後,您的意見反應將用來改善 Microsoft 產品與服務。 您的 IT 管理員將能夠收集這些資料。 隱私權聲明。

感謝您的意見反應!

×