Question

I imported a dataset named "multiple.txt" into R using the read.table function. The table contains 50...

I imported a dataset named "multiple.txt" into R using the read.table function. The table contains 50 variables and 100 observations per variable. Each variable is named V1, V2, V3,...,V50.

The goal is to implement multiple testing across all 50 variables using the t-stat equation T = (x-bar - 0)/(Sx/sqrt(n). I was wondering if you could post sample code to run the t-statistic equation comparing each variable sample mean to 0, making a vector with all 50 of the t-stats, and then making a vector with each p-value.

Homework Answers

Answer #1

The following R code can be used to solve the required solution:-

------------------------------------------------------------------------------------------------------------------------------------

d=read.table()
T=array(dim=1)
pvalue=array(dim=1)
for(i in 1:ncol(d))
{
T[i]=(mean(d[,i])-0)/sqrt(var(d[,i])/100)
pvalue[i]=1-pt(T,99)
}
result = cbind(T,pvalue)
print(result)

------------------------------------------------------------------------------------------------------------------------------------

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
The built-in R dataset swiss gives Standardized fertility measure and socio-economic indicators for each of 47...
The built-in R dataset swiss gives Standardized fertility measure and socio-economic indicators for each of 47 French-speaking provinces of Switzerland at about 1888. The dataset is a data frame containing 6 columns (variables). The column Infant.Mortality represents the average number of live births who live less than 1 year over a 3-year period. We are interested in the Infant.Mortality column. We can convert the data in this colun to an ordinary vector x by making the assignment x <- swiss$Infant.Mortality....
T F 1. A p-value of .008 in hypothesis testing means there is only a .8%...
T F 1. A p-value of .008 in hypothesis testing means there is only a .8% chance we could get such sample statistics from the population if the null hypothesis is as stated. Such an event is considered unlikely and we would reject the null hypothesis. T F 2. As a general rule in hypothesis testing, it is always safer to set up your alternate hypothesis with a greater-than or less-than orientation. _____3. If the level of significance is .02...
1) What are some indicators that there are assignable causes for variation in a process? I.Process...
1) What are some indicators that there are assignable causes for variation in a process? I.Process capability. II. Data patters outside of the control limits. III. Data patters within the control limits. IV. Points randomly falling above and below the control chart center line. a. II and III b. II, III, IV c. I, II, IV d. I, II, III, IV 2) The best quantitative tool to determine the cause for variation in a process is: a. ANOVA b. Correllation...
1. For a pair of sample x- and y-values, what is the difference between the observed...
1. For a pair of sample x- and y-values, what is the difference between the observed value of y and the predicted value of y? a) An outlier b) The explanatory variable c) A residual d) The response variable 2. Which of the following statements is false: a) The correlation coefficient is unitless. b) A correlation coefficient of 0.62 suggests a stronger correlation than a correlation coefficient of -0.82. c) The correlation coefficient, r, is always between -1 and 1....
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT