Answered step by step
Verified Expert Solution
Question
1 Approved Answer
help using MATLAB please Coursework #2 is very open ended - you could do some complex programming for this coursework However, many of you may
help using MATLAB please
Coursework #2 is very open ended - you could do some complex programming for this coursework However, many of you may not feel very confident about your modelling/programming skills, and will want a default plan of action, so here it is. Of course, it is fine to do something very different to this, or to vary this plan in various ways, so feel free to discuss other options with me 1) You will be adapting my scripts, available on Moodle, which do a simple regression from scratch (.e without using a high-level command which does the whole thing for you, like fitgim). 2) First, you need to come up with a scenario which gives rise to non-linear data, ie, data where the relationship between the predictor and the outcome is not going to be captured by a straight line. An example would be the relationship between arousal and test performance, which is inverse Ushaped. As arousal increases, so does test performance, until arousal gets too high, at which points test performance starts to decline again Operationalise your relationship into an imaginary research scenario. What is being measured for each variable? What range of possible values will you see in the data? 3) Now, you need to find a mathematical function with one or more parameters that could potentially describe your particular non-linear relationship. There are loads of online maths resources that will remind you about functions. In linear regression, the function is a first- order polynomial that describes a straight line, and the parameters are the slope and the intercept, but the meaning of the parameters (and how they affect the resulting function output) is different for different kinds of function. Get familiar with your function. How does the line described by your function fi.e. the predicted y values for each value of x) vary as you vary the values of the parameters? Web resources on function translation/transformation may help. Note that what you do in step 5a (below} is closely related to this process of getting familiar with your function, so you shouldn't think of these steps as a strict sequence. 4) Create some data for your scenario. There are at least three ways to do this: a. Take the scenario from a real paper. Use the graphs or tables in that paper to create a (rough) copy of the data set b. Play around with the parameters of your function, and find a set of parameters that creates an output that seems sensible fie.gives values for the predictor and outcome variables that look about right). Then add some random noise to each data point using Matlab's random number functions. c. Just make the data up any way you see fit. 5) Modify my.m files so that they fit your mathematical function to your particular data and recover a set of best-fitting parameters. Think about: a. What is the Matlab code that would implement your modet/function. In most cases, your function is going to be described by a simple equation, but it won't be exactly the same as the equation that describes the model in my example code. b. How many parameters does your model have, compared to my model. What changes does that imply? What metric should be used to describe the goodness of fit in order to find the best-fitting model)? Should it be least-squares or maximum-likelihood? 6) Test your function. Run it with your made-up data. See what parameters it finds. Are you happy with the fit? 7) Submit the data, the code, and your outline and reflective journal. The second assessment component is a project (worth 30%) composed of: 1) a piece of software which fits the data from an imaginary experiment to a model, and 2) a reflective journal describing your development process for this piece of software. The software will demonstrate the practical implementation of t skills taught in the final few weeks of the cours If in doubt, discuss and agree the problem you will attempt in advance with the lecturer, but broadly, you should write a program that takes as its input some psychological data and fits it to a model with one or more free parameters, using either least-squares or maximum-likelihood methods as appropriate. The project should contain: 1) A maximum 500 word outline of the problem to be solved (e.g. a model and an experiment which will produce data for the model to fit) 2) Annotated Matlab code (in a format that can be executed to test whether the project works) 3) A reflective journal (max 1000 words) outlining the development process (e.g. unexpected problems, how they were overcome, limitations etc.) Coursework #2 is very open ended - you could do some complex programming for this coursework However, many of you may not feel very confident about your modelling/programming skills, and will want a default plan of action, so here it is. Of course, it is fine to do something very different to this, or to vary this plan in various ways, so feel free to discuss other options with me 1) You will be adapting my scripts, available on Moodle, which do a simple regression from scratch (.e without using a high-level command which does the whole thing for you, like fitgim). 2) First, you need to come up with a scenario which gives rise to non-linear data, ie, data where the relationship between the predictor and the outcome is not going to be captured by a straight line. An example would be the relationship between arousal and test performance, which is inverse Ushaped. As arousal increases, so does test performance, until arousal gets too high, at which points test performance starts to decline again Operationalise your relationship into an imaginary research scenario. What is being measured for each variable? What range of possible values will you see in the data? 3) Now, you need to find a mathematical function with one or more parameters that could potentially describe your particular non-linear relationship. There are loads of online maths resources that will remind you about functions. In linear regression, the function is a first- order polynomial that describes a straight line, and the parameters are the slope and the intercept, but the meaning of the parameters (and how they affect the resulting function output) is different for different kinds of function. Get familiar with your function. How does the line described by your function fi.e. the predicted y values for each value of x) vary as you vary the values of the parameters? Web resources on function translation/transformation may help. Note that what you do in step 5a (below} is closely related to this process of getting familiar with your function, so you shouldn't think of these steps as a strict sequence. 4) Create some data for your scenario. There are at least three ways to do this: a. Take the scenario from a real paper. Use the graphs or tables in that paper to create a (rough) copy of the data set b. Play around with the parameters of your function, and find a set of parameters that creates an output that seems sensible fie.gives values for the predictor and outcome variables that look about right). Then add some random noise to each data point using Matlab's random number functions. c. Just make the data up any way you see fit. 5) Modify my.m files so that they fit your mathematical function to your particular data and recover a set of best-fitting parameters. Think about: a. What is the Matlab code that would implement your modet/function. In most cases, your function is going to be described by a simple equation, but it won't be exactly the same as the equation that describes the model in my example code. b. How many parameters does your model have, compared to my model. What changes does that imply? What metric should be used to describe the goodness of fit in order to find the best-fitting model)? Should it be least-squares or maximum-likelihood? 6) Test your function. Run it with your made-up data. See what parameters it finds. Are you happy with the fit? 7) Submit the data, the code, and your outline and reflective journal. The second assessment component is a project (worth 30%) composed of: 1) a piece of software which fits the data from an imaginary experiment to a model, and 2) a reflective journal describing your development process for this piece of software. The software will demonstrate the practical implementation of t skills taught in the final few weeks of the cours If in doubt, discuss and agree the problem you will attempt in advance with the lecturer, but broadly, you should write a program that takes as its input some psychological data and fits it to a model with one or more free parameters, using either least-squares or maximum-likelihood methods as appropriate. The project should contain: 1) A maximum 500 word outline of the problem to be solved (e.g. a model and an experiment which will produce data for the model to fit) 2) Annotated Matlab code (in a format that can be executed to test whether the project works) 3) A reflective journal (max 1000 words) outlining the development process (e.g. unexpected problems, how they were overcome, limitations etc.) Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started