全因子设计(2 ^ 4)在R中没有重复(为什么我不能在R中绘制丹尼尔图)

时间:2018-01-10 04:58:36

标签: r anova orthogonal experimental-design

我正在尝试分析具有中心点和星点的全因子设计2 ^ 4,没有重复。但是,我试图描绘丹尼尔的情节,但我不能。 R代码(https://docs.google.com/document/d/1hrODFpL4tWnWr9CPL9g_myALMQ926SsNS9Ncy5MnhA0/edit?usp=sharing)。

import React, {Component} from 'react';
import {StyleSheet, Text, View, Animated} from 'react-native';
import Button from './Button';
import CardSection from './CardSection';
import MyDatePicker from "./MyDatePicker";
import Card from "./Card";
import ProgressBar from "./ProgressBar";


const handleStartDate = (delta) => {
    return (previousState, currentProps) => {
        return {...previousState, startDate: delta};
    };
};

const handleEndDate = (delta) => {
    return (previousState, currentProps) => {
        return {...previousState, endDate: delta};
    };
};

const handleProgressUpdate = () => {
    return (previousState, currentProps) => {
        return {...previousState, progress: this.state.dictionary["jatinverma"]};
    };
};

class AppComp extends Component {
    state = {startDate: null, endDate: null, jiraData: "", progress: 0, dictionary: {}};

    onStartDateChange = (date) => {
        this.setState(handleStartDate(date));
    };

    onEndDateChange = (date) => {
        this.setState(handleEndDate(date));
    };

    componentDidMount() {

        // debugger;
    }

    handleJSONData = (data) => {
        var keyArr = Object.keys(this.state.dictionary);

        for (var i = 0; i <= data.issues.length; i++) {

            fetch(data.issues[i].self, {
                method: 'get',
                headers: {
                    'Authorization': 'Basic ' + btoa('username:password'),
                }
            })
                .then((response) => response.json())
                .then(resData => {
                    var worklogsArr = resData.fields.worklog.worklogs;

                    for (var j = 0; j < worklogsArr.length; j++) {

                        var dtc = +Date.parse(worklogsArr[j].updated.slice(0, 10));
                        var startDate = +Date.parse(this.state.startDate);
                        var endDate = +Date.parse(this.state.endDate);
                        if ((dtc >= startDate) && (dtc <= endDate)) {
                            if (Object.keys(this.state.dictionary).indexOf(worklogsArr[j].author.name) >= 0) {
                                var nameDic = worklogsArr[j].author.name;
                                var abc = this.state.dictionary;
                                var ov = this.state.dictionary[nameDic];

                                abc[nameDic] = ov + worklogsArr[j].timeSpentSeconds;
                                this.setState({dictionary: abc});
                                console.log(this.state)
                            } else {
                                var nameDic = worklogsArr[j].author.name;
                                var abc = this.state.dictionary;

                                abc[nameDic] = worklogsArr[j].timeSpentSeconds;
                                this.setState({dictionary: abc});
                                console.log(this.state);
                            }
                        } else {

                        }

                    }
                });
        }

    }

    handleButtonClick = () => {
        this.setState({dictionary: {}});

        if (!global.btoa) {
            global.btoa = require('base-64').encode;
        }

        fetch('https://crossitc.atlassian.net/rest/api/latest/search?jql=updated>=' + this.state.startDate + '%20AND%20updated<=' + this.state.endDate, {
            method: 'get',
            headers: {
                'Authorization': 'Basic ' + btoa('username:password'),
            }
        })
            .then((response) => response.json())
            .then(responseData => {
                console.log(responseData);
                this.handleJSONData(responseData);

                 this.setState(handleProgressUpdate);
                console.log("HIIIIIIIIIIII" + this.state);
                debugger;
            });
    }

    render() {

        return (
            <Card>
                <CardSection>
                    <MyDatePicker onDateChangeRef={this.onStartDateChange} dateDateRef={this.state.startDate}/>
                    <Text> START={this.state.startDate}</Text>
                </CardSection>

                <CardSection>
                    <MyDatePicker onDateChangeRef={this.onEndDateChange} dateDate={this.state.endDate}/>
                    <Text> END={this.state.endDate}</Text>
                </CardSection>

                <CardSection>
                    <Button onPress={this.handleButtonClick}>CLICK!!!</Button>
                </CardSection>

                <CardSection>
                    <View style={styles.container}>
                        <View style={styles.progressContainer}>
                            <Text>Hours:</Text>
                            <ProgressBar progress={this.state.progress} row duration={500}/>
                            <Text>100%</Text>
                        </View>
                    </View>
                </CardSection>
            </Card>

        );
    }
};

const styles = {
    container: {
        flex: 1,
    },
    progressContainer: {
        alignItems: "center",
        flexDirection: "row"
    }
}

export default AppComp;

2 个答案:

答案 0 :(得分:0)

这是一个响应面设计。您通常从筛选设计开始按顺序构建这些设备,例如: 2⁴完整或分数设计,复制中心点作为第一次迭代。 Daniels图在确定调查因子的20个主要显着效应(活动子空间)时非常好,应该在这个阶段使用。 如果发现所有四个因子都有效,则可以添加星点,因为筛选设计已指示接近超空间“最大”或“最小”值。如果所有因素都是活跃的,您通常使用最小二乘分析来分析结果。您不会基于统计显着性删除响应面分析中的因子,因为这意味着猜测的零值将是比实际估计更好的最佳估计。 简而言之就是:

分析响应曲面时不使用DANIELS图。

参考:“实验者统计”Box Hunter和Hunter Wileys 2005年第11和第12章。

请注意,您应该能够在Daniels图中绘制模型残差。

答案 1 :(得分:0)

Daniel的图仅适用于通过回归创建的拟合模型。例如:

model<-lm(y.response~Temperatura*Time*Acid*Biomass,data=CCD)

它将创建模型。我建议:

BsM2::DanielPlot(model)

创建图。