Skip to content

Econometrics with R for IS and Thesis [MFU MBA in LSCM]

useR! logo

You are lucky!

Econometrics seem hard and tough. But with R, econometrics analysis is easy and FREE!

There are 7 more reasons why we should use R for statistics and econometrics analysis.

For the special course on Econometric analysis with R for MBA dissertation at Mae Fah Luang University, please do this 3 things as follow.

1. Download R 

Home page of "www.r-project.org"

Home page of “www.r-project.org”

First please download the software from the official website www.r-project.com

  • If you use Window PC, please use this link.
  • If you use Apple Mac, please use this link.
  • If you use Linux, please use this link.

2. Download R-Studio

Screenshot of R Studio (Windows PC)

Screenshot of R Studio (Windows PC)

The default R interface is not that good. There is a more optimised and user-friendly IDE for R called “R Studio”. R Studio is also free and available for Window, Linux and Mac users. It is my best IDE for R in various aspects. For students, R Studio is also a good one.

So please also download R Studio here (select RStudio desktop version)

3. Consult my online R-Manual and R related post here

ASER_banner_feature

Please have a look and play with the ASER manual before the class, see you!

Ex-post documents

  • Slides used in the lecture can be downloaded here here
    cover slide econ with R at MFU MBA LSCM
  • Codes used in the classed are as follow.
# codes used in the course "econometrics with R" at Mae Fah Luang University on 30th March 2013

# use R as a calculator
2+3

# start an analysis
data <- mtcars

# call variable names
names(data)

# draw a histogram
hist(data$mpg, xlab="miles per gallon", main = "Histogram of MPG", col="blue")
hist(data$hp, xlab="miles per gallon", main = "Histogram of hp", col="red")

# transform hp by sqr / exp
hist(sqrt(data$hp))

# create new variable by sqrting hp
data$sqrt_hp <- sqrt(data$hp)

# call 2nd obs.
data[2,]
data[2:5,]
data[2:5,2]

barplot(data$hp)

plot(data[2,])

# descriptive analysis
library("psych")
describe(data)

# Mean testing
# pair sample t-test
t.test(data$mpg, data$cyl)
t.test(data$drat, data$wt)

# independent variable t-test
t.test(data$mpg ~ data$am)
# regression model 1
model1 <- lm(mpg ~ gear, data = data)
summary(model1)
anova(model1)

# regression model 2
model2 <- lm(mpg ~ gear + hp, data = data)
summary(model2)
plot(model2)

# test if model2 is better than model1 statistically
anova(model1, model2)
<pre>
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: