Question

In: Statistics and Probability

R code Need assistance in getting this R code to run variables (Process) char ( Age)...

R code

Need assistance in getting this R code to run variables (Process) char ( Age) char

tmp <- expand.grid(Process = unique(words$Process),Age =unique(words$Age))
X <- model.matrix(~ factor(Process):factor(Age), data = tmp)

glht(mod, linfct = X)

Solutions

Expert Solution

I think your code is incomplete and i dont have data also to test it. So i have included one of the example for your reference and edited your code little bit,

Your Code -

#####################################


TEMP = expand.grid(height = seq(60, 80, 5), weight = seq(100, 300, 50),
sex = c("Male","Female"))

X = model.matrix(~ height:weight, data = TEMP)

glht(mod, linfct = X)

################################################

Example -


tmp <- expand.grid(Process = unique(words$Process)
Age =unique(words$Age),stringsAsFactors = TRUE)

X <- model.matrix(~ factor(Process):factor(Age), data = tmp)

glht(mod, linfct = X)


Related Solutions

Need C++ code to be able to run, keep getting a constant value error #include #include...
Need C++ code to be able to run, keep getting a constant value error #include #include #include #include #include #include using namespace std; using namespace std::chrono; int c; void insertionSort(int* arr, int n) { for (int i = 1;i < n;i++) { int v = arr[i]; int j; for (j = i - 1;j > -1;j--) { c++; if (arr[j] > v) { arr[j + 1] = arr[j]; } else { break; } } arr[j + 1] = v; }...
You need a data structure that contains fields for name (char array), color (char array), age...
You need a data structure that contains fields for name (char array), color (char array), age (int), and height (int). Name the struct Info when you define it. Create a function named getUserInfo() that asks the user for name, color, age, and height and then returns a data structure containing that information. It should do the following: What is your name? George What is your favorite color? Green What is your age? 111 What is your height in inches? 72...
Hello, I am in need of some assistance in interpreting the data for the two variables...
Hello, I am in need of some assistance in interpreting the data for the two variables I did in a t-test for in Excel. Variable 1 is Relationship with Direct Supervisor and Variable 2 is the Workplace Happiness Rating. I am supposed to write a 125- to 175-word summary of my interpretation of the results of the t test. t-Test: Two-Sample Assuming Equal Variances Variable 1 Variable 2 Mean 2.5 7.4 Variance 1.030612245 2 Observations 50 50 Pooled Variance 1.515306122...
(a) Using R and R Commander, run the Correlation test between the variables attpublicschools and attteachingprof....
(a) Using R and R Commander, run the Correlation test between the variables attpublicschools and attteachingprof. Copy appropriate output and paste it below this question. Is the correlation significant at 5% alpha level?                                                                                   [6 Points] I have done the correlation test. (see below for data) How do I know if the correlation significant at 5% alpha level? Is 5% alpha the same as 95% confidence interval? Pearson's product-moment correlation data: attpublicschools and attteachingprof t = 3.724, df = 22,...
The following code will generate a Decision Tree. You need to run the code and explain...
The following code will generate a Decision Tree. You need to run the code and explain the tree. After you get the Tree. You need to explain how does it draw like that. install.packages("rpart.plot") # install package rpart.plot ########################################## # section 7.1.1 Overview of a Decision Tree ########################################## library("rpart") library("rpart.plot") # Read the data setwd("c:/data/") banktrain <- read.table("bank-sample-test.csv",header=TRUE,sep=",") ## drop a few columns to simplify the tree drops<-c("age", "balance", "day", "campaign", "pdays", "previous", "month") banktrain <- banktrain [,!(names(banktrain) %in% drops)]...
(3) Suppose that you run a regression of wage on a set of independent variables: age,...
(3) Suppose that you run a regression of wage on a set of independent variables: age, years of education, experience, and a dummy variable married. There are 100 observations, i.e., n=100. You want to test whether all the coefficient and intercept estimates in the equation for married and unmarried are equal to each other. i.e., Married: wage = β0 + β1*age + β2*educ + β3*exper + uUnmarried: wage = α0 + α1*age + α2*educ + α3*exper + v (a) Write...
I need assistance translating a custom C++ program to MIPS. My C++ code is the following:...
I need assistance translating a custom C++ program to MIPS. My C++ code is the following: I have made numerous attempts on my own to no avail, any assistance is appreciated. Also, template code for this solution is provided below: #include int moveRobots(int *, int *, int, int ); int getNew(int, int); int main() { int x[4], y[4], i, j, myX = 25, myY = 25, move, status = 1; // initialize positions of four robots x[0] = 0; y[0]...
USE R CODING! Pleaseee I need the code With R coding Obs: it supposed to use...
USE R CODING! Pleaseee I need the code With R coding Obs: it supposed to use probability density function like X ~ Binomial( n ,p ) dbinom(X=?, n, prob) pbinom(X=?, n, prob) rbinmo(幾個符合二項分配的X, n, prob) X~Poisson (lamda) dpois(X=?, lamda) ppois (X=?, lamda) rpois (X, lamda) **Suppose the random variable X obeys the binomial allocation B (n=100, p=0.1) (a) Use X as the binomial allocation to calculate P(12≤X≤14) (b) In practice, when np ≥ 5 and n(1-p) ≥ 5, X will...
Is there an R code that would allow me to run a random sample 10,000 times...
Is there an R code that would allow me to run a random sample 10,000 times without having to run the code created individually? I have completed the first two tasks, but I do not know if R has a repeat code that would speed things up. Now using the “Minutes” column generate a random sample size of 5. (THIS HAS ALREADY BEEN COMPLETED BY ME. JUST ANSWER THE QUESTION CONCERNING THE THIRD ONE AND THE R CODE). Calculate the...
HI. I have been trying to run my code but I keep getting the following error....
HI. I have been trying to run my code but I keep getting the following error. I can't figure out what I'm doing wrong. I also tried to use else if to run the area of the other shapes but it gave me an error and I created the private method. Exception in thread "main" java.util.InputMismatchException at java.base/java.util.Scanner.throwFor(Scanner.java:939) at java.base/java.util.Scanner.next(Scanner.java:1594) at java.base/java.util.Scanner.nextInt(Scanner.java:2258) at java.base/java.util.Scanner.nextInt(Scanner.java:2212) at project2.areacalculation.main(areacalculation.java:26) My code is below package project2; import java.util.Scanner; public class areacalculation { private static...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT