One Sample T-Test

From Socr

(Difference between revisions)
Jump to: navigation, search
m
 
Line 53: Line 53:
}
}
</pre>
</pre>
 +
 +
 +
{{translate|pageName=http://wiki.stat.ucla.edu/socr/index.php?title=One_Sample_T-Test}}

Current revision as of 15:38, 22 January 2007

/*

January 2007. Annie Che <chea@stat.ucla.edu>. UCLA Statistics.

Source of example data:
Mathematical Statistics and Data Analysis, John Rice, Second Edition.
Page 390, example A, determination of the laten heat of fusion of ice.

*/
package edu.ucla.stat.SOCR.analyses.example;

import java.util.HashMap;
import edu.ucla.stat.SOCR.analyses.data.Data;
import edu.ucla.stat.SOCR.analyses.data.DataType;
import edu.ucla.stat.SOCR.analyses.result.OneTResult;


public class OneTExample {
	public static void main(String args[]) {
		double[] soloVariable = {93,67,77,92,97,62,136,120,115,104,115,121,102,130, 198,217,209,221,190};

		// you'll need to instantiate a data instance first.
		Data data = new Data();

		//data.appendX("score", score, DataType.FACTOR);
		data.appendY("SoloVariable", soloVariable, DataType.QUANTITATIVE);


		// then use the following line to get the result.
		try {
			OneTResult result =
                        (OneTResult) data.modelOneT(soloVariable);

			if (result != null) {

				// Getting the model's parameter estiamtes and statistics.
				double sampleMean = result.getSampleMean();
				double sampleVar = result.getSampleVariance();

				int degreesFreedome = result.getDF();

				System.out.println("sample mean = " + sampleMean);
				System.out.println("sample variance = " + sampleVar);
				System.out.println("degrees of freedom = " + degreesFreedome);


			}
		} catch (Exception e) {
			System.out.println(e);
		}
	}
}




Translate this page:

(default)

Deutsch

Español

Français

Italiano

Português

日本語

България

الامارات العربية المتحدة

Suomi

इस भाषा में

Norge

한국어

中文

繁体中文

Русский

Nederlands

Ελληνικά

Hrvatska

Česká republika

Danmark

Polska

România

Sverige

Personal tools