marginal effects of mlogit in R

后端 未结 2 1226
情话喂你
情话喂你 2020-12-18 14:32

I am new to R, and I don\'t understand yet completely the logic of its calculations...

I cannot overcome my problem with the help from previous posts either.

2条回答
  •  我在风中等你
    2020-12-18 15:20

    You could use colMeans

      op <- options(scipen= 100, digits=2)
      colMeans(mldata[,3:11], na.rm=TRUE)
       #  CHINN           DEBT            ERA           INFL          MONEY 
       #  -0.27         115.25           0.20          33.66          74.66 
       #OPENNESS       RESERVES           RGDP           RSVS 
       #  92.06 18809465124.14         136.56          18.81 
      options(op)
    

    or summarise_each from dplyr

    library(dplyr)
    mldata %>%
    summarise_each(funs(round(mean(., na.rm=TRUE),2)), CHINN:RSVS)
    # CHINN   DEBT ERA  INFL MONEY OPENNESS    RESERVES   RGDP  RSVS
    #1 -0.27 115.25 0.2 33.66 74.66    92.06 18809465124 136.56 18.81
    

提交回复
热议问题