To load data set from the package “fma”, use the commands:

>data (package=fma) This instantly loads the pre existing data sets in the package. To load the data set regarding US consumption and income, use the command: >data (usconsumption) To print the data: >usconsumption

Now, form a time series from the data using the command:

>ustimeseries <- ts (usconsumption, frequency=4, start=1970) Here, the variable name is “ustimeseries”, frequency is 4(because it is quarterly data), and start=1 (since the data starts from 1970) Now, print the series: >ustimeseries

Fit a time series regression model by using the function tslm. Use the command:

>fit <- tslm (consumption~income, data=usconsumption) Draw a scatter plot of time series by using the command: >plot (consumption~income, data=usconsumption) Fit the line of best fit for time series by the command: >abline (fit)

For scenario based forecasting using R, use the command:

> f <- forecast (fit, newdata=data.frame(income=c(-1,1))) To plot the forecasted value, use the following R command to generate the graph of forecasts from linear regression model: > plot (f)

Basic Subject

Computer Science

- Programming Assignment Help
- Database Help
- Data Structure Assignment Help
- Operating Systems Assignment Help
- Computer Network Assignment Help
- UML Diagram Assignment Help
- IT Assignment Help
- Game Programming
- Computer Science Assignment Help
- Medical Science Assignment Help
- Social Science Assignment Help
- Information Systems

Engineering

- Biochemical and Biotechnology Help
- Chemical Engineering Assignment
- Statistics Assignment Help
- Civil Engineering Assignment Help
- Electrical, Electronics Help
- Mathematics, Computing Assignment Help
- Mechanical and Industrial Engg. Help
- Petroleum Engg. Assignment Help
- Biochemistry Assignment Help
- Cell Biology Assignment Help
- Arts and Architecture Help
- Silverlight Assignment Help