0

I have data on birth proportion every year for four different countries. I have fitted this data with four simple regression lines using the code:-

mbirthprop <- read.csv("ex0724.csv")
attach(mbirthprop)
summary(lm(Denmark~Year))
summary(lm(Netherlands~Year))
summary(lm(Canada~Year))
summary(lm(USA~Year))

The goal is to calculate the t-statistic for the test that the slopes of the regressions are zero using R. How do I do that? Also how to print out/display the graphs with the regression line?

Ben Bolker
  • 211,554
  • 25
  • 370
  • 453
  • When asking for help, you should include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. Also each post should ask just one question at a time. – MrFlick Jan 25 '18 at 21:09
  • Alright ! Thanks for the tip! – neerja sundar ranjan Jan 25 '18 at 21:34

1 Answers1

1

An example:

fit <- lm(mpg ~ cyl, mtcars)
sfit <- summary(fit)
sfit$coefficients[,c("t value")]

(Intercept)         cyl 
      18.27       -8.92 
thc
  • 9,527
  • 1
  • 24
  • 39