Fixing the issue in assumption of OLS step by step or one by one
Recent newsHi, I want to raise the issue related to know whether your OLS is ok or not.
read more(Comments)
The data in excel and how to handle them in Stata
So here is a couple of suggestion on what we will learn in this page
The nice thing from Stata is, you don't need to regress with formula, just take a picture, and while you got the equation.
First if you want to know what behind some function, please type help in Matlab Terminal
such as
>> help xlsread
or if you want to see them in the document format type
>> doc xlsread
since the default of xlsread is numeric only, so if you want them to read all, it should be
Request the numeric data, text data, and combined data from the Excel file in the first example.
[num,txt,raw] = xlsread('myExample.xlsx')
num = 1 2 3 4 5 NaN 7 8 9 txt = 'First' 'Second' 'Third' '' '' '' '' '' 'x' raw = 'First' 'Second' 'Third' [ 1] [ 2] [ 3] [ 4] [ 5] 'x' [ 7] [ 8] [ 9]
Got it!
%%
% COURSE: Master MATLAB through guided problem-solving
% SECTION: Importing and exporting data
% VIDEO: Import and export Excel-format data
% Instructor: mikexcohen.com
%
%%
% list data folder and file
dataFolder = '/Users/dimasmukhlas/Documents/MATLAB/Udemy/';
dataFile = 'sensordata.xlsx';
% import data file using xlsread
[numdata,txtdata, rawdata] = xlsread(dataFile);
% check sizes and outputs
whos
%% extract key data
% starting line
startline = find( strcmpi(rawdata(:,1),'Start data') );
% strcmpi compare the strring to find the value of startdata from all row
% in column 1 , the result will be boleaan
%function find basically found which one from all this row that true
% get list of sensor IDs
sensorID = cell2mat(rawdata(startline+1:end-1,2));
%get the rawdata from startline + 1 until the end -1 and take the column 2
% the function cell2mat is changing the text into numerical vector
% get list of time points
timepoints = cell2mat(rawdata(startline+1:end-1,4));
% now get all of the data
datatemp = cell2mat(rawdata(startline+1:end-1,end));
%check how the data looks like in graph
plot(sensorID,'o');
plot(timepoints,'o');
plot(datatemp,'o');
% a list of unique sensor numbers would also be useful
uchans = unique(sensorID);
utimes = unique(timepoints);
% initialize data matrix
datamat = nan( length(uchans),length(utimes) );
%% populate and plot
% populate one line at a time
for linei=1:length(sensorID)
% line-specific channel and time point
datamat(sensorID(linei),timepoints(linei)) = datatemp(linei);
end
% plot
figure(1), clf
plot(datamat','s-','markerfacecolor','w')
%% bonus: identify missing data
% find where datamat is nan
% isnaan is the function to find Nan data
missingdata = find(isnan(datamat));
% loop over all missing time points
for i=1:length(missingdata)
% convert index to subscript to find channel/time point
[missChan,missTime]=ind2sub(size(datamat),missingdata(i));
% print message
warning([ 'Channel ' num2str(missChan) ' timepoint ' num2str(missTime) ' has a missing value!' ])
end
%%
Descriptive statistic meaning we want to get the full picture of what the set of data looks like, about their average, their modus, median etc.
The need to find how the data looks like before we move to some statistical or even econometric equation is very important.
%%
% COURSE: Master MATLAB through guided problem-solving
% SECTION: Descriptive statistics
% VIDEO: Compute measures of central tendency
% Instructor: mikexcohen.com
%
%%
% dataset to work with
% round means finding the nearest integer
% exp is the exponential, such as exponential 1 is 2,...
% randn is normally distributed random variable
% (101,1) mean to create 101 line of row in 1 column
data = round( exp(2+randn(101,1)/2) );
% always important to look at data!
% how to data looks like
figure(1), clf
histogram(data,20)
%% compute the mean
% algorithm here
% numel is the number of element
n = numel(data);
themean = sum(data)/n;
% compare with MATLAB's mean function
themean2 = mean(data);
%% compute the median
% now see how the data when its not sorted
plot(data);
% sort the data points
datasort = sort(data);
plot(datasort);
% if you want to descend
datasortdescend = sort(data,"descend");
plot(datasortdescend);
% find the middle value
% ceil means ceiling or goes up from the result, check also
% fix, floor,
themedian = datasort(ceil(n/2));
% compare with built-in function
themedian2 = median (data);
%% compute the mode
% find the unique data values
uniquevals = unique(data);
% loop through values and count the number of numbers with each value
% size is showing the size matrix of the unique value which is 21x1
% zeros is making a zero out of all, so 21 row of zero
numnums = zeros(size(uniquevals));
% the for loop here
% ui set into 1
% length is Length of largest array dimension, in this case 21
for ui=1:length(numnums)
% here is the counting
numnums(ui) = sum(data ==uniquevals(ui));
%fill the value of numnums with the sum of data unique value
end
% find the maximum count
[dontcare,maxidx] = max (numnums);
% the mode is that value
themode = uniquevals(maxidx);
% compare with MATLAB function
themode2 = moode(data);
%% bonus
hold on
plot([1 1]*themean,get(gca,'ylim'),'r--','LineWidth',5)
plot([1 1]*themedian,get(gca,'ylim'),'b--','LineWidth',5)
plot([1 1]*themode,get(gca,'ylim'),'k--','LineWidth',5)
legend({'Data';'mean';'median';'mode'})
xlabel('Value'), ylabel('Count')
%%
%%
% COURSE: Master MATLAB through guided problem-solving
% SECTION: 2D plotting
% VIDEO: Lines
% Instructor: mikexcohen.com
%
%%
%% very brief intro to plotting lines
% start with a clean figure
figure(1), clf
% note: MATLAB draws down the columns;
% this code produces 4 10-point lines
plot(randn(10,4))
%it will give 10 axis from 0 to 10, and each axis will have random and 4
%lines
%get the current axis (gca), which is from 0 to 10 axis
hold on
plot(get(gca,'xlim'),[0 0],'k','linewidth',3)
%% curve from straight lines
% number of lines (resolution)
n = 100;
% lets make this disco color
% clear figure and hold on
figure(2), clf
hold on
% loop over lines
for i=1:n
plot([i n],[0 i],'w')
% maksudnya untuk menggambar garis dibutuhka dua titik koordinat
% nah x yang i berinteraksi dengan y 0
% dan x yang n berinteraksi dengan y i
plot([i n],[i 0], 'm')
% the top just the inverse from x and y
plot([0 i],[i n],'g')
end
% give the plot that 1980's video game look
% gcf meanig get current figure like all the color to be black
% and axis of x and y become gone
set(gcf,'color','k')
axis off
%%
e. Uncertainty in Future Money
So this is thee case
Hi, I want to raise the issue related to know whether your OLS is ok or not.
read moreThe **45-degree line** in economics and geometry refers to a line where the values on the x-axis and y-axis are equal at every point. It typically has a slope of 1, meaning that for every unit increase along the horizontal axis (x), there is an equal unit increase along the vertical axis (y). Here are a couple of contexts where the 45-degree line is significant:
read moreThe **hyperinflation in Hungary** in the aftermath of World War II (1945–1946) is considered the worst case of hyperinflation in recorded history. The reasons behind this extreme economic event are numerous, involving a combination of war-related devastation, political instability, massive fiscal imbalances, and mismanagement of monetary policy. Here's an in-depth look at the primary causes:
read more**Neutrality of money** is a concept in economics that suggests changes in the **money supply** only affect **nominal variables** (like prices, wages, and exchange rates) and have **no effect on real variables** (like real GDP, employment, or real consumption) in the **long run**.
read moreDeflation in Japan, which has persisted over several decades since the early 1990s, is a complex economic phenomenon. It has been influenced by a combination of structural, demographic, monetary, and fiscal factors. Here are the key reasons why deflation occurred and persisted in Japan:
read moreHedging against inflation involves taking financial or investment actions designed to protect the purchasing power of money in the face of rising prices. Inflation erodes the value of currency over time, so investors seek assets or strategies that tend to increase in value or generate returns that outpace inflation. Below are several ways to hedge against inflation:
read moreThe **Phillips Curve** illustrates the relationship between inflation and unemployment, and how this relationship differs in the **short run** and the **long run**. Over time, economists have modified the original Phillips Curve framework to reflect more nuanced understandings of inflation and unemployment dynamics.
read moreDealing with inflation requires a combination of **fiscal and monetary policy** tools. Policymakers adjust these tools depending on the nature of inflation—whether it's **demand-pull** (inflation caused by excessive demand in the economy) or **cost-push** (inflation caused by rising production costs). Below are key approaches to controlling inflation through fiscal and monetary policy.
read moreCollaboratively administrate empowered markets via plug-and-play networks. Dynamically procrastinate B2C users after installed base benefits. Dramatically visualize customer directed convergence without
Comments