Difference between revisions of "One Sample T-Test"

From SOCR
Jump to: navigation, search
m
m (Text replacement - "{{translate|pageName=http://wiki.stat.ucla.edu/socr/" to ""{{translate|pageName=http://wiki.socr.umich.edu/")
 
Line 55: Line 55:
  
  
{{translate|pageName=http://wiki.stat.ucla.edu/socr/index.php?title=One_Sample_T-Test}}
+
"{{translate|pageName=http://wiki.socr.umich.edu/index.php?title=One_Sample_T-Test}}

Latest revision as of 14:42, 3 March 2020

/*

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)
Uk flag.gif

Deutsch
De flag.gif

Español
Es flag.gif

Français
Fr flag.gif

Italiano
It flag.gif

Português
Pt flag.gif

日本語
Jp flag.gif

България
Bg flag.gif

الامارات العربية المتحدة
Ae flag.gif

Suomi
Fi flag.gif

इस भाषा में
In flag.gif

Norge
No flag.png

한국어
Kr flag.gif

中文
Cn flag.gif

繁体中文
Cn flag.gif

Русский
Ru flag.gif

Nederlands
Nl flag.gif

Ελληνικά
Gr flag.gif

Hrvatska
Hr flag.gif

Česká republika
Cz flag.gif

Danmark
Dk flag.gif

Polska
Pl flag.png

România
Ro flag.png

Sverige
Se flag.gif