Marianne.bourne 24
Postad: 4 maj 2023 20:21

Övning i R - Nybörjare

Fråga: Use the variable income, quarterly disposable household income in nominal £ 1971:Q1–1985:Q2, from the data set IncomeUK in package Ecdat.

Use the first order difference of income to estimate the five models AR(p) where p = 1, 2, 3, 4, 5. The models should be estimated with lm() or dynlm(), the latter from the package with the same name. Make sure that the same number of observations are used to estimate the different each model.

 

Jag är nybörjare i R och hade önskat vägledning till hur man ska ta sig an första stegen. Jag har lyckats ladda ned Ecdat och fått upp data set "IncomeUK" i R. 

rfloren 99
Postad: 4 maj 2023 20:34
data(IncomeUK)
IncomeUK$diff_income <- diff(IncomeUK$income)

Ger dig first order difference of income 

Den första raden kommer ju inte ha en diff så kanske bäst att ta bort den

IncomeUK <- IncomeUK[-1, ]

Modellen kommer jag inte ihåg hur man gör, men kanske lite hjälp på vägen :D

Svara Avbryt
Close