myData=importdata("cars.txt","|",1) ;
curb = myData.data(:,1); % dependent variable
lngth = myData.data(:,2); % independent variable; name 'lngth' is
to avoid
% confusion with in-built MATLAB function length
% a. observe whether or not dependent variable curb has linear relation with independent variable lngth
figure;plot(lngth,curb)
% b. fit regression line using least square method
mean_l = mean(lngth);
mean_c = mean(curb);
for i=1:length(lngth)
std_l(i) = (lngth(i) - mean_l)^2;
cov_lc(i) = (lngth(i) - mean_l)*(curb(i) -
mean_c);
end
m = sum(cov_lc)/sum(std_l); % slope of regression line
b = mean_c -m*mean_l; % intercept of regression line
curb_fit = m*lngth + b; % equation of regression line
% c. plot the regression line
figure;plot(lngth, curb_fit)
% d. forecast values of curb for length = [100 150 200]
curb_100 = m*100 + b;
curb_150 = m*150 + b;
curb_200 = m*200 + b;
please solve this in matlab platform, will solving write this mydata=importdata(‘’cars.txt’’,”|”,1) like this i hv the...
The β 1 term indicates a. the Y value for a given value of X. b. the average change in Y for a unit change in X. c. the Y value when X equals zero. d. the change in observed X for a given change in Y. What does regression analysis attempt to establish? a. linearity in the relationship between independent variables b. a mathematical relationship between a dependent variable, for which future values will be forecast, and one or...
Please I need help with MATLAB .. PLease help me . Thankyou Write Matlab code to plot a 2D sinc function over a 2D cartesian grid where x ranges from 100 to 355 and y ranges from 0 to 255 and the sinc is centered at somewhere not midway in the grid. First plot the grid, and then plot the function on the grid (both as grayscale and as a surface plot). Comment the code well, generate the figures and...
Please use Excel Solver.
Consider the following set of time series sales data for a growing company over the past 8 months: Month Sales 1 15 2 13 18 4 22 20 6 23 7 22 8 21 1. Construct a time series plot. What type of pattern exists? 2. Develop a forecast for the next month using the averaging method. 3. Develop a forecast for the next month using the naïve last-value method. 4. Develop a forecast for the...
i
need help solving these questions,please
don’t know how to solve it by using matlab.!
Solve the following questions Ol: You are required to develop a script to calculate the volume of a pyramid, which is 1/3 *base *height, where the base is length *width. Prompt the user to enter values for the length, width, and height, and then calculate the volume of the pyramid. When the user enters each value, he or she will then also be prompted to...
For expert using R , I solve it but i need to figure out what
I got is correct or wrong. Thank you
# Simple Linear Regression and Polynomial Regression
# HW 2
#
# Read data from csv file
data <-
read.csv("C:\data\SweetPotatoFirmness.csv",header=TRUE,
sep=",")
head(data)
str(data)
# scatterplot of independent and dependent variables
plot(data$pectin,data$firmness,xlab="Pectin,
%",ylab="Firmness")
par(mfrow = c(2, 2)) # Split the plotting panel into a 2 x 2
grid
model <- lm(firmness ~ pectin , data=data)
summary(model)
anova(model)
plot(model)...
MATLAB Question: Write a script for the problem pictured. Please
send the script, not just the printout. Make sure your script
allows you to input a value for n
so when prompted, in the command window, user types n value. The
n value should be the f_k if k ==1 .... Please also send print outs
if you can.
BELOW IS A SAMPLE ANSWER THAT DID NOT PUT THE INPUT SCRIPT
NEEDED FOR THIS QUESTION TO BE CORRECT. YOU CAN...
I need this program in MATLAB with different or another code. INPUT: x = [0 1 8 12 27]; y = [1 2 3 4 5]; nx = length(x); ny = length(y); n = length(x); if nx ~= ny display('Error. La cantidad de datos en x no es igual que los datos en y') end Sx = sum(x); Sxx = sum(x.^2); Sy = sum(y); Sxy = sum(x.*y); a1 = (n*Sxy - Sx*Sy)/(n*Sxx-(Sx)^2); a0 = (Sxx*Sy - Sxy*Sx)/(n*Sxx - (Sx)^2); m...
Please write this in the computer, not by the hand. 12. Answer the following: Select two variables, one independent variable and the other the dependent variable. Explain the cause and effect the relation between the two. How would you construct the Simple Linear Regression (quantity of data and how you will measure the results), and what would you use to validate the equation forecasting an x value. What will be your expectation of the results of this investigation?
Answer the following: Please write this in computer Select two variables, one independent variable and the other the dependent variable. Explain the cause and effect the relation between the two. How would you construct the Simple Linear Regression (quantity of data and how you will measure the results), and what would you use to validate the equation forecasting an x value. What will be your expectation of the results of this investigation?
Part I: Determine whether each of the following statements is TRUE or FALSE, and write a short explanation for your answer The mean and median are always equal to each other and can never be different. The median and mode must always be equal and can never be different. The expected value of a random variable is a weighted average of outcomes, where each outcome is weighted by its probability of occurrence. Regressions are used to estimate the relationship between...