-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWrite OLS Table
56 lines (50 loc) · 1.29 KB
/
Write OLS Table
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
library(foreign)
library(pscl)
require(ffbase)
require(LaF)
require(ETLUtils)
library(xtable)
require(biglm)
library(psych)
library(xtable)
cleardata<-function(input){
names<-rownames(input)
final<-matrix("",nrow=nrow(input)*2,ncol=2)
j=1
for(i in 1:nrow(input)){
st<-paste("(",round(as.numeric(as.matrix(input[i,2])),digits=5),")",sep="")
if(!is.na(input[i,4])){
if(as.numeric(input[i,4])<=0.001){
coe<-paste(round(as.numeric(input[i,1]),digits=5),"***",sep="")
}
if(as.numeric(input[i,4]<=0.01&as.numeric(input[i,4])>0.001 )){
coe<-paste(round(as.numeric(input[i,1]),digits=5),"**",sep="")
}
if(as.numeric(input[i,4]<=0.05&&as.numeric(input[i,4])>0.01)){
coe<-paste(round(as.numeric(input[i,1]),digits=5),"*",sep="")
}
if(as.numeric(input[i,4]<=0.1&&as.numeric(input[i,4])>0.05)){
coe<-paste(round(as.numeric(input[i,1]),digits=5),"+",sep="")
}
if(as.numeric(input[i,4])>0.1){
coe<-round(as.numeric(input[i,1]),digits=5)}
}else{
coe<-"NA"
}
final[j,1]<-names[i]
final[j,2]<-coe
final[j+1,2]<-st
j<-j+2
}
return(final)
}
# write zero inflation model
mm<-summary(results2)
print.xtable(xtable(
rbind(data.frame(cleardata(mm$coefficients)),
data.frame(cbind("Obs.",nrow(fulldata))),
data.frame(cbind("R square", round(
as.numeric(as.matrix(mm$r.squared) ),digits=2) ))
)
)
,type="html",file="numfundingzipsubset1.html")