zoukankan      html  css  js  c++  java
  • time series 时间序列 | fractional factorial design 部分要因试验设计

    作业: 

    1) A plot of data from a time series, which shows a cyclical pattern – please show a time series plot and identify the length of the major cycle. 

    2) Data from a full factorial or fractional factorial experiment with at least 2 factors – please identify the factors and the dependent variable. It is sufficient to provide me with a small part of the dataset (e.g. 10 records), if the dataset is large.

    slides for FFD

    kings <- scan("http://robjhyndman.com/tsdldata/misc/kings.dat",skip=3)
    kings
    kingstimeseries <- ts(kings)
    kingstimeseries
    # An example is a data set of the number of births per month in New York city, from January 1946 to December 1959 
    births <- scan("http://robjhyndman.com/tsdldata/data/nybirths.dat")
    birthstimeseries <- ts(births, frequency=12, start=c(1946,1))
    birthstimeseries
    #
    souvenir <- scan("http://robjhyndman.com/tsdldata/data/fancy.dat")
    souvenirtimeseries <- ts(souvenir, frequency=12, start=c(1987,1))
    souvenirtimeseries
    #
    plot.ts(kingstimeseries)
    #
    plot.ts(birthstimeseries)
    #
    plot.ts(souvenirtimeseries)
    #
    logsouvenirtimeseries <- log(souvenirtimeseries)
    plot.ts(logsouvenirtimeseries)
    #
    library("TTR")
    birthstimeseriescomponents <- decompose(birthstimeseries)
    birthstimeseriescomponents$seasonal 
    # get the estimated values of the seasonal component
    plot(birthstimeseriescomponents)
    #
    birthstimeseriescomponents <- decompose(birthstimeseries)
    birthstimeseriesseasonallyadjusted <- birthstimeseries - birthstimeseriescomponents$seasonal
    plot(birthstimeseriesseasonallyadjusted)
    

      

    #tell where the data come from
    datafilename="http://personality-project.org/R/datasets/R.appendix1.data"
    #read the data
    data.ex1=read.table(datafilename,header=T)
    #do the analysis
    aov.ex1 = aov(Alertness~Dosage,data=data.ex1)
    #show the table
    summary(aov.ex1)
    
    # 2-way
    datafilename="http://personality-project.org/r/datasets/R.appendix2.data"
    #read the data
    data.ex2=read.table(datafilename,header=T)
    #show the data
    data.ex2
    #do the analysis
    aov.ex2 = aov(Alertness~Gender*Dosage,data=data.ex2)
    #show the summary table
    summary(aov.ex2)
    

    后面贴答案  

  • 相关阅读:
    项目中的*签到*小功能!
    亲们,拿到DateTime.Now你是否也是这样比较的?
    <input type="file" />,美化自定义上传按钮
    让你的页面实现自定义的 Ajax Loading加载的体验!
    按回车键提交表单!
    字符串比较大小,CompareTo来搞定!
    巧用Contains可以做到过滤同类项!
    项目开发中遇到的Bug知识整理!
    SharePoint中详细的版本对比
    ASP.NET安全隐患及SharePoint中的Workaround
  • 原文地址:https://www.cnblogs.com/leezx/p/10716876.html
Copyright © 2011-2022 走看看