0

Im working on a project that im searching what the effects of Risk-Taking behaviour on Entrepreneurship, i mean how culture affects the Entrepreneurial activities. I run regressions to see the impact of independent variables on the dependent variables which represent the presence of Entrepreneurial Intention.

I would like to exctract the regression tables and summary tables i have constructed to the LyX document processor in order to have a more scientific view.

Whats the process i must follow to do this ??

EDIT:

MY DATASET:

My dataset is quite big and even if i use the order: dput(head(GemData,10)) the result is very big to post it here !!! Any order way ?!

MY CODE:

## you need the 'haven' package for loading a .dta file 

library(haven)

GemData <- read_dta(("C:/Users/ILIAS/Documents/Bachelors Thesis/GEM Dataset.dta"))


#### Stepwise Regression for y1 = 'all_high_stat_entre' and y2 = 'all_fear_fail' ####


library(MASS)

index<-which(is.na(GemData$all_high_stat_entre)==F)

n = nrow(GemData)
r<-NULL
for(i in 2:n){
  r[i-1]=cor(GemData$all_high_stat_entre[index],GemData[index,i])
}

index.r<-which(is.na(r)==F)

## 'res' is that number of column which the response 'all_high_stat_entre' ## 
res = which(r==1)

#---------------------------------------------------------------------------------------

index_fail<-which(is.na(GemData$all_fear_fail)==F)

r_fail<-NULL
for(i in 2:n){
  r_fail[i-1]=cor(GemData$all_fear_fail[index_fail],GemData[index_fail,i])
}

index.r.fail<-which(is.na(r_fail)==F)

##  'res.fail' is that number of column which the response 'all_fear_fail' ##
res.fail = which(r_fail==1)


#### Stepwise regression of 'all_high_stat_entre' ####

index.r.mod = index.r[-res]
index.r.mod.1=which(abs(r)>0.3)

n.all_high = length(index.r.mod.1)

data.subset=GemData[index,index.r.mod.1]
data.subset[,(n.all_high + 1)]=GemData$all_high_stat_entre[index]
colnames(data.subset)=c(names(data.subset)[1:19],"all_high_stat_entre")

## fit a full model

full.model <- lm(all_high_stat_entre~.,data=data.subset)
min.model <- lm(all_high_stat_entre~1,data=data.subset)

## ols_step_all_possible(full.model)

library(olsrr)
ols_step_forward_p(full.model)

model.all.high = lm(all_high_stat_entre ~ all_entre_des+all_estab_bus_age2+all_est_bus_fem+all_fut_startbus+all_startbus_job+all_know_entre+all_est_bus_sect4,data=data.subset)
summary(model.all.high)
stargazer(model.all.high, title="Results",type='text')

fwd.model <- stepAIC(min.model, direction='forward', scope=(~all_entre_des+all_estab_bus_age2+all_est_bus_fem+all_fut_startbus+all_startbus_job+all_know_entre+all_est_bus_sect4),data=data.subset)

library(stargazer)
stargazer(fwd.model, title="Results",type='text')

#--------------------------------------------------------------------------------------------

#### Modeling for the response 'all_fear_fail' ####

index.r.mod.fail = index.r[-res.fail]
index.r.mod.fail.1=which(abs(r_fail)>0.3)

n.all_fail = length(index.r.mod.fail.1)

data.subset.fail=GemData[index_fail,index.r.mod.fail.1]
data.subset.fail[,(n.all_fail + 1)]=GemData$all_fear_fail[index_fail]
colnames(data.subset.fail)=c(names(data.subset.fail)[1:(n.all_fail)],"all_fear_fail")

## fit a full model

full.model.fail <- lm(all_fear_fail~.,data=data.subset.fail)
min.model.fail <- lm(all_fear_fail~1,data=data.subset.fail)

## ols_step_all_possible(full.model)

library(olsrr)
ols_step_forward_p(full.model.fail)

fwd.model.fail <- stepAIC(min.model.fail, direction='forward', scope=(~all_per_cap+all_know_entre+all_per_opp),data=data.subset.fail)

library(stargazer)
stargazer(fwd.model.fail, title="Results" , type='text')

Thanks in advance !

  • Maybe refer https://tex.stackexchange.com/questions/364225/export-tables-from-r-to-latex https://stackoverflow.com/questions/28771177/how-to-export-a-table-from-r-to-latex-and-include-dimension-names – Nad Pat Sep 29 '21 at 14:27
  • You might enjoy learning knitr. Note that LyX has a simple knitr example file (Help > Specific Manuals > knitr). – scottkosty Sep 30 '21 at 01:32
  • @Nad Pat doesnt work for my situation sir/mis !? Thanks any other suggestion ? – ilaias zark HD Oct 01 '21 at 08:34
  • Could you provide a reproducible example so that we can run it? – Nad Pat Oct 01 '21 at 09:05
  • @NadPat my dataset is very big and i have tried the order dput(head()) any other solution to post my dataset ?! Thanks ! – ilaias zark HD Oct 02 '21 at 11:06
  • @NadPat other way to show you a piece of my dataset in order to run the code i have made ? – ilaias zark HD Oct 02 '21 at 11:08
  • I have tried a lot of ways to post a piece of my dataset but the result from dput is very huge, and its because my dataset contains 10165 columns . @NadPat – ilaias zark HD Oct 02 '21 at 11:17

0 Answers0